1 #ifndef ISL_SCHEDLUE_TREE_H
2 #define ISL_SCHEDLUE_TREE_H
4 #include <isl_schedule_band.h>
5 #include <isl/schedule.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, except when the tree consists of only a leaf.
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.
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.
33 * The "extension" field is valid when the is isl_schedule_node_extension
34 * maps outer schedule dimenions (the flat product of the outer band nodes)
35 * to additional iteration domains.
37 * The "filter" field is valid when type is isl_schedule_node_filter
38 * and represents the statement instances selected by the node.
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.
44 * The "mark" field is valid when type is isl_schedule_node_mark and
45 * identifies the mark.
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).
51 * anchored is set if the node or any of its descendants depends
52 * on its position in the schedule tree.
54 struct isl_schedule_tree
{
58 enum isl_schedule_node_type type
;
60 isl_schedule_band
*band
;
62 isl_union_set
*domain
;
64 isl_union_pw_multi_aff
*contraction
;
65 isl_union_map
*expansion
;
67 isl_union_map
*extension
;
68 isl_union_set
*filter
;
72 isl_schedule_tree_list
*children
;
75 isl_ctx
*isl_schedule_tree_get_ctx(__isl_keep isl_schedule_tree
*tree
);
76 enum isl_schedule_node_type
isl_schedule_tree_get_type(
77 __isl_keep isl_schedule_tree
*tree
);
79 __isl_give isl_schedule_tree
*isl_schedule_tree_leaf(isl_ctx
*ctx
);
80 int isl_schedule_tree_is_leaf(__isl_keep isl_schedule_tree
*tree
);
82 isl_bool
isl_schedule_tree_plain_is_equal(__isl_keep isl_schedule_tree
*tree1
,
83 __isl_keep isl_schedule_tree
*tree2
);
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
);
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
);
118 isl_bool
isl_schedule_tree_is_subtree_anchored(
119 __isl_keep isl_schedule_tree
*tree
);
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
);
130 enum 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
);
135 enum 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
*
138 isl_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
*
158 isl_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
);
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
);
181 unsigned isl_schedule_tree_band_n_member(__isl_keep isl_schedule_tree
*tree
);
183 isl_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
);
187 isl_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
);
192 int isl_schedule_tree_has_children(__isl_keep isl_schedule_tree
*tree
);
193 int 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
);
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
);
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
);
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
);
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
);
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
);
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
);