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
This commit is contained in:
Sebastian Pop 2009-08-15 07:10:20 +00:00 committed by Sebastian Pop
parent ae66da3ba5
commit f263917cbf
6 changed files with 71 additions and 52 deletions

View file

@ -1,3 +1,12 @@
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.
2009-08-14 Olatunji Ruwase <tjruwase@google.com>
* doc/extend.texi (Symbol-Renaming Pragmas): redefine_extname is

View file

@ -1,3 +1,28 @@
2009-08-15 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/40981
* graphite-ppl.c (ppl_max_for_le): Correct the use of
ppl_Pointset_Powerset_C_Polyhedron_maximize.
2009-08-13 Sebastian Pop <sebastian.pop@amd.com>
* graphite-poly.c (print_pbb): Print PBB index.
2009-08-13 Sebastian Pop <sebastian.pop@amd.com>
* Merge from mainline (r150672:150764).
2009-08-13 Sebastian Pop <sebastian.pop@amd.com>
* 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.
* graphite-ppl.h (ppl_max_for_le): Declared.
2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
* Merge from mainline (r150372:150672).
2009-08-11 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/40980

View file

@ -53,35 +53,6 @@ along with GCC; see the file COPYING3. If not see
#include "graphite.h"
#include "graphite-poly.h"
/* Return in RES the maximum of the linear expression LE on polyhedron PS. */
static 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;
value_init (nv);
value_init (dv);
ppl_new_Coefficient (&num);
ppl_new_Coefficient (&denom);
ppl_Pointset_Powerset_C_Polyhedron_maximize (ps, le, num, denom, &maximum);
if (maximum)
{
ppl_Coefficient_to_mpz_t (num, nv);
ppl_Coefficient_to_mpz_t (denom, dv);
value_division (res, nv, dv);
}
value_clear (nv);
value_clear (dv);
ppl_delete_Coefficient (num);
ppl_delete_Coefficient (denom);
}
/* Builds a linear expression, of dimension DIM, representing PDR's
memory access:

View file

@ -711,35 +711,15 @@ pbb_number_of_iterations (poly_bb_p pbb,
graphite_dim_t loop_depth,
Value niter)
{
ppl_dimension_type loop_iter = pbb_iterator_dim (pbb, loop_depth);
ppl_Linear_Expression_t le;
ppl_Coefficient_t num, denom;
Value dv;
int maximum;
ppl_dimension_type dim;
value_init (dv);
ppl_new_Coefficient (&num);
ppl_new_Coefficient (&denom);
ppl_Pointset_Powerset_C_Polyhedron_space_dimension (PBB_DOMAIN (pbb), &dim);
ppl_new_Linear_Expression_with_dimension (&le, dim);
ppl_set_coef (le, loop_iter, 1);
ppl_Pointset_Powerset_C_Polyhedron_maximize (PBB_DOMAIN (pbb), le,
num, denom, &maximum);
if (maximum == 1)
{
ppl_Coefficient_to_mpz_t (num, niter);
ppl_Coefficient_to_mpz_t (denom, dv);
value_division (niter, niter, dv);
}
else
value_set_si (niter, -1);
value_clear (dv);
ppl_set_coef (le, pbb_iterator_dim (pbb, loop_depth), 1);
value_set_si (niter, -1);
ppl_max_for_le (PBB_DOMAIN (pbb), le, niter);
ppl_delete_Linear_Expression (le);
ppl_delete_Coefficient (num);
ppl_delete_Coefficient (denom);
}
#endif

View file

@ -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

View file

@ -44,6 +44,9 @@ void ppl_insert_dimensions_pointset (ppl_Pointset_Powerset_C_Polyhedron_t, int,
int);
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 (ppl_Pointset_Powerset_C_Polyhedron_t,
ppl_Linear_Expression_t, Value);
/* Assigns to RES the value of the INTEGER_CST T. */