2 * Copyright 2008-2009 Katholieke Universiteit Leuven
4 * Use of this software is governed by the MIT 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/local_space.h>
14 #include <isl/space.h>
15 #include <isl/aff_type.h>
16 #include <isl/set_type.h>
19 #include <isl/printer.h>
21 #if defined(__cplusplus)
25 struct isl_constraint;
26 typedef struct isl_constraint isl_constraint;
28 ISL_DECLARE_LIST(constraint)
30 isl_ctx *isl_constraint_get_ctx(__isl_keep isl_constraint *c);
32 __isl_give isl_constraint *isl_equality_alloc(__isl_take isl_local_space *ls);
33 __isl_give isl_constraint *isl_inequality_alloc(__isl_take isl_local_space *ls);
35 struct isl_constraint *isl_constraint_cow(struct isl_constraint *c);
36 struct isl_constraint *isl_constraint_copy(struct isl_constraint *c);
37 void *isl_constraint_free(__isl_take isl_constraint *c);
39 int isl_basic_set_n_constraint(__isl_keep isl_basic_set *bset);
40 int isl_basic_map_foreach_constraint(__isl_keep isl_basic_map *bmap,
41 int (*fn)(__isl_take isl_constraint *c, void *user), void *user);
42 int isl_basic_set_foreach_constraint(__isl_keep isl_basic_set *bset,
43 int (*fn)(__isl_take isl_constraint *c, void *user), void *user);
44 int isl_constraint_is_equal(struct isl_constraint *constraint1,
45 struct isl_constraint *constraint2);
47 int isl_basic_set_foreach_bound_pair(__isl_keep isl_basic_set *bset,
48 enum isl_dim_type type, unsigned pos,
49 int (*fn)(__isl_take isl_constraint *lower,
50 __isl_take isl_constraint *upper,
51 __isl_take isl_basic_set *bset, void *user), void *user);
53 __isl_give isl_basic_map *isl_basic_map_add_constraint(
54 __isl_take isl_basic_map *bmap, __isl_take isl_constraint *constraint);
55 __isl_give isl_basic_set *isl_basic_set_add_constraint(
56 __isl_take isl_basic_set *bset, __isl_take isl_constraint *constraint);
57 __isl_give isl_map *isl_map_add_constraint(__isl_take isl_map *map,
58 __isl_take isl_constraint *constraint);
59 __isl_give isl_set *isl_set_add_constraint(__isl_take isl_set *set,
60 __isl_take isl_constraint *constraint);
62 int isl_basic_map_has_defining_equality(
63 __isl_keep isl_basic_map *bmap, enum isl_dim_type type, int pos,
64 __isl_give isl_constraint **c);
65 int isl_basic_set_has_defining_equality(
66 struct isl_basic_set *bset, enum isl_dim_type type, int pos,
67 struct isl_constraint **constraint);
68 int isl_basic_set_has_defining_inequalities(
69 struct isl_basic_set *bset, enum isl_dim_type type, int pos,
70 struct isl_constraint **lower,
71 struct isl_constraint **upper);
73 __isl_give isl_space *isl_constraint_get_space(
74 __isl_keep isl_constraint *constraint);
75 __isl_give isl_local_space *isl_constraint_get_local_space(
76 __isl_keep isl_constraint *constraint);
77 int isl_constraint_dim(struct isl_constraint *constraint,
78 enum isl_dim_type type);
80 int isl_constraint_involves_dims(__isl_keep isl_constraint *constraint,
81 enum isl_dim_type type, unsigned first, unsigned n);
83 const char *isl_constraint_get_dim_name(__isl_keep isl_constraint *constraint,
84 enum isl_dim_type type, unsigned pos);
85 void isl_constraint_get_constant(__isl_keep isl_constraint *constraint,
87 __isl_give isl_val *isl_constraint_get_constant_val(
88 __isl_keep isl_constraint *constraint);
89 void isl_constraint_get_coefficient(__isl_keep isl_constraint *constraint,
90 enum isl_dim_type type, int pos, isl_int *v);
91 __isl_give isl_val *isl_constraint_get_coefficient_val(
92 __isl_keep isl_constraint *constraint, enum isl_dim_type type, int pos);
93 __isl_give isl_constraint *isl_constraint_set_constant(
94 __isl_take isl_constraint *constraint, isl_int v);
95 __isl_give isl_constraint *isl_constraint_set_constant_si(
96 __isl_take isl_constraint *constraint, int v);
97 __isl_give isl_constraint *isl_constraint_set_constant_val(
98 __isl_take isl_constraint *constraint, __isl_take isl_val *v);
99 __isl_give isl_constraint *isl_constraint_set_coefficient(
100 __isl_take isl_constraint *constraint,
101 enum isl_dim_type type, int pos, isl_int v);
102 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
103 __isl_take isl_constraint *constraint,
104 enum isl_dim_type type, int pos, int v);
105 __isl_give isl_constraint *isl_constraint_set_coefficient_val(
106 __isl_take isl_constraint *constraint,
107 enum isl_dim_type type, int pos, isl_val *v);
109 __isl_give isl_aff *isl_constraint_get_div(__isl_keep isl_constraint *constraint,
112 struct isl_constraint *isl_constraint_negate(struct isl_constraint *constraint);
114 int isl_constraint_is_equality(__isl_keep isl_constraint *constraint);
115 int isl_constraint_is_div_constraint(__isl_keep isl_constraint *constraint);
117 int isl_constraint_is_lower_bound(__isl_keep isl_constraint *constraint,
118 enum isl_dim_type type, unsigned pos);
119 int isl_constraint_is_upper_bound(__isl_keep isl_constraint *constraint,
120 enum isl_dim_type type, unsigned pos);
122 __isl_give isl_basic_map *isl_basic_map_from_constraint(
123 __isl_take isl_constraint *constraint);
124 struct isl_basic_set *isl_basic_set_from_constraint(
125 struct isl_constraint *constraint);
127 __isl_give isl_aff *isl_constraint_get_bound(
128 __isl_keep isl_constraint *constraint, enum isl_dim_type type, int pos);
129 __isl_give isl_aff *isl_constraint_get_aff(
130 __isl_keep isl_constraint *constraint);
131 __isl_give isl_constraint *isl_equality_from_aff(__isl_take isl_aff *aff);
132 __isl_give isl_constraint *isl_inequality_from_aff(__isl_take isl_aff *aff);
134 __isl_give isl_basic_set *isl_basic_set_drop_constraint(
135 __isl_take isl_basic_set *bset, __isl_take isl_constraint *constraint);
137 __isl_give isl_printer *isl_printer_print_constraint(__isl_take isl_printer *p,
138 __isl_keep isl_constraint *c);
139 void isl_constraint_dump(__isl_keep isl_constraint *c);
141 #if defined(__cplusplus)