Also report failures in special tests
[cloog/uuh.git] / include / cloog / clast.h
blobb4553695b2799e576a890fb6fda8f5ca10c019e3
1 #ifndef CLOOG_CLAST_H
2 #define CLOOG_CLAST_H
3 #if defined(__cplusplus)
4 extern "C"
6 #endif
8 enum clast_expr_type {
9 clast_expr_name,
10 clast_expr_term,
11 clast_expr_bin,
12 clast_expr_red
14 struct clast_expr {
15 enum clast_expr_type type;
18 struct clast_name {
19 struct clast_expr expr;
20 const char * name;
23 /* Represents the term
24 * val * var (if var != NULL)
25 * or
26 * val (if var == NULL)
28 struct clast_term {
29 struct clast_expr expr;
30 cloog_int_t val;
31 struct clast_expr *var;
34 enum clast_red_type { clast_red_sum, clast_red_min, clast_red_max };
35 struct clast_reduction {
36 struct clast_expr expr;
37 enum clast_red_type type;
38 int n;
39 struct clast_expr* elts[1];
42 enum clast_bin_type { clast_bin_fdiv, clast_bin_cdiv,
43 clast_bin_div, clast_bin_mod };
44 struct clast_binary {
45 struct clast_expr expr;
46 enum clast_bin_type type;
47 struct clast_expr* LHS;
48 cloog_int_t RHS;
51 struct clast_stmt;
52 struct clast_stmt_op {
53 void (*free)(struct clast_stmt *);
56 #define CLAST_STMT_IS_A(stmt, type) ((stmt)->op == &(type))
58 extern const struct clast_stmt_op stmt_root;
59 extern const struct clast_stmt_op stmt_ass;
60 extern const struct clast_stmt_op stmt_user;
61 extern const struct clast_stmt_op stmt_block;
62 extern const struct clast_stmt_op stmt_for;
63 extern const struct clast_stmt_op stmt_guard;
65 struct clast_stmt {
66 const struct clast_stmt_op *op;
67 struct clast_stmt *next;
70 struct clast_root {
71 struct clast_stmt stmt;
72 CloogNames * names; /**< Names of iterators and parameters. */
75 struct clast_assignment {
76 struct clast_stmt stmt;
77 const char * LHS;
78 struct clast_expr * RHS;
81 struct clast_block {
82 struct clast_stmt stmt;
83 struct clast_stmt * body;
86 struct clast_user_stmt {
87 struct clast_stmt stmt;
88 CloogDomain * domain;
89 CloogStatement * statement;
90 struct clast_stmt * substitutions;
93 struct clast_for {
94 struct clast_stmt stmt;
95 CloogDomain * domain;
96 const char * iterator;
97 struct clast_expr * LB;
98 struct clast_expr * UB;
99 cloog_int_t stride;
100 struct clast_stmt * body;
103 struct clast_equation {
104 struct clast_expr * LHS;
105 struct clast_expr * RHS;
106 int sign;
109 struct clast_guard {
110 struct clast_stmt stmt;
111 struct clast_stmt * then;
112 int n;
113 struct clast_equation eq[1];
117 struct clast_stmt *cloog_clast_create_from_input(CloogInput *input,
118 CloogOptions *options);
119 struct clast_stmt *cloog_clast_create(CloogProgram *program,
120 CloogOptions *options);
121 void cloog_clast_free(struct clast_stmt *s);
123 struct clast_name *new_clast_name(const char *name);
124 struct clast_term *new_clast_term(cloog_int_t c, struct clast_expr *v);
125 struct clast_binary *new_clast_binary(enum clast_bin_type t,
126 struct clast_expr *lhs, cloog_int_t rhs);
127 struct clast_reduction *new_clast_reduction(enum clast_red_type t, int n);
128 struct clast_root *new_clast_root(CloogNames *names);
129 struct clast_assignment *new_clast_assignment(const char *lhs,
130 struct clast_expr *rhs);
131 struct clast_user_stmt *new_clast_user_stmt(CloogDomain *domain,
132 CloogStatement *stmt, struct clast_stmt *subs);
133 struct clast_block *new_clast_block(void);
134 struct clast_for *new_clast_for(CloogDomain *domain, const char *it,
135 struct clast_expr *LB, struct clast_expr *UB,
136 CloogStride *stride);
137 struct clast_guard *new_clast_guard(int n);
139 void free_clast_name(struct clast_name *t);
140 void free_clast_term(struct clast_term *t);
141 void free_clast_binary(struct clast_binary *b);
142 void free_clast_reduction(struct clast_reduction *r);
143 void free_clast_expr(struct clast_expr *e);
144 void free_clast_stmt(struct clast_stmt *s);
146 int clast_expr_equal(struct clast_expr *e1, struct clast_expr *e2);
148 struct clast_expr *clast_bound_from_constraint(CloogConstraint *constraint,
149 int level, CloogNames *names);
151 #if defined(__cplusplus)
153 #endif
154 #endif /* define _H */