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_type.h>
15 #include <isl/aff_type.h>
16 #include <isl/set_type.h>
18 #include <isl/val_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 __isl_give isl_constraint
*isl_constraint_copy(__isl_keep isl_constraint
*c
);
40 __isl_null isl_constraint
*isl_constraint_free(__isl_take isl_constraint
*c
);
42 isl_size
isl_basic_map_n_constraint(__isl_keep isl_basic_map
*bmap
);
43 isl_size
isl_basic_set_n_constraint(__isl_keep isl_basic_set
*bset
);
44 isl_stat
isl_basic_map_foreach_constraint(__isl_keep isl_basic_map
*bmap
,
45 isl_stat (*fn
)(__isl_take isl_constraint
*c
, void *user
), void *user
);
46 isl_stat
isl_basic_set_foreach_constraint(__isl_keep isl_basic_set
*bset
,
47 isl_stat (*fn
)(__isl_take isl_constraint
*c
, void *user
), void *user
);
48 __isl_give isl_constraint_list
*isl_basic_map_get_constraint_list(
49 __isl_keep isl_basic_map
*bmap
);
50 __isl_give isl_constraint_list
*isl_basic_set_get_constraint_list(
51 __isl_keep isl_basic_set
*bset
);
52 int isl_constraint_is_equal(__isl_keep isl_constraint
*constraint1
,
53 __isl_keep isl_constraint
*constraint2
);
55 isl_stat
isl_basic_set_foreach_bound_pair(__isl_keep isl_basic_set
*bset
,
56 enum isl_dim_type type
, unsigned pos
,
57 isl_stat (*fn
)(__isl_take isl_constraint
*lower
,
58 __isl_take isl_constraint
*upper
,
59 __isl_take isl_basic_set
*bset
, void *user
), void *user
);
61 __isl_give isl_basic_map
*isl_basic_map_add_constraint(
62 __isl_take isl_basic_map
*bmap
, __isl_take isl_constraint
*constraint
);
63 __isl_give isl_basic_set
*isl_basic_set_add_constraint(
64 __isl_take isl_basic_set
*bset
, __isl_take isl_constraint
*constraint
);
65 __isl_give isl_map
*isl_map_add_constraint(__isl_take isl_map
*map
,
66 __isl_take isl_constraint
*constraint
);
67 __isl_give isl_set
*isl_set_add_constraint(__isl_take isl_set
*set
,
68 __isl_take isl_constraint
*constraint
);
70 isl_bool
isl_basic_map_has_defining_equality(
71 __isl_keep isl_basic_map
*bmap
, enum isl_dim_type type
, int pos
,
72 __isl_give isl_constraint
**c
);
73 isl_bool
isl_basic_set_has_defining_equality(
74 struct isl_basic_set
*bset
, enum isl_dim_type type
, int pos
,
75 struct isl_constraint
**constraint
);
76 isl_bool
isl_basic_set_has_defining_inequalities(
77 struct isl_basic_set
*bset
, enum isl_dim_type type
, int pos
,
78 struct isl_constraint
**lower
,
79 struct isl_constraint
**upper
);
81 __isl_give isl_space
*isl_constraint_get_space(
82 __isl_keep isl_constraint
*constraint
);
83 __isl_give isl_local_space
*isl_constraint_get_local_space(
84 __isl_keep isl_constraint
*constraint
);
85 isl_size
isl_constraint_dim(__isl_keep isl_constraint
*constraint
,
86 enum isl_dim_type type
);
88 isl_bool
isl_constraint_involves_dims(__isl_keep isl_constraint
*constraint
,
89 enum isl_dim_type type
, unsigned first
, unsigned n
);
91 const char *isl_constraint_get_dim_name(__isl_keep isl_constraint
*constraint
,
92 enum isl_dim_type type
, unsigned pos
);
93 __isl_give isl_val
*isl_constraint_get_constant_val(
94 __isl_keep isl_constraint
*constraint
);
95 __isl_give isl_val
*isl_constraint_get_coefficient_val(
96 __isl_keep isl_constraint
*constraint
, enum isl_dim_type type
, int pos
);
97 __isl_give isl_constraint
*isl_constraint_set_constant_si(
98 __isl_take isl_constraint
*constraint
, int v
);
99 __isl_give isl_constraint
*isl_constraint_set_constant_val(
100 __isl_take isl_constraint
*constraint
, __isl_take isl_val
*v
);
101 __isl_give isl_constraint
*isl_constraint_set_coefficient_si(
102 __isl_take isl_constraint
*constraint
,
103 enum isl_dim_type type
, int pos
, int v
);
104 __isl_give isl_constraint
*isl_constraint_set_coefficient_val(
105 __isl_take isl_constraint
*constraint
,
106 enum isl_dim_type type
, int pos
, __isl_take isl_val
*v
);
108 __isl_give isl_aff
*isl_constraint_get_div(__isl_keep isl_constraint
*constraint
,
111 __isl_give isl_constraint
*isl_constraint_negate(
112 __isl_take isl_constraint
*constraint
);
114 isl_bool
isl_constraint_is_equality(__isl_keep isl_constraint
*constraint
);
115 isl_bool
isl_constraint_is_div_constraint(
116 __isl_keep isl_constraint
*constraint
);
118 isl_bool
isl_constraint_is_lower_bound(__isl_keep isl_constraint
*constraint
,
119 enum isl_dim_type type
, unsigned pos
);
120 isl_bool
isl_constraint_is_upper_bound(__isl_keep isl_constraint
*constraint
,
121 enum isl_dim_type type
, unsigned pos
);
123 __isl_give isl_basic_map
*isl_basic_map_from_constraint(
124 __isl_take isl_constraint
*constraint
);
125 __isl_give isl_basic_set
*isl_basic_set_from_constraint(
126 __isl_take isl_constraint
*constraint
);
128 __isl_give isl_aff
*isl_constraint_get_bound(
129 __isl_keep isl_constraint
*constraint
, enum isl_dim_type type
, int pos
);
130 __isl_give isl_aff
*isl_constraint_get_aff(
131 __isl_keep isl_constraint
*constraint
);
132 __isl_give isl_constraint
*isl_equality_from_aff(__isl_take isl_aff
*aff
);
133 __isl_give isl_constraint
*isl_inequality_from_aff(__isl_take isl_aff
*aff
);
135 int isl_constraint_plain_cmp(__isl_keep isl_constraint
*c1
,
136 __isl_keep isl_constraint
*c2
);
137 int isl_constraint_cmp_last_non_zero(__isl_keep isl_constraint
*c1
,
138 __isl_keep isl_constraint
*c2
);
140 __isl_give isl_printer
*isl_printer_print_constraint(__isl_take isl_printer
*p
,
141 __isl_keep isl_constraint
*c
);
142 void isl_constraint_dump(__isl_keep isl_constraint
*c
);
144 #if defined(__cplusplus)