From 6fd2691af8b426078996469960834e9bdd65ab9d Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 28 Nov 2009 19:47:58 +0100 Subject: [PATCH] isl_tab: add isl_tab_freeze_constraint --- isl_map_simplify.c | 3 ++- isl_tab.c | 24 ++++++++++++++++++++++++ isl_tab.h | 3 +++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/isl_map_simplify.c b/isl_map_simplify.c index 354de119..e17dffb9 100644 --- a/isl_map_simplify.c +++ b/isl_map_simplify.c @@ -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; diff --git a/isl_tab.c b/isl_tab.c index 38a3aef1..2583e091 100644 --- 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: diff --git a/isl_tab.h b/isl_tab.h index 9f55e0cc..920dea75 100644 --- 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); -- 2.11.4.GIT