Polly 23.0.0git
isl_ast_build.c
Go to the documentation of this file.
1/*
2 * Copyright 2012-2013 Ecole Normale Superieure
3 * Copyright 2014 INRIA Rocquencourt
4 *
5 * Use of this software is governed by the MIT license
6 *
7 * Written by Sven Verdoolaege,
8 * Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France
9 * and Inria Paris - Rocquencourt, Domaine de Voluceau - Rocquencourt,
10 * B.P. 105 - 78153 Le Chesnay, France
11 */
12
13#include <isl/id.h>
14#include <isl/val.h>
15#include <isl/space.h>
16#include <isl/map.h>
17#include <isl/aff.h>
18#include <isl/constraint.h>
19#include <isl/map.h>
20#include <isl/union_set.h>
21#include <isl/union_map.h>
23#include <isl_ast_private.h>
24#include <isl_config.h>
25
26/* Construct a map that isolates the current dimension.
27 *
28 * Essentially, the current dimension of "set" is moved to the single output
29 * dimension in the result, with the current dimension in the domain replaced
30 * by an unconstrained variable.
31 */
34{
35 isl_map *map;
36
39
40 if (!build)
41 return isl_map_free(map);
42
43 map = isl_map_equate(map, isl_dim_in, build->depth, isl_dim_out, 0);
44 map = isl_map_eliminate(map, isl_dim_in, build->depth, 1);
45
46 return map;
47}
48
49/* Initialize the information derived during the AST generation to default
50 * values for a schedule domain in "space".
51 *
52 * We also check that the remaining fields are not NULL so that
53 * the calling functions don't have to perform this test.
54 */
57{
58 isl_ctx *ctx;
59 isl_vec *strides;
60 isl_size dim;
61
62 build = isl_ast_build_cow(build);
63 if (!build || !build->domain)
64 goto error;
65
66 ctx = isl_ast_build_get_ctx(build);
67 dim = isl_space_dim(space, isl_dim_set);
68 if (dim < 0)
69 goto error;
70 strides = isl_vec_alloc(ctx, dim);
71 strides = isl_vec_set_si(strides, 1);
72
73 isl_vec_free(build->strides);
74 build->strides = strides;
75
76 space = isl_space_map_from_set(space);
77 isl_multi_aff_free(build->offsets);
78 build->offsets = isl_multi_aff_zero(isl_space_copy(space));
79 isl_multi_aff_free(build->values);
80 build->values = isl_multi_aff_identity(isl_space_copy(space));
81 isl_multi_aff_free(build->internal2input);
82 build->internal2input = isl_multi_aff_identity(space);
83
84 if (!build->iterators || !build->domain || !build->generated ||
85 !build->pending || !build->values || !build->internal2input ||
86 !build->strides || !build->offsets || !build->options)
87 return isl_ast_build_free(build);
88
89 return build;
90error:
91 isl_space_free(space);
92 return isl_ast_build_free(build);
93}
94
95/* Return an isl_id called "c%d", with "%d" set to "i".
96 * If an isl_id with such a name already appears among the parameters
97 * in build->domain, then adjust the name to "c%d_%d".
98 */
101{
102 int j;
103 char name[23];
104 isl_set *dom = build->domain;
105
106 snprintf(name, sizeof(name), "c%d", i);
107 j = 0;
109 snprintf(name, sizeof(name), "c%d_%d", i, j++);
110 return isl_id_alloc(ctx, name, NULL);
111}
112
113/* Create an isl_ast_build with "set" as domain.
114 *
115 * The input set is usually a parameter domain, but we currently allow it to
116 * be any kind of set. We set the domain of the returned isl_ast_build
117 * to "set" and initialize all the other fields to default values.
118 */
120{
121 int i;
122 isl_size n;
123 isl_ctx *ctx;
124 isl_space *space;
125 isl_ast_build *build;
126
129 if (n < 0)
130 goto error;
131
132 ctx = isl_set_get_ctx(set);
133
134 build = isl_calloc_type(ctx, isl_ast_build);
135 if (!build)
136 goto error;
137
138 build->ref = 1;
139 build->domain = set;
140 build->generated = isl_set_copy(build->domain);
143 build->depth = n;
144 build->iterators = isl_id_list_alloc(ctx, n);
145 for (i = 0; i < n; ++i) {
146 isl_id *id;
149 else
150 id = generate_name(ctx, i, build);
151 build->iterators = isl_id_list_add(build->iterators, id);
152 }
153 space = isl_set_get_space(set);
154 if (isl_space_is_params(space))
155 space = isl_space_set_from_params(space);
156
157 return isl_ast_build_init_derived(build, space);
158error:
160 return NULL;
161}
162
163/* Create an isl_ast_build with a universe (parametric) context.
164 */
166{
167 isl_space *space;
169
170 space = isl_space_params_alloc(ctx, 0);
171 context = isl_set_universe(space);
172
174}
175
177{
178 if (!build)
179 return NULL;
180
181 build->ref++;
182 return build;
183}
184
186{
187 isl_ctx *ctx;
189
190 if (!build)
191 return NULL;
192
193 ctx = isl_ast_build_get_ctx(build);
195 if (!dup)
196 return NULL;
197
198 dup->ref = 1;
199 dup->outer_pos = build->outer_pos;
200 dup->depth = build->depth;
201 dup->iterators = isl_id_list_copy(build->iterators);
202 dup->domain = isl_set_copy(build->domain);
203 dup->generated = isl_set_copy(build->generated);
204 dup->pending = isl_set_copy(build->pending);
205 dup->values = isl_multi_aff_copy(build->values);
206 dup->internal2input = isl_multi_aff_copy(build->internal2input);
207 dup->value = isl_pw_aff_copy(build->value);
208 dup->strides = isl_vec_copy(build->strides);
209 dup->offsets = isl_multi_aff_copy(build->offsets);
210 dup->executed = isl_union_map_copy(build->executed);
211 dup->options = isl_union_map_copy(build->options);
212 dup->at_each_domain = build->at_each_domain;
213 dup->at_each_domain_user = build->at_each_domain_user;
214 dup->before_each_for = build->before_each_for;
215 dup->before_each_for_user = build->before_each_for_user;
216 dup->after_each_for = build->after_each_for;
217 dup->after_each_for_user = build->after_each_for_user;
218 dup->before_each_mark = build->before_each_mark;
219 dup->before_each_mark_user = build->before_each_mark_user;
220 dup->after_each_mark = build->after_each_mark;
221 dup->after_each_mark_user = build->after_each_mark_user;
222 dup->create_leaf = build->create_leaf;
223 dup->create_leaf_user = build->create_leaf_user;
224 dup->node = isl_schedule_node_copy(build->node);
225 if (build->loop_type) {
226 int i;
227
228 dup->n = build->n;
229 dup->loop_type = isl_alloc_array(ctx,
230 enum isl_ast_loop_type, dup->n);
231 if (dup->n && !dup->loop_type)
232 return isl_ast_build_free(dup);
233 for (i = 0; i < dup->n; ++i)
234 dup->loop_type[i] = build->loop_type[i];
235 }
236
237 if (!dup->iterators || !dup->domain || !dup->generated ||
238 !dup->pending || !dup->values ||
239 !dup->strides || !dup->offsets || !dup->options ||
240 (build->internal2input && !dup->internal2input) ||
241 (build->executed && !dup->executed) ||
242 (build->value && !dup->value) ||
243 (build->node && !dup->node))
244 return isl_ast_build_free(dup);
245
246 return dup;
247}
248
249/* Align the parameters of "build" to those of "model", introducing
250 * additional parameters if needed.
251 */
254{
255 build = isl_ast_build_cow(build);
256 if (!build)
257 goto error;
258
259 build->domain = isl_set_align_params(build->domain,
260 isl_space_copy(model));
261 build->generated = isl_set_align_params(build->generated,
262 isl_space_copy(model));
263 build->pending = isl_set_align_params(build->pending,
264 isl_space_copy(model));
265 build->values = isl_multi_aff_align_params(build->values,
266 isl_space_copy(model));
267 build->offsets = isl_multi_aff_align_params(build->offsets,
268 isl_space_copy(model));
269 build->options = isl_union_map_align_params(build->options,
270 isl_space_copy(model));
271 if (build->internal2input) {
272 build->internal2input =
273 isl_multi_aff_align_params(build->internal2input,
274 model);
275 if (!build->internal2input)
276 return isl_ast_build_free(build);
277 } else {
278 isl_space_free(model);
279 }
280
281 if (!build->domain || !build->values || !build->offsets ||
282 !build->options)
283 return isl_ast_build_free(build);
284
285 return build;
286error:
287 isl_space_free(model);
288 return NULL;
289}
290
292{
293 if (!build)
294 return NULL;
295
296 if (build->ref == 1)
297 return build;
298 build->ref--;
299 return isl_ast_build_dup(build);
300}
301
304{
305 if (!build)
306 return NULL;
307
308 if (--build->ref > 0)
309 return NULL;
310
311 isl_id_list_free(build->iterators);
312 isl_set_free(build->domain);
313 isl_set_free(build->generated);
314 isl_set_free(build->pending);
315 isl_multi_aff_free(build->values);
316 isl_multi_aff_free(build->internal2input);
317 isl_pw_aff_free(build->value);
318 isl_vec_free(build->strides);
319 isl_multi_aff_free(build->offsets);
320 isl_multi_aff_free(build->schedule_map);
321 isl_union_map_free(build->executed);
322 isl_union_map_free(build->options);
323 isl_schedule_node_free(build->node);
324 free(build->loop_type);
325 isl_set_free(build->isolated);
326
327 free(build);
328
329 return NULL;
330}
331
333{
334 return build ? isl_set_get_ctx(build->domain) : NULL;
335}
336
337/* Replace build->options by "options".
338 */
341{
342 build = isl_ast_build_cow(build);
343
344 if (!build || !options)
345 goto error;
346
347 isl_union_map_free(build->options);
348 build->options = options;
349
350 return build;
351error:
353 return isl_ast_build_free(build);
354}
355
356/* Set the iterators for the next code generation.
357 *
358 * If we still have some iterators left from the previous code generation
359 * (if any) or if iterators have already been set by a previous
360 * call to this function, then we remove them first.
361 */
363 __isl_take isl_ast_build *build, __isl_take isl_id_list *iterators)
364{
365 isl_size dim, n_it;
366
367 build = isl_ast_build_cow(build);
368 if (!build)
369 goto error;
370
371 dim = isl_ast_build_dim(build, isl_dim_set);
372 n_it = isl_id_list_n_id(build->iterators);
373 if (dim < 0 || n_it < 0)
374 goto error;
375 if (n_it < dim)
377 "isl_ast_build in inconsistent state", goto error);
378 if (n_it > dim)
379 build->iterators = isl_id_list_drop(build->iterators,
380 dim, n_it - dim);
381 build->iterators = isl_id_list_concat(build->iterators, iterators);
382 if (!build->iterators)
383 return isl_ast_build_free(build);
384
385 return build;
386error:
387 isl_id_list_free(iterators);
388 return isl_ast_build_free(build);
389}
390
391/* Set the "at_each_domain" callback of "build" to "fn".
392 */
396 __isl_keep isl_ast_build *build, void *user), void *user)
397{
398 build = isl_ast_build_cow(build);
399
400 if (!build)
401 return NULL;
402
403 build->at_each_domain = fn;
404 build->at_each_domain_user = user;
405
406 return build;
407}
408
409/* Set the "before_each_for" callback of "build" to "fn".
410 */
414 void *user), void *user)
415{
416 build = isl_ast_build_cow(build);
417
418 if (!build)
419 return NULL;
420
421 build->before_each_for = fn;
422 build->before_each_for_user = user;
423
424 return build;
425}
426
427/* Set the "after_each_for" callback of "build" to "fn".
428 */
432 __isl_keep isl_ast_build *build, void *user), void *user)
433{
434 build = isl_ast_build_cow(build);
435
436 if (!build)
437 return NULL;
438
439 build->after_each_for = fn;
440 build->after_each_for_user = user;
441
442 return build;
443}
444
445/* Set the "before_each_mark" callback of "build" to "fn".
446 */
450 void *user), void *user)
451{
452 build = isl_ast_build_cow(build);
453
454 if (!build)
455 return NULL;
456
457 build->before_each_mark = fn;
458 build->before_each_mark_user = user;
459
460 return build;
461}
462
463/* Set the "after_each_mark" callback of "build" to "fn".
464 */
468 __isl_keep isl_ast_build *build, void *user), void *user)
469{
470 build = isl_ast_build_cow(build);
471
472 if (!build)
473 return NULL;
474
475 build->after_each_mark = fn;
476 build->after_each_mark_user = user;
477
478 return build;
479}
480
481/* Set the "create_leaf" callback of "build" to "fn".
482 */
486 void *user), void *user)
487{
488 build = isl_ast_build_cow(build);
489
490 if (!build)
491 return NULL;
492
493 build->create_leaf = fn;
494 build->create_leaf_user = user;
495
496 return build;
497}
498
499/* Clear all information that is specific to this code generation
500 * and that is (probably) not meaningful to any nested code generation.
501 */
504{
505 isl_space *space;
506
507 build = isl_ast_build_cow(build);
508 if (!build)
509 return NULL;
510
511 space = isl_union_map_get_space(build->options);
512 isl_union_map_free(build->options);
513 build->options = isl_union_map_empty(space);
514
515 build->at_each_domain = NULL;
516 build->at_each_domain_user = NULL;
517 build->before_each_for = NULL;
518 build->before_each_for_user = NULL;
519 build->after_each_for = NULL;
520 build->after_each_for_user = NULL;
521 build->before_each_mark = NULL;
522 build->before_each_mark_user = NULL;
523 build->after_each_mark = NULL;
524 build->after_each_mark_user = NULL;
525 build->create_leaf = NULL;
526 build->create_leaf_user = NULL;
527
528 if (!build->options)
529 return isl_ast_build_free(build);
530
531 return build;
532}
533
534/* Have any loops been eliminated?
535 * That is, do any of the original schedule dimensions have a fixed
536 * value that has been substituted?
537 */
539{
540 int i;
541
542 for (i = 0; i < build->depth; ++i)
543 if (isl_ast_build_has_affine_value(build, i))
544 return 1;
545
546 return 0;
547}
548
549/* Clear build->schedule_map.
550 * This function should be called whenever anything that might affect
551 * the result of isl_ast_build_get_schedule_map_multi_aff changes.
552 * In particular, it should be called when the depth is changed or
553 * when an iterator is determined to have a fixed value.
554 */
556{
557 if (!build)
558 return;
559 isl_multi_aff_free(build->schedule_map);
560 build->schedule_map = NULL;
561}
562
563/* Do we need a (non-trivial) schedule map?
564 * That is, is the internal schedule space different from
565 * the external schedule space?
566 *
567 * The internal and external schedule spaces are only the same
568 * if code has been generated for the entire schedule and if none
569 * of the loops have been eliminated.
570 */
572{
573 isl_size dim;
574
575 dim = isl_ast_build_dim(build, isl_dim_set);
576 if (dim < 0)
577 return isl_bool_error;
578 return isl_bool_ok(build->depth != dim || any_eliminated(build));
579}
580
581/* Return a mapping from the internal schedule space to the external
582 * schedule space in the form of an isl_multi_aff.
583 * The internal schedule space originally corresponds to that of the
584 * input schedule. This may change during the code generation if
585 * if isl_ast_build_insert_dim is ever called.
586 * The external schedule space corresponds to the
587 * loops that have been generated.
588 *
589 * Currently, the only difference between the internal schedule domain
590 * and the external schedule domain is that some dimensions are projected
591 * out in the external schedule domain. In particular, the dimensions
592 * for which no code has been generated yet and the dimensions that correspond
593 * to eliminated loops.
594 *
595 * We cache a copy of the schedule_map in build->schedule_map.
596 * The cache is cleared through isl_ast_build_reset_schedule_map
597 * whenever anything changes that might affect the result of this function.
598 */
601{
602 isl_bool needs_map;
603 isl_space *space;
605
606 if (!build)
607 return NULL;
608 if (build->schedule_map)
609 return isl_multi_aff_copy(build->schedule_map);
610 needs_map = isl_ast_build_need_schedule_map(build);
611 if (needs_map < 0)
612 return NULL;
613
614 space = isl_ast_build_get_space(build, 1);
615 space = isl_space_map_from_set(space);
616 ma = isl_multi_aff_identity(space);
617 if (needs_map) {
618 int i;
620
621 if (dim < 0)
622 ma = isl_multi_aff_free(ma);
623 ma = isl_multi_aff_drop_dims(ma, isl_dim_out,
624 build->depth, dim - build->depth);
625 for (i = build->depth - 1; i >= 0; --i)
626 if (isl_ast_build_has_affine_value(build, i))
627 ma = isl_multi_aff_drop_dims(ma,
628 isl_dim_out, i, 1);
629 }
630
631 build->schedule_map = ma;
632 return isl_multi_aff_copy(build->schedule_map);
633}
634
635/* Return a mapping from the internal schedule space to the external
636 * schedule space in the form of an isl_map.
637 */
646
647/* Return the position of the dimension in build->domain for which
648 * an AST node is currently being generated.
649 */
651{
652 return build ? build->depth : isl_size_error;
653}
654
655/* Prepare for generating code for the next level.
656 * In particular, increase the depth and reset any information
657 * that is local to the current depth.
658 */
661{
662 build = isl_ast_build_cow(build);
663 if (!build)
664 return NULL;
665 build->depth++;
667 build->value = isl_pw_aff_free(build->value);
668 return build;
669}
670
672{
673 if (!build)
674 return;
675
676 fprintf(stderr, "domain: ");
677 isl_set_dump(build->domain);
678 fprintf(stderr, "generated: ");
679 isl_set_dump(build->generated);
680 fprintf(stderr, "pending: ");
681 isl_set_dump(build->pending);
682 fprintf(stderr, "iterators: ");
683 isl_id_list_dump(build->iterators);
684 fprintf(stderr, "values: ");
685 isl_multi_aff_dump(build->values);
686 if (build->value) {
687 fprintf(stderr, "value: ");
688 isl_pw_aff_dump(build->value);
689 }
690 fprintf(stderr, "strides: ");
691 isl_vec_dump(build->strides);
692 fprintf(stderr, "offsets: ");
693 isl_multi_aff_dump(build->offsets);
694 fprintf(stderr, "internal2input: ");
695 isl_multi_aff_dump(build->internal2input);
696}
697
698/* Initialize "build" for AST construction in schedule space "space"
699 * in the case that build->domain is a parameter set.
700 *
701 * build->iterators is assumed to have been updated already.
702 */
705{
706 isl_set *set;
707
708 build = isl_ast_build_cow(build);
709 if (!build)
710 goto error;
711
714 build->domain);
715 build->pending = isl_set_intersect_params(isl_set_copy(set),
716 build->pending);
717 build->generated = isl_set_intersect_params(set, build->generated);
718
719 return isl_ast_build_init_derived(build, space);
720error:
721 isl_ast_build_free(build);
722 isl_space_free(space);
723 return NULL;
724}
725
726/* Assign "aff" to *user and return -1, effectively extracting
727 * the first (and presumably only) affine expression in the isl_pw_aff
728 * on which this function is used.
729 */
731 __isl_take isl_aff *aff, void *user)
732{
733 isl_aff **p = user;
734
735 *p = aff;
737
738 return isl_stat_error;
739}
740
741/* Intersect "set" with the stride constraint of "build", if any.
742 */
745{
746 isl_set *stride;
747
748 if (!build)
749 return isl_set_free(set);
750 if (!isl_ast_build_has_stride(build, build->depth))
751 return set;
752
754 return isl_set_intersect(set, stride);
755}
756
757/* Check if the given bounds on the current dimension (together with
758 * the stride constraint, if any) imply that
759 * this current dimension attains only a single value (in terms of
760 * parameters and outer dimensions).
761 * If so, we record it in build->value.
762 * If, moreover, this value can be represented as a single affine expression,
763 * then we also update build->values, effectively marking the current
764 * dimension as "eliminated".
765 *
766 * When computing the gist of the fixed value that can be represented
767 * as a single affine expression, it is important to only take into
768 * account the domain constraints in the original AST build and
769 * not the domain of the affine expression itself.
770 * Otherwise, a [i/3] is changed into a i/3 because we know that i
771 * is a multiple of 3, but then we end up not expressing anywhere
772 * in the context that i is a multiple of 3.
773 */
776{
777 isl_bool sv;
778 isl_size n;
780 isl_aff *aff = NULL;
781 isl_map *it_map;
782 isl_set *set;
783
784 set = isl_set_from_basic_set(bounds);
785 set = isl_set_intersect(set, isl_set_copy(build->domain));
787 it_map = isl_ast_build_map_to_iterator(build, set);
788
790 if (sv < 0)
791 build = isl_ast_build_free(build);
792 if (!build || !sv) {
793 isl_map_free(it_map);
794 return build;
795 }
796
798 build->value = isl_pw_multi_aff_get_pw_aff(pma, 0);
799 build->value = isl_ast_build_compute_gist_pw_aff(build, build->value);
800 build->value = isl_pw_aff_coalesce(build->value);
802
803 n = isl_pw_aff_n_piece(build->value);
804 if (n < 0)
805 return isl_ast_build_free(build);
806 if (n != 1)
807 return build;
808
810
811 build->values = isl_multi_aff_set_aff(build->values, build->depth, aff);
812 if (!build->values)
813 return isl_ast_build_free(build);
815 return build;
816}
817
818/* Update the AST build based on the given loop bounds for
819 * the current dimension and the stride information available in the build.
820 *
821 * We first make sure that the bounds do not refer to any iterators
822 * that have already been eliminated.
823 * Then, we check if the bounds imply that the current iterator
824 * has a fixed value.
825 * If they do and if this fixed value can be expressed as a single
826 * affine expression, we eliminate the iterators from the bounds.
827 * Note that we cannot simply plug in this single value using
828 * isl_basic_set_preimage_multi_aff as the single value may only
829 * be defined on a subset of the domain. Plugging in the value
830 * would restrict the build domain to this subset, while this
831 * restriction may not be reflected in the generated code.
832 * Finally, we intersect build->domain with the updated bounds.
833 * We also add the stride constraint unless we have been able
834 * to find a fixed value expressed as a single affine expression.
835 *
836 * Note that the check for a fixed value in update_values requires
837 * us to intersect the bounds with the current build domain.
838 * When we intersect build->domain with the updated bounds in
839 * the final step, we make sure that these updated bounds have
840 * not been intersected with the old build->domain.
841 * Otherwise, we would indirectly intersect the build domain with itself,
842 * which can lead to inefficiencies, in particular if the build domain
843 * contains any unknown divs.
844 *
845 * The pending and generated sets are not updated by this function to
846 * match the updated domain.
847 * The caller still needs to call isl_ast_build_set_pending_generated.
848 */
851{
852 isl_set *set;
853
854 build = isl_ast_build_cow(build);
855 if (!build)
856 goto error;
857
858 build = update_values(build, isl_basic_set_copy(bounds));
859 if (!build)
860 goto error;
862 if (isl_ast_build_has_affine_value(build, build->depth)) {
863 set = isl_set_eliminate(set, isl_dim_set, build->depth, 1);
865 build->pending = isl_set_intersect(build->pending,
867 build->domain = isl_set_intersect(build->domain, set);
868 } else {
869 build->domain = isl_set_intersect(build->domain, set);
870 build = isl_ast_build_include_stride(build);
871 if (!build)
872 goto error;
873 }
874 isl_basic_set_free(bounds);
875
876 if (!build->domain || !build->pending || !build->generated)
877 return isl_ast_build_free(build);
878
879 return build;
880error:
881 isl_ast_build_free(build);
882 isl_basic_set_free(bounds);
883 return NULL;
884}
885
886/* Update the pending and generated sets of "build" according to "bounds".
887 * If the build has an affine value at the current depth,
888 * then isl_ast_build_set_loop_bounds has already set the pending set.
889 * Otherwise, do it here.
890 */
893{
894 isl_basic_set *generated, *pending;
895
896 if (!build)
897 goto error;
898
899 if (isl_ast_build_has_affine_value(build, build->depth)) {
900 isl_basic_set_free(bounds);
901 return build;
902 }
903
904 build = isl_ast_build_cow(build);
905 if (!build)
906 goto error;
907
908 pending = isl_basic_set_copy(bounds);
910 isl_dim_set, build->depth, 1);
911 build->pending = isl_set_intersect(build->pending,
912 isl_set_from_basic_set(pending));
913 generated = bounds;
915 generated, isl_dim_set, build->depth, 1);
916 build->generated = isl_set_intersect(build->generated,
917 isl_set_from_basic_set(generated));
918
919 if (!build->pending || !build->generated)
920 return isl_ast_build_free(build);
921
922 return build;
923error:
924 isl_ast_build_free(build);
925 isl_basic_set_free(bounds);
926 return NULL;
927}
928
929/* Intersect build->domain with "set", where "set" is specified
930 * in terms of the internal schedule domain.
931 */
934{
935 build = isl_ast_build_cow(build);
936 if (!build)
937 goto error;
938
940 build->domain = isl_set_intersect(build->domain, set);
941 build->domain = isl_set_coalesce(build->domain);
942
943 if (!build->domain)
944 return isl_ast_build_free(build);
945
946 return build;
947error:
948 isl_ast_build_free(build);
950 return NULL;
951}
952
953/* Intersect build->generated and build->domain with "set",
954 * where "set" is specified in terms of the internal schedule domain.
955 */
958{
961 build = isl_ast_build_cow(build);
962 if (!build)
963 goto error;
964
965 build->generated = isl_set_intersect(build->generated, set);
966 build->generated = isl_set_coalesce(build->generated);
967
968 if (!build->generated)
969 return isl_ast_build_free(build);
970
971 return build;
972error:
973 isl_ast_build_free(build);
975 return NULL;
976}
977
978/* Replace the set of pending constraints by "guard", which is then
979 * no longer considered as pending.
980 * That is, add "guard" to the generated constraints and clear all pending
981 * constraints, making the domain equal to the generated constraints.
982 */
985{
986 build = isl_ast_build_restrict_generated(build, guard);
987 build = isl_ast_build_cow(build);
988 if (!build)
989 return NULL;
990
991 isl_set_free(build->domain);
992 build->domain = isl_set_copy(build->generated);
993 isl_set_free(build->pending);
994 build->pending = isl_set_universe(isl_set_get_space(build->domain));
995
996 if (!build->pending)
997 return isl_ast_build_free(build);
998
999 return build;
1000}
1001
1002/* Intersect build->domain with "set", where "set" is specified
1003 * in terms of the external schedule domain.
1004 */
1007{
1008 isl_bool needs_map;
1009
1012
1013 needs_map = isl_ast_build_need_schedule_map(build);
1014 if (needs_map < 0)
1015 goto error;
1016 if (needs_map) {
1020 }
1022error:
1023 isl_ast_build_free(build);
1025 return NULL;
1026}
1027
1028/* Replace build->executed by "executed".
1029 */
1032{
1033 build = isl_ast_build_cow(build);
1034 if (!build)
1035 goto error;
1036
1037 isl_union_map_free(build->executed);
1038 build->executed = executed;
1039
1040 return build;
1041error:
1042 isl_ast_build_free(build);
1043 isl_union_map_free(executed);
1044 return NULL;
1045}
1046
1047/* Does "build" point to a band node?
1048 * That is, are we currently handling a band node inside a schedule tree?
1049 */
1051{
1052 if (!build)
1053 return -1;
1054 return build->node != NULL;
1055}
1056
1057/* Return a copy of the band node that "build" refers to.
1058 */
1061{
1062 if (!build)
1063 return NULL;
1064 return isl_schedule_node_copy(build->node);
1065}
1066
1067/* Extract the loop AST generation types for the members of build->node
1068 * and store them in build->loop_type.
1069 */
1072{
1073 int i;
1074 isl_size n;
1075 isl_ctx *ctx;
1076 isl_schedule_node *node;
1077
1078 if (!build)
1079 return NULL;
1080 n = isl_schedule_node_band_n_member(build->node);
1081 if (n < 0)
1082 return isl_ast_build_free(build);
1083 ctx = isl_ast_build_get_ctx(build);
1084 if (!build->node)
1085 isl_die(ctx, isl_error_internal, "missing AST node",
1086 return isl_ast_build_free(build));
1087
1088 free(build->loop_type);
1089 build->n = n;
1090 build->loop_type = isl_alloc_array(ctx,
1091 enum isl_ast_loop_type, build->n);
1092 if (build->n && !build->loop_type)
1093 return isl_ast_build_free(build);
1094 node = build->node;
1095 for (i = 0; i < build->n; ++i)
1096 build->loop_type[i] =
1098
1099 return build;
1100}
1101
1102/* Replace the band node that "build" refers to by "node" and
1103 * extract the corresponding loop AST generation types.
1104 */
1108{
1109 build = isl_ast_build_cow(build);
1110 if (!build || !node)
1111 goto error;
1112
1113 isl_schedule_node_free(build->node);
1114 build->node = node;
1115
1116 build = extract_loop_types(build);
1117
1118 return build;
1119error:
1120 isl_ast_build_free(build);
1122 return NULL;
1123}
1124
1125/* Remove any reference to a band node from "build".
1126 */
1129{
1130 build = isl_ast_build_cow(build);
1131 if (!build)
1132 return NULL;
1133
1134 isl_schedule_node_free(build->node);
1135 build->node = NULL;
1136
1137 return build;
1138}
1139
1140/* Return a copy of the current schedule domain.
1141 */
1143{
1144 return build ? isl_set_copy(build->domain) : NULL;
1145}
1146
1147/* Return a copy of the set of pending constraints.
1148 */
1151{
1152 return build ? isl_set_copy(build->pending) : NULL;
1153}
1154
1155/* Return a copy of the set of generated constraints.
1156 */
1159{
1160 return build ? isl_set_copy(build->generated) : NULL;
1161}
1162
1163/* Return a copy of the map from the internal schedule domain
1164 * to the original input schedule domain.
1165 */
1168{
1169 return build ? isl_multi_aff_copy(build->internal2input) : NULL;
1170}
1171
1172/* Return the number of variables of the given type
1173 * in the (internal) schedule space.
1174 */
1176 enum isl_dim_type type)
1177{
1178 if (!build)
1179 return isl_size_error;
1180 return isl_set_dim(build->domain, type);
1181}
1182
1183/* Return the (schedule) space of "build".
1184 *
1185 * If "internal" is set, then this space is the space of the internal
1186 * representation of the entire schedule, including those parts for
1187 * which no code has been generated yet.
1188 *
1189 * If "internal" is not set, then this space is the external representation
1190 * of the loops generated so far.
1191 */
1193 int internal)
1194{
1195 int i;
1196 isl_size dim;
1197 isl_bool needs_map;
1198 isl_space *space;
1199
1200 if (!build)
1201 return NULL;
1202
1203 space = isl_set_get_space(build->domain);
1204 if (internal)
1205 return space;
1206
1207 needs_map = isl_ast_build_need_schedule_map(build);
1208 if (needs_map < 0)
1209 return isl_space_free(space);
1210 if (!needs_map)
1211 return space;
1212
1213 dim = isl_ast_build_dim(build, isl_dim_set);
1214 if (dim < 0)
1215 return isl_space_free(space);
1216 space = isl_space_drop_dims(space, isl_dim_set,
1217 build->depth, dim - build->depth);
1218 for (i = build->depth - 1; i >= 0; --i) {
1219 isl_bool affine = isl_ast_build_has_affine_value(build, i);
1220
1221 if (affine < 0)
1222 return isl_space_free(space);
1223 if (affine)
1224 space = isl_space_drop_dims(space, isl_dim_set, i, 1);
1225 }
1226
1227 return space;
1228}
1229
1230/* Return the external representation of the schedule space of "build",
1231 * i.e., a space with a dimension for each loop generated so far,
1232 * with the names of the dimensions set to the loop iterators.
1233 */
1236{
1237 isl_space *space;
1238 int i, skip;
1239
1240 if (!build)
1241 return NULL;
1242
1243 space = isl_ast_build_get_space(build, 0);
1244
1245 skip = 0;
1246 for (i = 0; i < build->depth; ++i) {
1247 isl_id *id;
1248
1249 if (isl_ast_build_has_affine_value(build, i)) {
1250 skip++;
1251 continue;
1252 }
1253
1254 id = isl_ast_build_get_iterator_id(build, i);
1255 space = isl_space_set_dim_id(space, isl_dim_set, i - skip, id);
1256 }
1257
1258 return space;
1259}
1260
1261/* Return the current schedule, as stored in build->executed, in terms
1262 * of the external schedule domain.
1263 */
1266{
1267 isl_bool needs_map;
1268 isl_union_map *executed;
1270
1271 needs_map = isl_ast_build_need_schedule_map(build);
1272 if (needs_map < 0)
1273 return NULL;
1274
1275 executed = isl_union_map_copy(build->executed);
1276 if (needs_map) {
1278 executed = isl_union_map_apply_domain(executed,
1280 }
1281 schedule = isl_union_map_reverse(executed);
1282
1283 return schedule;
1284}
1285
1286/* Return the iterator attached to the internal schedule dimension "pos".
1287 */
1289 __isl_keep isl_ast_build *build, int pos)
1290{
1291 if (!build)
1292 return NULL;
1293
1294 return isl_id_list_get_id(build->iterators, pos);
1295}
1296
1297/* Set the stride and offset of the current dimension to the given
1298 * value and expression.
1299 */
1302{
1303 int pos;
1304
1305 build = isl_ast_build_cow(build);
1306 if (!build || !stride || !offset)
1307 goto error;
1308
1309 pos = build->depth;
1310
1311 build->strides = isl_vec_set_element_val(build->strides, pos, stride);
1312 build->offsets = isl_multi_aff_set_aff(build->offsets, pos, offset);
1313 if (!build->strides || !build->offsets)
1314 return isl_ast_build_free(build);
1315
1316 return build;
1317error:
1318 isl_val_free(stride);
1320 return isl_ast_build_free(build);
1321}
1322
1323/* Return a set expressing the stride constraint at the current depth.
1324 *
1325 * In particular, if the current iterator (i) is known to attain values
1326 *
1327 * f + s a
1328 *
1329 * where f is the offset and s is the stride, then the returned set
1330 * expresses the constraint
1331 *
1332 * (f - i) mod s = 0
1333 */
1336{
1337 isl_aff *aff;
1338 isl_set *set;
1339 isl_val *stride;
1340 int pos;
1341
1342 if (!build)
1343 return NULL;
1344
1345 pos = build->depth;
1346
1347 if (!isl_ast_build_has_stride(build, pos))
1348 return isl_set_universe(isl_ast_build_get_space(build, 1));
1349
1350 stride = isl_ast_build_get_stride(build, pos);
1353 aff = isl_aff_mod_val(aff, stride);
1355
1356 return set;
1357}
1358
1359/* Return the expansion implied by the stride and offset at the current
1360 * depth.
1361 *
1362 * That is, return the mapping
1363 *
1364 * [i_0, ..., i_{d-1}, i_d, i_{d+1}, ...]
1365 * -> [i_0, ..., i_{d-1}, s * i_d + offset(i), i_{d+1}, ...]
1366 *
1367 * where s is the stride at the current depth d and offset(i) is
1368 * the corresponding offset.
1369 */
1372{
1373 isl_space *space;
1375 isl_size pos;
1376 isl_aff *aff, *offset;
1377 isl_val *stride;
1378
1380 if (pos < 0)
1381 return NULL;
1382
1383 space = isl_ast_build_get_space(build, 1);
1384 space = isl_space_map_from_set(space);
1385 ma = isl_multi_aff_identity(space);
1386
1387 if (!isl_ast_build_has_stride(build, pos))
1388 return ma;
1389
1391 stride = isl_ast_build_get_stride(build, pos);
1392 aff = isl_multi_aff_get_aff(ma, pos);
1393 aff = isl_aff_scale_val(aff, stride);
1395 ma = isl_multi_aff_set_aff(ma, pos, aff);
1396
1397 return ma;
1398}
1399
1400/* Add constraints corresponding to any previously detected
1401 * stride on the current dimension to build->domain.
1402 */
1405{
1406 isl_set *set;
1407
1408 if (!build)
1409 return NULL;
1410 if (!isl_ast_build_has_stride(build, build->depth))
1411 return build;
1412 build = isl_ast_build_cow(build);
1413 if (!build)
1414 return NULL;
1415
1417
1418 build->domain = isl_set_intersect(build->domain, isl_set_copy(set));
1419 build->generated = isl_set_intersect(build->generated, set);
1420 if (!build->domain || !build->generated)
1421 return isl_ast_build_free(build);
1422
1423 return build;
1424}
1425
1426/* Check if the constraints in "set" imply any stride on the current
1427 * dimension and, if so, record the stride information in "build"
1428 * and return the updated "build".
1429 *
1430 * We assume that inner dimensions have been eliminated from "set"
1431 * by the caller. This is needed because the common stride
1432 * may be imposed by different inner dimensions on different parts of
1433 * the domain.
1434 * The assumption ensures that the lower bound does not depend
1435 * on inner dimensions.
1436 */
1439{
1440 isl_size pos;
1441 isl_bool no_stride;
1442 isl_val *stride;
1443 isl_aff *offset;
1444 isl_stride_info *si;
1445
1447 if (pos < 0)
1448 goto error;
1449
1451 stride = isl_stride_info_get_stride(si);
1455
1456 no_stride = isl_val_is_one(stride);
1457 if (no_stride >= 0 && !no_stride)
1458 return set_stride(build, stride, offset);
1459 isl_val_free(stride);
1461 if (no_stride < 0)
1462 return isl_ast_build_free(build);
1463 return build;
1464error:
1466 return NULL;
1467}
1468
1469/* Does "map" not involve the input dimension data->depth?
1470 */
1472{
1473 int *depth = user;
1474
1475 return isl_bool_not(isl_map_involves_dims(map, isl_dim_in, *depth, 1));
1476}
1477
1478/* Do any options depend on the value of the dimension at the current depth?
1479 */
1481{
1482 isl_bool free;
1483
1484 if (!build)
1485 return -1;
1486
1487 free = isl_union_map_every_map(build->options, &free_of_depth,
1488 &build->depth);
1489 return isl_bool_not(free);
1490}
1491
1492/* Construct the map
1493 *
1494 * { [i] -> [i] : i < pos; [i] -> [i + 1] : i >= pos }
1495 *
1496 * with "space" the parameter space of the constructed map.
1497 */
1499 int pos)
1500{
1501 isl_constraint *c;
1502 isl_basic_map *bmap1, *bmap2;
1503
1504 space = isl_space_set_from_params(space);
1505 space = isl_space_add_dims(space, isl_dim_set, 1);
1506 space = isl_space_map_from_set(space);
1513
1514 bmap1 = isl_basic_map_upper_bound_si(bmap1, isl_dim_in, 0, pos - 1);
1515 bmap2 = isl_basic_map_lower_bound_si(bmap2, isl_dim_in, 0, pos);
1516
1517 return isl_basic_map_union(bmap1, bmap2);
1518}
1519
1520static const char *option_str[] = {
1521 [isl_ast_loop_atomic] = "atomic",
1522 [isl_ast_loop_unroll] = "unroll",
1523 [isl_ast_loop_separate] = "separate"
1524};
1525
1526/* Update the "options" to reflect the insertion of a dimension
1527 * at position "pos" in the schedule domain space.
1528 * "space" is the original domain space before the insertion and
1529 * may be named and/or structured.
1530 *
1531 * The (relevant) input options all have "space" as domain, which
1532 * has to be mapped to the extended space.
1533 * The values of the ranges also refer to the schedule domain positions
1534 * and they therefore also need to be adjusted. In particular, values
1535 * smaller than pos do not need to change, while values greater than or
1536 * equal to pos need to be incremented.
1537 * That is, we need to apply the following map.
1538 *
1539 * { atomic[i] -> atomic[i] : i < pos; [i] -> [i + 1] : i >= pos;
1540 * unroll[i] -> unroll[i] : i < pos; [i] -> [i + 1] : i >= pos;
1541 * separate[i] -> separate[i] : i < pos; [i] -> [i + 1] : i >= pos;
1542 * separation_class[[i] -> [c]]
1543 * -> separation_class[[i] -> [c]] : i < pos;
1544 * separation_class[[i] -> [c]]
1545 * -> separation_class[[i + 1] -> [c]] : i >= pos }
1546 */
1549{
1550 isl_map *map;
1551 isl_union_map *insertion;
1553 const char *name = "separation_class";
1554
1555 space = isl_space_map_from_set(space);
1556 map = isl_map_identity(space);
1560
1561 if (!options)
1562 return NULL;
1563
1565
1567
1571 const char *name = option_str[type];
1574 insertion = isl_union_map_add_map(insertion, map_type);
1575 }
1576
1580 insertion = isl_union_map_add_map(insertion, map);
1581
1583
1584 return options;
1585}
1586
1587/* If we are generating an AST from a schedule tree (build->node is set),
1588 * then update the loop AST generation types
1589 * to reflect the insertion of a dimension at (global) position "pos"
1590 * in the schedule domain space.
1591 * We do not need to adjust any isolate option since we would not be inserting
1592 * any dimensions if there were any isolate option.
1593 */
1595 __isl_take isl_ast_build *build, int pos)
1596{
1597 int i;
1598 int local_pos;
1599 enum isl_ast_loop_type *loop_type;
1600 isl_ctx *ctx;
1601
1602 build = isl_ast_build_cow(build);
1603 if (!build)
1604 return NULL;
1605 if (!build->node)
1606 return build;
1607
1608 ctx = isl_ast_build_get_ctx(build);
1609 local_pos = pos - build->outer_pos;
1610 loop_type = isl_realloc_array(ctx, build->loop_type,
1611 enum isl_ast_loop_type, build->n + 1);
1612 if (!loop_type)
1613 return isl_ast_build_free(build);
1614 build->loop_type = loop_type;
1615 for (i = build->n - 1; i >= local_pos; --i)
1616 loop_type[i + 1] = loop_type[i];
1617 loop_type[local_pos] = isl_ast_loop_default;
1618 build->n++;
1619
1620 return build;
1621}
1622
1623/* Insert a single dimension in the schedule domain at position "pos".
1624 * The new dimension is given an isl_id with the empty string as name.
1625 *
1626 * The main difficulty is updating build->options to reflect the
1627 * extra dimension. This is handled in options_insert_dim.
1628 *
1629 * Note that because of the dimension manipulations, the resulting
1630 * schedule domain space will always be unnamed and unstructured.
1631 * However, the original schedule domain space may be named and/or
1632 * structured, so we have to take this possibility into account
1633 * while performing the transformations.
1634 *
1635 * Since the inserted schedule dimension is used by the caller
1636 * to differentiate between different domain spaces, there is
1637 * no longer a uniform mapping from the internal schedule space
1638 * to the input schedule space. The internal2input mapping is
1639 * therefore removed.
1640 */
1642 __isl_take isl_ast_build *build, int pos)
1643{
1644 isl_ctx *ctx;
1645 isl_space *space, *ma_space;
1646 isl_id *id;
1648
1649 build = isl_ast_build_cow(build);
1650 if (!build)
1651 return NULL;
1652
1653 ctx = isl_ast_build_get_ctx(build);
1654 id = isl_id_alloc(ctx, "", NULL);
1655 if (!build->node)
1656 space = isl_ast_build_get_space(build, 1);
1657 build->iterators = isl_id_list_insert(build->iterators, pos, id);
1658 build->domain = isl_set_insert_dims(build->domain,
1659 isl_dim_set, pos, 1);
1660 build->generated = isl_set_insert_dims(build->generated,
1661 isl_dim_set, pos, 1);
1662 build->pending = isl_set_insert_dims(build->pending,
1663 isl_dim_set, pos, 1);
1664 build->strides = isl_vec_insert_els(build->strides, pos, 1);
1665 build->strides = isl_vec_set_element_si(build->strides, pos, 1);
1666 ma_space = isl_space_params(isl_multi_aff_get_space(build->offsets));
1667 ma_space = isl_space_set_from_params(ma_space);
1668 ma_space = isl_space_add_dims(ma_space, isl_dim_set, 1);
1669 ma_space = isl_space_map_from_set(ma_space);
1670 ma = isl_multi_aff_zero(isl_space_copy(ma_space));
1671 build->offsets = isl_multi_aff_splice(build->offsets, pos, pos, ma);
1672 ma = isl_multi_aff_identity(ma_space);
1673 build->values = isl_multi_aff_splice(build->values, pos, pos, ma);
1674 if (!build->node)
1675 build->options = options_insert_dim(build->options, space, pos);
1676 build->internal2input = isl_multi_aff_free(build->internal2input);
1677
1678 if (!build->iterators || !build->domain || !build->generated ||
1679 !build->pending || !build->values ||
1680 !build->strides || !build->offsets || !build->options)
1681 return isl_ast_build_free(build);
1682
1683 build = node_insert_dim(build, pos);
1684
1685 return build;
1686}
1687
1688/* Scale down the current dimension by a factor of "m".
1689 * "umap" is an isl_union_map that implements the scaling down.
1690 * That is, it is of the form
1691 *
1692 * { [.... i ....] -> [.... i' ....] : i = m i' }
1693 *
1694 * This function is called right after the strides have been
1695 * detected, but before any constraints on the current dimension
1696 * have been included in build->domain.
1697 * We therefore only need to update stride, offset, the options and
1698 * the mapping from internal schedule space to the original schedule
1699 * space, if we are still keeping track of such a mapping.
1700 * The latter mapping is updated by plugging in
1701 * { [... i ...] -> [... m i ... ] }.
1702 */
1706{
1707 isl_aff *aff;
1708 isl_val *v;
1709 int depth;
1710
1711 build = isl_ast_build_cow(build);
1712 if (!build || !umap || !m)
1713 goto error;
1714
1715 depth = build->depth;
1716
1717 if (build->internal2input) {
1718 isl_space *space;
1720 isl_aff *aff;
1721
1722 space = isl_multi_aff_get_space(build->internal2input);
1724 ma = isl_multi_aff_identity(space);
1725 aff = isl_multi_aff_get_aff(ma, depth);
1727 ma = isl_multi_aff_set_aff(ma, depth, aff);
1728 build->internal2input =
1729 isl_multi_aff_pullback_multi_aff(build->internal2input, ma);
1730 if (!build->internal2input)
1731 goto error;
1732 }
1733
1734 v = isl_vec_get_element_val(build->strides, depth);
1735 v = isl_val_div(v, isl_val_copy(m));
1736 build->strides = isl_vec_set_element_val(build->strides, depth, v);
1737
1738 aff = isl_multi_aff_get_aff(build->offsets, depth);
1740 build->offsets = isl_multi_aff_set_aff(build->offsets, depth, aff);
1741 build->options = isl_union_map_apply_domain(build->options, umap);
1742 if (!build->strides || !build->offsets || !build->options)
1743 return isl_ast_build_free(build);
1744
1745 return build;
1746error:
1747 isl_val_free(m);
1748 isl_union_map_free(umap);
1749 return isl_ast_build_free(build);
1750}
1751
1752/* Return a list of "n" isl_ids called "c%d", with "%d" starting at "first".
1753 * If an isl_id with such a name already appears among the parameters
1754 * in build->domain, then adjust the name to "c%d_%d".
1755 */
1756static __isl_give isl_id_list *generate_names(isl_ctx *ctx, int n, int first,
1758{
1759 int i;
1760 isl_id_list *names;
1761
1762 names = isl_id_list_alloc(ctx, n);
1763 for (i = 0; i < n; ++i) {
1764 isl_id *id;
1765
1766 id = generate_name(ctx, first + i, build);
1767 names = isl_id_list_add(names, id);
1768 }
1769
1770 return names;
1771}
1772
1773/* Embed "options" into the given isl_ast_build space.
1774 *
1775 * This function is called from within a nested call to
1776 * isl_ast_build_node_from_schedule_map.
1777 * "options" refers to the additional schedule,
1778 * while space refers to both the space of the outer isl_ast_build and
1779 * that of the additional schedule.
1780 * Specifically, space is of the form
1781 *
1782 * [I -> S]
1783 *
1784 * while options lives in the space(s)
1785 *
1786 * S -> *
1787 *
1788 * We compute
1789 *
1790 * [I -> S] -> S
1791 *
1792 * and compose this with options, to obtain the new options
1793 * living in the space(s)
1794 *
1795 * [I -> S] -> *
1796 */
1810
1811/* Update "build" for use in a (possibly nested) code generation. That is,
1812 * extend "build" from an AST build on some domain O to an AST build
1813 * on domain [O -> S], with S corresponding to "space".
1814 * If the original domain is a parameter domain, then the new domain is
1815 * simply S.
1816 * "iterators" is a list of iterators for S, but the number of elements
1817 * may be smaller or greater than the number of set dimensions of S.
1818 * If "keep_iterators" is set, then any extra ids in build->iterators
1819 * are reused for S. Otherwise, these extra ids are dropped.
1820 *
1821 * We first update build->outer_pos to the current depth.
1822 * This depth is zero in case this is the outermost code generation.
1823 *
1824 * We then add additional ids such that the number of iterators is at least
1825 * equal to the dimension of the new build domain.
1826 *
1827 * If the original domain is parametric, then we are constructing
1828 * an isl_ast_build for the outer code generation and we pass control
1829 * to isl_ast_build_init.
1830 *
1831 * Otherwise, we adjust the fields of "build" to include "space".
1832 */
1835{
1836 isl_ctx *ctx;
1837 isl_vec *strides;
1838 isl_set *set;
1839 isl_multi_aff *embedding;
1840 isl_size dim, space_dim, n_it;
1841
1842 build = isl_ast_build_cow(build);
1843 if (!build)
1844 goto error;
1845
1846 build->outer_pos = build->depth;
1847
1848 ctx = isl_ast_build_get_ctx(build);
1849 dim = isl_ast_build_dim(build, isl_dim_set);
1850 space_dim = isl_space_dim(space, isl_dim_set);
1851 n_it = isl_id_list_n_id(build->iterators);
1852 if (dim < 0 || space_dim < 0 || n_it < 0)
1853 goto error;
1854 dim += space_dim;
1855 if (n_it < dim) {
1856 isl_id_list *l;
1857 l = generate_names(ctx, dim - n_it, n_it, build);
1858 build->iterators = isl_id_list_concat(build->iterators, l);
1859 }
1860
1861 if (isl_set_is_params(build->domain))
1862 return isl_ast_build_init(build, space);
1863
1865 build->domain = isl_set_product(build->domain, isl_set_copy(set));
1866 build->pending = isl_set_product(build->pending, isl_set_copy(set));
1867 build->generated = isl_set_product(build->generated, set);
1868
1869 strides = isl_vec_alloc(ctx, space_dim);
1870 strides = isl_vec_set_si(strides, 1);
1871 build->strides = isl_vec_concat(build->strides, strides);
1872
1873 space = isl_space_map_from_set(space);
1874 build->offsets = isl_multi_aff_align_params(build->offsets,
1875 isl_space_copy(space));
1876 build->offsets = isl_multi_aff_product(build->offsets,
1877 isl_multi_aff_zero(isl_space_copy(space)));
1878 build->values = isl_multi_aff_align_params(build->values,
1879 isl_space_copy(space));
1880 embedding = isl_multi_aff_identity(space);
1881 build->values = isl_multi_aff_product(build->values,
1882 isl_multi_aff_copy(embedding));
1883 if (build->internal2input) {
1884 build->internal2input =
1885 isl_multi_aff_product(build->internal2input, embedding);
1886 build->internal2input =
1887 isl_multi_aff_flatten_range(build->internal2input);
1888 if (!build->internal2input)
1889 return isl_ast_build_free(build);
1890 } else {
1891 isl_multi_aff_free(embedding);
1892 }
1893
1894 space = isl_ast_build_get_space(build, 1);
1895 build->options = embed_options(build->options, space);
1896
1897 if (!build->iterators || !build->domain || !build->generated ||
1898 !build->pending || !build->values ||
1899 !build->strides || !build->offsets || !build->options)
1900 return isl_ast_build_free(build);
1901
1902 return build;
1903error:
1904 isl_ast_build_free(build);
1905 isl_space_free(space);
1906 return NULL;
1907}
1908
1909/* Does "aff" only attain non-negative values over build->domain?
1910 * That is, does it not attain any negative values?
1911 */
1914{
1915 isl_set *test;
1916 isl_bool empty;
1917
1918 if (!build)
1919 return isl_bool_error;
1920
1921 aff = isl_aff_copy(aff);
1923 test = isl_set_intersect(test, isl_set_copy(build->domain));
1924 empty = isl_set_is_empty(test);
1926
1927 return empty;
1928}
1929
1930/* Does the dimension at (internal) position "pos" have a non-trivial stride?
1931 */
1933{
1934 isl_val *v;
1935 isl_bool has_stride;
1936
1937 if (!build)
1938 return isl_bool_error;
1939
1940 v = isl_vec_get_element_val(build->strides, pos);
1941 has_stride = isl_bool_not(isl_val_is_one(v));
1942 isl_val_free(v);
1943
1944 return has_stride;
1945}
1946
1947/* Given that the dimension at position "pos" takes on values
1948 *
1949 * f + s a
1950 *
1951 * with a an integer, return s.
1952 */
1954 int pos)
1955{
1956 if (!build)
1957 return NULL;
1958
1959 return isl_vec_get_element_val(build->strides, pos);
1960}
1961
1962/* Given that the dimension at position "pos" takes on values
1963 *
1964 * f + s a
1965 *
1966 * with a an integer, return f.
1967 */
1969 __isl_keep isl_ast_build *build, int pos)
1970{
1971 if (!build)
1972 return NULL;
1973
1974 return isl_multi_aff_get_aff(build->offsets, pos);
1975}
1976
1977/* Is the dimension at position "pos" known to attain only a single
1978 * value that, moreover, can be described by a single affine expression
1979 * in terms of the outer dimensions and parameters?
1980 *
1981 * If not, then the corresponding affine expression in build->values
1982 * is set to be equal to the same input dimension.
1983 * Otherwise, it is set to the requested expression in terms of
1984 * outer dimensions and parameters.
1985 */
1987 int pos)
1988{
1989 isl_aff *aff;
1990 isl_bool involves;
1991
1992 if (!build)
1993 return isl_bool_error;
1994
1995 aff = isl_multi_aff_get_aff(build->values, pos);
1996 involves = isl_aff_involves_dims(aff, isl_dim_in, pos, 1);
1998
1999 return isl_bool_not(involves);
2000}
2001
2002/* Plug in the known values (fixed affine expressions in terms of
2003 * parameters and outer loop iterators) of all loop iterators
2004 * in the domain of "umap".
2005 *
2006 * We simply precompose "umap" with build->values.
2007 */
2010{
2011 isl_multi_aff *values;
2012
2013 if (!build)
2014 return isl_union_map_free(umap);
2015
2016 values = isl_multi_aff_copy(build->values);
2017 umap = isl_union_map_preimage_domain_multi_aff(umap, values);
2018
2019 return umap;
2020}
2021
2022/* Is the current dimension known to attain only a single value?
2023 */
2025{
2026 if (!build)
2027 return -1;
2028
2029 return build->value != NULL;
2030}
2031
2032/* Simplify the basic set "bset" based on what we know about
2033 * the iterators of already generated loops.
2034 *
2035 * "bset" is assumed to live in the (internal) schedule domain.
2036 */
2039{
2040 if (!build)
2041 goto error;
2042
2044 isl_multi_aff_copy(build->values));
2045 bset = isl_basic_set_gist(bset,
2046 isl_set_simple_hull(isl_set_copy(build->domain)));
2047
2048 return bset;
2049error:
2050 isl_basic_set_free(bset);
2051 return NULL;
2052}
2053
2054/* Simplify the set "set" based on what we know about
2055 * the iterators of already generated loops.
2056 *
2057 * "set" is assumed to live in the (internal) schedule domain.
2058 */
2061{
2062 if (!build)
2063 goto error;
2064
2065 if (!isl_set_is_params(set))
2067 isl_multi_aff_copy(build->values));
2068 set = isl_set_gist(set, isl_set_copy(build->domain));
2069
2070 return set;
2071error:
2073 return NULL;
2074}
2075
2076/* Include information about what we know about the iterators of
2077 * already generated loops to "set".
2078 *
2079 * We currently only plug in the known affine values of outer loop
2080 * iterators.
2081 * In principle we could also introduce equalities or even other
2082 * constraints implied by the intersection of "set" and build->domain.
2083 */
2086{
2087 if (!build)
2088 return isl_set_free(set);
2089
2091 isl_multi_aff_copy(build->values));
2092}
2093
2094/* Plug in the known affine values of outer loop iterators in "bset".
2095 */
2098{
2099 if (!build)
2100 return isl_basic_set_free(bset);
2101
2103 isl_multi_aff_copy(build->values));
2104}
2105
2106/* Simplify the map "map" based on what we know about
2107 * the iterators of already generated loops.
2108 *
2109 * The domain of "map" is assumed to live in the (internal) schedule domain.
2110 */
2113{
2114 if (!build)
2115 goto error;
2116
2117 map = isl_map_gist_domain(map, isl_set_copy(build->domain));
2118
2119 return map;
2120error:
2122 return NULL;
2123}
2124
2125/* Simplify the affine expression "aff" based on what we know about
2126 * the iterators of already generated loops.
2127 *
2128 * The domain of "aff" is assumed to live in the (internal) schedule domain.
2129 */
2132{
2133 if (!build)
2134 goto error;
2135
2136 aff = isl_aff_gist(aff, isl_set_copy(build->domain));
2137
2138 return aff;
2139error:
2141 return NULL;
2142}
2143
2144/* Simplify the piecewise affine expression "aff" based on what we know about
2145 * the iterators of already generated loops.
2146 *
2147 * The domain of "pa" is assumed to live in the (internal) schedule domain.
2148 */
2151{
2152 if (!build)
2153 goto error;
2154
2155 if (!isl_set_is_params(build->domain))
2157 isl_multi_aff_copy(build->values));
2158 pa = isl_pw_aff_gist(pa, isl_set_copy(build->domain));
2159
2160 return pa;
2161error:
2163 return NULL;
2164}
2165
2166/* Simplify the piecewise multi-affine expression "aff" based on what
2167 * we know about the iterators of already generated loops.
2168 *
2169 * The domain of "pma" is assumed to live in the (internal) schedule domain.
2170 */
2173{
2174 if (!build)
2175 goto error;
2176
2178 isl_multi_aff_copy(build->values));
2179 pma = isl_pw_multi_aff_gist(pma, isl_set_copy(build->domain));
2180
2181 return pma;
2182error:
2184 return NULL;
2185}
2186
2187/* Extract the schedule domain of the given type from build->options
2188 * at the current depth.
2189 *
2190 * In particular, find the subset of build->options that is of
2191 * the following form
2192 *
2193 * schedule_domain -> type[depth]
2194 *
2195 * and return the corresponding domain, after eliminating inner dimensions
2196 * and divs that depend on the current dimension.
2197 *
2198 * Note that the domain of build->options has been reformulated
2199 * in terms of the internal build space in embed_options,
2200 * but the position is still that within the current code generation.
2201 */
2204{
2205 const char *name;
2206 isl_space *space;
2207 isl_map *option;
2208 isl_set *domain;
2209 int local_pos;
2210
2211 if (!build)
2212 return NULL;
2213
2214 name = option_str[type];
2215 local_pos = build->depth - build->outer_pos;
2216
2217 space = isl_ast_build_get_space(build, 1);
2218 space = isl_space_from_domain(space);
2219 space = isl_space_add_dims(space, isl_dim_out, 1);
2220 space = isl_space_set_tuple_name(space, isl_dim_out, name);
2221
2222 option = isl_union_map_extract_map(build->options, space);
2223 option = isl_map_fix_si(option, isl_dim_out, 0, local_pos);
2224
2225 domain = isl_map_domain(option);
2227
2228 return domain;
2229}
2230
2231/* How does the user want the current schedule dimension to be generated?
2232 * These choices have been extracted from the schedule node
2233 * in extract_loop_types and stored in build->loop_type.
2234 * They have been updated to reflect any dimension insertion in
2235 * node_insert_dim.
2236 * Return isl_ast_domain_error on error.
2237 *
2238 * If "isolated" is set, then we get the loop AST generation type
2239 * directly from the band node since node_insert_dim cannot have been
2240 * called on a band with the isolate option.
2241 */
2243 __isl_keep isl_ast_build *build, int isolated)
2244{
2245 int local_pos;
2246 isl_ctx *ctx;
2247
2248 if (!build)
2249 return isl_ast_loop_error;
2250 ctx = isl_ast_build_get_ctx(build);
2251 if (!build->node)
2253 "only works for schedule tree based AST generation",
2254 return isl_ast_loop_error);
2255
2256 local_pos = build->depth - build->outer_pos;
2257 if (!isolated)
2258 return build->loop_type[local_pos];
2260 build->node, local_pos);
2261}
2262
2263/* Extract the isolated set from the isolate option, if any,
2264 * and store in the build.
2265 * If there is no isolate option, then the isolated set is
2266 * set to the empty set.
2267 *
2268 * The isolate option is of the form
2269 *
2270 * isolate[[outer bands] -> current_band]
2271 *
2272 * We flatten this set and then map it back to the internal
2273 * schedule space.
2274 *
2275 * If we have already extracted the isolated set
2276 * or if internal2input is no longer set, then we do not
2277 * need to do anything. In the latter case, we know
2278 * that the current band cannot have any isolate option.
2279 */
2282{
2283 isl_set *isolated;
2284
2285 if (!build)
2286 return NULL;
2287 if (!build->internal2input)
2288 return build;
2289 if (build->isolated)
2290 return build;
2291
2292 build = isl_ast_build_cow(build);
2293 if (!build)
2294 return NULL;
2295
2296 isolated = isl_schedule_node_band_get_ast_isolate_option(build->node);
2297 isolated = isl_set_flatten(isolated);
2298 isolated = isl_set_preimage_multi_aff(isolated,
2299 isl_multi_aff_copy(build->internal2input));
2300
2301 build->isolated = isolated;
2302 if (!build->isolated)
2303 return isl_ast_build_free(build);
2304
2305 return build;
2306}
2307
2308/* Does "build" have a non-empty isolated set?
2309 *
2310 * The caller is assumed to have called isl_ast_build_extract_isolated first.
2311 */
2313{
2314 int empty;
2315
2316 if (!build)
2317 return -1;
2318 if (!build->internal2input)
2319 return 0;
2320 if (!build->isolated)
2322 "isolated set not extracted yet", return -1);
2323
2324 empty = isl_set_plain_is_empty(build->isolated);
2325 return empty < 0 ? -1 : !empty;
2326}
2327
2328/* Return a copy of the isolated set of "build".
2329 *
2330 * The caller is assume to have called isl_ast_build_has_isolated first,
2331 * with this function returning true.
2332 * In particular, this function should not be called if we are no
2333 * longer keeping track of internal2input (and there therefore could
2334 * not possibly be any isolated set).
2335 */
2337{
2338 if (!build)
2339 return NULL;
2340 if (!build->internal2input)
2342 "build cannot have isolated set", return NULL);
2343
2344 return isl_set_copy(build->isolated);
2345}
2346
2347/* Extract the separation class mapping at the current depth.
2348 *
2349 * In particular, find and return the subset of build->options that is of
2350 * the following form
2351 *
2352 * schedule_domain -> separation_class[[depth] -> [class]]
2353 *
2354 * The caller is expected to eliminate inner dimensions from the domain.
2355 *
2356 * Note that the domain of build->options has been reformulated
2357 * in terms of the internal build space in embed_options,
2358 * but the position is still that within the current code generation.
2359 */
2362{
2363 isl_ctx *ctx;
2364 isl_space *space_sep, *space;
2365 isl_map *res;
2366 int local_pos;
2367
2368 if (!build)
2369 return NULL;
2370
2371 local_pos = build->depth - build->outer_pos;
2372 ctx = isl_ast_build_get_ctx(build);
2373 space_sep = isl_space_alloc(ctx, 0, 1, 1);
2374 space_sep = isl_space_wrap(space_sep);
2375 space_sep = isl_space_set_tuple_name(space_sep, isl_dim_set,
2376 "separation_class");
2377 space = isl_ast_build_get_space(build, 1);
2378 space_sep = isl_space_align_params(space_sep, isl_space_copy(space));
2379 space = isl_space_map_from_domain_and_range(space, space_sep);
2380
2381 res = isl_union_map_extract_map(build->options, space);
2382 res = isl_map_fix_si(res, isl_dim_out, 0, local_pos);
2384
2385 return res;
2386}
2387
2388/* Eliminate dimensions inner to the current dimension.
2389 */
2392{
2393 int dim;
2394 int depth;
2395
2396 if (!build)
2397 return isl_set_free(set);
2398
2399 dim = isl_set_dim(set, isl_dim_set);
2400 depth = build->depth;
2402 set = isl_set_eliminate(set, isl_dim_set, depth + 1, dim - (depth + 1));
2403
2404 return set;
2405}
2406
2407/* Eliminate unknown divs and divs that depend on the current dimension.
2408 *
2409 * Note that during the elimination of unknown divs, we may discover
2410 * an explicit representation of some other unknown divs, which may
2411 * depend on the current dimension. We therefore need to eliminate
2412 * unknown divs first.
2413 */
2416{
2417 int depth;
2418
2419 if (!build)
2420 return isl_set_free(set);
2421
2423 depth = build->depth;
2425
2426 return set;
2427}
2428
2429/* Eliminate dimensions inner to the current dimension as well as
2430 * unknown divs and divs that depend on the current dimension.
2431 * The result then consists only of constraints that are independent
2432 * of the current dimension and upper and lower bounds on the current
2433 * dimension.
2434 */
void isl_multi_aff_dump(__isl_keep isl_multi_aff *maff)
__isl_null isl_aff * isl_aff_free(__isl_take isl_aff *aff)
Definition isl_aff.c:449
__isl_give isl_basic_set * isl_aff_zero_basic_set(__isl_take isl_aff *aff)
Definition isl_aff.c:2469
__isl_overload __isl_give isl_pw_aff * isl_pw_aff_pullback_multi_aff(__isl_take isl_pw_aff *pa, __isl_take isl_multi_aff *ma)
__isl_overload __isl_give isl_aff * isl_aff_scale_val(__isl_take isl_aff *aff, __isl_take isl_val *v)
Definition isl_aff.c:2075
isl_stat isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff, isl_stat(*fn)(__isl_take isl_set *set, __isl_take isl_aff *aff, void *user), void *user)
__isl_overload __isl_give isl_multi_aff * isl_multi_aff_pullback_multi_aff(__isl_take isl_multi_aff *ma1, __isl_take isl_multi_aff *ma2)
Definition isl_aff.c:6097
__isl_null isl_pw_aff * isl_pw_aff_free(__isl_take isl_pw_aff *pwaff)
__isl_overload __isl_give isl_aff * isl_aff_scale_down_val(__isl_take isl_aff *aff, __isl_take isl_val *v)
Definition isl_aff.c:2142
__isl_give isl_aff * isl_aff_copy(__isl_keep isl_aff *aff)
Definition isl_aff.c:145
void isl_pw_aff_dump(__isl_keep isl_pw_aff *pwaff)
__isl_give isl_aff * isl_aff_add_coefficient_si(__isl_take isl_aff *aff, enum isl_dim_type type, int pos, int v)
Definition isl_aff.c:1426
__isl_give isl_basic_set * isl_aff_neg_basic_set(__isl_take isl_aff *aff)
Definition isl_aff.c:2431
__isl_export __isl_give isl_pw_multi_aff * isl_pw_multi_aff_gist(__isl_take isl_pw_multi_aff *pma, __isl_take isl_set *set)
__isl_overload __isl_give isl_aff * isl_aff_mod_val(__isl_take isl_aff *aff, __isl_take isl_val *mod)
Definition isl_aff.c:1796
__isl_export __isl_give isl_aff * isl_aff_gist(__isl_take isl_aff *aff, __isl_take isl_set *context)
Definition isl_aff.c:2325
__isl_give isl_pw_multi_aff * isl_pw_multi_aff_from_map(__isl_take isl_map *map)
Definition isl_aff.c:5617
__isl_export __isl_give isl_aff * isl_aff_add(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2)
Definition isl_aff.c:1976
__isl_null isl_pw_multi_aff * isl_pw_multi_aff_free(__isl_take isl_pw_multi_aff *pma)
__isl_overload __isl_give isl_pw_multi_aff * isl_pw_multi_aff_pullback_multi_aff(__isl_take isl_pw_multi_aff *pma, __isl_take isl_multi_aff *ma)
__isl_export __isl_give isl_pw_aff * isl_pw_aff_coalesce(__isl_take isl_pw_aff *pa)
isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff, enum isl_dim_type type, unsigned first, unsigned n)
isl_size isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff)
__isl_give isl_pw_aff * isl_pw_multi_aff_get_pw_aff(__isl_keep isl_pw_multi_aff *pma, int pos)
Definition isl_aff.c:6332
__isl_give isl_pw_aff * isl_pw_aff_copy(__isl_keep isl_pw_aff *pwaff)
__isl_export __isl_give isl_pw_aff * isl_pw_aff_gist(__isl_take isl_pw_aff *pwaff, __isl_take isl_set *context)
struct isl_multi_aff isl_multi_aff
Definition aff_type.h:29
isl_ast_loop_type
Definition ast_type.h:91
@ isl_ast_loop_atomic
Definition ast_type.h:94
@ isl_ast_loop_separate
Definition ast_type.h:96
@ isl_ast_loop_unroll
Definition ast_type.h:95
@ isl_ast_loop_error
Definition ast_type.h:92
@ isl_ast_loop_default
Definition ast_type.h:93
__isl_give isl_constraint * isl_constraint_copy(__isl_keep isl_constraint *c)
__isl_give isl_constraint * isl_constraint_alloc_equality(__isl_take isl_local_space *ls)
__isl_give isl_basic_map * isl_basic_map_from_constraint(__isl_take isl_constraint *constraint)
__isl_give isl_constraint * isl_constraint_set_constant_si(__isl_take isl_constraint *constraint, int v)
__isl_give isl_constraint * isl_constraint_set_coefficient_si(__isl_take isl_constraint *constraint, enum isl_dim_type type, int pos, int v)
#define __isl_take
Definition ctx.h:22
#define isl_calloc_type(ctx, type)
Definition ctx.h:130
isl_stat
Definition ctx.h:84
@ isl_stat_error
Definition ctx.h:85
#define __isl_give
Definition ctx.h:19
#define isl_size_error
Definition ctx.h:98
#define __isl_null
Definition ctx.h:28
#define isl_die(ctx, errno, msg, code)
Definition ctx.h:138
isl_bool isl_bool_ok(int b)
Definition isl_ctx.c:58
@ isl_error_internal
Definition ctx.h:79
#define isl_alloc_array(ctx, type, n)
Definition ctx.h:132
#define __isl_keep
Definition ctx.h:25
int isl_size
Definition ctx.h:97
#define isl_realloc_array(ctx, ptr, type, n)
Definition ctx.h:135
isl_bool isl_bool_not(isl_bool b)
Definition isl_ctx.c:44
isl_bool
Definition ctx.h:89
@ isl_bool_error
Definition ctx.h:90
m
Definition guard1-0.c:2
isl_stat isl_stat(* fn)(__isl_take ISL_KEY *key, __isl_take ISL_VAL *val, void *user)
Definition hmap.h:37
isl_stat isl_stat void * user
Definition hmap.h:39
isl_bool isl_bool(* test)(__isl_keep ISL_KEY *key, __isl_keep ISL_VAL *val, void *user)
Definition hmap.h:41
__isl_give isl_id * isl_id_alloc(isl_ctx *ctx, __isl_keep const char *name, void *user)
__isl_give isl_ast_build * isl_ast_build_increase_depth(__isl_take isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_set_before_each_mark(__isl_take isl_ast_build *build, isl_stat(*fn)(__isl_keep isl_id *mark, __isl_keep isl_ast_build *build, void *user), void *user)
static int any_eliminated(isl_ast_build *build)
static __isl_give isl_id_list * generate_names(isl_ctx *ctx, int n, int first, __isl_keep isl_ast_build *build)
int isl_ast_build_has_value(__isl_keep isl_ast_build *build)
__isl_give isl_set * isl_ast_build_eliminate_inner(__isl_keep isl_ast_build *build, __isl_take isl_set *set)
static __isl_give isl_ast_build * update_values(__isl_take isl_ast_build *build, __isl_take isl_basic_set *bounds)
static __isl_give isl_id * generate_name(isl_ctx *ctx, int i, __isl_keep isl_ast_build *build)
static __isl_give isl_ast_build * isl_ast_build_init_derived(__isl_take isl_ast_build *build, __isl_take isl_space *space)
__isl_give isl_aff * isl_ast_build_get_offset(__isl_keep isl_ast_build *build, int pos)
enum isl_ast_loop_type isl_ast_build_get_loop_type(__isl_keep isl_ast_build *build, int isolated)
__isl_give isl_map * isl_ast_build_map_to_iterator(__isl_keep isl_ast_build *build, __isl_take isl_set *set)
__isl_give isl_ast_build * isl_ast_build_copy(__isl_keep isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_set_before_each_for(__isl_take isl_ast_build *build, __isl_give isl_id *(*fn)(__isl_keep isl_ast_build *build, void *user), void *user)
static __isl_give isl_union_map * embed_options(__isl_take isl_union_map *options, __isl_take isl_space *space)
__isl_give isl_set * isl_ast_build_specialize(__isl_keep isl_ast_build *build, __isl_take isl_set *set)
__isl_give isl_ast_build * isl_ast_build_include_stride(__isl_take isl_ast_build *build)
isl_bool isl_ast_build_has_stride(__isl_keep isl_ast_build *build, int pos)
__isl_give isl_basic_set * isl_ast_build_compute_gist_basic_set(__isl_keep isl_ast_build *build, __isl_take isl_basic_set *bset)
__isl_give isl_ast_build * isl_ast_build_align_params(__isl_take isl_ast_build *build, __isl_take isl_space *model)
__isl_give isl_ast_build * isl_ast_build_cow(__isl_take isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_extract_isolated(__isl_take isl_ast_build *build)
isl_bool isl_ast_build_need_schedule_map(__isl_keep isl_ast_build *build)
__isl_give isl_union_map * isl_ast_build_get_schedule(__isl_keep isl_ast_build *build)
__isl_give isl_set * isl_ast_build_eliminate_divs(__isl_keep isl_ast_build *build, __isl_take isl_set *set)
__isl_give isl_ast_build * isl_ast_build_scale_down(__isl_take isl_ast_build *build, __isl_take isl_val *m, __isl_take isl_union_map *umap)
static __isl_give isl_set * intersect_stride_constraint(__isl_take isl_set *set, __isl_keep isl_ast_build *build)
isl_bool isl_ast_build_aff_is_nonneg(__isl_keep isl_ast_build *build, __isl_keep isl_aff *aff)
__isl_give isl_ast_build * isl_ast_build_set_options(__isl_take isl_ast_build *build, __isl_take isl_union_map *options)
static __isl_give isl_ast_build * isl_ast_build_init(__isl_take isl_ast_build *build, __isl_take isl_space *space)
static void isl_ast_build_reset_schedule_map(__isl_keep isl_ast_build *build)
__isl_give isl_pw_aff * isl_ast_build_compute_gist_pw_aff(__isl_keep isl_ast_build *build, __isl_take isl_pw_aff *pa)
__isl_give isl_ast_build * isl_ast_build_detect_strides(__isl_take isl_ast_build *build, __isl_take isl_set *set)
__isl_give isl_ast_build * isl_ast_build_set_after_each_mark(__isl_take isl_ast_build *build, __isl_give isl_ast_node *(*fn)(__isl_take isl_ast_node *node, __isl_keep isl_ast_build *build, void *user), void *user)
__isl_give isl_ast_build * isl_ast_build_reset_schedule_node(__isl_take isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_clear_local_info(__isl_take isl_ast_build *build)
__isl_give isl_set * isl_ast_build_compute_gist(__isl_keep isl_ast_build *build, __isl_take isl_set *set)
__isl_null isl_ast_build * isl_ast_build_free(__isl_take isl_ast_build *build)
static __isl_give isl_map * construct_insertion_map(__isl_take isl_space *space, int pos)
__isl_give isl_set * isl_ast_build_get_generated(__isl_keep isl_ast_build *build)
void isl_ast_build_dump(__isl_keep isl_ast_build *build)
__isl_give isl_aff * isl_ast_build_compute_gist_aff(__isl_keep isl_ast_build *build, __isl_take isl_aff *aff)
__isl_give isl_map * isl_ast_build_get_schedule_map(__isl_keep isl_ast_build *build)
__isl_give isl_space * isl_ast_build_get_schedule_space(__isl_keep isl_ast_build *build)
__isl_give isl_union_map * isl_ast_build_substitute_values_union_map_domain(__isl_keep isl_ast_build *build, __isl_take isl_union_map *umap)
int isl_ast_build_has_schedule_node(__isl_keep isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_from_context(__isl_take isl_set *set)
__isl_give isl_map * isl_ast_build_get_separation_class(__isl_keep isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_dup(__isl_keep isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_replace_pending_by_guard(__isl_take isl_ast_build *build, __isl_take isl_set *guard)
__isl_give isl_ast_build * isl_ast_build_restrict(__isl_take isl_ast_build *build, __isl_take isl_set *set)
__isl_give isl_space * isl_ast_build_get_space(__isl_keep isl_ast_build *build, int internal)
static __isl_give isl_ast_build * isl_ast_build_restrict_internal(__isl_take isl_ast_build *build, __isl_take isl_set *set)
int isl_ast_build_has_isolated(__isl_keep isl_ast_build *build)
__isl_give isl_set * isl_ast_build_get_stride_constraint(__isl_keep isl_ast_build *build)
__isl_give isl_val * isl_ast_build_get_stride(__isl_keep isl_ast_build *build, int pos)
static __isl_give isl_ast_build * extract_loop_types(__isl_take isl_ast_build *build)
static __isl_give isl_union_map * options_insert_dim(__isl_take isl_union_map *options, __isl_take isl_space *space, int pos)
__isl_give isl_ast_build * isl_ast_build_set_executed(__isl_take isl_ast_build *build, __isl_take isl_union_map *executed)
__isl_give isl_multi_aff * isl_ast_build_get_stride_expansion(__isl_keep isl_ast_build *build)
isl_size isl_ast_build_get_depth(__isl_keep isl_ast_build *build)
static __isl_give isl_ast_build * node_insert_dim(__isl_take isl_ast_build *build, int pos)
__isl_give isl_set * isl_ast_build_get_domain(__isl_keep isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_set_loop_bounds(__isl_take isl_ast_build *build, __isl_take isl_basic_set *bounds)
__isl_give isl_ast_build * isl_ast_build_restrict_generated(__isl_take isl_ast_build *build, __isl_take isl_set *set)
__isl_give isl_set * isl_ast_build_get_option_domain(__isl_keep isl_ast_build *build, enum isl_ast_loop_type type)
__isl_give isl_id * isl_ast_build_get_iterator_id(__isl_keep isl_ast_build *build, int pos)
isl_ctx * isl_ast_build_get_ctx(__isl_keep isl_ast_build *build)
static __isl_give isl_ast_build * set_stride(__isl_take isl_ast_build *build, __isl_take isl_val *stride, __isl_take isl_aff *offset)
__isl_give isl_ast_build * isl_ast_build_set_at_each_domain(__isl_take isl_ast_build *build, __isl_give isl_ast_node *(*fn)(__isl_take isl_ast_node *node, __isl_keep isl_ast_build *build, void *user), void *user)
__isl_give isl_ast_build * isl_ast_build_set_pending_generated(__isl_take isl_ast_build *build, __isl_take isl_basic_set *bounds)
__isl_give isl_set * isl_ast_build_get_isolated(__isl_keep isl_ast_build *build)
__isl_give isl_schedule_node * isl_ast_build_get_schedule_node(__isl_keep isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_set_after_each_for(__isl_take isl_ast_build *build, __isl_give isl_ast_node *(*fn)(__isl_take isl_ast_node *node, __isl_keep isl_ast_build *build, void *user), void *user)
int isl_ast_build_options_involve_depth(__isl_keep isl_ast_build *build)
__isl_give isl_pw_multi_aff * isl_ast_build_compute_gist_pw_multi_aff(__isl_keep isl_ast_build *build, __isl_take isl_pw_multi_aff *pma)
__isl_give isl_map * isl_ast_build_compute_gist_map_domain(__isl_keep isl_ast_build *build, __isl_take isl_map *map)
static isl_bool free_of_depth(__isl_keep isl_map *map, void *user)
isl_size isl_ast_build_dim(__isl_keep isl_ast_build *build, enum isl_dim_type type)
__isl_give isl_ast_build * isl_ast_build_product(__isl_take isl_ast_build *build, __isl_take isl_space *space)
__isl_give isl_ast_build * isl_ast_build_insert_dim(__isl_take isl_ast_build *build, int pos)
__isl_give isl_ast_build * isl_ast_build_set_create_leaf(__isl_take isl_ast_build *build, __isl_give isl_ast_node *(*fn)(__isl_take isl_ast_build *build, void *user), void *user)
isl_bool isl_ast_build_has_affine_value(__isl_keep isl_ast_build *build, int pos)
static const char * option_str[]
__isl_give isl_set * isl_ast_build_get_pending(__isl_keep isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_set_iterators(__isl_take isl_ast_build *build, __isl_take isl_id_list *iterators)
static isl_stat extract_single_piece(__isl_take isl_set *set, __isl_take isl_aff *aff, void *user)
__isl_give isl_set * isl_ast_build_eliminate(__isl_keep isl_ast_build *build, __isl_take isl_set *domain)
__isl_give isl_ast_build * isl_ast_build_set_schedule_node(__isl_take isl_ast_build *build, __isl_take isl_schedule_node *node)
__isl_give isl_basic_set * isl_ast_build_specialize_basic_set(__isl_keep isl_ast_build *build, __isl_take isl_basic_set *bset)
__isl_give isl_multi_aff * isl_ast_build_get_internal2input(__isl_keep isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_alloc(isl_ctx *ctx)
__isl_give isl_multi_aff * isl_ast_build_get_schedule_map_multi_aff(__isl_keep isl_ast_build *build)
__isl_give dup(__isl_keep LIST(EL) *list)
static unsigned pos(__isl_keep isl_space *space, enum isl_dim_type type)
Definition isl_map.c:73
#define isl_set
#define isl_basic_set
int sv
Definition isl_test.c:3554
enum isl_fold type
Definition isl_test.c:3867
const char * pa
Definition isl_test.c:7173
const char * set
Definition isl_test.c:1364
const char * ma
Definition isl_test.c:7387
const char * map
Definition isl_test.c:1791
const char * pma
Definition isl_test.c:3019
const char * p
Definition isl_test.c:8454
const char * schedule
Definition isl_test.c:10508
const char * offset
Definition isl_test.c:1577
const char * name
Definition isl_test.c:10749
const char * context
Definition isl_test.c:1792
const char * aff
Definition isl_test.c:7130
const char * res
Definition isl_test.c:783
const char * id
Definition isl_test.c:7131
__isl_give isl_local_space * isl_local_space_from_space(__isl_take isl_space *space)
__isl_export __isl_give isl_set * isl_map_domain(__isl_take isl_map *bmap)
Definition isl_map.c:8777
__isl_export isl_bool isl_map_is_single_valued(__isl_keep isl_map *map)
Definition isl_map.c:12632
__isl_export __isl_give isl_set * isl_set_flatten(__isl_take isl_set *set)
Definition isl_map.c:13020
isl_bool isl_map_involves_dims(__isl_keep isl_map *map, enum isl_dim_type type, unsigned first, unsigned n)
Definition isl_map.c:3504
__isl_give isl_map * isl_map_eliminate(__isl_take isl_map *map, enum isl_dim_type type, unsigned first, unsigned n)
Definition isl_map.c:2717
__isl_export __isl_give isl_map * isl_map_universe(__isl_take isl_space *space)
Definition isl_map.c:6967
__isl_give isl_map * isl_map_copy(__isl_keep isl_map *map)
Definition isl_map.c:1494
__isl_give isl_map * isl_map_set_tuple_name(__isl_take isl_map *map, enum isl_dim_type type, const char *s)
Definition isl_map.c:686
__isl_export __isl_give isl_space * isl_map_get_space(__isl_keep isl_map *map)
Definition isl_map.c:599
__isl_give isl_basic_map * isl_basic_map_upper_bound_si(__isl_take isl_basic_map *bmap, enum isl_dim_type type, unsigned pos, int value)
Definition isl_map.c:7382
__isl_give isl_map * isl_map_range_map(__isl_take isl_map *map)
Definition isl_map.c:6777
__isl_give isl_basic_map * isl_basic_map_lower_bound_si(__isl_take isl_basic_map *bmap, enum isl_dim_type type, unsigned pos, int value)
Definition isl_map.c:7373
__isl_give isl_map * isl_map_equate(__isl_take isl_map *map, enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2)
Definition isl_map.c:13957
__isl_export __isl_give isl_map * isl_map_product(__isl_take isl_map *map1, __isl_take isl_map *map2)
Definition isl_map.c:11613
__isl_give isl_map * isl_map_from_domain(__isl_take isl_set *set)
Definition isl_map.c:6836
__isl_give isl_map * isl_map_fix_si(__isl_take isl_map *map, enum isl_dim_type type, unsigned pos, int value)
Definition isl_map.c:7235
__isl_export __isl_give isl_map * isl_map_coalesce(__isl_take isl_map *map)
__isl_give isl_map * isl_map_identity(__isl_take isl_space *space)
Definition isl_map.c:9558
__isl_give isl_map * isl_map_insert_dims(__isl_take isl_map *map, enum isl_dim_type type, unsigned pos, unsigned n)
Definition isl_map.c:4760
__isl_give isl_map * isl_map_add_dims(__isl_take isl_map *map, enum isl_dim_type type, unsigned n)
Definition isl_map.c:4795
__isl_null isl_map * isl_map_free(__isl_take isl_map *map)
Definition isl_map.c:7040
__isl_export __isl_give isl_map * isl_map_gist_domain(__isl_take isl_map *map, __isl_take isl_set *context)
__isl_export __isl_give isl_map * isl_basic_map_union(__isl_take isl_basic_map *bmap1, __isl_take isl_basic_map *bmap2)
Definition isl_map.c:10128
__isl_give isl_map * isl_map_from_multi_aff(__isl_take isl_multi_aff *maff)
__isl_export isl_size isl_schedule_node_band_n_member(__isl_keep isl_schedule_node *node)
enum isl_ast_loop_type isl_schedule_node_band_member_get_ast_loop_type(__isl_keep isl_schedule_node *node, int pos)
__isl_export __isl_give isl_set * isl_schedule_node_band_get_ast_isolate_option(__isl_keep isl_schedule_node *node)
enum isl_ast_loop_type isl_schedule_node_band_member_get_isolate_ast_loop_type(__isl_keep isl_schedule_node *node, int pos)
__isl_null isl_schedule_node * isl_schedule_node_free(__isl_take isl_schedule_node *node)
__isl_give isl_schedule_node * isl_schedule_node_copy(__isl_keep isl_schedule_node *node)
__isl_export __isl_give isl_set * isl_set_universe(__isl_take isl_space *space)
Definition isl_map.c:6985
__isl_export __isl_give isl_set * isl_set_coalesce(__isl_take isl_set *set)
__isl_give isl_basic_set * isl_basic_set_drop_constraints_not_involving_dims(__isl_take isl_basic_set *bset, enum isl_dim_type type, unsigned first, unsigned n)
Definition isl_map.c:3655
__isl_export __isl_give isl_set * isl_set_product(__isl_take isl_set *set1, __isl_take isl_set *set2)
Definition isl_map.c:11635
isl_ctx * isl_set_get_ctx(__isl_keep isl_set *set)
Definition isl_map.c:397
__isl_export __isl_give isl_space * isl_set_get_space(__isl_keep isl_set *set)
Definition isl_map.c:604
isl_bool isl_set_plain_is_empty(__isl_keep isl_set *set)
Definition isl_map.c:9823
__isl_export __isl_give isl_set * isl_set_detect_equalities(__isl_take isl_set *set)
__isl_overload __isl_give isl_set * isl_set_preimage_multi_aff(__isl_take isl_set *set, __isl_take isl_multi_aff *ma)
Definition isl_map.c:14675
__isl_give isl_basic_set * isl_basic_set_preimage_multi_aff(__isl_take isl_basic_set *bset, __isl_take isl_multi_aff *ma)
Definition isl_map.c:14536
__isl_export __isl_give isl_set * isl_set_intersect_params(__isl_take isl_set *set, __isl_take isl_set *params)
Definition isl_map.c:4538
__isl_give isl_set * isl_set_eliminate(__isl_take isl_set *set, enum isl_dim_type type, unsigned first, unsigned n)
Definition isl_map.c:2747
__isl_null isl_basic_set * isl_basic_set_free(__isl_take isl_basic_set *bset)
Definition isl_map.c:1523
__isl_give isl_basic_set * isl_set_simple_hull(__isl_take isl_set *set)
int isl_set_find_dim_by_name(__isl_keep isl_set *set, enum isl_dim_type type, const char *name)
Definition isl_map.c:1062
__isl_null isl_set * isl_set_free(__isl_take isl_set *set)
Definition isl_map.c:4055
__isl_give isl_set * isl_set_remove_divs_involving_dims(__isl_take isl_set *set, enum isl_dim_type type, unsigned first, unsigned n)
Definition isl_map.c:3466
__isl_give isl_set * isl_set_remove_unknown_divs(__isl_take isl_set *set)
Definition isl_map.c:3856
__isl_give isl_set * isl_set_copy(__isl_keep isl_set *set)
Definition isl_map.c:1470
void isl_set_dump(__isl_keep isl_set *set)
__isl_export __isl_give isl_set * isl_set_gist(__isl_take isl_set *set, __isl_take isl_set *context)
__isl_give isl_set * isl_set_compute_divs(__isl_take isl_set *set)
Definition isl_map.c:8772
isl_bool isl_set_is_params(__isl_keep isl_set *set)
Definition isl_map.c:1270
isl_size isl_set_dim(__isl_keep isl_set *set, enum isl_dim_type type)
Definition isl_map.c:132
__isl_export __isl_give isl_basic_set * isl_basic_set_gist(__isl_take isl_basic_set *bset, __isl_take isl_basic_set *context)
__isl_give isl_set * isl_set_align_params(__isl_take isl_set *set, __isl_take isl_space *model)
Definition isl_map.c:13178
__isl_give isl_basic_set * isl_basic_set_drop_constraints_involving_dims(__isl_take isl_basic_set *bset, enum isl_dim_type type, unsigned first, unsigned n)
Definition isl_map.c:3688
__isl_export __isl_give isl_set * isl_set_intersect(__isl_take isl_set *set1, __isl_take isl_set *set2)
Definition isl_map.c:4521
__isl_give isl_id * isl_set_get_dim_id(__isl_keep isl_set *set, enum isl_dim_type type, unsigned pos)
Definition isl_map.c:1004
__isl_give isl_set * isl_set_insert_dims(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, unsigned n)
Definition isl_map.c:4789
__isl_constructor __isl_give isl_set * isl_set_from_basic_set(__isl_take isl_basic_set *bset)
Definition isl_map.c:4024
__isl_give isl_basic_set * isl_basic_set_copy(__isl_keep isl_basic_set *bset)
Definition isl_map.c:1465
isl_bool isl_set_has_dim_id(__isl_keep isl_set *set, enum isl_dim_type type, unsigned pos)
Definition isl_map.c:998
__isl_export isl_bool isl_set_is_empty(__isl_keep isl_set *set)
Definition isl_map.c:9828
__isl_give isl_stride_info * isl_set_get_stride_info(__isl_keep isl_set *set, int pos)
Definition isl_stride.c:335
__isl_null isl_space * isl_space_free(__isl_take isl_space *space)
Definition isl_space.c:478
__isl_give isl_space * isl_space_from_domain(__isl_take isl_space *space)
Definition isl_space.c:2242
__isl_export __isl_give isl_space * isl_space_params(__isl_take isl_space *space)
Definition isl_space.c:2305
__isl_give isl_space * isl_space_set_from_params(__isl_take isl_space *space)
Definition isl_space.c:2321
__isl_give isl_space * isl_space_copy(__isl_keep isl_space *space)
Definition isl_space.c:469
__isl_give isl_space * isl_space_align_params(__isl_take isl_space *space1, __isl_take isl_space *space2)
Definition isl_space.c:3358
__isl_give isl_space * isl_space_map_from_domain_and_range(__isl_take isl_space *domain, __isl_take isl_space *range)
Definition isl_space.c:1967
__isl_give isl_space * isl_space_set_dim_id(__isl_take isl_space *space, enum isl_dim_type type, unsigned pos, __isl_take isl_id *id)
Definition isl_space.c:737
__isl_give isl_space * isl_space_set_tuple_name(__isl_take isl_space *space, enum isl_dim_type type, const char *s)
Definition isl_space.c:818
__isl_export __isl_give isl_space * isl_space_wrap(__isl_take isl_space *space)
Definition isl_space.c:2926
isl_bool isl_space_is_params(__isl_keep isl_space *space)
Definition isl_space.c:211
__isl_export __isl_give isl_space * isl_space_unwrap(__isl_take isl_space *space)
Definition isl_space.c:2951
__isl_export __isl_give isl_space * isl_space_map_from_set(__isl_take isl_space *space)
Definition isl_space.c:1927
__isl_give isl_space * isl_space_drop_dims(__isl_take isl_space *space, enum isl_dim_type type, unsigned first, unsigned num)
Definition isl_space.c:2141
isl_size isl_space_dim(__isl_keep isl_space *space, enum isl_dim_type type)
Definition isl_space.c:372
__isl_give isl_space * isl_space_alloc(isl_ctx *ctx, unsigned nparam, unsigned n_in, unsigned n_out)
Definition isl_space.c:28
__isl_give isl_space * isl_space_add_dims(__isl_take isl_space *space, enum isl_dim_type type, unsigned n)
Definition isl_space.c:1262
__isl_give isl_space * isl_space_params_alloc(isl_ctx *ctx, unsigned nparam)
Definition isl_space.c:227
__isl_export __isl_give isl_space * isl_space_domain(__isl_take isl_space *space)
Definition isl_space.c:2232
isl_dim_type
Definition space_type.h:13
@ isl_dim_param
Definition space_type.h:15
@ isl_dim_in
Definition space_type.h:16
@ isl_dim_set
Definition space_type.h:18
@ isl_dim_out
Definition space_type.h:17
__isl_null isl_stride_info * isl_stride_info_free(__isl_take isl_stride_info *si)
Definition isl_stride.c:37
__isl_give isl_aff * isl_stride_info_get_offset(__isl_keep isl_stride_info *si)
Definition isl_stride.c:92
__isl_give isl_val * isl_stride_info_get_stride(__isl_keep isl_stride_info *si)
Definition isl_stride.c:83
isl_union_map * options
isl_id_list * iterators
static Kind map_type
static Signature domain
__isl_null isl_union_map * isl_union_map_free(__isl_take isl_union_map *umap)
__isl_export __isl_give isl_space * isl_union_map_get_space(__isl_keep isl_union_map *umap)
__isl_export __isl_give isl_union_map * isl_union_map_reverse(__isl_take isl_union_map *umap)
__isl_give isl_union_map * isl_union_map_add_map(__isl_take isl_union_map *umap, __isl_take isl_map *map)
__isl_give isl_union_map * isl_union_map_align_params(__isl_take isl_union_map *umap, __isl_take isl_space *model)
__isl_export __isl_give isl_map * isl_union_map_extract_map(__isl_keep isl_union_map *umap, __isl_take isl_space *space)
__isl_overload __isl_give isl_union_map * isl_union_map_preimage_domain_multi_aff(__isl_take isl_union_map *umap, __isl_take isl_multi_aff *ma)
__isl_export isl_bool isl_union_map_every_map(__isl_keep isl_union_map *umap, isl_bool(*test)(__isl_keep isl_map *map, void *user), void *user)
__isl_export __isl_give isl_union_map * isl_union_map_apply_range(__isl_take isl_union_map *umap1, __isl_take isl_union_map *umap2)
__isl_give isl_union_map * isl_union_map_copy(__isl_keep isl_union_map *umap)
__isl_export __isl_give isl_union_map * isl_union_map_apply_domain(__isl_take isl_union_map *umap1, __isl_take isl_union_map *umap2)
__isl_give isl_union_map * isl_union_map_empty(__isl_take isl_space *space)
__isl_constructor __isl_give isl_union_map * isl_union_map_from_map(__isl_take isl_map *map)
__isl_give isl_val * isl_val_copy(__isl_keep isl_val *v)
Definition isl_val.c:219
__isl_export __isl_give isl_val * isl_val_div(__isl_take isl_val *v1, __isl_take isl_val *v2)
Definition isl_val.c:875
__isl_null isl_val * isl_val_free(__isl_take isl_val *v)
Definition isl_val.c:263
__isl_export isl_bool isl_val_is_one(__isl_keep isl_val *v)
Definition isl_val.c:1201
__isl_give isl_val * isl_vec_get_element_val(__isl_keep isl_vec *vec, int pos)
Definition isl_vec.c:256
__isl_null isl_vec * isl_vec_free(__isl_take isl_vec *vec)
Definition isl_vec.c:234
__isl_give isl_vec * isl_vec_set_si(__isl_take isl_vec *vec, int v)
Definition isl_vec.c:397
__isl_give isl_vec * isl_vec_concat(__isl_take isl_vec *vec1, __isl_take isl_vec *vec2)
Definition isl_vec.c:168
__isl_give isl_vec * isl_vec_insert_els(__isl_take isl_vec *vec, unsigned pos, unsigned n)
Definition isl_vec.c:560
__isl_give isl_vec * isl_vec_copy(__isl_keep isl_vec *vec)
Definition isl_vec.c:198
__isl_give isl_vec * isl_vec_set_element_si(__isl_take isl_vec *vec, int pos, int v)
Definition isl_vec.c:285
__isl_give isl_vec * isl_vec_set_element_val(__isl_take isl_vec *vec, int pos, __isl_take isl_val *v)
Definition isl_vec.c:303
void isl_vec_dump(__isl_keep isl_vec *vec)
Definition isl_vec.c:374
__isl_give isl_vec * isl_vec_alloc(isl_ctx *ctx, unsigned size)
Definition isl_vec.c:33
n
Definition youcefn.c:8