add isl_schedule_insert_context
[isl.git] / isl_schedule_tree.h
blobfff89fad672a196e827c8af3950640b3c8a5b635
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.
29 * The "filter" field is valid when type is isl_schedule_node_filter
30 * and represents the statement instances selected by the node.
32 * The "children" field is valid for all types except
33 * isl_schedule_node_leaf. This field is NULL if there are
34 * no children (except for the implicit leaves).
36 * anchored is set if the node or any of its descendants depends
37 * on its position in the schedule tree.
39 struct isl_schedule_tree {
40 int ref;
41 isl_ctx *ctx;
42 int anchored;
43 enum isl_schedule_node_type type;
44 union {
45 isl_schedule_band *band;
46 isl_set *context;
47 isl_union_set *domain;
48 isl_union_set *filter;
50 isl_schedule_tree_list *children;
53 isl_ctx *isl_schedule_tree_get_ctx(__isl_keep isl_schedule_tree *tree);
54 enum isl_schedule_node_type isl_schedule_tree_get_type(
55 __isl_keep isl_schedule_tree *tree);
57 __isl_give isl_schedule_tree *isl_schedule_tree_leaf(isl_ctx *ctx);
58 int isl_schedule_tree_is_leaf(__isl_keep isl_schedule_tree *tree);
60 int isl_schedule_tree_plain_is_equal(__isl_keep isl_schedule_tree *tree1,
61 __isl_keep isl_schedule_tree *tree2);
63 __isl_give isl_schedule_tree *isl_schedule_tree_copy(
64 __isl_keep isl_schedule_tree *tree);
65 __isl_null isl_schedule_tree *isl_schedule_tree_free(
66 __isl_take isl_schedule_tree *tree);
68 __isl_give isl_schedule_tree *isl_schedule_tree_from_band(
69 __isl_take isl_schedule_band *band);
70 __isl_give isl_schedule_tree *isl_schedule_tree_from_context(
71 __isl_take isl_set *context);
72 __isl_give isl_schedule_tree *isl_schedule_tree_from_domain(
73 __isl_take isl_union_set *domain);
74 __isl_give isl_schedule_tree *isl_schedule_tree_from_filter(
75 __isl_take isl_union_set *filter);
76 __isl_give isl_schedule_tree *isl_schedule_tree_from_children(
77 enum isl_schedule_node_type type,
78 __isl_take isl_schedule_tree_list *list);
79 __isl_give isl_schedule_tree *isl_schedule_tree_from_pair(
80 enum isl_schedule_node_type type, __isl_take isl_schedule_tree *tree1,
81 __isl_take isl_schedule_tree *tree2);
83 int isl_schedule_tree_is_subtree_anchored(__isl_keep isl_schedule_tree *tree);
85 __isl_give isl_space *isl_schedule_tree_band_get_space(
86 __isl_keep isl_schedule_tree *tree);
87 __isl_give isl_multi_union_pw_aff *isl_schedule_tree_band_get_partial_schedule(
88 __isl_keep isl_schedule_tree *tree);
89 enum isl_ast_loop_type isl_schedule_tree_band_member_get_ast_loop_type(
90 __isl_keep isl_schedule_tree *tree, int pos);
91 __isl_give isl_schedule_tree *isl_schedule_tree_band_member_set_ast_loop_type(
92 __isl_take isl_schedule_tree *tree, int pos,
93 enum isl_ast_loop_type type);
94 enum isl_ast_loop_type isl_schedule_tree_band_member_get_isolate_ast_loop_type(
95 __isl_keep isl_schedule_tree *tree, int pos);
96 __isl_give isl_schedule_tree *
97 isl_schedule_tree_band_member_set_isolate_ast_loop_type(
98 __isl_take isl_schedule_tree *tree, int pos,
99 enum isl_ast_loop_type type);
100 __isl_give isl_union_set *isl_schedule_tree_band_get_ast_build_options(
101 __isl_keep isl_schedule_tree *tree);
102 __isl_give isl_schedule_tree *isl_schedule_tree_band_set_ast_build_options(
103 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *options);
104 __isl_give isl_set *isl_schedule_tree_context_get_context(
105 __isl_keep isl_schedule_tree *tree);
106 __isl_give isl_union_set *isl_schedule_tree_domain_get_domain(
107 __isl_keep isl_schedule_tree *tree);
108 __isl_give isl_schedule_tree *isl_schedule_tree_domain_set_domain(
109 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *domain);
110 __isl_give isl_union_set *isl_schedule_tree_filter_get_filter(
111 __isl_keep isl_schedule_tree *tree);
112 __isl_give isl_schedule_tree *isl_schedule_tree_filter_set_filter(
113 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *filter);
115 __isl_give isl_schedule_tree *isl_schedule_tree_first_schedule_descendant(
116 __isl_take isl_schedule_tree *tree, __isl_keep isl_schedule_tree *leaf);
117 __isl_give isl_union_map *isl_schedule_tree_get_subtree_schedule_union_map(
118 __isl_keep isl_schedule_tree *tree);
120 unsigned isl_schedule_tree_band_n_member(__isl_keep isl_schedule_tree *tree);
122 int isl_schedule_tree_band_member_get_coincident(
123 __isl_keep isl_schedule_tree *tree, int pos);
124 __isl_give isl_schedule_tree *isl_schedule_tree_band_member_set_coincident(
125 __isl_take isl_schedule_tree *tree, int pos, int coincident);
126 int isl_schedule_tree_band_get_permutable(__isl_keep isl_schedule_tree *tree);
127 __isl_give isl_schedule_tree *isl_schedule_tree_band_set_permutable(
128 __isl_take isl_schedule_tree *tree, int permutable);
130 int isl_schedule_tree_has_children(__isl_keep isl_schedule_tree *tree);
131 int isl_schedule_tree_n_children(__isl_keep isl_schedule_tree *tree);
132 __isl_give isl_schedule_tree *isl_schedule_tree_get_child(
133 __isl_keep isl_schedule_tree *tree, int pos);
135 __isl_give isl_schedule_tree *isl_schedule_tree_insert_band(
136 __isl_take isl_schedule_tree *tree, __isl_take isl_schedule_band *band);
137 __isl_give isl_schedule_tree *isl_schedule_tree_insert_context(
138 __isl_take isl_schedule_tree *tree, __isl_take isl_set *context);
139 __isl_give isl_schedule_tree *isl_schedule_tree_insert_domain(
140 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *domain);
141 __isl_give isl_schedule_tree *isl_schedule_tree_insert_filter(
142 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *filter);
143 __isl_give isl_schedule_tree *isl_schedule_tree_children_insert_filter(
144 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *filter);
146 __isl_give isl_schedule_tree *isl_schedule_tree_append_to_leaves(
147 __isl_take isl_schedule_tree *tree1,
148 __isl_take isl_schedule_tree *tree2);
150 __isl_give isl_schedule_tree *isl_schedule_tree_band_scale(
151 __isl_take isl_schedule_tree *tree, __isl_take isl_multi_val *mv);
152 __isl_give isl_schedule_tree *isl_schedule_tree_band_scale_down(
153 __isl_take isl_schedule_tree *tree, __isl_take isl_multi_val *mv);
154 __isl_give isl_schedule_tree *isl_schedule_tree_band_tile(
155 __isl_take isl_schedule_tree *tree, __isl_take isl_multi_val *sizes);
156 __isl_give isl_schedule_tree *isl_schedule_tree_band_split(
157 __isl_take isl_schedule_tree *tree, int pos);
158 __isl_give isl_schedule_tree *isl_schedule_tree_band_gist(
159 __isl_take isl_schedule_tree *tree, __isl_take isl_union_set *context);
161 __isl_give isl_schedule_tree *isl_schedule_tree_child(
162 __isl_take isl_schedule_tree *tree, int pos);
163 __isl_give isl_schedule_tree *isl_schedule_tree_reset_children(
164 __isl_take isl_schedule_tree *tree);
165 __isl_give isl_schedule_tree *isl_schedule_tree_drop_child(
166 __isl_take isl_schedule_tree *tree, int pos);
167 __isl_give isl_schedule_tree *isl_schedule_tree_replace_child(
168 __isl_take isl_schedule_tree *tree, int pos,
169 __isl_take isl_schedule_tree *new_child);
171 __isl_give isl_schedule_tree *isl_schedule_tree_reset_user(
172 __isl_take isl_schedule_tree *tree);
173 __isl_give isl_schedule_tree *isl_schedule_tree_align_params(
174 __isl_take isl_schedule_tree *tree, __isl_take isl_space *space);
175 __isl_give isl_schedule_tree *isl_schedule_tree_pullback_union_pw_multi_aff(
176 __isl_take isl_schedule_tree *tree,
177 __isl_take isl_union_pw_multi_aff *upma);
179 __isl_give isl_printer *isl_printer_print_schedule_tree(
180 __isl_take isl_printer *p, __isl_keep isl_schedule_tree *tree);
181 __isl_give isl_printer *isl_printer_print_schedule_tree_mark(
182 __isl_take isl_printer *p, __isl_keep isl_schedule_tree *tree,
183 int n_ancestor, int *child_pos);
185 #endif