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