Patchwork [29/65] Resolve CLooG's value_* macros to their respective mpz_* counterparts.

login
register
mail settings
Submitter Sebastian Pop
Date Aug. 2, 2010, 8:20 p.m.
Message ID <1280780438-17543-30-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/60627/
State New
Headers show

Comments

Sebastian Pop - Aug. 2, 2010, 8:20 p.m.
From: grosser <grosser@138bc75d-0d04-0410-961f-82ee72b054a4>

2010-07-04  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>

	* graphite-clast-to-gimple.c
	(precision_for_value): Resolve value_* calls to matching mpz_* calls.
	(precision_for_interval): Same.
	(gcc_type_for_interval): Same.
	(compute_type_for_level): Same.
	* graphite-interchange.c
	(lst_interchange_profitable_p): Same.
	* graphite-poly.c
	(psct_scattering_dim_for_loop_depth): Same.
	* graphite-ppl.c
	(ppl_max_for_le_pointset): Same.
	(ppl_min_for_le_pointset): Same.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@161820 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog                  |   15 +++++++++++++
 gcc/ChangeLog.graphite         |   15 +++++++++++++
 gcc/graphite-clast-to-gimple.c |   46 ++++++++++++++++++++--------------------
 gcc/graphite-interchange.c     |    2 +-
 gcc/graphite-poly.c            |    2 +-
 gcc/graphite-ppl.c             |    4 +-
 6 files changed, 57 insertions(+), 27 deletions(-)

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 397839b..672f765 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@ 
+2010-08-02  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>
+
+	* graphite-clast-to-gimple.c
+	(precision_for_value): Resolve value_* calls to matching mpz_* calls.
+	(precision_for_interval): Same.
+	(gcc_type_for_interval): Same.
+	(compute_type_for_level): Same.
+	* graphite-interchange.c
+	(lst_interchange_profitable_p): Same.
+	* graphite-poly.c
+	(psct_scattering_dim_for_loop_depth): Same.
+	* graphite-ppl.c
+	(ppl_max_for_le_pointset): Same.
+	(ppl_min_for_le_pointset): Same.
+
 2010-08-02  Sebastian Pop  <sebastian.pop@amd.com>
 
 	* graphite-sese-to-poly.c (rewrite_degenerate_phi): New.
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 34a83b6..a589860 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,18 @@ 
+2010-07-04  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>
+
+	* graphite-clast-to-gimple.c
+	(precision_for_value): Resolve value_* calls to matching mpz_* calls.
+	(precision_for_interval): Same.
+	(gcc_type_for_interval): Same.
+	(compute_type_for_level): Same.
+	* graphite-interchange.c
+	(lst_interchange_profitable_p): Same.
+	* graphite-poly.c
+	(psct_scattering_dim_for_loop_depth): Same.
+	* graphite-ppl.c
+	(ppl_max_for_le_pointset): Same.
+	(ppl_min_for_le_pointset): Same.
+
 2010-06-25  Vladimir Kargov  <kargov@gmail.com>
 
 	* refined-regions.c (bb_index_compare): New.
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 7eb9165..aca2c31 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -426,26 +426,26 @@  precision_for_value (mpz_t val)
   mpz_t x, y, two;
   int precision;
 
-  value_init (x);
-  value_init (y);
-  value_init (two);
-  value_set_si (x, 2);
-  value_assign (y, val);
-  value_set_si (two, 2);
+  mpz_init (x);
+  mpz_init (y);
+  mpz_init (two);
+  mpz_set_si (x, 2);
+  mpz_set (y, val);
+  mpz_set_si (two, 2);
   precision = 1;
 
-  if (value_neg_p (y))
-    value_oppose (y, y);
+  if (mpz_sgn (y) < 0)
+    mpz_neg (y, y);
 
-  while (value_gt (y, x))
+  while (mpz_cmp (y, x) > 0)
     {
-      value_multiply (x, x, two);
+      mpz_mul (x, x, two);
       precision++;
     }
 
-  value_clear (x);
-  value_clear (y);
-  value_clear (two);
+  mpz_clear (x);
+  mpz_clear (y);
+  mpz_clear (two);
 
   return precision;
 }
@@ -459,12 +459,12 @@  precision_for_interval (mpz_t low, mpz_t up)
   mpz_t diff;
   int precision;
 
-  gcc_assert (value_le (low, up));
+  gcc_assert (mpz_cmp (low, up) <= 0);
 
-  value_init (diff);
-  value_subtract (diff, up, low);
+  mpz_init (diff);
+  mpz_sub (diff, up, low);
   precision = precision_for_value (diff);
-  value_clear (diff);
+  mpz_clear (diff);
 
   return precision;
 }
@@ -479,9 +479,9 @@  gcc_type_for_interval (mpz_t low, mpz_t up)
   tree type;
   enum machine_mode mode;
 
-  gcc_assert (value_le (low, up));
+  gcc_assert (mpz_cmp (low, up) <= 0);
 
-  if (value_neg_p (low))
+  if (mpz_sgn (low) < 0)
     unsigned_p = false;
 
   prec_up = precision_for_value (up);
@@ -731,14 +731,14 @@  compute_type_for_level (poly_bb_p pbb, int level)
   mpz_t low, up;
   tree type;
 
-  value_init (low);
-  value_init (up);
+  mpz_init (low);
+  mpz_init (up);
 
   compute_bounds_for_level (pbb, level, low, up);
   type = gcc_type_for_interval (low, up);
 
-  value_clear (low);
-  value_clear (up);
+  mpz_clear (low);
+  mpz_clear (up);
   return type;
 }
 
diff --git a/gcc/graphite-interchange.c b/gcc/graphite-interchange.c
index 0a7a749..de3bf25 100644
--- a/gcc/graphite-interchange.c
+++ b/gcc/graphite-interchange.c
@@ -478,7 +478,7 @@  lst_interchange_profitable_p (lst_p loop1, lst_p loop2)
   memory_strides_in_loop (loop1, lst_depth (loop1), d1);
   memory_strides_in_loop (loop2, lst_depth (loop2), d2);
 
-  res = value_lt (d1, d2);
+  res = mpz_cmp (d1, d2) < 0;
 
   mpz_clear (d1);
   mpz_clear (d2);
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index 28da7f0..5c4a6f9 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -1032,7 +1032,7 @@  psct_scattering_dim_for_loop_depth (poly_bb_p pbb, graphite_dim_t loop_depth)
 	  ppl_Linear_Expression_coefficient (expr, scatter, coef);
 	  ppl_Coefficient_to_mpz_t (coef, val);
 
-	  if (value_notzero_p (val))
+	  if (mpz_sgn (val) != 0)
 	    {
 	      mpz_clear (val);
 	      ppl_delete_Linear_Expression (expr);
diff --git a/gcc/graphite-ppl.c b/gcc/graphite-ppl.c
index bbe2024..9f5bab0 100644
--- a/gcc/graphite-ppl.c
+++ b/gcc/graphite-ppl.c
@@ -664,7 +664,7 @@  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));
+      gcc_assert (mpz_sgn (dv) != 0);
       mpz_tdiv_q (res, nv, dv);
     }
 
@@ -695,7 +695,7 @@  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));
+      gcc_assert (mpz_sgn (dv) != 0);
       mpz_tdiv_q (res, nv, dv);
     }