scop.c: expr_collect_accesses: plug memory leak on error path
[pet.git] / scop.h
bloba23a1f1013b62cceceb05d6322bbbd4c6a5df1fd
1 #ifndef PET_SCOP_H
2 #define PET_SCOP_H
4 #include <pet.h>
6 #include <isl/aff.h>
7 #include <isl/id.h>
9 #if defined(__cplusplus)
10 extern "C" {
11 #endif
13 /* Do we want to skip the rest of the current loop iteration (pet_skip_now)
14 * or subsequent loop iterations (pet_skip_later)?
16 enum pet_skip { pet_skip_now = 0, pet_skip_later = 1 };
18 const char *pet_type_str(enum pet_expr_type type);
19 enum pet_expr_type pet_str_type(const char *str);
21 enum pet_op_type pet_str_op(const char *str);
23 struct pet_expr *pet_expr_from_index(__isl_take isl_multi_pw_aff *index);
24 struct pet_expr *pet_expr_from_index_and_depth(
25 __isl_take isl_multi_pw_aff *index, int depth);
26 struct pet_expr *pet_expr_from_access_and_index(__isl_take isl_map *access,
27 __isl_take isl_multi_pw_aff *index);
28 struct pet_expr *pet_expr_kill_from_access_and_index(__isl_take isl_map *access,
29 __isl_take isl_multi_pw_aff *index);
30 struct pet_expr *pet_expr_new_unary(isl_ctx *ctx, enum pet_op_type op,
31 struct pet_expr *arg);
32 struct pet_expr *pet_expr_new_binary(isl_ctx *ctx, enum pet_op_type op,
33 struct pet_expr *lhs, struct pet_expr *rhs);
34 struct pet_expr *pet_expr_new_ternary(isl_ctx *ctx, struct pet_expr *cond,
35 struct pet_expr *lhs, struct pet_expr *rhs);
36 struct pet_expr *pet_expr_new_call(isl_ctx *ctx, const char *name,
37 unsigned n_arg);
38 struct pet_expr *pet_expr_new_cast(isl_ctx *ctx, const char *type_name,
39 struct pet_expr *arg);
40 struct pet_expr *pet_expr_new_double(isl_ctx *ctx, double d, const char *s);
41 void pet_expr_dump(struct pet_expr *expr);
42 struct pet_expr *pet_expr_free(struct pet_expr *expr);
44 int pet_expr_is_affine(struct pet_expr *expr);
45 __isl_give isl_id *pet_expr_access_get_id(struct pet_expr *expr);
46 struct pet_expr *pet_expr_access_align_params(struct pet_expr *expr);
47 int pet_expr_is_scalar_access(struct pet_expr *expr);
48 int pet_expr_is_equal(struct pet_expr *expr1, struct pet_expr *expr2);
49 struct pet_expr *pet_expr_restrict(struct pet_expr *expr,
50 __isl_take isl_set *cond);
52 struct pet_stmt *pet_stmt_from_pet_expr(isl_ctx *ctx, int line,
53 __isl_take isl_id *label, int id, struct pet_expr *expr);
54 void pet_stmt_dump(struct pet_stmt *stmt);
55 void *pet_stmt_free(struct pet_stmt *stmt);
57 struct pet_type *pet_type_alloc(isl_ctx *ctx, const char *name,
58 const char *definition);
59 struct pet_type *pet_type_free(struct pet_type *type);
61 void pet_array_dump(struct pet_array *array);
62 struct pet_array *pet_array_free(struct pet_array *array);
64 void *pet_implication_free(struct pet_implication *implication);
66 struct pet_stmt *pet_stmt_prefix(struct pet_stmt *stmt, int pos);
68 struct pet_scop *pet_scop_from_pet_stmt(isl_ctx *ctx, struct pet_stmt *stmt);
69 struct pet_scop *pet_scop_alloc(isl_ctx *ctx);
70 struct pet_scop *pet_scop_empty(isl_ctx *ctx);
71 struct pet_scop *pet_scop_add_seq(isl_ctx *ctx, struct pet_scop *scop1,
72 struct pet_scop *scop2);
73 struct pet_scop *pet_scop_add_par(isl_ctx *ctx, struct pet_scop *scop1,
74 struct pet_scop *scop2);
76 int pet_scop_is_equal(struct pet_scop *scop1, struct pet_scop *scop2);
78 struct pet_scop *pet_scop_prefix(struct pet_scop *scop, int pos);
79 struct pet_scop *pet_scop_embed(struct pet_scop *scop, __isl_take isl_set *dom,
80 __isl_take isl_map *sched, __isl_take isl_aff *iv_map,
81 __isl_take isl_id *id);
82 struct pet_scop *pet_scop_restrict(struct pet_scop *scop,
83 __isl_take isl_set *cond);
84 struct pet_scop *pet_scop_restrict_context(struct pet_scop *scop,
85 __isl_take isl_set *context);
86 struct pet_scop *pet_scop_reset_context(struct pet_scop *scop);
87 struct pet_expr *pet_expr_filter(struct pet_expr *expr,
88 __isl_take isl_multi_pw_aff *test, int satisfied);
89 struct pet_scop *pet_scop_filter(struct pet_scop *scop,
90 __isl_take isl_multi_pw_aff *test, int satisfied);
91 struct pet_scop *pet_scop_merge_filters(struct pet_scop *scop);
92 struct pet_scop *pet_scop_add_implication(struct pet_scop *scop,
93 __isl_take isl_map *map, int satisfied);
95 struct pet_scop *pet_scop_detect_parameter_accesses(struct pet_scop *scop);
97 struct pet_scop *pet_scop_gist(struct pet_scop *scop,
98 __isl_keep isl_union_map *value_bounds);
100 struct pet_scop *pet_scop_add_ref_ids(struct pet_scop *scop);
101 struct pet_scop *pet_scop_anonymize(struct pet_scop *scop);
103 int pet_expr_foreach_access_expr(struct pet_expr *expr,
104 int (*fn)(struct pet_expr *expr, void *user), void *user);
105 struct pet_expr *pet_expr_map_access(struct pet_expr *expr,
106 struct pet_expr *(*fn)(struct pet_expr *expr, void *user),
107 void *user);
109 int pet_scop_writes(struct pet_scop *scop, __isl_keep isl_id *id);
111 int pet_scop_has_skip(struct pet_scop *scop, enum pet_skip type);
112 int pet_scop_has_affine_skip(struct pet_scop *scop, enum pet_skip type);
113 int pet_scop_has_universal_skip(struct pet_scop *scop, enum pet_skip type);
114 int pet_scop_has_var_skip(struct pet_scop *scop, enum pet_skip type);
115 struct pet_scop *pet_scop_set_skip(struct pet_scop *scop,
116 enum pet_skip type, __isl_take isl_multi_pw_aff *skip);
117 __isl_give isl_multi_pw_aff *pet_scop_get_skip(struct pet_scop *scop,
118 enum pet_skip type);
119 __isl_give isl_set *pet_scop_get_affine_skip_domain(struct pet_scop *scop,
120 enum pet_skip type);
121 __isl_give isl_id *pet_scop_get_skip_id(struct pet_scop *scop,
122 enum pet_skip type);
123 struct pet_expr *pet_scop_get_skip_expr(struct pet_scop *scop,
124 enum pet_skip type);
125 void pet_scop_reset_skip(struct pet_scop *scop, enum pet_skip type);
127 struct pet_scop *pet_scop_add_array(struct pet_scop *scop,
128 struct pet_array *array);
130 struct pet_scop *pet_scop_update_start_end(struct pet_scop *scop,
131 unsigned start, unsigned end);
132 struct pet_scop *pet_scop_set_input_file(struct pet_scop *scop, FILE *input);
134 #if defined(__cplusplus)
136 #endif
138 #endif