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
);
37 /* only compound assignments operators before assignment */
62 /* Index into the pet_expr->args array when pet_expr->type == pet_expr_unary
64 enum pet_un_arg_type
{
68 /* Indices into the pet_expr->args array when
69 * pet_expr->type == pet_expr_binary
71 enum pet_bin_arg_type
{
76 /* Indices into the pet_expr->args array when
77 * pet_expr->type == pet_expr_ternary
79 enum pet_ter_arg_type
{
85 /* d is valid when type == pet_expr_double
86 * acc is valid when type == pet_expr_access
87 * name is valid when type == pet_expr_call
88 * op is valid otherwise
90 * acc.access usually maps an iteration space to a data space.
91 * If the access has arguments, however, then the domain of the
92 * mapping is a wrapped mapping from the iteration space
93 * to a space of dimensionality equal to the number of arguments.
94 * Each dimension in this space corresponds to the value of the
95 * corresponding argument.
97 * If the data space is unnamed (and 1D), then it represents
98 * the set of integers. That is, the access represents a value that
99 * is equal to the index.
102 enum pet_expr_type type
;
105 struct pet_expr
**args
;
119 /* If the statement has arguments, i.e., n_arg != 0, then
120 * "domain" is a wrapped map, mapping the iteration domain
121 * to the values of the arguments for which this statement
123 * Otherwise, it is simply the iteration domain.
125 * If one of the arguments is an access expression that accesses
126 * more than one element for a given iteration, then the constraints
127 * on the value of this argument (encoded in "domain") should be satisfied
128 * for all of those accessed elements.
134 struct pet_expr
*body
;
137 struct pet_expr
**args
;
140 /* context holds constraints on the parameter that ensure that
141 * this array has a valid (i.e., non-negative) size
143 * extent holds constraints on the indices
145 * value_bounds holds constraints on the elements of the array
146 * and may be NULL if no such constraints were specified by the user
148 * element_size is the size in bytes of each array element
150 * live_out is set if the array appears in a live-out pragma
152 * if uniquely_defined is set then the array is written by a single access
153 * such that any element that is ever read
154 * is known to be assigned exactly once before the read
156 * declared is set if the array was declared somewhere inside the scop.
157 * exposed is set if the declared array is visible outside the scop.
162 isl_set
*value_bounds
;
166 int uniquely_defined
;
171 /* The context describes the set of parameter values for which
172 * the scop can be executed.
173 * context_value describes assignments to the parameters (if any)
174 * outside of the scop.
178 isl_set
*context_value
;
181 struct pet_array
**arrays
;
184 struct pet_stmt
**stmts
;
187 /* Return a textual representation of the operator. */
188 const char *pet_op_str(enum pet_op_type op
);
189 int pet_op_is_inc_dec(enum pet_op_type op
);
191 /* Extract a pet_scop from a C source file.
192 * If function is not NULL, then the pet_scop is extracted from
193 * a function with that name.
195 struct pet_scop
*pet_scop_extract_from_C_source(isl_ctx
*ctx
,
196 const char *filename
, const char *function
);
198 /* Update all isl_sets and isl_maps such that they all have the same
199 * parameters in the same order.
201 struct pet_scop
*pet_scop_align_params(struct pet_scop
*scop
);
203 void pet_scop_dump(struct pet_scop
*scop
);
204 void *pet_scop_free(struct pet_scop
*scop
);
206 __isl_give isl_union_set
*pet_scop_collect_domains(struct pet_scop
*scop
);
207 /* Collect all read access relations. */
208 __isl_give isl_union_map
*pet_scop_collect_reads(struct pet_scop
*scop
);
209 /* Collect all write access relations. */
210 __isl_give isl_union_map
*pet_scop_collect_writes(struct pet_scop
*scop
);
211 __isl_give isl_union_map
*pet_scop_collect_schedule(struct pet_scop
*scop
);
213 #if defined(__cplusplus)