diff options
-rw-r--r-- | gcc/ChangeLog.graphite | 5 | ||||
-rw-r--r-- | gcc/graphite-ppl.c | 32 | ||||
-rw-r--r-- | gcc/graphite-ppl.h | 3 |
3 files changed, 39 insertions, 1 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 96c03db..61559f9 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -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. diff --git a/gcc/graphite-ppl.c b/gcc/graphite-ppl.c index 241171c..b47e24a 100644 --- a/gcc/graphite-ppl.c +++ b/gcc/graphite-ppl.c @@ -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 diff --git a/gcc/graphite-ppl.h b/gcc/graphite-ppl.h index 64c79f4a..f7dc2b3 100644 --- a/gcc/graphite-ppl.h +++ b/gcc/graphite-ppl.h @@ -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. */ |