isl_tab: introduce support for "big parameters"
[platform/upstream/isl.git] / isl_tab.h
index d08edce..17de6ed 100644 (file)
--- a/isl_tab.h
+++ b/isl_tab.h
@@ -23,10 +23,12 @@ enum isl_tab_undo_type {
        isl_tab_undo_zero,
        isl_tab_undo_allocate,
        isl_tab_undo_relax,
+       isl_tab_undo_saved_basis,
 };
 
 union isl_tab_undo_val {
        int             var_index;
+       int             *col_var;
 };
 
 struct isl_tab_undo {
@@ -45,7 +47,9 @@ struct isl_tab_undo {
  * Each row expresses the corresponding row variable as an affine expression
  * of the column variables.
  * The first two columns in the matrix contain the common denominator of
- * the row and the numerator of the constant term.  The third column
+ * the row and the numerator of the constant term.
+ * If "M" is set, then the third column represents the "big parameter".
+ * The third (M = 0) or fourth (M = 1) column
  * in the matrix is called column 0 with respect to the col_var array.
  * The sample value of the tableau is the value that assigns zero
  * to all the column variables and the constant term of each affine
@@ -54,6 +58,12 @@ struct isl_tab_undo {
  * value satisfies the non-negativity constraints (usually on the slack
  * variables).
  *
+ * The big parameter represents an arbitrarily big (and divisible)
+ * positive number.  If present, then the sign of a row is determined
+ * lexicographically, with the sign of the big parameter coefficient
+ * considered first.  The big parameter will only be used while
+ * solving PILP problems.
+ *
  * The first n_dead column variables have their values fixed to zero.
  * The corresponding tab_vars are flagged "is_zero".
  * Some of the rows that have have zero coefficients in all but
@@ -66,11 +76,16 @@ struct isl_tab_undo {
  * since the constraint has been reduced to 0 = 0 and is therefore always
  * satisfied.
  *
+ * There are "n_var" variables in total.  The first "n_param" of these
+ * are called parameters and the last "n_div" of these are called divs.
+ * The basic tableau operations makes no distinction between different
+ * kinds of variables.
+ *
  * Dead columns and redundant rows are detected on the fly.
  * However, the basic operations do not ensure that all dead columns
  * or all redundant rows are detected.
  * isl_tab_detect_equalities and isl_tab_detect_redundant can be used
- * to peform and exhaustive search for dead columns and redundant rows.
+ * to perform and exhaustive search for dead columns and redundant rows.
  */
 struct isl_tab {
        struct isl_mat *mat;
@@ -81,6 +96,9 @@ struct isl_tab {
        unsigned n_redundant;
 
        unsigned n_var;
+       unsigned n_param;
+       unsigned n_div;
+       unsigned max_var;
        unsigned n_con;
        unsigned n_eq;
        unsigned max_con;
@@ -98,10 +116,11 @@ struct isl_tab {
        unsigned rational : 1;
        unsigned empty : 1;
        unsigned in_undo : 1;
+       unsigned M : 1;
 };
 
 struct isl_tab *isl_tab_alloc(struct isl_ctx *ctx,
-       unsigned n_row, unsigned n_var);
+       unsigned n_row, unsigned n_var, unsigned M);
 void isl_tab_free(struct isl_tab *tab);
 
 struct isl_tab *isl_tab_from_basic_map(struct isl_basic_map *bmap);
@@ -156,6 +175,8 @@ struct isl_tab *isl_tab_mark_empty(struct isl_tab *tab);
 struct isl_tab *isl_tab_dup(struct isl_tab *tab);
 int isl_tab_extend_cons(struct isl_tab *tab, unsigned n_new);
 int isl_tab_allocate_con(struct isl_tab *tab);
+int isl_tab_extend_vars(struct isl_tab *tab, unsigned n_new);
+int isl_tab_allocate_var(struct isl_tab *tab);
 void isl_tab_pivot(struct isl_tab *tab, int row, int col);
 int isl_tab_add_row(struct isl_tab *tab, isl_int *line);
 int isl_tab_row_is_redundant(struct isl_tab *tab, int row);
@@ -164,5 +185,6 @@ int isl_tab_min_at_most_neg_one(struct isl_tab *tab, struct isl_tab_var *var);
 void isl_tab_push(struct isl_tab *tab, enum isl_tab_undo_type type);
 void isl_tab_push_var(struct isl_tab *tab,
        enum isl_tab_undo_type type, struct isl_tab_var *var);
+void isl_tab_push_basis(struct isl_tab *tab);
 
 #endif