OSDN Git Service

2009-10-17 Sebastian Pop <sebastian.pop@amd.com>
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Nov 2009 05:13:03 +0000 (05:13 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Nov 2009 05:13:03 +0000 (05:13 +0000)
* graphite-ppl.c (ppl_min_for_le_polyhedron): New.
* graphite-ppl.h (graphite-ppl.h): Declared.

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

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

index 96c03db..61559f9 100644 (file)
@@ -1,5 +1,10 @@
 2009-10-17  Sebastian Pop  <sebastian.pop@amd.com>
 
+       * graphite-ppl.c (ppl_min_for_le_polyhedron): New.
+       * graphite-ppl.h (graphite-ppl.h): Declared.
+
+2009-10-17  Sebastian Pop  <sebastian.pop@amd.com>
+
        * graphite-ppl.c (ppl_print_linear_expr): New.
        (debug_ppl_linear_expr): New.
        * graphite-ppl.h (ppl_print_linear_expr): Declared.
index 241171c..b47e24a 100644 (file)
@@ -669,4 +669,36 @@ ppl_max_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps,
   ppl_delete_Coefficient (denom);
 }
 
+/* Return in RES the maximum of the linear expression LE on the
+   polyhedron POL.  */
+
+void
+ppl_min_for_le_polyhedron (ppl_Polyhedron_t pol,
+                          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_Polyhedron_minimize (pol, 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 64c79f4..f7dc2b3 100644 (file)
@@ -48,7 +48,8 @@ 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_pointset (ppl_Pointset_Powerset_C_Polyhedron_t,
                               ppl_Linear_Expression_t, Value);
-
+void ppl_min_for_le_polyhedron (ppl_Polyhedron_t, ppl_Linear_Expression_t,
+                               Value);
 
 /* Assigns to RES the value of the INTEGER_CST T.  */