• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef PET_H
2 #define PET_H
3 
4 #include <isl/aff.h>
5 #include <isl/arg.h>
6 #include <isl/ast_build.h>
7 #include <isl/set.h>
8 #include <isl/map.h>
9 #include <isl/union_map.h>
10 #include <isl/printer.h>
11 #include <isl/id_to_ast_expr.h>
12 #include <isl/id_to_pw_aff.h>
13 #include <isl/schedule.h>
14 
15 #if defined(__cplusplus)
16 extern "C" {
17 #endif
18 
19 struct pet_options;
20 ISL_ARG_DECL(pet_options, struct pet_options, pet_options_args)
21 
22 /* Create an isl_ctx that references the pet options. */
23 isl_ctx *isl_ctx_alloc_with_pet_options();
24 
25 /* If autodetect is set, any valid scop is extracted.
26  * Otherwise, the scop needs to be delimited by pragmas.
27  */
28 int pet_options_set_autodetect(isl_ctx *ctx, int val);
29 int pet_options_get_autodetect(isl_ctx *ctx);
30 
31 int pet_options_set_detect_conditional_assignment(isl_ctx *ctx, int val);
32 int pet_options_get_detect_conditional_assignment(isl_ctx *ctx);
33 
34 /* If encapsulate-dynamic-control is set, then any dynamic control
35  * in the input program will be encapsulated in macro statements.
36  * This means in particular that no statements with arguments
37  * will be created.
38  */
39 int pet_options_set_encapsulate_dynamic_control(isl_ctx *ctx, int val);
40 int pet_options_get_encapsulate_dynamic_control(isl_ctx *ctx);
41 
42 #define	PET_OVERFLOW_AVOID	0
43 #define	PET_OVERFLOW_IGNORE	1
44 int pet_options_set_signed_overflow(isl_ctx *ctx, int val);
45 int pet_options_get_signed_overflow(isl_ctx *ctx);
46 
47 struct pet_loc;
48 typedef struct pet_loc pet_loc;
49 
50 /* Return an additional reference to "loc". */
51 __isl_give pet_loc *pet_loc_copy(__isl_keep pet_loc *loc);
52 /* Free a reference to "loc". */
53 pet_loc *pet_loc_free(__isl_take pet_loc *loc);
54 
55 /* Return the offset in the input file of the start of "loc". */
56 unsigned pet_loc_get_start(__isl_keep pet_loc *loc);
57 /* Return the offset in the input file of the character after "loc". */
58 unsigned pet_loc_get_end(__isl_keep pet_loc *loc);
59 /* Return the line number of a line within the "loc" region. */
60 int pet_loc_get_line(__isl_keep pet_loc *loc);
61 /* Return the indentation of the "loc" region. */
62 __isl_keep const char *pet_loc_get_indent(__isl_keep pet_loc *loc);
63 
64 enum pet_expr_type {
65 	pet_expr_error = -1,
66 	pet_expr_access,
67 	pet_expr_call,
68 	pet_expr_cast,
69 	pet_expr_int,
70 	pet_expr_double,
71 	pet_expr_op
72 };
73 
74 enum pet_op_type {
75 	/* only compound assignments operators before assignment */
76 	pet_op_add_assign,
77 	pet_op_sub_assign,
78 	pet_op_mul_assign,
79 	pet_op_div_assign,
80 	pet_op_and_assign,
81 	pet_op_xor_assign,
82 	pet_op_or_assign,
83 	pet_op_assign,
84 	pet_op_add,
85 	pet_op_sub,
86 	pet_op_mul,
87 	pet_op_div,
88 	pet_op_mod,
89 	pet_op_shl,
90 	pet_op_shr,
91 	pet_op_eq,
92 	pet_op_ne,
93 	pet_op_le,
94 	pet_op_ge,
95 	pet_op_lt,
96 	pet_op_gt,
97 	pet_op_minus,
98 	pet_op_post_inc,
99 	pet_op_post_dec,
100 	pet_op_pre_inc,
101 	pet_op_pre_dec,
102 	pet_op_address_of,
103 	pet_op_assume,
104 	pet_op_kill,
105 	pet_op_and,
106 	pet_op_xor,
107 	pet_op_or,
108 	pet_op_not,
109 	pet_op_land,
110 	pet_op_lor,
111 	pet_op_lnot,
112 	pet_op_cond,
113 	pet_op_last
114 };
115 
116 /* Index into the pet_expr->args array when pet_expr->type == pet_expr_unary
117  */
118 enum pet_un_arg_type {
119 	pet_un_arg
120 };
121 
122 /* Indices into the pet_expr->args array when
123  * pet_expr->type == pet_expr_binary
124  */
125 enum pet_bin_arg_type {
126 	pet_bin_lhs,
127 	pet_bin_rhs
128 };
129 
130 /* Indices into the pet_expr->args array when
131  * pet_expr->type == pet_expr_ternary
132  */
133 enum pet_ter_arg_type {
134 	pet_ter_cond,
135 	pet_ter_true,
136 	pet_ter_false
137 };
138 
139 struct pet_expr;
140 typedef struct pet_expr pet_expr;
141 
142 /* Return an additional reference to "expr". */
143 __isl_give pet_expr *pet_expr_copy(__isl_keep pet_expr *expr);
144 /* Free a reference to "expr". */
145 __isl_null pet_expr *pet_expr_free(__isl_take pet_expr *expr);
146 
147 /* Return the isl_ctx in which "expr" was created. */
148 isl_ctx *pet_expr_get_ctx(__isl_keep pet_expr *expr);
149 
150 /* Return the type of "expr". */
151 enum pet_expr_type pet_expr_get_type(__isl_keep pet_expr *expr);
152 /* Return the number of arguments of "expr". */
153 int pet_expr_get_n_arg(__isl_keep pet_expr *expr);
154 /* Set the number of arguments of "expr" to "n". */
155 __isl_give pet_expr *pet_expr_set_n_arg(__isl_take pet_expr *expr, int n);
156 /* Return the argument of "expr" at position "pos". */
157 __isl_give pet_expr *pet_expr_get_arg(__isl_keep pet_expr *expr, int pos);
158 /* Replace the argument of "expr" at position "pos" by "arg". */
159 __isl_give pet_expr *pet_expr_set_arg(__isl_take pet_expr *expr, int pos,
160 	__isl_take pet_expr *arg);
161 
162 /* Return the operation type of operation expression "expr". */
163 enum pet_op_type pet_expr_op_get_type(__isl_keep pet_expr *expr);
164 /* Replace the operation type of operation expression "expr" by "type". */
165 __isl_give pet_expr *pet_expr_op_set_type(__isl_take pet_expr *expr,
166 	enum pet_op_type type);
167 
168 /* Construct a (read) access pet_expr from an index expression. */
169 __isl_give pet_expr *pet_expr_from_index(__isl_take isl_multi_pw_aff *index);
170 
171 /* Does "expr" represent an affine expression? */
172 isl_bool pet_expr_is_affine(__isl_keep pet_expr *expr);
173 /* Does the access expression "expr" read the accessed elements? */
174 isl_bool pet_expr_access_is_read(__isl_keep pet_expr *expr);
175 /* Does the access expression "expr" write to the accessed elements? */
176 isl_bool pet_expr_access_is_write(__isl_keep pet_expr *expr);
177 /* Does the access expression "expr" kill the accessed elements? */
178 isl_bool pet_expr_access_is_kill(__isl_keep pet_expr *expr);
179 /* Mark "expr" as a read depending on "read". */
180 __isl_give pet_expr *pet_expr_access_set_read(__isl_take pet_expr *expr,
181 	int read);
182 /* Mark "expr" as a write depending on "write". */
183 __isl_give pet_expr *pet_expr_access_set_write(__isl_take pet_expr *expr,
184 	int write);
185 /* Mark "expr" as a kill depending on "kill". */
186 __isl_give pet_expr *pet_expr_access_set_kill(__isl_take pet_expr *expr,
187 	int kill);
188 /* Return the reference identifier of access expression "expr". */
189 __isl_give isl_id *pet_expr_access_get_ref_id(__isl_keep pet_expr *expr);
190 /* Replace the reference identifier of access expression "expr" by "ref_id". */
191 __isl_give pet_expr *pet_expr_access_set_ref_id(__isl_take pet_expr *expr,
192 	__isl_take isl_id *ref_id);
193 /* Return the identifier of the outer array accessed by "expr". */
194 __isl_give isl_id *pet_expr_access_get_id(__isl_keep pet_expr *expr);
195 /* Return the index expression of access expression "expr". */
196 __isl_give isl_multi_pw_aff *pet_expr_access_get_index(
197 	__isl_keep pet_expr *expr);
198 
199 /* Return the potential read access relation of access expression "expr". */
200 __isl_give isl_union_map *pet_expr_access_get_may_read(
201 	__isl_keep pet_expr *expr);
202 /* Return the potential write access relation of access expression "expr". */
203 __isl_give isl_union_map *pet_expr_access_get_may_write(
204 	__isl_keep pet_expr *expr);
205 /* Return the definite write access relation of access expression "expr". */
206 __isl_give isl_union_map *pet_expr_access_get_must_write(
207 	__isl_keep pet_expr *expr);
208 /* Return the argument dependent potential read access relation of "expr". */
209 __isl_give isl_union_map *pet_expr_access_get_dependent_may_read(
210 	__isl_keep pet_expr *expr);
211 /* Return the argument dependent potential write access relation of "expr". */
212 __isl_give isl_union_map *pet_expr_access_get_dependent_may_write(
213 	__isl_keep pet_expr *expr);
214 /* Return the argument dependent definite write access relation of "expr". */
215 __isl_give isl_union_map *pet_expr_access_get_dependent_must_write(
216 	__isl_keep pet_expr *expr);
217 /* Return the tagged potential read access relation of access "expr". */
218 __isl_give isl_union_map *pet_expr_access_get_tagged_may_read(
219 	__isl_keep pet_expr *expr);
220 /* Return the tagged potential write access relation of access "expr". */
221 __isl_give isl_union_map *pet_expr_access_get_tagged_may_write(
222 	__isl_keep pet_expr *expr);
223 
224 /* Return the name of the function called by "expr". */
225 __isl_keep const char *pet_expr_call_get_name(__isl_keep pet_expr *expr);
226 /* Replace the name of the function called by "expr" by "name". */
227 __isl_give pet_expr *pet_expr_call_set_name(__isl_take pet_expr *expr,
228 	__isl_keep const char *name);
229 
230 /* Create a pet_expr representing a cast of "arg" to "type_name". */
231 __isl_give pet_expr *pet_expr_new_cast(const char *type_name,
232 	__isl_take pet_expr *arg);
233 /* Replace the type of the cast performed by "expr" by "name". */
234 __isl_give pet_expr *pet_expr_cast_set_type_name(__isl_take pet_expr *expr,
235 	__isl_keep const char *name);
236 
237 /* Return the value of the integer represented by "expr". */
238 __isl_give isl_val *pet_expr_int_get_val(__isl_keep pet_expr *expr);
239 /* Replace the value of the integer represented by "expr" by "v". */
240 __isl_give pet_expr *pet_expr_int_set_val(__isl_take pet_expr *expr,
241 	__isl_take isl_val *v);
242 
243 /* Return a string representation of the double expression "expr". */
244 __isl_give char *pet_expr_double_get_str(__isl_keep pet_expr *expr);
245 /* Replace value and string representation of the double expression "expr" */
246 __isl_give pet_expr *pet_expr_double_set(__isl_take pet_expr *expr,
247 	double d, __isl_keep const char *s);
248 
249 /* Call "fn" on each of the subexpressions of "expr" of type pet_expr_access. */
250 int pet_expr_foreach_access_expr(__isl_keep pet_expr *expr,
251 	int (*fn)(__isl_keep pet_expr *expr, void *user), void *user);
252 /* Call "fn" on each of the subexpressions of "expr" of type pet_expr_call. */
253 int pet_expr_foreach_call_expr(__isl_keep pet_expr *expr,
254 	int (*fn)(__isl_keep pet_expr *expr, void *user), void *user);
255 
256 struct pet_context;
257 typedef struct pet_context pet_context;
258 
259 /* Create a context with the given domain. */
260 __isl_give pet_context *pet_context_alloc(__isl_take isl_set *domain);
261 /* Return an additional reference to "pc". */
262 __isl_give pet_context *pet_context_copy(__isl_keep pet_context *pc);
263 /* Free a reference to "pc". */
264 __isl_null pet_context *pet_context_free(__isl_take pet_context *pc);
265 
266 /* Return the isl_ctx in which "pc" was created. */
267 isl_ctx *pet_context_get_ctx(__isl_keep pet_context *pc);
268 
269 /* Extract an affine expression defined over the domain of "pc" from "expr"
270  * or return NaN.
271  */
272 __isl_give isl_pw_aff *pet_expr_extract_affine(__isl_keep pet_expr *expr,
273 	__isl_keep pet_context *pc);
274 
275 void pet_expr_dump(__isl_keep pet_expr *expr);
276 
277 enum pet_tree_type {
278 	pet_tree_error = -1,
279 	pet_tree_expr,
280 	pet_tree_block,
281 	pet_tree_break,
282 	pet_tree_continue,
283 	pet_tree_decl,		/* A declaration without initialization */
284 	pet_tree_decl_init,	/* A declaration with initialization */
285 	pet_tree_if,		/* An if without an else branch */
286 	pet_tree_if_else,	/* An if with an else branch */
287 	pet_tree_for,
288 	pet_tree_infinite_loop,
289 	pet_tree_while,
290 	pet_tree_return,
291 };
292 
293 struct pet_tree;
294 typedef struct pet_tree pet_tree;
295 
296 /* Return the isl_ctx in which "tree" was created. */
297 isl_ctx *pet_tree_get_ctx(__isl_keep pet_tree *tree);
298 
299 /* Return an additional reference to "tree". */
300 __isl_give pet_tree *pet_tree_copy(__isl_keep pet_tree *tree);
301 /* Free a reference to "tree". */
302 __isl_null pet_tree *pet_tree_free(__isl_take pet_tree *tree);
303 
304 /* Return the location of "tree". */
305 __isl_give pet_loc *pet_tree_get_loc(__isl_keep pet_tree *tree);
306 
307 /* Return the type of "tree". */
308 enum pet_tree_type pet_tree_get_type(__isl_keep pet_tree *tree);
309 
310 /* Return the expression of the expression tree "tree". */
311 __isl_give pet_expr *pet_tree_expr_get_expr(__isl_keep pet_tree *tree);
312 
313 /* Return the expression returned by the return tree "tree". */
314 __isl_give pet_expr *pet_tree_return_get_expr(__isl_keep pet_tree *tree);
315 
316 /* Return the number of children of the block tree "tree". */
317 int pet_tree_block_n_child(__isl_keep pet_tree *tree);
318 /* Return child "pos" of the block tree "tree". */
319 __isl_give pet_tree *pet_tree_block_get_child(__isl_keep pet_tree *tree,
320 	int pos);
321 
322 /* Is "tree" a declaration (with or without initialization)? */
323 int pet_tree_is_decl(__isl_keep pet_tree *tree);
324 /* Return the variable declared by the declaration tree "tree". */
325 __isl_give pet_expr *pet_tree_decl_get_var(__isl_keep pet_tree *tree);
326 /* Return the initial value of the pet_tree_decl_init tree "tree". */
327 __isl_give pet_expr *pet_tree_decl_get_init(__isl_keep pet_tree *tree);
328 
329 /* Return the condition of the if tree "tree". */
330 __isl_give pet_expr *pet_tree_if_get_cond(__isl_keep pet_tree *tree);
331 /* Return the then branch of the if tree "tree". */
332 __isl_give pet_tree *pet_tree_if_get_then(__isl_keep pet_tree *tree);
333 /* Return the else branch of the if tree with else branch "tree". */
334 __isl_give pet_tree *pet_tree_if_get_else(__isl_keep pet_tree *tree);
335 
336 /* Is "tree" a for loop, a while loop or an infinite loop? */
337 int pet_tree_is_loop(__isl_keep pet_tree *tree);
338 /* Return the induction variable of the for loop "tree" */
339 __isl_give pet_expr *pet_tree_loop_get_var(__isl_keep pet_tree *tree);
340 /* Return the initial value of the induction variable of the for loop "tree" */
341 __isl_give pet_expr *pet_tree_loop_get_init(__isl_keep pet_tree *tree);
342 /* Return the condition of the loop tree "tree" */
343 __isl_give pet_expr *pet_tree_loop_get_cond(__isl_keep pet_tree *tree);
344 /* Return the induction variable of the for loop "tree" */
345 __isl_give pet_expr *pet_tree_loop_get_inc(__isl_keep pet_tree *tree);
346 /* Return the body of the loop tree "tree" */
347 __isl_give pet_tree *pet_tree_loop_get_body(__isl_keep pet_tree *tree);
348 
349 /* Call "fn" on each top-level expression in the nodes of "tree" */
350 int pet_tree_foreach_expr(__isl_keep pet_tree *tree,
351 	int (*fn)(__isl_keep pet_expr *expr, void *user), void *user);
352 /* Call "fn" on each access subexpression in the nodes of "tree" */
353 int pet_tree_foreach_access_expr(__isl_keep pet_tree *tree,
354 	int (*fn)(__isl_keep pet_expr *expr, void *user), void *user);
355 /* Modify all call subexpressions in the nodes of "tree" through "fn". */
356 __isl_give pet_tree *pet_tree_map_call_expr(__isl_take pet_tree *tree,
357 	__isl_give pet_expr *(*fn)(__isl_take pet_expr *expr, void *user),
358 	void *user);
359 
360 void pet_tree_dump(__isl_keep pet_tree *tree);
361 
362 /* "loc" represents the region of the source code that is represented
363  * by this statement.
364  *
365  * If the statement has arguments, i.e., n_arg != 0, then
366  * "domain" is a wrapped map, mapping the iteration domain
367  * to the values of the arguments for which this statement
368  * is executed.
369  * Otherwise, it is simply the iteration domain.
370  *
371  * If one of the arguments is an access expression that accesses
372  * more than one element for a given iteration, then the constraints
373  * on the value of this argument (encoded in "domain") should be satisfied
374  * for all of those accessed elements.
375  */
376 struct pet_stmt {
377 	pet_loc *loc;
378 	isl_set *domain;
379 	pet_tree *body;
380 
381 	unsigned n_arg;
382 	pet_expr **args;
383 };
384 
385 /* Return the iteration space of "stmt". */
386 __isl_give isl_space *pet_stmt_get_space(struct pet_stmt *stmt);
387 
388 /* Is "stmt" an assignment statement? */
389 int pet_stmt_is_assign(struct pet_stmt *stmt);
390 /* Is "stmt" a kill statement? */
391 int pet_stmt_is_kill(struct pet_stmt *stmt);
392 
393 /* pet_stmt_build_ast_exprs is currently limited to only handle
394  * some forms of data dependent accesses.
395  * If pet_stmt_can_build_ast_exprs returns 1, then pet_stmt_build_ast_exprs
396  * can safely be called on "stmt".
397  */
398 int pet_stmt_can_build_ast_exprs(struct pet_stmt *stmt);
399 /* Construct an associative array from reference identifiers of
400  * access expressions in "stmt" to the corresponding isl_ast_expr.
401  * Each index expression is first transformed through "fn_index"
402  * (if not NULL).  Then an AST expression is generated using "build".
403  * Finally, the AST expression is transformed using "fn_expr"
404  * (if not NULL).
405  */
406 __isl_give isl_id_to_ast_expr *pet_stmt_build_ast_exprs(struct pet_stmt *stmt,
407 	__isl_keep isl_ast_build *build,
408 	__isl_give isl_multi_pw_aff *(*fn_index)(
409 		__isl_take isl_multi_pw_aff *mpa, __isl_keep isl_id *id,
410 		void *user), void *user_index,
411 	__isl_give isl_ast_expr *(*fn_expr)(__isl_take isl_ast_expr *expr,
412 		__isl_keep isl_id *id, void *user), void *user_expr);
413 
414 /* Print "stmt" to "p".
415  *
416  * The access expressions in "stmt" are replaced by the isl_ast_expr
417  * associated to its reference identifier in "ref2expr".
418  */
419 __isl_give isl_printer *pet_stmt_print_body(struct pet_stmt *stmt,
420 	__isl_take isl_printer *p, __isl_keep isl_id_to_ast_expr *ref2expr);
421 
422 /* This structure represents a defined type.
423  * "name" is the name of the type, while "definition" is a string
424  * representation of its definition.
425  */
426 struct pet_type {
427 	char *name;
428 	char *definition;
429 };
430 
431 /* context holds constraints on the parameter that ensure that
432  * this array has a valid (i.e., non-negative) size
433  *
434  * extent holds constraints on the indices
435  *
436  * value_bounds holds constraints on the elements of the array
437  * and may be NULL if no such constraints were specified by the user
438  *
439  * element_size is the size in bytes of each array element
440  * element_type is the type of the array elements.
441  * element_is_record is set if this type is a record type.
442  *
443  * live_out is set if the array appears in a live-out pragma
444  *
445  * if uniquely_defined is set then the array is written by a single access
446  * such that any element that is ever read
447  * is known to be assigned exactly once before the read
448  *
449  * declared is set if the array was declared somewhere inside the scop.
450  * exposed is set if the declared array is visible outside the scop.
451  * outer is set if the type of the array elements is a record and
452  * the fields of this record are represented by separate pet_array structures.
453  */
454 struct pet_array {
455 	isl_set *context;
456 	isl_set *extent;
457 	isl_set *value_bounds;
458 	char *element_type;
459 	int element_is_record;
460 	int element_size;
461 	int live_out;
462 	int uniquely_defined;
463 	int declared;
464 	int exposed;
465 	int outer;
466 };
467 
468 /* This structure represents an implication on a boolean filter.
469  * In particular, if the filter value of an element in the domain
470  * of "extension" is equal to "satisfied", then the filter values
471  * of the corresponding images in "extension" are also equal
472  * to "satisfied".
473  */
474 struct pet_implication {
475 	int satisfied;
476 	isl_map *extension;
477 };
478 
479 /* This structure represents an independence implied by a for loop
480  * that is marked as independent in the source code.
481  * "filter" contains pairs of statement instances that are guaranteed
482  * not to be dependent on each other based on the independent for loop,
483  * assuming that no dependences carried by this loop are implied
484  * by the variables in "local".
485  * "local" contains the variables that are local to the loop that was
486  * marked independent.
487  */
488 struct pet_independence {
489 	isl_union_map *filter;
490 	isl_union_set *local;
491 };
492 
493 /* "loc" represents the region of the source code that is represented
494  * by this scop.
495  * If the scop was detected based on scop and endscop pragmas, then
496  * the lines containing these pragmas are included in this region.
497  * In the final result, the context describes the set of parameter values
498  * for which the scop can be executed.
499  * During the construction of the pet_scop, the context lives in a set space
500  * where each dimension refers to an outer loop.
501  * context_value describes assignments to the parameters (if any)
502  * outside of the scop.
503  *
504  * "schedule" is the schedule of the statements in the scop.
505  *
506  * The n_type types define types that may be referenced from by the arrays.
507  *
508  * The n_implication implications describe implications on boolean filters.
509  *
510  * The n_independence independences describe independences implied
511  * by for loops that are marked independent in the source code.
512  */
513 struct pet_scop {
514 	pet_loc *loc;
515 
516 	isl_set *context;
517 	isl_set *context_value;
518 	isl_schedule *schedule;
519 
520 	int n_type;
521 	struct pet_type **types;
522 
523 	int n_array;
524 	struct pet_array **arrays;
525 
526 	int n_stmt;
527 	struct pet_stmt **stmts;
528 
529 	int n_implication;
530 	struct pet_implication **implications;
531 
532 	int n_independence;
533 	struct pet_independence **independences;
534 };
535 typedef struct pet_scop pet_scop;
536 
537 /* Return a textual representation of the operator. */
538 const char *pet_op_str(enum pet_op_type op);
539 int pet_op_is_inc_dec(enum pet_op_type op);
540 
541 /* Extract a pet_scop from a C source file.
542  * If function is not NULL, then the pet_scop is extracted from
543  * a function with that name.
544  */
545 __isl_give pet_scop *pet_scop_extract_from_C_source(isl_ctx *ctx,
546 	const char *filename, const char *function);
547 
548 /* Transform the C source file "input" by rewriting each scop
549  * When autodetecting scops, at most one scop per function is rewritten.
550  * The transformed C code is written to "output".
551  */
552 int pet_transform_C_source(isl_ctx *ctx, const char *input, FILE *output,
553 	__isl_give isl_printer *(*transform)(__isl_take isl_printer *p,
554 		__isl_take pet_scop *scop, void *user), void *user);
555 /* Given a scop and a printer passed to a pet_transform_C_source callback,
556  * print the original corresponding code to the printer.
557  */
558 __isl_give isl_printer *pet_scop_print_original(__isl_keep pet_scop *scop,
559 	__isl_take isl_printer *p);
560 
561 /* Update all isl_sets and isl_maps such that they all have the same
562  * parameters in the same order.
563  */
564 __isl_give pet_scop *pet_scop_align_params(__isl_take pet_scop *scop);
565 
566 /* Does "scop" contain any data dependent accesses? */
567 int pet_scop_has_data_dependent_accesses(__isl_keep pet_scop *scop);
568 /* Does "scop" contain any data dependent conditions? */
569 int pet_scop_has_data_dependent_conditions(__isl_keep pet_scop *scop);
570 /* pet_stmt_build_ast_exprs is currently limited to only handle
571  * some forms of data dependent accesses.
572  * If pet_scop_can_build_ast_exprs returns 1, then pet_stmt_build_ast_exprs
573  * can safely be called on all statements in the scop.
574  */
575 int pet_scop_can_build_ast_exprs(__isl_keep pet_scop *scop);
576 
577 void pet_scop_dump(__isl_keep pet_scop *scop);
578 __isl_null pet_scop *pet_scop_free(__isl_take pet_scop *scop);
579 
580 /* Return the context of "scop". */
581 __isl_give isl_set *pet_scop_get_context(__isl_keep pet_scop *scop);
582 /* Return the schedule of "scop". */
583 __isl_give isl_schedule *pet_scop_get_schedule(__isl_keep pet_scop *scop);
584 /* Return the set of all statement instances. */
585 __isl_give isl_union_set *pet_scop_get_instance_set(__isl_keep pet_scop *scop);
586 /* Return the potential read access relation. */
587 __isl_give isl_union_map *pet_scop_get_may_reads(__isl_keep pet_scop *scop);
588 /* Return the tagged potential read access relation. */
589 __isl_give isl_union_map *pet_scop_get_tagged_may_reads(
590 	__isl_keep pet_scop *scop);
591 /* Return the potential write access relation. */
592 __isl_give isl_union_map *pet_scop_get_may_writes(__isl_keep pet_scop *scop);
593 /* Return the definite write access relation. */
594 __isl_give isl_union_map *pet_scop_get_must_writes(__isl_keep pet_scop *scop);
595 /* Return the tagged potential write access relation. */
596 __isl_give isl_union_map *pet_scop_get_tagged_may_writes(
597 	__isl_keep pet_scop *scop);
598 /* Return the tagged definite write access relation. */
599 __isl_give isl_union_map *pet_scop_get_tagged_must_writes(
600 	__isl_keep pet_scop *scop);
601 /* Return the definite kill access relation. */
602 __isl_give isl_union_map *pet_scop_get_must_kills(__isl_keep pet_scop *scop);
603 /* Return the tagged definite kill access relation. */
604 __isl_give isl_union_map *pet_scop_get_tagged_must_kills(
605 	__isl_keep pet_scop *scop);
606 
607 /* Compute a mapping from all outermost arrays (of structs) in scop
608  * to their innermost members.
609  */
610 __isl_give isl_union_map *pet_scop_compute_outer_to_inner(
611 	__isl_keep pet_scop *scop);
612 /* Compute a mapping from all outermost arrays (of structs) in scop
613  * to their members, including the outermost arrays themselves.
614  */
615 __isl_give isl_union_map *pet_scop_compute_outer_to_any(
616 	__isl_keep pet_scop *scop);
617 
618 #if defined(__cplusplus)
619 }
620 #endif
621 
622 #endif
623