11 #if defined(__cplusplus)
17 * All structures are reference counted to allow reuse without duplication.
18 * A *_copy operation will increase the reference count, while a *_free
19 * operation will decrease the reference count and only actually release
20 * the structures when the reference count drops to zero.
22 * Functions that return an isa structure will in general _destroy_
23 * all argument isa structures (the obvious execption begin the _copy
24 * functions). A pointer passed to such a function may therefore
25 * never be used after the function call. If you want to keep a
26 * reference to the old structure(s), use the appropriate _copy function.
29 /* A "basic map" is a relation between two sets of variables,
30 * called the "in" and "out" variables.
32 * It is implemented as a set with two extra fields:
33 * n_in is the number of in variables
34 * n_out is the number of out variables
35 * n_in + n_out should be equal to set.dim
39 struct isl_basic_map {
41 #define ISL_BASIC_MAP_FINAL (1 << 0)
42 #define ISL_BASIC_MAP_EMPTY (1 << 1)
43 #define ISL_BASIC_MAP_NO_IMPLICIT (1 << 2)
44 #define ISL_BASIC_MAP_NO_REDUNDANT (1 << 3)
45 #define ISL_BASIC_MAP_RATIONAL (1 << 4)
46 #define ISL_BASIC_MAP_NORMALIZED (1 << 5)
47 #define ISL_BASIC_MAP_NORMALIZED_DIVS (1 << 6)
48 #define ISL_BASIC_MAP_ALL_EQUALITIES (1 << 7)
67 struct isl_vec *sample;
70 struct isl_blk block2;
74 /* A "map" is a (disjoint) union of basic maps.
76 * Currently, the isl_set structure is identical to the isl_map structure
77 * and the library depends on this correspondence internally.
78 * However, users should not depend on this correspondence.
82 #define ISL_MAP_DISJOINT (1 << 0)
83 #define ISL_MAP_NORMALIZED (1 << 1)
93 struct isl_basic_map *p[1];
97 unsigned isl_basic_map_n_in(const struct isl_basic_map *bmap);
98 unsigned isl_basic_map_n_out(const struct isl_basic_map *bmap);
99 unsigned isl_basic_map_n_param(const struct isl_basic_map *bmap);
100 unsigned isl_basic_map_n_div(const struct isl_basic_map *bmap);
101 unsigned isl_basic_map_total_dim(const struct isl_basic_map *bmap);
102 unsigned isl_basic_map_dim(const struct isl_basic_map *bmap,
103 enum isl_dim_type type);
105 unsigned isl_map_n_in(const struct isl_map *map);
106 unsigned isl_map_n_out(const struct isl_map *map);
107 unsigned isl_map_n_param(const struct isl_map *map);
108 unsigned isl_map_dim(const struct isl_map *map, enum isl_dim_type type);
110 struct isl_dim *isl_basic_map_get_dim(struct isl_basic_map *bmap);
111 struct isl_dim *isl_map_get_dim(struct isl_map *map);
113 struct isl_basic_map *isl_basic_map_alloc(struct isl_ctx *ctx,
114 unsigned nparam, unsigned in, unsigned out, unsigned extra,
115 unsigned n_eq, unsigned n_ineq);
116 struct isl_basic_map *isl_basic_map_identity(struct isl_dim *set_dim);
117 struct isl_basic_map *isl_basic_map_identity_like(struct isl_basic_map *model);
118 struct isl_basic_map *isl_basic_map_finalize(struct isl_basic_map *bmap);
119 void isl_basic_map_free(struct isl_basic_map *bmap);
120 struct isl_basic_map *isl_basic_map_copy(struct isl_basic_map *bmap);
121 struct isl_basic_map *isl_basic_map_extend(struct isl_basic_map *base,
122 unsigned nparam, unsigned n_in, unsigned n_out, unsigned extra,
123 unsigned n_eq, unsigned n_ineq);
124 struct isl_basic_map *isl_basic_map_extend_constraints(
125 struct isl_basic_map *base, unsigned n_eq, unsigned n_ineq);
126 struct isl_basic_map *isl_basic_map_equal(
127 struct isl_dim *dim, unsigned n_equal);
128 struct isl_basic_map *isl_basic_map_less_at(struct isl_dim *dim, unsigned pos);
129 struct isl_basic_map *isl_basic_map_more_at(struct isl_dim *dim, unsigned pos);
130 struct isl_basic_map *isl_basic_map_empty(struct isl_dim *dim);
131 struct isl_basic_map *isl_basic_map_empty_like(struct isl_basic_map *model);
132 struct isl_basic_map *isl_basic_map_empty_like_map(struct isl_map *model);
133 struct isl_basic_map *isl_basic_map_universe(struct isl_dim *dim);
134 struct isl_basic_map *isl_basic_map_convex_hull(struct isl_basic_map *bmap);
136 struct isl_basic_map *isl_basic_map_intersect_domain(
137 struct isl_basic_map *bmap,
138 struct isl_basic_set *bset);
139 struct isl_basic_map *isl_basic_map_intersect_range(
140 struct isl_basic_map *bmap,
141 struct isl_basic_set *bset);
142 struct isl_basic_map *isl_basic_map_intersect(
143 struct isl_basic_map *bmap1,
144 struct isl_basic_map *bmap2);
145 struct isl_map *isl_basic_map_union(
146 struct isl_basic_map *bmap1,
147 struct isl_basic_map *bmap2);
148 struct isl_basic_map *isl_basic_map_apply_domain(
149 struct isl_basic_map *bmap1,
150 struct isl_basic_map *bmap2);
151 struct isl_basic_map *isl_basic_map_apply_range(
152 struct isl_basic_map *bmap1,
153 struct isl_basic_map *bmap2);
154 struct isl_basic_map *isl_basic_map_reverse(struct isl_basic_map *bmap);
155 struct isl_basic_set *isl_basic_map_domain(struct isl_basic_map *bmap);
156 struct isl_basic_set *isl_basic_map_range(struct isl_basic_map *bmap);
157 struct isl_basic_map *isl_basic_map_remove(struct isl_basic_map *bmap,
158 enum isl_dim_type type, unsigned first, unsigned n);
159 struct isl_basic_map *isl_basic_map_from_basic_set(struct isl_basic_set *bset,
160 struct isl_dim *dim);
161 struct isl_basic_set *isl_basic_set_from_basic_map(struct isl_basic_map *bmap);
162 struct isl_basic_map *isl_basic_map_simplify(struct isl_basic_map *bmap);
163 struct isl_basic_map *isl_basic_map_detect_equalities(
164 struct isl_basic_map *bmap);
165 #define ISL_FORMAT_POLYLIB 1
166 #define ISL_FORMAT_OMEGA 2
167 struct isl_basic_map *isl_basic_map_read_from_file(struct isl_ctx *ctx,
168 FILE *input, unsigned nparam, unsigned input_format);
169 struct isl_basic_map *isl_basic_map_fix_si(struct isl_basic_map *bmap,
170 enum isl_dim_type type, unsigned pos, int value);
172 struct isl_basic_map *isl_basic_map_sum(
173 struct isl_basic_map *bmap1, struct isl_basic_map *bmap2);
174 struct isl_basic_map *isl_basic_map_neg(struct isl_basic_map *bmap);
175 struct isl_basic_map *isl_basic_map_floordiv(struct isl_basic_map *bmap,
178 struct isl_map *isl_map_sum(struct isl_map *map1, struct isl_map *map2);
179 struct isl_map *isl_map_neg(struct isl_map *map);
180 struct isl_map *isl_map_floordiv(struct isl_map *map, isl_int d);
182 int isl_basic_map_is_equal(
183 struct isl_basic_map *bmap1, struct isl_basic_map *bmap2);
185 struct isl_map *isl_basic_map_partial_lexmax(
186 struct isl_basic_map *bmap, struct isl_basic_set *dom,
187 struct isl_set **empty);
188 struct isl_map *isl_basic_map_partial_lexmin(
189 struct isl_basic_map *bmap, struct isl_basic_set *dom,
190 struct isl_set **empty);
192 void isl_basic_map_dump(struct isl_basic_map *bmap, FILE *out, int indent);
194 struct isl_basic_map *isl_map_copy_basic_map(struct isl_map *map);
195 struct isl_map *isl_map_drop_basic_map(struct isl_map *map,
196 struct isl_basic_map *bmap);
198 int isl_basic_map_fast_is_fixed(struct isl_basic_map *bmap,
199 enum isl_dim_type type, unsigned pos, isl_int *val);
201 int isl_basic_map_is_universe(struct isl_basic_map *bmap);
202 int isl_basic_map_fast_is_empty(struct isl_basic_map *bmap);
203 int isl_basic_map_is_empty(struct isl_basic_map *bmap);
204 int isl_basic_map_is_subset(struct isl_basic_map *bmap1,
205 struct isl_basic_map *bmap2);
206 int isl_basic_map_is_strict_subset(struct isl_basic_map *bmap1,
207 struct isl_basic_map *bmap2);
209 struct isl_map *isl_map_alloc(struct isl_ctx *ctx,
210 unsigned nparam, unsigned in, unsigned out, int n,
212 struct isl_map *isl_map_universe(struct isl_dim *dim);
213 struct isl_map *isl_map_empty(struct isl_dim *dim);
214 struct isl_map *isl_map_empty_like(struct isl_map *model);
215 struct isl_map *isl_map_empty_like_basic_map(struct isl_basic_map *model);
216 struct isl_map *isl_map_dup(struct isl_map *map);
217 struct isl_map *isl_map_add(struct isl_map *map, struct isl_basic_map *bmap);
218 struct isl_map *isl_map_identity(struct isl_dim *set_dim);
219 struct isl_map *isl_map_identity_like(struct isl_map *model);
220 struct isl_map *isl_map_identity_like_basic_map(struct isl_basic_map *model);
221 struct isl_map *isl_map_finalize(struct isl_map *map);
222 void isl_map_free(struct isl_map *map);
223 struct isl_map *isl_map_copy(struct isl_map *map);
224 struct isl_map *isl_map_extend(struct isl_map *base,
225 unsigned nparam, unsigned n_in, unsigned n_out);
226 struct isl_map *isl_map_reverse(struct isl_map *map);
227 struct isl_map *isl_map_union(struct isl_map *map1, struct isl_map *map2);
228 struct isl_map *isl_map_union_disjoint(
229 struct isl_map *map1, struct isl_map *map2);
230 struct isl_map *isl_map_intersect_domain(
232 struct isl_set *set);
233 struct isl_map *isl_map_intersect_range(
235 struct isl_set *set);
236 struct isl_map *isl_map_apply_domain(
237 struct isl_map *map1,
238 struct isl_map *map2);
239 struct isl_map *isl_map_apply_range(
240 struct isl_map *map1,
241 struct isl_map *map2);
242 struct isl_map *isl_map_product(struct isl_map *map1, struct isl_map *map2);
243 struct isl_map *isl_map_intersect(struct isl_map *map1, struct isl_map *map2);
244 struct isl_map *isl_map_subtract(struct isl_map *map1, struct isl_map *map2);
245 struct isl_map *isl_map_fix_input_si(struct isl_map *map,
246 unsigned input, int value);
247 struct isl_map *isl_map_fix_si(struct isl_map *map,
248 enum isl_dim_type type, unsigned pos, int value);
249 struct isl_basic_set *isl_basic_map_deltas(struct isl_basic_map *bmap);
250 struct isl_set *isl_map_deltas(struct isl_map *map);
251 struct isl_set *isl_map_range(struct isl_map *map);
252 struct isl_map *isl_map_detect_equalities(struct isl_map *map);
253 struct isl_basic_map *isl_map_affine_hull(struct isl_map *map);
254 struct isl_map *isl_map_remove(struct isl_map *map,
255 enum isl_dim_type type, unsigned first, unsigned n);
256 struct isl_map *isl_map_remove_inputs(struct isl_map *map,
257 unsigned first, unsigned n);
259 struct isl_set *isl_map_domain(struct isl_map *bmap);
260 struct isl_map *isl_map_from_basic_map(struct isl_basic_map *bmap);
261 struct isl_map *isl_map_from_range(struct isl_set *set);
262 struct isl_map *isl_map_from_set(struct isl_set *set, struct isl_dim *dim);
263 struct isl_set *isl_set_from_map(struct isl_map *map);
265 int isl_map_fast_is_empty(struct isl_map *map);
266 int isl_map_is_empty(struct isl_map *map);
267 int isl_map_is_subset(struct isl_map *map1, struct isl_map *map2);
268 int isl_map_is_strict_subset(struct isl_map *map1, struct isl_map *map2);
269 int isl_map_is_equal(struct isl_map *map1, struct isl_map *map2);
271 void isl_map_dump(struct isl_map *map, FILE *out, int indent);
273 int isl_map_fast_input_is_fixed(struct isl_map *map,
274 unsigned in, isl_int *val);
275 int isl_map_fast_is_fixed(struct isl_map *map,
276 enum isl_dim_type type, unsigned pos, isl_int *val);
278 struct isl_map *isl_map_coalesce(struct isl_map *map);
280 int isl_map_fast_is_equal(struct isl_map *map1, struct isl_map *map2);
282 #if defined(__cplusplus)