Resolve CLooG's value_* macros to their respective mpz_* counterparts.
[gcc.git] / gcc / graphite-ppl.c
index 62af5adfc6835fc13ed22ff13a838bf639ff4fb9..93b99cbfb1968bf1c08969b33c17b8482b5174b8 100644 (file)
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ggc.h"
 
 #ifdef HAVE_cloog
+
 #include "ppl_c.h"
 #include "cloog/cloog.h"
 #include "graphite-ppl.h"
@@ -55,7 +56,7 @@ cloog_matrix_to_ppl_constraint (CloogMatrix *matrix, int row)
   ppl_Linear_Expression_add_to_inhomogeneous (expr, coef);
   ppl_delete_Coefficient (coef);
 
-  if (value_zero_p (matrix->p[row][0]))
+  if (mpz_sgn (matrix->p[row][0]))
     ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_EQUAL);
   else
     ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
@@ -122,7 +123,7 @@ oppose_constraint (CloogMatrix *m, int row)
 
   /* Do not oppose the first column: it is the eq/ineq one.  */
   for (k = 1; k < m->NbColumns; k++)
-    value_oppose (m->p[row][k], m->p[row][k]);
+    mpz_neg (m->p[row][k], m->p[row][k]);
 }
 
 /* Inserts constraint CSTR at row ROW of matrix M.  */
@@ -144,18 +145,18 @@ insert_constraint_into_matrix (CloogMatrix *m, int row,
     }
 
   for (i = dim; i < nb_cols - 1; i++)
-    value_set_si (m->p[row][i + 1], 0);
+    mpz_set_si (m->p[row][i + 1], 0);
 
   ppl_Constraint_inhomogeneous_term  (cstr, c);
   ppl_Coefficient_to_mpz_t (c, m->p[row][nb_cols - 1]);
-  value_set_si (m->p[row][0], 1);
+  mpz_set_si (m->p[row][0], 1);
 
   switch (ppl_Constraint_type (cstr))
     {
     case PPL_CONSTRAINT_TYPE_LESS_THAN:
       oppose_constraint (m, row);
     case PPL_CONSTRAINT_TYPE_GREATER_THAN:
-      value_sub_int (m->p[row][nb_cols - 1],
+      mpz_sub_ui (m->p[row][nb_cols - 1],
                     m->p[row][nb_cols - 1], 1);
       break;
 
@@ -165,7 +166,7 @@ insert_constraint_into_matrix (CloogMatrix *m, int row,
       break;
 
     case PPL_CONSTRAINT_TYPE_EQUAL:
-      value_set_si (m->p[row][0], 0);
+      mpz_set_si (m->p[row][0], 0);
       break;
 
     default:
@@ -280,20 +281,20 @@ ppl_set_inhomogeneous_gmp (ppl_Linear_Expression_t e, Value x)
   Value v0, v1;
   ppl_Coefficient_t c;
 
-  value_init (v0);
-  value_init (v1);
+  mpz_init (v0);
+  mpz_init (v1);
   ppl_new_Coefficient (&c);
 
   ppl_Linear_Expression_inhomogeneous_term (e, c);
   ppl_Coefficient_to_mpz_t (c, v1);
-  value_oppose (v1, v1);
-  value_assign (v0, x);
-  value_addto (v0, v0, v1);
+  mpz_neg (v1, v1);
+  mpz_set (v0, x);
+  mpz_add (v0, v0, v1);
   ppl_assign_Coefficient_from_mpz_t (c, v0);
   ppl_Linear_Expression_add_to_inhomogeneous (e, c);
 
-  value_clear (v0);
-  value_clear (v1);
+  mpz_clear (v0);
+  mpz_clear (v1);
   ppl_delete_Coefficient (c);
 }
 
@@ -305,20 +306,20 @@ ppl_set_coef_gmp (ppl_Linear_Expression_t e, ppl_dimension_type i, Value x)
   Value v0, v1;
   ppl_Coefficient_t c;
 
-  value_init (v0);
-  value_init (v1);
+  mpz_init (v0);
+  mpz_init (v1);
   ppl_new_Coefficient (&c);
 
   ppl_Linear_Expression_coefficient (e, i, c);
   ppl_Coefficient_to_mpz_t (c, v1);
-  value_oppose (v1, v1);
-  value_assign (v0, x);
-  value_addto (v0, v0, v1);
+  mpz_neg (v1, v1);
+  mpz_set (v0, x);
+  mpz_add (v0, v0, v1);
   ppl_assign_Coefficient_from_mpz_t (c, v0);
   ppl_Linear_Expression_add_to_coefficient (e, i, c);
 
-  value_clear (v0);
-  value_clear (v1);
+  mpz_clear (v0);
+  mpz_clear (v1);
   ppl_delete_Coefficient (c);
 }
 
@@ -423,7 +424,7 @@ ppl_strip_loop (ppl_Polyhedron_t ph, ppl_dimension_type loop, int stride)
   ppl_Coefficient_t c;
   Value val;
 
-  value_init (val);
+  mpz_init (val);
   ppl_new_Coefficient (&c);
 
   ppl_Polyhedron_space_dimension (ph, &dim);
@@ -455,7 +456,7 @@ ppl_strip_loop (ppl_Polyhedron_t ph, ppl_dimension_type loop, int stride)
        ppl_Linear_Expression_coefficient (expr, loop, c);
        ppl_delete_Linear_Expression (expr);
        ppl_Coefficient_to_mpz_t (c, val);
-       v = value_get_si (val);
+       v = mpz_get_si (val);
 
        if (0 < v || v < 0)
          ppl_Polyhedron_add_constraint (tmp, cstr);
@@ -499,7 +500,7 @@ ppl_strip_loop (ppl_Polyhedron_t ph, ppl_dimension_type loop, int stride)
     ppl_delete_Constraint (new_cstr);
   }
 
