Polly 20.0.0git
isl_ast_build_private.h
Go to the documentation of this file.
1#ifndef ISL_AST_BUILD_PRIVATE_H
2#define ISL_AST_BUILD_PRIVATE_H
3
4#include <isl/aff.h>
5#include <isl/ast.h>
6#include <isl/ast_build.h>
7#include <isl/set.h>
8#include <isl/list.h>
9#include <isl/schedule_node.h>
10
11/* An isl_ast_build represents the context in which AST is being
12 * generated. That is, it (mostly) contains information about outer
13 * loops that can be used to simplify inner loops.
14 *
15 * "domain" represents constraints on the internal schedule domain,
16 * corresponding to the context of the AST generation and the constraints
17 * implied by the loops that have already been generated.
18 * When an isl_ast_build is first created, outside any AST generation,
19 * the domain is typically a parameter set. It is only when a AST
20 * generation phase is initiated that the domain of the isl_ast_build
21 * is changed to refer to the internal schedule domain.
22 * The domain then lives in a space of the form
23 *
24 * S
25 *
26 * or
27 *
28 * [O -> S]
29 *
30 * O represents the loops generated in outer AST generations.
31 * S represents the loops (both generated and to be generated)
32 * of the current AST generation.
33 * Both include eliminated loops.
34 * "domain" is expected not to have any unknown divs because
35 * it is used as the context argument in a call to isl_basic_set_gist
36 * in isl_ast_build_compute_gist_basic_set.
37 *
38 * "depth" is equal to the number of loops that have already
39 * been generated (including those in outer AST generations).
40 * "outer_pos" is equal to the number of loops in outer AST generations.
41 *
42 * "generated" is a superset of "domain" corresponding to those
43 * constraints that were either given by the user or that have
44 * effectively been generated (as bounds on a for loop).
45 *
46 * "pending" is a superset of "domain" corresponding to the constraints
47 * that still need to be generated (as guards), but that may end up
48 * not getting generated if they are implied by any constraints
49 * enforced by inner loops.
50 *
51 * "strides" contains the stride of each loop. The number of elements
52 * is equal to the number of dimensions in "domain".
53 * "offsets" contains the offsets of strided loops. If s is the stride
54 * for a given dimension and f is the corresponding offset, then the
55 * dimension takes on values
56 *
57 * f + s a
58 *
59 * with a an integer. For non-strided loops, the offset is zero.
60 *
61 * "iterators" contains the loop iterators of both generated and
62 * to be generated loops. The number of elements is at least as
63 * large as the dimension of the internal schedule domain. The
64 * number may be larger, in which case the additional ids can be
65 * used in a nested AST generation should the schedule be non-injective.
66 *
67 * "values" lives in the space
68 *
69 * [O -> S] -> [O -> S] (or S -> S)
70 *
71 * and expresses (if possible) loop iterators in terms of parameters
72 * and outer loop iterators. If the value of a given loop iterator
73 * cannot be expressed as an affine expression (either because the iterator
74 * attains multiple values or because the single value is a piecewise
75 * affine expression), then it is expressed in "values" as being equal
76 * to itself.
77 *
78 * "value" is the value of the loop iterator at the current depth.
79 * It is NULL if it has not been computed yet or if the value of the
80 * given loop iterator cannot be expressed as a piecewise affine expression
81 * (because the iterator attains multiple values).
82 *
83 * "schedule_map" maps the internal schedule domain to the external schedule
84 * domain. It may be NULL if it hasn't been computed yet.
85 * See isl_ast_build_get_schedule_map_multi_aff.
86 *
87 * "internal2input" maps the internal schedule domain to the original
88 * input schedule domain. In case of a schedule tree input, the original
89 * input schedule domain consist of the flat product of all outer
90 * band node spaces, including the current band node.
91 * It may be NULL if there no longer is such a uniform mapping
92 * (because different iterations have been rescheduled differently).
93 *
94 * "options" contains the AST build options in case we are generating
95 * an AST from a flat schedule map. When creating an AST from a schedule
96 * tree, this field is ignored.
97 *
98 * The "create_leaf" callback is called for every leaf in the generated AST.
99 * The callback is responsible for creating the node to be placed at those
100 * leaves. If this callback is not set, then isl will generated user
101 * nodes with call expressions corresponding to an element of the domain.
102 *
103 * The "at_each_domain" callback is called on every node created to represent
104 * an element of the domain. Each of these nodes is a user node
105 * with as expression a call expression.
106 *
107 * The "before_each_for" callback is called on each for node before
108 * its children have been created.
109 *
110 * The "after_each_for" callback is called on each for node after
111 * its children have been created.
112 *
113 * The "before_each_mark" callback is called before we handle the subtree
114 * of an isl_schedule_node_mark node.
115 *
116 * The "after_each_mark" callback is called after we have handled the subtree
117 * of an isl_schedule_node_mark node.
118 *
119 * "executed" contains the inverse schedule at this point
120 * of the AST generation.
121 * It is currently only used in isl_ast_build_get_schedule, which is
122 * in turn only used by user code from within a callback.
123 * The value is set right before we may be calling such a callback.
124 *
125 * "single_valued" is set if the current inverse schedule (which may or may
126 * not be stored in "executed") is known to be single valued, specifically
127 * an inverse schedule that was not (appeared not to be) single valued
128 * is extended to a single valued inverse schedule. This is mainly used
129 * to avoid an infinite recursion when we fail to detect later on that
130 * the extended inverse schedule is single valued.
131 *
132 * "node" points to the current band node in case we are generating
133 * an AST from a schedule tree. It may be NULL if we are not generating
134 * an AST from a schedule tree or if we are not inside a band node.
135 *
136 * "loop_type" originally contains loop AST generation types for
137 * the "n" members of "node" and it is updated (along with "n") when
138 * a schedule dimension is inserted.
139 * It is NULL if "node" is NULL.
140 *
141 * "isolated" is the piece of the schedule domain isolated by the isolate
142 * option on the current band. This set may be NULL if we have not checked
143 * for the isolate option yet.
144 */
146 int ref;
147
149 int depth;
150
151 isl_id_list *iterators;
152
157
159
162
165
167
168 __isl_give isl_ast_node *(*at_each_domain)(
170 __isl_keep isl_ast_build *build, void *user);
172
173 __isl_give isl_id *(*before_each_for)(
176 __isl_give isl_ast_node *(*after_each_for)(
180
182 __isl_keep isl_ast_build *build, void *user);
184 __isl_give isl_ast_node *(*after_each_mark)(
188
189 __isl_give isl_ast_node *(*create_leaf)(
190 __isl_take isl_ast_build *build, void *user);
192
195
197 int n;
200};
201
208 enum isl_dim_type type);
210 __isl_keep isl_ast_build *build, int internal);
216 __isl_take isl_ast_build *build, int pos);
221 __isl_take isl_ast_build *build, __isl_take isl_space *embedding);
232 __isl_take isl_union_map *executed);
234 __isl_take isl_ast_build *build, int sv);
253 int pos);
256 __isl_keep isl_ast_build *build, int pos);
257
266
272
289
292
295
298 int pos);
300 int pos);
305
307
318
320 __isl_keep isl_ast_build *build, int isolated);
321
324
326
327#endif
struct isl_multi_aff isl_multi_aff
Definition: aff_type.h:29
isl_ast_loop_type
Definition: ast_type.h:91
#define __isl_take
Definition: ctx.h:22
isl_stat
Definition: ctx.h:84
#define __isl_give
Definition: ctx.h:19
#define __isl_keep
Definition: ctx.h:25
int isl_size
Definition: ctx.h:96
isl_bool
Definition: ctx.h:89
m
Definition: guard1-0.c:2
isl_stat isl_stat(*) void user)
Definition: hmap.h:39
__isl_give isl_ast_build * isl_ast_build_increase_depth(__isl_take isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_set_single_valued(__isl_take isl_ast_build *build, int sv)
int isl_ast_build_has_value(__isl_keep isl_ast_build *build)
__isl_give isl_set * isl_ast_build_eliminate_inner(__isl_keep isl_ast_build *build, __isl_take isl_set *set)
__isl_give isl_aff * isl_ast_build_get_offset(__isl_keep isl_ast_build *build, int pos)
enum isl_ast_loop_type isl_ast_build_get_loop_type(__isl_keep isl_ast_build *build, int isolated)
__isl_give isl_map * isl_ast_build_map_to_iterator(__isl_keep isl_ast_build *build, __isl_take isl_set *set)
Definition: isl_ast_build.c:32
__isl_give isl_ast_build * isl_ast_build_product(__isl_take isl_ast_build *build, __isl_take isl_space *embedding)
__isl_give isl_set * isl_ast_build_specialize(__isl_keep isl_ast_build *build, __isl_take isl_set *set)
__isl_give isl_ast_build * isl_ast_build_include_stride(__isl_take isl_ast_build *build)
isl_bool isl_ast_build_has_stride(__isl_keep isl_ast_build *build, int pos)
__isl_give isl_basic_set * isl_ast_build_compute_gist_basic_set(__isl_keep isl_ast_build *build, __isl_take isl_basic_set *bset)
__isl_give isl_ast_build * isl_ast_build_align_params(__isl_take isl_ast_build *build, __isl_take isl_space *model)
__isl_give isl_ast_build * isl_ast_build_cow(__isl_take isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_extract_isolated(__isl_take isl_ast_build *build)
isl_bool isl_ast_build_need_schedule_map(__isl_keep isl_ast_build *build)
__isl_give isl_set * isl_ast_build_eliminate_divs(__isl_keep isl_ast_build *build, __isl_take isl_set *set)
__isl_give isl_ast_build * isl_ast_build_scale_down(__isl_take isl_ast_build *build, __isl_take isl_val *m, __isl_take isl_union_map *umap)
isl_bool isl_ast_build_aff_is_nonneg(__isl_keep isl_ast_build *build, __isl_keep isl_aff *aff)
__isl_give isl_pw_aff * isl_ast_build_compute_gist_pw_aff(__isl_keep isl_ast_build *build, __isl_take isl_pw_aff *pa)
__isl_give isl_ast_build * isl_ast_build_detect_strides(__isl_take isl_ast_build *build, __isl_take isl_set *set)
__isl_give isl_ast_build * isl_ast_build_reset_schedule_node(__isl_take isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_clear_local_info(__isl_take isl_ast_build *build)
__isl_give isl_set * isl_ast_build_compute_gist(__isl_keep isl_ast_build *build, __isl_take isl_set *set)
__isl_give isl_set * isl_ast_build_get_generated(__isl_keep isl_ast_build *build)
void isl_ast_build_dump(__isl_keep isl_ast_build *build)
__isl_give isl_aff * isl_ast_build_compute_gist_aff(__isl_keep isl_ast_build *build, __isl_take isl_aff *aff)
__isl_give isl_map * isl_ast_build_get_schedule_map(__isl_keep isl_ast_build *build)
__isl_give isl_union_map * isl_ast_build_substitute_values_union_map_domain(__isl_keep isl_ast_build *build, __isl_take isl_union_map *umap)
int isl_ast_build_has_schedule_node(__isl_keep isl_ast_build *build)
__isl_give isl_map * isl_ast_build_get_separation_class(__isl_keep isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_replace_pending_by_guard(__isl_take isl_ast_build *build, __isl_take isl_set *guard)
__isl_give isl_space * isl_ast_build_get_space(__isl_keep isl_ast_build *build, int internal)
int isl_ast_build_has_isolated(__isl_keep isl_ast_build *build)
__isl_give isl_set * isl_ast_build_get_stride_constraint(__isl_keep isl_ast_build *build)
__isl_give isl_val * isl_ast_build_get_stride(__isl_keep isl_ast_build *build, int pos)
__isl_give isl_ast_build * isl_ast_build_set_executed(__isl_take isl_ast_build *build, __isl_take isl_union_map *executed)
__isl_give isl_multi_aff * isl_ast_build_get_stride_expansion(__isl_keep isl_ast_build *build)
isl_size isl_ast_build_get_depth(__isl_keep isl_ast_build *build)
__isl_give isl_set * isl_ast_build_get_domain(__isl_keep isl_ast_build *build)
__isl_give isl_ast_build * isl_ast_build_set_loop_bounds(__isl_take isl_ast_build *build, __isl_take isl_basic_set *bounds)
__isl_give isl_ast_build * isl_ast_build_restrict_generated(__isl_take isl_ast_build *build, __isl_take isl_set *set)
__isl_give isl_set * isl_ast_build_get_option_domain(__isl_keep isl_ast_build *build, enum isl_ast_loop_type type)
__isl_give isl_id * isl_ast_build_get_iterator_id(__isl_keep isl_ast_build *build, int pos)
__isl_give isl_ast_build * isl_ast_build_set_pending_generated(__isl_take isl_ast_build *build, __isl_take isl_basic_set *bounds)
__isl_give isl_set * isl_ast_build_get_isolated(__isl_keep isl_ast_build *build)
__isl_give isl_schedule_node * isl_ast_build_get_schedule_node(__isl_keep isl_ast_build *build)
int isl_ast_build_options_involve_depth(__isl_keep isl_ast_build *build)
__isl_give isl_pw_multi_aff * isl_ast_build_compute_gist_pw_multi_aff(__isl_keep isl_ast_build *build, __isl_take isl_pw_multi_aff *pma)
__isl_give isl_map * isl_ast_build_compute_gist_map_domain(__isl_keep isl_ast_build *build, __isl_take isl_map *map)
isl_size isl_ast_build_dim(__isl_keep isl_ast_build *build, enum isl_dim_type type)
__isl_give isl_ast_build * isl_ast_build_insert_dim(__isl_take isl_ast_build *build, int pos)
isl_bool isl_ast_build_has_affine_value(__isl_keep isl_ast_build *build, int pos)
__isl_give isl_set * isl_ast_build_get_pending(__isl_keep isl_ast_build *build)
__isl_give isl_set * isl_ast_build_eliminate(__isl_keep isl_ast_build *build, __isl_take isl_set *domain)
__isl_give isl_ast_build * isl_ast_build_set_schedule_node(__isl_take isl_ast_build *build, __isl_take isl_schedule_node *node)
__isl_give isl_basic_set * isl_ast_build_specialize_basic_set(__isl_keep isl_ast_build *build, __isl_take isl_basic_set *bset)
__isl_give isl_multi_aff * isl_ast_build_get_internal2input(__isl_keep isl_ast_build *build)
__isl_give isl_multi_aff * isl_ast_build_get_schedule_map_multi_aff(__isl_keep isl_ast_build *build)
static unsigned pos(__isl_keep isl_space *space, enum isl_dim_type type)
Definition: isl_map.c:70
int sv
Definition: isl_test.c:3704
enum isl_fold type
Definition: isl_test.c:4017
const char * set
Definition: isl_test.c:1356
const char * map
Definition: isl_test.c:1783
const char * pma
Definition: isl_test.c:3169
const char * context
Definition: isl_test.c:1784
const char * aff
Definition: isl_test.c:7278
struct isl_set isl_set
Definition: map_type.h:26
struct isl_basic_set isl_basic_set
Definition: map_type.h:20
isl_dim_type
Definition: space_type.h:13
isl_union_map * options
isl_id_list * iterators
isl_union_map * executed
isl_stat(* before_each_mark)(__isl_keep isl_id *mark, __isl_keep isl_ast_build *build, void *user)
isl_schedule_node * node
enum isl_ast_loop_type * loop_type
isl_multi_aff * schedule_map
isl_multi_aff * internal2input
isl_multi_aff * offsets
isl_multi_aff * values
static Signature domain