change isl_basic_map_foreach_lexmin prototype
[platform/upstream/isl.git] / isl_tab.c
index 28af80e..5151ab6 100644 (file)
--- a/isl_tab.c
+++ b/isl_tab.c
@@ -12,6 +12,7 @@
 #include "isl_map_private.h"
 #include "isl_tab.h"
 #include <isl/seq.h>
+#include <isl_config.h>
 
 /*
  * The implementation of tableaus in this file was inspired by Section 8
@@ -1187,6 +1188,11 @@ static int to_row(struct isl_tab *tab, struct isl_tab_var *var, int sign)
        return isl_tab_pivot(tab, r, var->index);
 }
 
+/* Check whether all variables that are marked as non-negative
+ * also have a non-negative sample value.  This function is not
+ * called from the current code but is useful during debugging.
+ */
+static void check_table(struct isl_tab *tab) __attribute__ ((unused));
 static void check_table(struct isl_tab *tab)
 {
        int i;
@@ -2582,7 +2588,6 @@ int isl_tab_select_facet(struct isl_tab *tab, int con)
 
 static int may_be_equality(struct isl_tab *tab, int row)
 {
-       unsigned off = 2 + tab->M;
        return tab->rational ? isl_int_is_zero(tab->mat->row[row][1])
                             : isl_int_lt(tab->mat->row[row][1],
                                            tab->mat->row[row][0]);
@@ -2928,7 +2933,7 @@ static int perform_undo_var(struct isl_tab *tab, struct isl_tab_undo *undo) WARN
 static int perform_undo_var(struct isl_tab *tab, struct isl_tab_undo *undo)
 {
        struct isl_tab_var *var = var_from_index(tab, undo->u.var_index);
-       switch(undo->type) {
+       switch (undo->type) {
        case isl_tab_undo_nonneg:
                var->is_nonneg = 0;
                break;
@@ -2966,6 +2971,10 @@ static int perform_undo_var(struct isl_tab *tab, struct isl_tab_undo *undo)
                break;
        case isl_tab_undo_relax:
                return unrelax(tab, var);
+       default:
+               isl_die(tab->mat->ctx, isl_error_internal,
+                       "perform_undo_var called on invalid undo record",
+                       return -1);
        }
 
        return 0;
@@ -3250,7 +3259,8 @@ __isl_keep isl_basic_set *isl_tab_peek_bset(struct isl_tab *tab)
        return (isl_basic_set *)tab->bmap;
 }
 
-void isl_tab_dump(struct isl_tab *tab, FILE *out, int indent)
+static void isl_tab_print_internal(__isl_keep struct isl_tab *tab,
+       FILE *out, int indent)
 {
        unsigned r, c;
        int i;
@@ -3319,9 +3329,14 @@ void isl_tab_dump(struct isl_tab *tab, FILE *out, int indent)
        tab->mat->n_row = tab->n_row;
        c = tab->mat->n_col;
        tab->mat->n_col = 2 + tab->M + tab->n_col;
-       isl_mat_dump(tab->mat, out, indent);
+       isl_mat_print_internal(tab->mat, out, indent);
        tab->mat->n_row = r;
        tab->mat->n_col = c;
        if (tab->bmap)
                isl_basic_map_print_internal(tab->bmap, out, indent);
 }
+
+void isl_tab_dump(__isl_keep struct isl_tab *tab)
+{
+       isl_tab_print_internal(tab, stderr, 0);
+}