1#ifndef ISL_SCHEDLUE_TREE_H
2#define ISL_SCHEDLUE_TREE_H
3
4#include <isl_schedule_band.h>
5#include <isl/schedule.h>
6#include <isl/set.h>
7#include <isl/union_set.h>
8
9struct isl_schedule_tree;
10typedef struct isl_schedule_tree isl_schedule_tree;
11
12ISL_DECLARE_LIST(schedule_tree)
13
14/* A schedule (sub)tree.
15 *
16 * The leaves of a tree are not explicitly represented inside
17 * the isl_schedule_tree, except when the tree consists of only a leaf.
18 *
19 * The "band" field is valid when type is isl_schedule_node_band.
20 * The "context" field is valid when type is isl_schedule_node_context
21 * and represents constraints on the flat product of the outer band nodes,
22 * possibly introducing additional parameters.
23 * The "domain" field is valid when type is isl_schedule_node_domain
24 * and introduces the statement instances scheduled by the tree.
25 *
26 * The "contraction" and "expansion" fields are valid when type
27 * is isl_schedule_node_expansion.
28 * "expansion" expands the reaching domain elements to one or more
29 * domain elements for the subtree.
30 * "contraction" maps these elements back to the corresponding
31 * reaching domain element. It does not involve any domain constraints.
32 *
33 * The "extension" field is valid when the is isl_schedule_node_extension
34 * maps outer schedule dimensions (the flat product of the outer band nodes)
35 * to additional iteration domains.
36 *
37 * The "filter" field is valid when type is isl_schedule_node_filter
38 * and represents the statement instances selected by the node.
39 *
40 * The "guard" field is valid when type is isl_schedule_node_guard
41 * and represents constraints on the flat product of the outer band nodes
42 * that need to be enforced by the outer nodes in the generated AST.
43 *
44 * The "mark" field is valid when type is isl_schedule_node_mark and
45 * identifies the mark.
46 *
47 * The "children" field is valid for all types except
48 * isl_schedule_node_leaf. This field is NULL if there are
49 * no children (except for the implicit leaves).
50 *
51 * anchored is set if the node or any of its descendants depends
52 * on its position in the schedule tree.
53 */
54struct isl_schedule_tree {
55 int ref;
56 isl_ctx *ctx;
57 int anchored;
58 enum isl_schedule_node_type type;
59 union {
60 isl_schedule_band *band;
61 isl_set *context;
62 isl_union_set *domain;
63 struct {
64 isl_union_pw_multi_aff *contraction;
65 isl_union_map *expansion;
66 };
67 isl_union_map *extension;
68 isl_union_set *filter;
69 isl_set *guard;
70 isl_id *mark;
71 };
72 isl_schedule_tree_list *children;
73};
74
75isl_ctx *isl_schedule_tree_get_ctx(__isl_keep isl_schedule_tree *tree);
76enum isl_schedule_node_type isl_schedule_tree_get_type(
77 __isl_keep isl_schedule_tree *tree);
78
79__isl_give isl_schedule_tree *isl_schedule_tree_leaf(isl_ctx *ctx);
80int isl_schedule_tree_is_leaf(__isl_keep isl_schedule_tree *tree);
81
82isl_bool isl_schedule_tree_plain_is_equal(__isl_keep isl_schedule_tree *tree1,
83 __isl_keep isl_schedule_tree *tree2);
84
85__isl_give isl_schedule_tree *isl_schedule_tree_copy(
86 __isl_keep isl_schedule_tree *tree);
87__isl_null isl_schedule_tree *isl_schedule_tree_free(
88 __isl_take isl_schedule_tree *tree);
89
90__isl_give isl_schedule_tree *isl_schedule_tree_from_band(
91 __isl_take isl_schedule_band *band);
92__isl_give isl_schedule_tree *isl_schedule_tree_from_context(
93 __isl_take isl_set *context);
94__isl_give isl_schedule_tree *isl_schedule_tree_from_domain(
95 __isl_take isl_union_set *domain);
96__isl_give isl_schedule_tree *isl_schedule_tree_from_expansion(
97 __isl_take isl_union_pw_multi_aff *contraction,
98 __isl_take isl_union_map *expansion);
99__isl_give isl_schedule_tree *isl_schedule_tree_from_extension(
100 __isl_take isl_union_map *extension);
101__isl_give isl_schedule_tree *isl_schedule_tree_from_filter(
102 __isl_take isl_union_set *filter);
103__isl_give isl_schedule_tree *isl_schedule_tree_from_guard(
104 __isl_take isl_set *guard);
105__isl_give isl_schedule_tree *isl_schedule_tree_from_children(
106 enum isl_schedule_node_type type,
107 __isl_take isl_schedule_tree_list *list);
108__isl_give isl_schedule_tree *isl_schedule_tree_from_pair(
109 enum isl_schedule_node_type type, __isl_take isl_schedule_tree *tree1,
110 __isl_take isl_schedule_tree *tree2);
111__isl_give isl_schedule_tree *isl_schedule_tree_sequence_pair(
112 __isl_take isl_schedule_tree *tree1,
113 __isl_take isl_schedule_tree *tree2);
114__isl_give isl_schedule_tree *isl_schedule_tree_set_pair(
115 __isl_take isl_schedule_tree *tree1,
116 __isl_take isl_schedule_tree *tree2);
117
118isl_bool isl_schedule_tree_is_subtree_anchored(
119 __isl_keep isl_schedule_tree *tree);
120
121__isl_give isl_space *isl_schedule_tree_band_get_space(
122 __isl_keep isl_schedule_tree *tree);
123__isl_give isl_schedule_tree *isl_schedule_tree_band_intersect_domain(
124 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *domain);
125__isl_give isl_multi_union_pw_aff *isl_schedule_tree_band_get_partial_schedule(
126 __isl_keep isl_schedule_tree *tree);
127__isl_give isl_schedule_tree *isl_schedule_tree_band_set_partial_schedule(
128 __isl_take isl_schedule_tree *tree,
129 __isl_take isl_multi_union_pw_aff *schedule);
130enum isl_ast_loop_type isl_schedule_tree_band_member_get_ast_loop_type(
131 __isl_keep isl_schedule_tree *tree, int pos);
132__isl_give isl_schedule_tree *isl_schedule_tree_band_member_set_ast_loop_type(
133 __isl_take isl_schedule_tree *tree, int pos,
134 enum isl_ast_loop_type type);
135enum isl_ast_loop_type isl_schedule_tree_band_member_get_isolate_ast_loop_type(
136 __isl_keep isl_schedule_tree *tree, int pos);
137__isl_give isl_schedule_tree *
138isl_schedule_tree_band_member_set_isolate_ast_loop_type(
139 __isl_take isl_schedule_tree *tree, int pos,
140 enum isl_ast_loop_type type);
141__isl_give isl_union_set *isl_schedule_tree_band_get_ast_build_options(
142 __isl_keep isl_schedule_tree *tree);
143__isl_give isl_schedule_tree *isl_schedule_tree_band_set_ast_build_options(
144 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *options);
145__isl_give isl_set *isl_schedule_tree_band_get_ast_isolate_option(
146 __isl_keep isl_schedule_tree *tree, int depth);
147__isl_give isl_set *isl_schedule_tree_context_get_context(
148 __isl_keep isl_schedule_tree *tree);
149__isl_give isl_union_set *isl_schedule_tree_domain_get_domain(
150 __isl_keep isl_schedule_tree *tree);
151__isl_give isl_schedule_tree *isl_schedule_tree_domain_set_domain(
152 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *domain);
153__isl_give isl_union_pw_multi_aff *isl_schedule_tree_expansion_get_contraction(
154 __isl_keep isl_schedule_tree *tree);
155__isl_give isl_union_map *isl_schedule_tree_expansion_get_expansion(
156 __isl_keep isl_schedule_tree *tree);
157__isl_give isl_schedule_tree *
158isl_schedule_tree_expansion_set_contraction_and_expansion(
159 __isl_take isl_schedule_tree *tree,
160 __isl_take isl_union_pw_multi_aff *contraction,
161 __isl_take isl_union_map *expansion);
162__isl_give isl_union_map *isl_schedule_tree_extension_get_extension(
163 __isl_keep isl_schedule_tree *tree);
164__isl_give isl_schedule_tree *isl_schedule_tree_extension_set_extension(
165 __isl_take isl_schedule_tree *tree,
166 __isl_take isl_union_map *extension);
167__isl_give isl_union_set *isl_schedule_tree_filter_get_filter(
168 __isl_keep isl_schedule_tree *tree);
169__isl_give isl_schedule_tree *isl_schedule_tree_filter_set_filter(
170 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *filter);
171__isl_give isl_set *isl_schedule_tree_guard_get_guard(
172 __isl_keep isl_schedule_tree *tree);
173__isl_give isl_id *isl_schedule_tree_mark_get_id(
174 __isl_keep isl_schedule_tree *tree);
175
176__isl_give isl_schedule_tree *isl_schedule_tree_first_schedule_descendant(
177 __isl_take isl_schedule_tree *tree, __isl_keep isl_schedule_tree *leaf);
178__isl_give isl_union_map *isl_schedule_tree_get_subtree_schedule_union_map(
179 __isl_keep isl_schedule_tree *tree);
180
181isl_size isl_schedule_tree_band_n_member(__isl_keep isl_schedule_tree *tree);
182
183isl_bool isl_schedule_tree_band_member_get_coincident(
184 __isl_keep isl_schedule_tree *tree, int pos);
185__isl_give isl_schedule_tree *isl_schedule_tree_band_member_set_coincident(
186 __isl_take isl_schedule_tree *tree, int pos, int coincident);
187isl_bool isl_schedule_tree_band_get_permutable(
188 __isl_keep isl_schedule_tree *tree);
189__isl_give isl_schedule_tree *isl_schedule_tree_band_set_permutable(
190 __isl_take isl_schedule_tree *tree, int permutable);
191
192int isl_schedule_tree_has_children(__isl_keep isl_schedule_tree *tree);
193isl_size isl_schedule_tree_n_children(__isl_keep isl_schedule_tree *tree);
194__isl_give isl_schedule_tree *isl_schedule_tree_get_child(
195 __isl_keep isl_schedule_tree *tree, int pos);
196
197__isl_give isl_schedule_tree *isl_schedule_tree_insert_band(
198 __isl_take isl_schedule_tree *tree, __isl_take isl_schedule_band *band);
199__isl_give isl_schedule_tree *isl_schedule_tree_insert_context(
200 __isl_take isl_schedule_tree *tree, __isl_take isl_set *context);
201__isl_give isl_schedule_tree *isl_schedule_tree_insert_domain(
202 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *domain);
203__isl_give isl_schedule_tree *isl_schedule_tree_insert_expansion(
204 __isl_take isl_schedule_tree *tree,
205 __isl_take isl_union_pw_multi_aff *contraction,
206 __isl_take isl_union_map *expansion);
207__isl_give isl_schedule_tree *isl_schedule_tree_insert_extension(
208 __isl_take isl_schedule_tree *tree,
209 __isl_take isl_union_map *extension);
210__isl_give isl_schedule_tree *isl_schedule_tree_insert_filter(
211 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *filter);
212__isl_give isl_schedule_tree *isl_schedule_tree_children_insert_filter(
213 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *filter);
214__isl_give isl_schedule_tree *isl_schedule_tree_insert_guard(
215 __isl_take isl_schedule_tree *tree, __isl_take isl_set *guard);
216__isl_give isl_schedule_tree *isl_schedule_tree_insert_mark(
217 __isl_take isl_schedule_tree *tree, __isl_take isl_id *mark);
218
219__isl_give isl_schedule_tree *isl_schedule_tree_append_to_leaves(
220 __isl_take isl_schedule_tree *tree1,
221 __isl_take isl_schedule_tree *tree2);
222
223__isl_give isl_schedule_tree *isl_schedule_tree_band_scale(
224 __isl_take isl_schedule_tree *tree, __isl_take isl_multi_val *mv);
225__isl_give isl_schedule_tree *isl_schedule_tree_band_scale_down(
226 __isl_take isl_schedule_tree *tree, __isl_take isl_multi_val *mv);
227__isl_give isl_schedule_tree *isl_schedule_tree_band_mod(
228 __isl_take isl_schedule_tree *tree, __isl_take isl_multi_val *mv);
229__isl_give isl_schedule_tree *isl_schedule_tree_band_tile(
230 __isl_take isl_schedule_tree *tree, __isl_take isl_multi_val *sizes);
231__isl_give isl_schedule_tree *isl_schedule_tree_band_shift(
232 __isl_take isl_schedule_tree *tree,
233 __isl_take isl_multi_union_pw_aff *shift);
234__isl_give isl_schedule_tree *isl_schedule_tree_band_split(
235 __isl_take isl_schedule_tree *tree, int pos, int depth);
236__isl_give isl_schedule_tree *isl_schedule_tree_band_gist(
237 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *context);
238
239__isl_give isl_schedule_tree *isl_schedule_tree_child(
240 __isl_take isl_schedule_tree *tree, int pos);
241__isl_give isl_schedule_tree *isl_schedule_tree_reset_children(
242 __isl_take isl_schedule_tree *tree);
243__isl_give isl_schedule_tree *isl_schedule_tree_drop_child(
244 __isl_take isl_schedule_tree *tree, int pos);
245__isl_give isl_schedule_tree *isl_schedule_tree_replace_child(
246 __isl_take isl_schedule_tree *tree, int pos,
247 __isl_take isl_schedule_tree *new_child);
248__isl_give isl_schedule_tree *isl_schedule_tree_sequence_splice(
249 __isl_take isl_schedule_tree *tree, int pos,
250 __isl_take isl_schedule_tree *child);
251
252__isl_give isl_schedule_tree *isl_schedule_tree_reset_user(
253 __isl_take isl_schedule_tree *tree);
254__isl_give isl_schedule_tree *isl_schedule_tree_align_params(
255 __isl_take isl_schedule_tree *tree, __isl_take isl_space *space);
256__isl_give isl_schedule_tree *isl_schedule_tree_pullback_union_pw_multi_aff(
257 __isl_take isl_schedule_tree *tree,
258 __isl_take isl_union_pw_multi_aff *upma);
259
260__isl_give isl_printer *isl_printer_print_schedule_tree(
261 __isl_take isl_printer *p, __isl_keep isl_schedule_tree *tree);
262__isl_give isl_printer *isl_printer_print_schedule_tree_mark(
263 __isl_take isl_printer *p, __isl_keep isl_schedule_tree *tree,
264 int n_ancestor, int *child_pos);
265
266#endif
267

source code of polly/lib/External/isl/isl_schedule_tree.h