Commit 07b0d0e2 by Alexander Monakov Committed by Sebastian Pop

graphite-sese-to-poly.c (build_loop_iteration_domains): Generalize construction…

graphite-sese-to-poly.c (build_loop_iteration_domains): Generalize construction of parameter constraints from loop iteration analysis.

2009-10-20  Alexander Monakov  <amonakov@ispras.ru>

	* graphite-sese-to-poly.c (build_loop_iteration_domains): Generalize
	construction of parameter constraints from loop iteration analysis.
	* gcc.dg/graphite/run-id-2.c: New test.

From-SVN: r154610
parent 67255edf
2009-10-20 Alexander Monakov <amonakov@ispras.ru>
* graphite-sese-to-poly.c (build_loop_iteration_domains): Generalize
construction of parameter constraints from loop iteration analysis.
* gcc.dg/graphite/run-id-2.c: New test.
2009-10-17 Sebastian Pop <sebastian.pop@amd.com> 2009-10-17 Sebastian Pop <sebastian.pop@amd.com>
* graphite-interchange.c (memory_stride_in_loop): Delete p1, lma * graphite-interchange.c (memory_stride_in_loop): Delete p1, lma
......
...@@ -1140,15 +1140,22 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop, ...@@ -1140,15 +1140,22 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
Value val; Value val;
ppl_Linear_Expression_t nb_iters_le; ppl_Linear_Expression_t nb_iters_le;
ppl_Polyhedron_t pol; ppl_Polyhedron_t pol;
graphite_dim_t p, n = scop_nb_params (scop); graphite_dim_t n = scop_nb_params (scop);
ppl_Coefficient_t coef; ppl_Coefficient_t coef;
ppl_new_C_Polyhedron_from_space_dimension (&pol, dim, 0); ppl_new_C_Polyhedron_from_space_dimension (&pol, dim, 0);
ppl_new_Linear_Expression_from_Linear_Expression (&nb_iters_le, ppl_new_Linear_Expression_from_Linear_Expression (&nb_iters_le,
ub_expr); ub_expr);
/* Construct the negated number of last iteration in VAL. */
value_init (val); value_init (val);
mpz_set_double_int (val, nit, false); mpz_set_double_int (val, nit, false);
value_sub_int (val, val, 1);
value_oppose (val, val);
/* NB_ITERS_LE holds number of last iteration in parametrical form.
Subtract estimated number of last iteration and assert that result
is not positive. */
ppl_new_Coefficient_from_mpz_t (&coef, val); ppl_new_Coefficient_from_mpz_t (&coef, val);
ppl_Linear_Expression_add_to_inhomogeneous (nb_iters_le, coef); ppl_Linear_Expression_add_to_inhomogeneous (nb_iters_le, coef);
ppl_delete_Coefficient (coef); ppl_delete_Coefficient (coef);
...@@ -1156,33 +1163,25 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop, ...@@ -1156,33 +1163,25 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL); PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL);
ppl_Polyhedron_add_constraint (pol, ub); ppl_Polyhedron_add_constraint (pol, ub);
for (p = 0; p < n; p++) /* Remove all but last N dimensions from POL to obtain constraints
on parameters. */
{ {
ppl_Linear_Expression_t le; ppl_dimension_type *dims = XNEWVEC (ppl_dimension_type, dim - n);
graphite_dim_t i;
ppl_new_Linear_Expression_with_dimension (&le, dim); for (i = 0; i < dim - n; i++)
ppl_set_coef (le, nb + 1 + p, -1); dims[i] = i;
ppl_Polyhedron_remove_space_dimensions (pol, dims, dim - n);
value_set_si (val, -1); XDELETEVEC (dims);
ppl_min_for_le_polyhedron (pol, le, val); }
if (!value_mone_p (val))
{
ppl_Linear_Expression_t parm_bound;
ppl_Constraint_t cstr;
ppl_new_Linear_Expression_with_dimension (&parm_bound, n);
ppl_set_coef (parm_bound, p, -1);
ppl_set_inhomogeneous_gmp (parm_bound, val);
ppl_new_Constraint (&cstr, parm_bound,
PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
ppl_Pointset_Powerset_C_Polyhedron_add_constraint
(SCOP_CONTEXT (scop), cstr);
ppl_delete_Constraint (cstr);
ppl_delete_Linear_Expression (parm_bound);
}
ppl_delete_Linear_Expression (le); /* Add constraints on parameters to SCoP context. */
{
ppl_Pointset_Powerset_C_Polyhedron_t constraints_ps;
ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron
(&constraints_ps, pol);
ppl_Pointset_Powerset_C_Polyhedron_intersection_assign
(SCOP_CONTEXT (scop), constraints_ps);
ppl_delete_Pointset_Powerset_C_Polyhedron (constraints_ps);
} }
ppl_delete_Polyhedron (pol); ppl_delete_Polyhedron (pol);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment