aboutsummaryrefslogtreecommitdiff
path: root/gcc/graphite-ppl.c
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@amd.com>2009-08-15 07:10:20 +0000
committerSebastian Pop <spop@gcc.gnu.org>2009-08-15 07:10:20 +0000
commitf263917cbf18bbd28cf79cc6280c5a02e4667337 (patch)
tree3e08ed92479684ba002d8c7a8eaed82caf2a98c4 /gcc/graphite-ppl.c
parentae66da3ba5136550245f96339e8d48d565903cd2 (diff)
downloadgcc-f263917cbf18bbd28cf79cc6280c5a02e4667337.zip
gcc-f263917cbf18bbd28cf79cc6280c5a02e4667337.tar.gz
gcc-f263917cbf18bbd28cf79cc6280c5a02e4667337.tar.bz2
Correct the use of ppl_Pointset_Powerset_C_Polyhedron_maximize.
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. From-SVN: r150789
Diffstat (limited to 'gcc/graphite-ppl.c')
-rw-r--r--gcc/graphite-ppl.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/graphite-ppl.c b/gcc/graphite-ppl.c
index 967b6ea..ca65c85 100644
--- a/gcc/graphite-ppl.c
+++ b/gcc/graphite-ppl.c
@@ -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