OSDN Git Service

Correct the use of ppl_Pointset_Powerset_C_Polyhedron_maximize.
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 15 Aug 2009 07:10:20 +0000 (07:10 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 15 Aug 2009 07:10:20 +0000 (07:10 +0000)
2009-08-15  Sebastian Pop  <sebastian.pop@amd.com>

PR middle-end/40981
* graphite-interchange.c (ppl_max_for_le): Moved...
* graphite-poly.c (pbb_number_of_iterations): Call ppl_max_for_le.
* graphite-ppl.c (ppl_max_for_le): ... here.  Correct the use of
ppl_Pointset_Powerset_C_Polyhedron_maximize.
* graphite-ppl.h (ppl_max_for_le): Declared.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150789 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ChangeLog.graphite
gcc/graphite-interchange.c
gcc/graphite-poly.c
gcc/graphite-ppl.c
gcc/graphite-ppl.h

index ca2a399..fc097c3 100644 (file)
@@ -1,3 +1,12 @@
+2009-08-15  Sebastian Pop  <sebastian.pop@amd.com>
+
+       PR middle-end/40981
+       * graphite-interchange.c (ppl_max_for_le): Moved...
+       * graphite-poly.c (pbb_number_of_iterations): Call ppl_max_for_le.
+       * graphite-ppl.c (ppl_max_for_le): ... here.  Correct the use of
+       ppl_Pointset_Powerset_C_Polyhedron_maximize.
+       * graphite-ppl.h (ppl_max_for_le): Declared.
+
 2009-08-14  Olatunji Ruwase <tjruwase@google.com>
 
        * doc/extend.texi (Symbol-Renaming Pragmas): redefine_extname is
index 1a0e3fa..ec52e26 100644 (file)
@@ -1,3 +1,28 @@
+2009-08-15  Sebastian Pop  <sebastian.pop@amd.com>
+
+       PR middle-end/40981
+       * graphite-ppl.c (ppl_max_for_le): Correct the use of
+       ppl_Pointset_Powerset_C_Polyhedron_maximize.
+
+2009-08-13  Sebastian Pop  <sebastian.pop@amd.com>
+
+       * graphite-poly.c (print_pbb): Print PBB index.
+
+2009-08-13  Sebastian Pop  <sebastian.pop@amd.com>
+
+       * Merge from mainline (r150672:150764).
+
+2009-08-13  Sebastian Pop  <sebastian.pop@amd.com>
+
+       * graphite-interchange.c (ppl_max_for_le): Moved...
+       * graphite-poly.c (pbb_number_of_iterations): Call ppl_max_for_le.
+       * graphite-ppl.c (ppl_max_for_le): ... here.
+       * graphite-ppl.h (ppl_max_for_le): Declared.
+
+2009-08-12  Sebastian Pop  <sebastian.pop@amd.com>
+
+       * Merge from mainline (r150372:150672).
+
 2009-08-11  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR middle-end/40980
index c9da69b..314f17c 100644 (file)
@@ -53,35 +53,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "graphite.h"
 #include "graphite-poly.h"
 
-/* Return in RES the maximum of the linear expression LE on polyhedron PS.  */
-
-static void
-ppl_max_for_le (ppl_Pointset_Powerset_C_Polyhedron_t ps,
-               ppl_Linear_Expression_t le, Value res)
-{
-  ppl_Coefficient_t num, denom;
-  Value dv, nv;
-  int maximum;
-
-  value_init (nv);
-  value_init (dv);
-  ppl_new_Coefficient (&num);
-  ppl_new_Coefficient (&denom);
-  ppl_Pointset_Powerset_C_Polyhedron_maximize (ps, le, num, denom, &maximum);
-
-  if (maximum)
-    {
-      ppl_Coefficient_to_mpz_t (num, nv);
-      ppl_Coefficient_to_mpz_t (denom, dv);
-      value_division (res, nv, dv);
-    }
-
-  value_clear (nv);
-  value_clear (dv);
-  ppl_delete_Coefficient (num);
-  ppl_delete_Coefficient (denom);
-}
-
 /* Builds a linear expression, of dimension DIM, representing PDR's
    memory access:
 
index 944c4bf..f9b93e4 100644 (file)
@@ -711,35 +711,15 @@ pbb_number_of_iterations (poly_bb_p pbb,
                          graphite_dim_t loop_depth,
                          Value niter)
 {
-  ppl_dimension_type loop_iter = pbb_iterator_dim (pbb, loop_depth);
   ppl_Linear_Expression_t le;
-  ppl_Coefficient_t num, denom;
-  Value dv;
-  int maximum;
   ppl_dimension_type dim;
 
-  value_init (dv);
-  ppl_new_Coefficient (&num);
-  ppl_new_Coefficient (&denom);
   ppl_Pointset_Powerset_C_Polyhedron_space_dimension (PBB_DOMAIN (pbb), &dim);
   ppl_new_Linear_Expression_with_dimension (&le, dim);
-  ppl_set_coef (le, loop_iter, 1);
-  ppl_Pointset_Powerset_C_Polyhedron_maximize (PBB_DOMAIN (pbb), le,
-                                              num, denom, &maximum);
-
-  if (maximum == 1)
-    {
-      ppl_Coefficient_to_mpz_t (num, niter);
-      ppl_Coefficient_to_mpz_t (denom, dv);
-      value_division (niter, niter, dv);
-    }
-  else
-    value_set_si (niter, -1);
-
-  value_clear (dv);
+  ppl_set_coef (le, pbb_iterator_dim (pbb, loop_depth), 1);
+  value_set_si (niter, -1);
+  ppl_max_for_le (PBB_DOMAIN (pbb), le, niter);
   ppl_delete_Linear_Expression (le);
-  ppl_delete_Coefficient (num);
-  ppl_delete_Coefficient (denom);
 }
 
 #endif
index 967b6ea..ca65c85 100644 (file)
@@ -613,4 +613,35 @@ ppl_read_polyhedron_matrix (ppl_Polyhedron_t *ph, FILE *file)
   new_C_Polyhedron_from_Cloog_Matrix (ph, mat);
   cloog_matrix_free (mat);
 }
+
+/* Return in RES the maximum of the linear expression LE on polyhedron PS.  */
+
+void
+ppl_max_for_le (ppl_Pointset_Powerset_C_Polyhedron_t ps,
+               ppl_Linear_Expression_t le, Value res)
+{
+  ppl_Coefficient_t num, denom;
+  Value dv, nv;
+  int maximum, err;
+
+  value_init (nv);
+  value_init (dv);
+  ppl_new_Coefficient (&num);
+  ppl_new_Coefficient (&denom);
+  err = ppl_Pointset_Powerset_C_Polyhedron_maximize (ps, le, num, denom, &maximum);
+
+  if (err > 0)
+    {
+      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);
+    }
+
+  value_clear (nv);
+  value_clear (dv);
+  ppl_delete_Coefficient (num);
+  ppl_delete_Coefficient (denom);
+}
+
 #endif
index cfa31ec..0ed6b34 100644 (file)
@@ -44,6 +44,9 @@ void ppl_insert_dimensions_pointset (ppl_Pointset_Powerset_C_Polyhedron_t, int,
                                     int);
 void ppl_set_inhomogeneous_gmp (ppl_Linear_Expression_t, Value);
 void ppl_set_coef_gmp (ppl_Linear_Expression_t, ppl_dimension_type, Value);
+void ppl_max_for_le (ppl_Pointset_Powerset_C_Polyhedron_t,
+                    ppl_Linear_Expression_t, Value);
+
 
 /* Assigns to RES the value of the INTEGER_CST T.  */