7 #include <isl/union_map.h>
9 #if defined(__cplusplus)
14 ISL_ARG_DECL(pet_options
, struct pet_options
, pet_options_args
)
16 /* If autodetect is set, any valid scop is extracted.
17 * Otherwise, the scop needs to be delimited by pragmas.
19 int pet_options_set_autodetect(isl_ctx
*ctx
, int val
);
20 int pet_options_get_autodetect(isl_ctx
*ctx
);
22 #define PET_OVERFLOW_AVOID 0
23 #define PET_OVERFLOW_IGNORE 1
24 int pet_options_set_signed_overflow(isl_ctx
*ctx
, int val
);
25 int pet_options_get_signed_overflow(isl_ctx
*ctx
);
38 /* only compound assignments operators before assignment */
63 /* Index into the pet_expr->args array when pet_expr->type == pet_expr_unary
65 enum pet_un_arg_type
{
69 /* Indices into the pet_expr->args array when
70 * pet_expr->type == pet_expr_binary
72 enum pet_bin_arg_type
{
77 /* Indices into the pet_expr->args array when
78 * pet_expr->type == pet_expr_ternary
80 enum pet_ter_arg_type
{
86 /* d is valid when type == pet_expr_double
87 * acc is valid when type == pet_expr_access
88 * name is valid when type == pet_expr_call
89 * type is valid when type == pet_expr_cast
90 * op is valid otherwise
92 * For each access expression inside the body of a statement, acc.ref_id
93 * is a unique reference identifier.
94 * acc.access usually maps an iteration space to a data space.
95 * If the access has arguments, however, then the domain of the
96 * mapping is a wrapped mapping from the iteration space
97 * to a space of dimensionality equal to the number of arguments.
98 * Each dimension in this space corresponds to the value of the
99 * corresponding argument.
101 * If the data space is unnamed (and 1D), then it represents
102 * the set of integers. That is, the access represents a value that
103 * is equal to the index.
105 * A double is represented as both an (approximate) value "val" and
106 * a string representation "s".
109 enum pet_expr_type type
;
112 struct pet_expr
**args
;
131 /* If the statement has arguments, i.e., n_arg != 0, then
132 * "domain" is a wrapped map, mapping the iteration domain
133 * to the values of the arguments for which this statement
135 * Otherwise, it is simply the iteration domain.
137 * If one of the arguments is an access expression that accesses
138 * more than one element for a given iteration, then the constraints
139 * on the value of this argument (encoded in "domain") should be satisfied
140 * for all of those accessed elements.
146 struct pet_expr
*body
;
149 struct pet_expr
**args
;
152 /* context holds constraints on the parameter that ensure that
153 * this array has a valid (i.e., non-negative) size
155 * extent holds constraints on the indices
157 * value_bounds holds constraints on the elements of the array
158 * and may be NULL if no such constraints were specified by the user
160 * element_size is the size in bytes of each array element
162 * live_out is set if the array appears in a live-out pragma
164 * if uniquely_defined is set then the array is written by a single access
165 * such that any element that is ever read
166 * is known to be assigned exactly once before the read
168 * declared is set if the array was declared somewhere inside the scop.
169 * exposed is set if the declared array is visible outside the scop.
174 isl_set
*value_bounds
;
178 int uniquely_defined
;
183 /* This structure represents an implication on a boolean filter.
184 * In particular, if the filter value of an element in the domain
185 * of "extension" is equal to "satisfied", then the filter values
186 * of the corresponding images in "extension" are also equal
189 struct pet_implication
{
194 /* The start and end fields contain the offsets in the input file
195 * of the scop, where end points to the first character after the scop.
196 * If the scop was detected based on scop and endscop pragmas, then
197 * the lines containing these pragmas are included in this range.
198 * Internally, end may be zero to indicate that no offset information is
200 * The context describes the set of parameter values for which
201 * the scop can be executed.
202 * context_value describes assignments to the parameters (if any)
203 * outside of the scop.
205 * The n_implication implications describe implications on boolean filters.
212 isl_set
*context_value
;
215 struct pet_array
**arrays
;
218 struct pet_stmt
**stmts
;
221 struct pet_implication
**implications
;
224 /* Return a textual representation of the operator. */
225 const char *pet_op_str(enum pet_op_type op
);
226 int pet_op_is_inc_dec(enum pet_op_type op
);
228 /* Extract a pet_scop from a C source file.
229 * If function is not NULL, then the pet_scop is extracted from
230 * a function with that name.
232 struct pet_scop
*pet_scop_extract_from_C_source(isl_ctx
*ctx
,
233 const char *filename
, const char *function
);
235 /* Update all isl_sets and isl_maps such that they all have the same
236 * parameters in the same order.
238 struct pet_scop
*pet_scop_align_params(struct pet_scop
*scop
);
240 void pet_scop_dump(struct pet_scop
*scop
);
241 void *pet_scop_free(struct pet_scop
*scop
);
243 __isl_give isl_union_set
*pet_scop_collect_domains(struct pet_scop
*scop
);
244 /* Collect all read access relations. */
245 __isl_give isl_union_map
*pet_scop_collect_reads(struct pet_scop
*scop
);
246 /* Collect all write access relations. */
247 __isl_give isl_union_map
*pet_scop_collect_writes(struct pet_scop
*scop
);
248 __isl_give isl_union_map
*pet_scop_collect_schedule(struct pet_scop
*scop
);
250 #if defined(__cplusplus)