From e6d78739a8b39c81be30410f717d643b18846e8b Mon Sep 17 00:00:00 2001 From: spop Date: Wed, 25 Nov 2009 05:13:03 +0000 Subject: [PATCH] 2009-10-17 Sebastian Pop * 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 | 5 +++++ gcc/graphite-ppl.c | 32 ++++++++++++++++++++++++++++++++ gcc/graphite-ppl.h | 3 ++- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 96c03db2ea6..61559f9f65b 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,5 +1,10 @@ 2009-10-17 Sebastian Pop + * graphite-ppl.c (ppl_min_for_le_polyhedron): New. + * graphite-ppl.h (graphite-ppl.h): Declared. + +2009-10-17 Sebastian Pop + * 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 241171c9ed1..b47e24a4ab4 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 64c79f4a253..f7dc2b31ed2 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. */ -- 2.11.0