PetScan: allow label on any statement
[pet.git] / skip.h
blob0cb5a55b3262b5913b71ee8e07f6756f4e6617e2
1 #ifndef PET_SKIP_H
2 #define PET_SKIP_H
4 #include <pet.h>
6 #include "context.h"
7 #include "state.h"
9 #if defined(__cplusplus)
10 extern "C" {
11 #endif
13 enum pet_skip_type {
14 pet_skip_if,
15 pet_skip_if_else,
16 pet_skip_seq
19 /* Structure that handles the construction of skip conditions.
21 * scop_then and scop_else represent the then and else branches
22 * of the if statement
24 * scop1 and scop2 represent the two statements that are combined
26 * skip[type] is true if we need to construct a skip condition of that type
27 * equal is set if the skip conditions of types pet_skip_now and pet_skip_later
28 * are equal to each other
29 * index[type] is an index expression from a zero-dimension domain
30 * to the virtual array representing the skip condition
31 * scop[type] is a scop for computing the skip condition
33 struct pet_skip_info {
34 isl_ctx *ctx;
36 enum pet_skip_type type;
38 int skip[2];
39 int equal;
40 isl_multi_pw_aff *index[2];
41 struct pet_scop *scop[2];
43 union {
44 struct {
45 struct pet_scop *scop_then;
46 struct pet_scop *scop_else;
47 } i;
48 struct {
49 struct pet_scop *scop1;
50 struct pet_scop *scop2;
51 } s;
52 } u;
55 int pet_skip_info_has_skip(struct pet_skip_info *skip);
57 void pet_skip_info_if_init(struct pet_skip_info *skip, isl_ctx *ctx,
58 struct pet_scop *scop_then, struct pet_scop *scop_else,
59 int have_else, int affine);
60 void pet_skip_info_if_extract_index(struct pet_skip_info *skip,
61 __isl_keep isl_multi_pw_aff *index, __isl_keep pet_context *pc,
62 struct pet_state *state);
63 void pet_skip_info_if_extract_cond(struct pet_skip_info *skip,
64 __isl_keep isl_pw_aff *cond, __isl_keep pet_context *pc,
65 struct pet_state *state);
66 struct pet_scop *pet_skip_info_if_add(struct pet_skip_info *skip,
67 struct pet_scop *scop, int offset);
69 void pet_skip_info_seq_init(struct pet_skip_info *skip, isl_ctx *ctx,
70 struct pet_scop *scop1, struct pet_scop *scop2);
71 void pet_skip_info_seq_extract(struct pet_skip_info *skip,
72 __isl_keep pet_context *pc, struct pet_state *state);
73 struct pet_scop *pet_skip_info_seq_add(struct pet_skip_info *skip,
74 struct pet_scop *scop, int offset);
76 #if defined(__cplusplus)
78 #endif
80 #endif