PetScan::extract_condition: convert clang::Expr to pet_expr first
[pet.git] / skip.h
blob0fb5a7f371e190000b9ec28f804b754091c576b2
1 #ifndef PET_SKIP_H
2 #define PET_SKIP_H
4 #include <pet.h>
6 #if defined(__cplusplus)
7 extern "C" {
8 #endif
10 enum pet_skip_type {
11 pet_skip_if,
12 pet_skip_if_else,
13 pet_skip_seq
16 /* Structure that handles the construction of skip conditions.
18 * scop_then and scop_else represent the then and else branches
19 * of the if statement
21 * scop1 and scop2 represent the two statements that are combined
23 * skip[type] is true if we need to construct a skip condition of that type
24 * equal is set if the skip conditions of types pet_skip_now and pet_skip_later
25 * are equal to each other
26 * index[type] is an index expression from a zero-dimension domain
27 * to the virtual array representing the skip condition
28 * scop[type] is a scop for computing the skip condition
30 struct pet_skip_info {
31 isl_ctx *ctx;
33 enum pet_skip_type type;
35 int skip[2];
36 int equal;
37 isl_multi_pw_aff *index[2];
38 struct pet_scop *scop[2];
40 union {
41 struct {
42 struct pet_scop *scop_then;
43 struct pet_scop *scop_else;
44 } i;
45 struct {
46 struct pet_scop *scop1;
47 struct pet_scop *scop2;
48 } s;
49 } u;
52 int pet_skip_info_has_skip(struct pet_skip_info *skip);
54 void pet_skip_info_if_init(struct pet_skip_info *skip, isl_ctx *ctx,
55 struct pet_scop *scop_then, struct pet_scop *scop_else,
56 int have_else, int affine);
57 void pet_skip_info_if_extract_index(struct pet_skip_info *skip,
58 __isl_keep isl_multi_pw_aff *index,
59 int int_size, int *n_stmt, int *n_test);
60 void pet_skip_info_if_extract_cond(struct pet_skip_info *skip,
61 __isl_keep isl_pw_aff *cond, int int_size, int *n_stmt, int *n_test);
62 struct pet_scop *pet_skip_info_if_add(struct pet_skip_info *skip,
63 struct pet_scop *scop, int offset);
65 void pet_skip_info_seq_init(struct pet_skip_info *skip, isl_ctx *ctx,
66 struct pet_scop *scop1, struct pet_scop *scop2);
67 void pet_skip_info_seq_extract(struct pet_skip_info *skip,
68 int int_size, int *n_stmt, int *n_test);
69 struct pet_scop *pet_skip_info_seq_add(struct pet_skip_info *skip,
70 struct pet_scop *scop, int offset);
72 #if defined(__cplusplus)
74 #endif
76 #endif