diff options
author | Sebastian Pop <sebastian.pop@amd.com> | 2010-02-06 17:40:45 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2010-02-06 17:40:45 +0000 |
commit | 429ba7409063a0877d79d76dfa2eff7e44b3b6d9 (patch) | |
tree | 3425083970cfd744fa61a946981fcaa6ccfbc37c /gcc/graphite-ppl.c | |
parent | 26bda00088e819ebd7d90b562d21c33ffd6a97a5 (diff) | |
download | gcc-429ba7409063a0877d79d76dfa2eff7e44b3b6d9.tar.gz |
Cleanup build relation.
2010-01-20 Sebastian Pop <sebastian.pop@amd.com>
* graphite-dependences.c (build_pairwise_constraint): Renamed
ppl_build_relation. Moved...
(dr_equality_constraints): Use ppl_build_relation.
(build_pairwise_scheduling_equality): Same.
(build_pairwise_scheduling_inequality): Same.
* graphite-ppl.c (ppl_build_relation): ...here.
* graphite-ppl.h (ppl_build_relation): Declared.
From-SVN: r156541
Diffstat (limited to 'gcc/graphite-ppl.c')
-rw-r--r-- | gcc/graphite-ppl.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/graphite-ppl.c b/gcc/graphite-ppl.c index b47e24a4ab4..38faebd6beb 100644 --- a/gcc/graphite-ppl.c +++ b/gcc/graphite-ppl.c @@ -700,5 +700,45 @@ ppl_min_for_le_polyhedron (ppl_Polyhedron_t pol, ppl_delete_Coefficient (denom); } +/* Builds a constraint in dimension DIM relating dimensions POS1 to + POS2 as "POS1 - POS2 CSTR_TYPE C" */ + +ppl_Constraint_t +ppl_build_relation (int dim, int pos1, int pos2, int c, + enum ppl_enum_Constraint_Type cstr_type) +{ + ppl_Linear_Expression_t expr; + ppl_Constraint_t cstr; + ppl_Coefficient_t coef; + Value v, v_op, v_c; + + value_init (v); + value_init (v_op); + value_init (v_c); + + value_set_si (v, 1); + value_set_si (v_op, -1); + value_set_si (v_c, c); + + ppl_new_Coefficient (&coef); + ppl_new_Linear_Expression_with_dimension (&expr, dim); + + ppl_assign_Coefficient_from_mpz_t (coef, v); + ppl_Linear_Expression_add_to_coefficient (expr, pos1, coef); + ppl_assign_Coefficient_from_mpz_t (coef, v_op); + ppl_Linear_Expression_add_to_coefficient (expr, pos2, coef); + ppl_assign_Coefficient_from_mpz_t (coef, v_c); + ppl_Linear_Expression_add_to_inhomogeneous (expr, coef); + + ppl_new_Constraint (&cstr, expr, cstr_type); + + ppl_delete_Linear_Expression (expr); + ppl_delete_Coefficient (coef); + value_clear (v); + value_clear (v_op); + value_clear (v_c); + + return cstr; +} #endif |