-  value_clear (val);
+  mpz_clear (val);
   ppl_delete_Coefficient (c);
   return res;
 }
@@ -520,8 +521,8 @@ ppl_lexico_compare_linear_expressions (ppl_Linear_Expression_t a,
   ppl_Linear_Expression_space_dimension (a, &length1);
   ppl_Linear_Expression_space_dimension (b, &length2);
   ppl_new_Coefficient (&c);
-  value_init (va);
-  value_init (vb);
+  mpz_init (va);
+  mpz_init (vb);
 
   if (length1 < length2)
     min_length = length1;
@@ -534,19 +535,19 @@ ppl_lexico_compare_linear_expressions (ppl_Linear_Expression_t a,
       ppl_Coefficient_to_mpz_t (c, va);
       ppl_Linear_Expression_coefficient (b, i, c);
       ppl_Coefficient_to_mpz_t (c, vb);
-      res = value_compare (va, vb);
+      res = mpz_cmp (va, vb);
 
       if (res == 0)
        continue;
 
-      value_clear (va);
-      value_clear (vb);
+      mpz_clear (va);
+      mpz_clear (vb);
       ppl_delete_Coefficient (c);
       return res;
     }
 
-  value_clear (va);
-  value_clear (vb);
+  mpz_clear (va);
+  mpz_clear (vb);
   ppl_delete_Coefficient (c);
   return length1 - length2;
 }
@@ -653,8 +654,8 @@ ppl_max_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps,
   Value dv, nv;
   int maximum, err;
 
-  value_init (nv);
-  value_init (dv);
+  mpz_init (nv);
+  mpz_init (dv);
   ppl_new_Coefficient (&num);
   ppl_new_Coefficient (&denom);
   err = ppl_Pointset_Powerset_C_Polyhedron_maximize (ps, le, num, denom, &maximum);
@@ -664,11 +665,11 @@ ppl_max_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps,
       ppl_Coefficient_to_mpz_t (num, nv);
       ppl_Coefficient_to_mpz_t (denom, dv);
       gcc_assert (value_notzero_p (dv));
-      value_division (res, nv, dv);
+      mpz_tdiv_q (res, nv, dv);
     }
 
-  value_clear (nv);
-  value_clear (dv);
+  mpz_clear (nv);
+  mpz_clear (dv);
   ppl_delete_Coefficient (num);
   ppl_delete_Coefficient (denom);
 }
@@ -684,8 +685,8 @@ ppl_min_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps,
   Value dv, nv;
   int minimum, err;
 
-  value_init (nv);
-  value_init (dv);
+  mpz_init (nv);
+  mpz_init (dv);
   ppl_new_Coefficient (&num);
   ppl_new_Coefficient (&denom);
   err = ppl_Pointset_Powerset_C_Polyhedron_minimize (ps, le, num, denom, &minimum);
@@ -695,11 +696,11 @@ ppl_min_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps,
       ppl_Coefficient_to_mpz_t (num, nv);
       ppl_Coefficient_to_mpz_t (denom, dv);
       gcc_assert (value_notzero_p (dv));
-      value_division (res, nv, dv);
+      mpz_tdiv_q (res, nv, dv);
     }
 
-  value_clear (nv);
-  value_clear (dv);
+  mpz_clear (nv);
+  mpz_clear (dv);
   ppl_delete_Coefficient (num);
   ppl_delete_Coefficient (denom);
 }
@@ -716,13 +717,13 @@ ppl_build_relation (int dim, int pos1, int pos2, int c,
   ppl_Coefficient_t coef;
   Value v, v_op, v_c;
 
-  value_init (v);
-  value_init (v_op);
-  value_init (v_c);
+  mpz_init (v);
+  mpz_init (v_op);
+  mpz_init (v_c);
 
-  value_set_si (v, 1);
-  value_set_si (v_op, -1);
-  value_set_si (v_c, c);
+  mpz_set_si (v, 1);
+  mpz_set_si (v_op, -1);
+  mpz_set_si (v_c, c);
 
   ppl_new_Coefficient (&coef);
   ppl_new_Linear_Expression_with_dimension (&expr, dim);
@@ -738,9 +739,9 @@ ppl_build_relation (int dim, int pos1, int pos2, int c,
 
   ppl_delete_Linear_Expression (expr);
   ppl_delete_Coefficient (coef);
-  value_clear (v);
-  value_clear (v_op);
-  value_clear (v_c);
+  mpz_clear (v);
+  mpz_clear (v_op);
+  mpz_clear (v_c);
 
   return cstr;
 }