add isl_schedule_node_guard
[isl.git] / isl_schedule_tree.h
blob151b1c38196d383793a8fdffafac13e92d2cd0ea
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 "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 {
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;
67 isl_union_set *filter;
68 isl_set *guard;
69 isl_id *mark;
71 isl_schedule_tree_list *children;
74 isl_ctx *isl_schedule_tree_get_ctx(__isl_keep isl_schedule_tree *tree);
75 enum isl_schedule_node_type isl_schedule_tree_get_type(
76 __isl_keep isl_schedule_tree *tree);
78 __isl_give isl_schedule_tree *isl_schedule_tree_leaf(isl_ctx *ctx);
79 int isl_schedule_tree_is_leaf(__isl_keep isl_schedule_tree *tree);
81 int isl_schedule_tree_plain_is_equal(__isl_keep isl_schedule_tree *tree1,
82 __isl_keep isl_schedule_tree *tree2);
84 __isl_give isl_schedule_tree *isl_schedule_tree_copy(
85 __isl_keep isl_schedule_tree *tree);
86 __isl_null isl_schedule_tree *isl_schedule_tree_free(
87 __isl_take isl_schedule_tree *tree);
89 __isl_give isl_schedule_tree *isl_schedule_tree_from_band(
90 __isl_take isl_schedule_band *band);
91 __isl_give isl_schedule_tree *isl_schedule_tree_from_context(
92 __isl_take isl_set *context);
93 __isl_give isl_schedule_tree *isl_schedule_tree_from_domain(
94 __isl_take isl_union_set *domain);
95 __isl_give isl_schedule_tree *isl_schedule_tree_from_expansion(
96 __isl_take isl_union_pw_multi_aff *contraction,
97 __isl_take isl_union_map *expansion);
98 __isl_give isl_schedule_tree *isl_schedule_tree_from_filter(
99 __isl_take isl_union_set *filter);
100 __isl_give isl_schedule_tree *isl_schedule_tree_from_guard(
101 __isl_take isl_set *guard);
102 __isl_give isl_schedule_tree *isl_schedule_tree_from_children(
103 enum isl_schedule_node_type type,
104 __isl_take isl_schedule_tree_list *list);
105 __isl_give isl_schedule_tree *isl_schedule_tree_from_pair(
106 enum isl_schedule_node_type type, __isl_take isl_schedule_tree *tree1,
107 __isl_take isl_schedule_tree *tree2);
109 int isl_schedule_tree_is_subtree_anchored(__isl_keep isl_schedule_tree *tree);
111 __isl_give isl_space *isl_schedule_tree_band_get_space(
112 __isl_keep isl_schedule_tree *tree);
113 __isl_give isl_schedule_tree *isl_schedule_tree_band_intersect_domain(
114 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *domain);
115 __isl_give isl_multi_union_pw_aff *isl_schedule_tree_band_get_partial_schedule(
116 __isl_keep isl_schedule_tree *tree);
117 __isl_give isl_schedule_tree *isl_schedule_tree_band_set_partial_schedule(
118 __isl_take isl_schedule_tree *tree,
119 __isl_take isl_multi_union_pw_aff *schedule);
120 enum isl_ast_loop_type isl_schedule_tree_band_member_get_ast_loop_type(
121 __isl_keep isl_schedule_tree *tree, int pos);
122 __isl_give isl_schedule_tree *isl_schedule_tree_band_member_set_ast_loop_type(
123 __isl_take isl_schedule_tree *tree, int pos,
124 enum isl_ast_loop_type type);
125 enum isl_ast_loop_type isl_schedule_tree_band_member_get_isolate_ast_loop_type(
126 __isl_keep isl_schedule_tree *tree, int pos);
127 __isl_give isl_schedule_tree *
128 isl_schedule_tree_band_member_set_isolate_ast_loop_type(
129 __isl_take isl_schedule_tree *tree, int pos,
130 enum isl_ast_loop_type type);
131 __isl_give isl_union_set *isl_schedule_tree_band_get_ast_build_options(
132 __isl_keep isl_schedule_tree *tree);
133 __isl_give isl_schedule_tree *isl_schedule_tree_band_set_ast_build_options(
134 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *options);
135 __isl_give isl_set *isl_schedule_tree_context_get_context(
136 __isl_keep isl_schedule_tree *tree);
137 __isl_give isl_union_set *isl_schedule_tree_domain_get_domain(
138 __isl_keep isl_schedule_tree *tree);
139 __isl_give isl_schedule_tree *isl_schedule_tree_domain_set_domain(
140 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *domain);
141 __isl_give isl_union_pw_multi_aff *isl_schedule_tree_expansion_get_contraction(
142 __isl_keep isl_schedule_tree *tree);
143 __isl_give isl_union_map *isl_schedule_tree_expansion_get_expansion(
144 __isl_keep isl_schedule_tree *tree);
145 __isl_give isl_schedule_tree *
146 isl_schedule_tree_expansion_set_contraction_and_expansion(
147 __isl_take isl_schedule_tree *tree,
148 __isl_take isl_union_pw_multi_aff *contraction,
149 __isl_take isl_union_map *expansion);
150 __isl_give isl_union_set *isl_schedule_tree_filter_get_filter(
151 __isl_keep isl_schedule_tree *tree);
152 __isl_give isl_schedule_tree *isl_schedule_tree_filter_set_filter(
153 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *filter);
154 __isl_give isl_set *isl_schedule_tree_guard_get_guard(
155 __isl_keep isl_schedule_tree *tree);
156 __isl_give isl_id *isl_schedule_tree_mark_get_id(
157 __isl_keep isl_schedule_tree *tree);
159 __isl_give isl_schedule_tree *isl_schedule_tree_first_schedule_descendant(
160 __isl_take isl_schedule_tree *tree, __isl_keep isl_schedule_tree *leaf);
161 __isl_give isl_union_map *isl_schedule_tree_get_subtree_schedule_union_map(
162 __isl_keep isl_schedule_tree *tree);
164 unsigned isl_schedule_tree_band_n_member(__isl_keep isl_schedule_tree *tree);
166 int isl_schedule_tree_band_member_get_coincident(
167 __isl_keep isl_schedule_tree *tree, int pos);
168 __isl_give isl_schedule_tree *isl_schedule_tree_band_member_set_coincident(
169 __isl_take isl_schedule_tree *tree, int pos, int coincident);
170 int isl_schedule_tree_band_get_permutable(__isl_keep isl_schedule_tree *tree);
171 __isl_give isl_schedule_tree *isl_schedule_tree_band_set_permutable(
172 __isl_take isl_schedule_tree *tree, int permutable);
174 int isl_schedule_tree_has_children(__isl_keep isl_schedule_tree *tree);
175 int isl_schedule_tree_n_children(__isl_keep isl_schedule_tree *tree);
176 __isl_give isl_schedule_tree *isl_schedule_tree_get_child(
177 __isl_keep isl_schedule_tree *tree, int pos);
179 __isl_give isl_schedule_tree *isl_schedule_tree_insert_band(
180 __isl_take isl_schedule_tree *tree, __isl_take isl_schedule_band *band);
181 __isl_give isl_schedule_tree *isl_schedule_tree_insert_context(
182 __isl_take isl_schedule_tree *tree, __isl_take isl_set *context);
183 __isl_give isl_schedule_tree *isl_schedule_tree_insert_domain(
184 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *domain);
185 __isl_give isl_schedule_tree *isl_schedule_tree_insert_expansion(
186 __isl_take isl_schedule_tree *tree,
187 __isl_take isl_union_pw_multi_aff *contraction,
188 __isl_take isl_union_map *expansion);
189 __isl_give isl_schedule_tree *isl_schedule_tree_insert_filter(
190 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *filter);
191 __isl_give isl_schedule_tree *isl_schedule_tree_children_insert_filter(
192 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *filter);
193 __isl_give isl_schedule_tree *isl_schedule_tree_insert_guard(
194 __isl_take isl_schedule_tree *tree, __isl_take isl_set *guard);
195 __isl_give isl_schedule_tree *isl_schedule_tree_insert_mark(
196 __isl_take isl_schedule_tree *tree, __isl_take isl_id *mark);
198 __isl_give isl_schedule_tree *isl_schedule_tree_append_to_leaves(
199 __isl_take isl_schedule_tree *tree1,
200 __isl_take isl_schedule_tree *tree2);
202 __isl_give isl_schedule_tree *isl_schedule_tree_band_scale(
203 __isl_take isl_schedule_tree *tree, __isl_take isl_multi_val *mv);
204 __isl_give isl_schedule_tree *isl_schedule_tree_band_scale_down(
205 __isl_take isl_schedule_tree *tree, __isl_take isl_multi_val *mv);
206 __isl_give isl_schedule_tree *isl_schedule_tree_band_tile(
207 __isl_take isl_schedule_tree *tree, __isl_take isl_multi_val *sizes);
208 __isl_give isl_schedule_tree *isl_schedule_tree_band_split(
209 __isl_take isl_schedule_tree *tree, int pos);
210 __isl_give isl_schedule_tree *isl_schedule_tree_band_gist(
211 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *context);
213 __isl_give isl_schedule_tree *isl_schedule_tree_child(
214 __isl_take isl_schedule_tree *tree, int pos);
215 __isl_give isl_schedule_tree *isl_schedule_tree_reset_children(
216 __isl_take isl_schedule_tree *tree);
217 __isl_give isl_schedule_tree *isl_schedule_tree_drop_child(
218 __isl_take isl_schedule_tree *tree, int pos);
219 __isl_give isl_schedule_tree *isl_schedule_tree_replace_child(
220 __isl_take isl_schedule_tree *tree, int pos,
221 __isl_take isl_schedule_tree *new_child);
223 __isl_give isl_schedule_tree *isl_schedule_tree_reset_user(
224 __isl_take isl_schedule_tree *tree);
225 __isl_give isl_schedule_tree *isl_schedule_tree_align_params(
226 __isl_take isl_schedule_tree *tree, __isl_take isl_space *space);
227 __isl_give isl_schedule_tree *isl_schedule_tree_pullback_union_pw_multi_aff(
228 __isl_take isl_schedule_tree *tree,
229 __isl_take isl_union_pw_multi_aff *upma);
231 __isl_give isl_printer *isl_printer_print_schedule_tree(
232 __isl_take isl_printer *p, __isl_keep isl_schedule_tree *tree);
233 __isl_give isl_printer *isl_printer_print_schedule_tree_mark(
234 __isl_take isl_printer *p, __isl_keep isl_schedule_tree *tree,
235 int n_ancestor, int *child_pos);
237 #endif