aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@amd.com>2009-11-25 05:13:30 +0000
committerSebastian Pop <spop@gcc.gnu.org>2009-11-25 05:13:30 +0000
commit62e475c55096f01d5eeb8fa15ac75c4300e606b0 (patch)
treeae82754cf384a2f316425983f9013a95c9ebd6e0 /gcc
parent3ecbce7e02d83a2c45bd87626ad5175f51fb27cb (diff)
downloadgcc-62e475c55096f01d5eeb8fa15ac75c4300e606b0.zip
gcc-62e475c55096f01d5eeb8fa15ac75c4300e606b0.tar.gz
gcc-62e475c55096f01d5eeb8fa15ac75c4300e606b0.tar.bz2
graphite-sese-to-poly.c (find_scop_parameters): Initialize SCOP_CONTEXT.
2009-10-17 Sebastian Pop <sebastian.pop@amd.com> * graphite-sese-to-poly.c (find_scop_parameters): Initialize SCOP_CONTEXT. (build_loop_iteration_domains): Extract bounds on parameters based on the data size. (build_scop_context): Do not initialize SCOP_CONTEXT; add new constraints. From-SVN: r154601
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog.graphite9
-rw-r--r--gcc/graphite-sese-to-poly.c70
2 files changed, 78 insertions, 1 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 61559f9..d15f043 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,14 @@
2009-10-17 Sebastian Pop <sebastian.pop@amd.com>
+ * graphite-sese-to-poly.c (find_scop_parameters): Initialize
+ SCOP_CONTEXT.
+ (build_loop_iteration_domains): Extract bounds on parameters
+ based on the data size.
+ (build_scop_context): Do not initialize SCOP_CONTEXT;
+ add new constraints.
+
+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.
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 507ab24..8f4d302 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -1044,6 +1044,9 @@ find_scop_parameters (scop_p scop)
scop_set_nb_params (scop, sese_nb_params (region));
SESE_ADD_PARAMS (region) = false;
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension
+ (&SCOP_CONTEXT (scop), scop_nb_params (scop), 0);
}
/* Returns a gimple_bb from BB. */
@@ -1119,6 +1122,7 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
Value one;
ppl_Constraint_t ub;
ppl_Linear_Expression_t ub_expr;
+ double_int nit;
value_init (one);
value_set_si (one, 1);
@@ -1127,6 +1131,66 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
scan_tree_for_params (SCOP_REGION (scop), nb_iters, ub_expr, one);
value_clear (one);
+ /* N <= estimated_nb_iters
+
+ FIXME: This is a workaround that should go away once we will
+ have the PIP algorithm. */
+ if (estimated_loop_iterations (loop, true, &nit))
+ {
+ Value val;
+ ppl_Linear_Expression_t nb_iters_le;
+ ppl_Polyhedron_t pol;
+ graphite_dim_t p, n = scop_nb_params (scop);
+ ppl_Coefficient_t coef;
+
+ ppl_new_C_Polyhedron_from_space_dimension (&pol, dim, 0);
+ ppl_new_Linear_Expression_from_Linear_Expression (&nb_iters_le,
+ ub_expr);
+
+ value_init (val);
+ mpz_set_double_int (val, nit, false);
+ ppl_new_Coefficient_from_mpz_t (&coef, val);
+ ppl_Linear_Expression_add_to_inhomogeneous (nb_iters_le, coef);
+ ppl_delete_Coefficient (coef);
+ ppl_new_Constraint (&ub, nb_iters_le,
+ PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL);
+ ppl_Polyhedron_add_constraint (pol, ub);
+
+ for (p = 0; p < n; p++)
+ {
+ ppl_Linear_Expression_t le;
+
+ ppl_new_Linear_Expression_with_dimension (&le, dim);
+ ppl_set_coef (le, nb + 1 + p, -1);
+
+ value_set_si (val, -1);
+ 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);
+ }
+
+ ppl_delete_Polyhedron (pol);
+ ppl_delete_Linear_Expression (nb_iters_le);
+ ppl_delete_Constraint (ub);
+ value_clear (val);
+ }
+
/* loop_i <= expr_nb_iters */
ppl_set_coef (ub_expr, nb, -1);
ppl_new_Constraint (&ub, ub_expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
@@ -1496,6 +1560,7 @@ static void
build_scop_context (scop_p scop)
{
ppl_Polyhedron_t context;
+ ppl_Pointset_Powerset_C_Polyhedron_t ps;
graphite_dim_t p, n = scop_nb_params (scop);
ppl_new_C_Polyhedron_from_space_dimension (&context, n, 0);
@@ -1504,8 +1569,11 @@ build_scop_context (scop_p scop)
add_param_constraints (scop, context, p);
ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron
- (&SCOP_CONTEXT (scop), context);
+ (&ps, context);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign
+ (SCOP_CONTEXT (scop), ps);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (ps);
ppl_delete_Polyhedron (context);
}