graphite-ppl.c (ppl_min_for_le_polyhedron): New.

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.

From-SVN: r154600
This commit is contained in:
Sebastian Pop 2009-11-25 05:13:03 +00:00 committed by Sebastian Pop
parent 04863400c4
commit 3ecbce7e02
3 changed files with 39 additions and 1 deletions

View File

@ -1,3 +1,8 @@
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.

View 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

View 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. */