summaryrefslogtreecommitdiff
path: root/gcc/graphite-ppl.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-02-06 21:44:56 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-02-06 21:44:56 +0000
commit3c0d801cdcce83e1739c42de0e26106281a61df9 (patch)
treea4bb1c0be4d5153898c2f02a7677e835473d9781 /gcc/graphite-ppl.c
parent7b919065100b9d5597126afce413f6caa6277704 (diff)
downloadgcc-3c0d801cdcce83e1739c42de0e26106281a61df9.tar.gz
2010-02-06 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 156556 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@156557 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-ppl.c')
-rw-r--r--gcc/graphite-ppl.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/graphite-ppl.c b/gcc/graphite-ppl.c
index b47e24a4ab4..0b7633514ef 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 + C CSTR_TYPE 0" */
+
+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