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_constraint_alloc_equality(
33 __isl_take isl_local_space
*ls
);
34 __isl_give isl_constraint
*isl_constraint_alloc_inequality(
35 __isl_take isl_local_space
*ls
);
36 __isl_give isl_constraint
*isl_equality_alloc(__isl_take isl_local_space
*ls
);
37 __isl_give isl_constraint
*isl_inequality_alloc(__isl_take isl_local_space
*ls
);
39 struct isl_constraint
*isl_constraint_cow(struct isl_constraint
*c
);
40 struct isl_constraint
*isl_constraint_copy(struct isl_constraint
*c
);
41 __isl_null isl_constraint
*isl_constraint_free(__isl_take isl_constraint
*c
);
43 int isl_basic_map_n_constraint(__isl_keep isl_basic_map
*bmap
);
44 int isl_basic_set_n_constraint(__isl_keep isl_basic_set
*bset
);
45 isl_stat
isl_basic_map_foreach_constraint(__isl_keep isl_basic_map
*bmap
,
46 isl_stat (*fn
)(__isl_take isl_constraint
*c
, void *user
), void *user
);
47 isl_stat
isl_basic_set_foreach_constraint(__isl_keep isl_basic_set
*bset
,
48 isl_stat (*fn
)(__isl_take isl_constraint
*c
, void *user
), void *user
);
49 __isl_give isl_constraint_list
*isl_basic_map_get_constraint_list(
50 __isl_keep isl_basic_map
*bmap
);
51 __isl_give isl_constraint_list
*isl_basic_set_get_constraint_list(
52 __isl_keep isl_basic_set
*bset
);
53 int isl_constraint_is_equal(struct isl_constraint
*constraint1
,
54 struct isl_constraint
*constraint2
);
56 isl_stat
isl_basic_set_foreach_bound_pair(__isl_keep isl_basic_set
*bset
,
57 enum isl_dim_type type
, unsigned pos
,
58 isl_stat (*fn
)(__isl_take isl_constraint
*lower
,
59 __isl_take isl_constraint
*upper
,
60 __isl_take isl_basic_set
*bset
, void *user
), void *user
);
62 __isl_give isl_basic_map
*isl_basic_map_add_constraint(
63 __isl_take isl_basic_map
*bmap
, __isl_take isl_constraint
*constraint
);
64 __isl_give isl_basic_set
*isl_basic_set_add_constraint(
65 __isl_take isl_basic_set
*bset
, __isl_take isl_constraint
*constraint
);
66 __isl_give isl_map
*isl_map_add_constraint(__isl_take isl_map
*map
,
67 __isl_take isl_constraint
*constraint
);
68 __isl_give isl_set
*isl_set_add_constraint(__isl_take isl_set
*set
,
69 __isl_take isl_constraint
*constraint
);
71 isl_bool
isl_basic_map_has_defining_equality(
72 __isl_keep isl_basic_map
*bmap
, enum isl_dim_type type
, int pos
,
73 __isl_give isl_constraint
**c
);
74 isl_bool
isl_basic_set_has_defining_equality(
75 struct isl_basic_set
*bset
, enum isl_dim_type type
, int pos
,
76 struct isl_constraint
**constraint
);
77 isl_bool
isl_basic_set_has_defining_inequalities(
78 struct isl_basic_set
*bset
, enum isl_dim_type type
, int pos
,
79 struct isl_constraint
**lower
,
80 struct isl_constraint
**upper
);
82 __isl_give isl_space
*isl_constraint_get_space(
83 __isl_keep isl_constraint
*constraint
);
84 __isl_give isl_local_space
*isl_constraint_get_local_space(
85 __isl_keep isl_constraint
*constraint
);
86 int isl_constraint_dim(struct isl_constraint
*constraint
,
87 enum isl_dim_type type
);
89 isl_bool
isl_constraint_involves_dims(__isl_keep isl_constraint
*constraint
,
90 enum isl_dim_type type
, unsigned first
, unsigned n
);
92 const char *isl_constraint_get_dim_name(__isl_keep isl_constraint
*constraint
,
93 enum isl_dim_type type
, unsigned pos
);
94 __isl_give isl_val
*isl_constraint_get_constant_val(
95 __isl_keep isl_constraint
*constraint
);
96 __isl_give isl_val
*isl_constraint_get_coefficient_val(
97 __isl_keep isl_constraint
*constraint
, enum isl_dim_type type
, int pos
);
98 __isl_give isl_constraint
*isl_constraint_set_constant_si(
99 __isl_take isl_constraint
*constraint
, int v
);
100 __isl_give isl_constraint
*isl_constraint_set_constant_val(
101 __isl_take isl_constraint
*constraint
, __isl_take isl_val
*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_take 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 isl_bool
isl_constraint_is_equality(__isl_keep isl_constraint
*constraint
);
115 int isl_constraint_is_div_constraint(__isl_keep isl_constraint
*constraint
);
117 isl_bool
isl_constraint_is_lower_bound(__isl_keep isl_constraint
*constraint
,
118 enum isl_dim_type type
, unsigned pos
);
119 isl_bool
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
);
135 __isl_give isl_basic_set
*isl_basic_set_drop_constraint(
136 __isl_take isl_basic_set
*bset
, __isl_take isl_constraint
*constraint
);
138 int isl_constraint_plain_cmp(__isl_keep isl_constraint
*c1
,
139 __isl_keep isl_constraint
*c2
);
140 int isl_constraint_cmp_last_non_zero(__isl_keep isl_constraint
*c1
,
141 __isl_keep isl_constraint
*c2
);
143 __isl_give isl_printer
*isl_printer_print_constraint(__isl_take isl_printer
*p
,
144 __isl_keep isl_constraint
*c
);
145 void isl_constraint_dump(__isl_keep isl_constraint
*c
);
147 #if defined(__cplusplus)