isl_tab: add isl_tab_freeze_constraint
authorSven Verdoolaege <skimo@kotnet.org>
Sat, 28 Nov 2009 18:47:58 +0000 (19:47 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Mon, 7 Dec 2009 15:56:11 +0000 (16:56 +0100)
isl_map_simplify.c
isl_tab.c
isl_tab.h

index 354de11..e17dffb 100644 (file)
@@ -1576,7 +1576,8 @@ static struct isl_basic_set *uset_gist(struct isl_basic_set *bset,
        if (!tab)
                goto error;
        for (i = 0; i < context_ineq; ++i)
-               tab->con[i].frozen = 1;
+               if (isl_tab_freeze_constraint(tab, i) < 0)
+                       goto error;
        tab = isl_tab_extend(tab, bset->n_ineq);
        if (!tab)
                goto error;
index 38a3aef..2583e09 100644 (file)
--- a/isl_tab.c
+++ b/isl_tab.c
@@ -936,6 +936,26 @@ int isl_tab_mark_empty(struct isl_tab *tab)
        return 0;
 }
 
+int isl_tab_freeze_constraint(struct isl_tab *tab, int con)
+{
+       struct isl_tab_var *var;
+
+       if (!tab)
+               return -1;
+
+       var = &tab->con[con];
+       if (var->frozen)
+               return 0;
+       if (var->index < 0)
+               return 0;
+       var->frozen = 1;
+
+       if (tab->need_undo)
+               return isl_tab_push_var(tab, isl_tab_undo_freeze, var);
+
+       return 0;
+}
+
 /* Update the rows signs after a pivot of "row" and "col", with "row_sgn"
  * the original sign of the pivot element.
  * We only keep track of row signs during PILP solving and in this case
@@ -2628,6 +2648,9 @@ static int perform_undo_var(struct isl_tab *tab, struct isl_tab_undo *undo)
                var->is_redundant = 0;
                tab->n_redundant--;
                break;
+       case isl_tab_undo_freeze:
+               var->frozen = 0;
+               break;
        case isl_tab_undo_zero:
                var->is_zero = 0;
                if (!var->is_row)
@@ -2748,6 +2771,7 @@ static int perform_undo(struct isl_tab *tab, struct isl_tab_undo *undo)
                break;
        case isl_tab_undo_nonneg:
        case isl_tab_undo_redundant:
+       case isl_tab_undo_freeze:
        case isl_tab_undo_zero:
        case isl_tab_undo_allocate:
        case isl_tab_undo_relax:
index 9f55e0c..920dea7 100644 (file)
--- a/isl_tab.h
+++ b/isl_tab.h
@@ -22,6 +22,7 @@ enum isl_tab_undo_type {
        isl_tab_undo_empty,
        isl_tab_undo_nonneg,
        isl_tab_undo_redundant,
+       isl_tab_undo_freeze,
        isl_tab_undo_zero,
        isl_tab_undo_allocate,
        isl_tab_undo_relax,
@@ -183,6 +184,8 @@ int isl_tab_add_ineq(struct isl_tab *tab, isl_int *ineq) WARN_UNUSED;
 struct isl_tab *isl_tab_add_eq(struct isl_tab *tab, isl_int *eq) WARN_UNUSED;
 struct isl_tab *isl_tab_add_valid_eq(struct isl_tab *tab, isl_int *eq) WARN_UNUSED;
 
+int isl_tab_freeze_constraint(struct isl_tab *tab, int con) WARN_UNUSED;
+
 int isl_tab_is_equality(struct isl_tab *tab, int con);
 int isl_tab_is_redundant(struct isl_tab *tab, int con);