2 * Copyright 2008-2009 Katholieke Universiteit Leuven
4 * Use of this software is governed by the GNU LGPLv2.1 license
6 * Written by Sven Verdoolaege, K.U.Leuven, Departement
7 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
10 #ifndef ISL_CONSTRAINT_H
11 #define ISL_CONSTRAINT_H
13 #include <isl/aff_type.h>
15 #include <isl/set_type.h>
16 #include <isl/printer.h>
18 #if defined(__cplusplus)
22 struct isl_constraint;
23 typedef struct isl_constraint isl_constraint;
25 isl_ctx *isl_constraint_get_ctx(__isl_keep isl_constraint *c);
27 __isl_give isl_constraint *isl_equality_alloc(__isl_take isl_dim *dim);
28 __isl_give isl_constraint *isl_inequality_alloc(__isl_take isl_dim *dim);
30 struct isl_constraint *isl_constraint_cow(struct isl_constraint *c);
31 struct isl_constraint *isl_constraint_copy(struct isl_constraint *c);
32 void *isl_constraint_free(__isl_take isl_constraint *c);
34 int isl_basic_map_foreach_constraint(__isl_keep isl_basic_map *bmap,
35 int (*fn)(__isl_take isl_constraint *c, void *user), void *user);
36 int isl_basic_set_foreach_constraint(__isl_keep isl_basic_set *bset,
37 int (*fn)(__isl_take isl_constraint *c, void *user), void *user);
38 int isl_constraint_is_equal(struct isl_constraint *constraint1,
39 struct isl_constraint *constraint2);
41 int isl_basic_set_foreach_bound_pair(__isl_keep isl_basic_set *bset,
42 enum isl_dim_type type, unsigned pos,
43 int (*fn)(__isl_take isl_constraint *lower,
44 __isl_take isl_constraint *upper,
45 __isl_take isl_basic_set *bset, void *user), void *user);
47 __isl_give isl_basic_map *isl_basic_map_add_constraint(
48 __isl_take isl_basic_map *bmap, __isl_take isl_constraint *constraint);
49 __isl_give isl_basic_set *isl_basic_set_add_constraint(
50 __isl_take isl_basic_set *bset, __isl_take isl_constraint *constraint);
51 __isl_give isl_map *isl_map_add_constraint(__isl_take isl_map *map,
52 __isl_take isl_constraint *constraint);
53 __isl_give isl_set *isl_set_add_constraint(__isl_take isl_set *set,
54 __isl_take isl_constraint *constraint);
56 int isl_basic_map_has_defining_equality(
57 __isl_keep isl_basic_map *bmap, enum isl_dim_type type, int pos,
58 __isl_give isl_constraint **c);
59 int isl_basic_set_has_defining_equality(
60 struct isl_basic_set *bset, enum isl_dim_type type, int pos,
61 struct isl_constraint **constraint);
62 int isl_basic_set_has_defining_inequalities(
63 struct isl_basic_set *bset, enum isl_dim_type type, int pos,
64 struct isl_constraint **lower,
65 struct isl_constraint **upper);
67 __isl_give isl_dim *isl_constraint_get_dim(
68 __isl_keep isl_constraint *constraint);
69 int isl_constraint_dim(struct isl_constraint *constraint,
70 enum isl_dim_type type);
72 int isl_constraint_involves_dims(__isl_keep isl_constraint *constraint,
73 enum isl_dim_type type, unsigned first, unsigned n);
75 const char *isl_constraint_get_dim_name(__isl_keep isl_constraint *constraint,
76 enum isl_dim_type type, unsigned pos);
77 void isl_constraint_get_constant(__isl_keep isl_constraint *constraint,
79 void isl_constraint_get_coefficient(__isl_keep isl_constraint *constraint,
80 enum isl_dim_type type, int pos, isl_int *v);
81 __isl_give isl_constraint *isl_constraint_set_constant(
82 __isl_take isl_constraint *constraint, isl_int v);
83 __isl_give isl_constraint *isl_constraint_set_constant_si(
84 __isl_take isl_constraint *constraint, int v);
85 __isl_give isl_constraint *isl_constraint_set_coefficient(
86 __isl_take isl_constraint *constraint,
87 enum isl_dim_type type, int pos, isl_int v);
88 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
89 __isl_take isl_constraint *constraint,
90 enum isl_dim_type type, int pos, int v);
92 __isl_give isl_div *isl_constraint_div(__isl_keep isl_constraint *constraint,
95 struct isl_constraint *isl_constraint_negate(struct isl_constraint *constraint);
97 int isl_constraint_is_equality(__isl_keep isl_constraint *constraint);
98 int isl_constraint_is_div_constraint(__isl_keep isl_constraint *constraint);
100 __isl_give isl_basic_map *isl_basic_map_from_constraint(
101 __isl_take isl_constraint *constraint);
102 struct isl_basic_set *isl_basic_set_from_constraint(
103 struct isl_constraint *constraint);
105 __isl_give isl_aff *isl_constraint_get_bound(
106 __isl_keep isl_constraint *constraint, enum isl_dim_type type, int pos);
107 __isl_give isl_aff *isl_constraint_get_aff(
108 __isl_keep isl_constraint *constraint);
109 __isl_give isl_constraint *isl_equality_from_aff(__isl_take isl_aff *aff);
110 __isl_give isl_constraint *isl_inequality_from_aff(__isl_take isl_aff *aff);
112 __isl_give isl_basic_set *isl_basic_set_drop_constraint(
113 __isl_take isl_basic_set *bset, __isl_take isl_constraint *constraint);
115 __isl_give isl_printer *isl_printer_print_constraint(__isl_take isl_printer *p,
116 __isl_keep isl_constraint *c);
117 void isl_constraint_dump(__isl_keep isl_constraint *c);
119 #if defined(__cplusplus)