1#ifndef ISL_AST_PRIVATE_H
2#define ISL_AST_PRIVATE_H
3
4#include <isl/aff.h>
5#include <isl/ast.h>
6#include <isl/set.h>
7#include <isl/map.h>
8#include <isl/vec.h>
9#include <isl/list.h>
10#include <isl/stream.h>
11
12#undef EL
13#define EL isl_ast_expr
14
15#include <isl_list_templ.h>
16
17/* An expression is either an integer, an identifier or an operation
18 * with zero or more arguments.
19 */
20struct isl_ast_expr {
21 int ref;
22
23 isl_ctx *ctx;
24
25 enum isl_ast_expr_type type;
26
27 union {
28 isl_val *v;
29 isl_id *id;
30 struct {
31 enum isl_ast_expr_op_type op;
32 isl_ast_expr_list *args;
33 } op;
34 } u;
35};
36
37__isl_give isl_ast_expr *isl_ast_expr_alloc_int_si(isl_ctx *ctx, int i);
38__isl_give isl_ast_expr *isl_ast_expr_alloc_op(isl_ctx *ctx,
39 enum isl_ast_expr_op_type op, int n_arg);
40__isl_give isl_ast_expr *isl_ast_expr_op_add_arg(__isl_take isl_ast_expr *expr,
41 __isl_take isl_ast_expr *arg);
42__isl_give isl_ast_expr *isl_ast_expr_alloc_binary(
43 enum isl_ast_expr_op_type type,
44 __isl_take isl_ast_expr *expr1, __isl_take isl_ast_expr *expr2);
45
46__isl_give isl_ast_expr *isl_stream_read_ast_expr(__isl_keep isl_stream *s);
47
48#undef EL
49#define EL isl_ast_node
50
51#include <isl_list_templ.h>
52
53/* A node is either a block, an if, a for, a user node or a mark node.
54 * "else_node" is NULL if the if node does not have an else branch.
55 * "cond" and "inc" are NULL for degenerate for nodes.
56 * In case of a mark node, "mark" is the mark and "node" is the marked node.
57 */
58struct isl_ast_node {
59 int ref;
60
61 isl_ctx *ctx;
62 enum isl_ast_node_type type;
63
64 union {
65 struct {
66 isl_ast_node_list *children;
67 } b;
68 struct {
69 isl_ast_expr *guard;
70 isl_ast_node *then;
71 isl_ast_node *else_node;
72 } i;
73 struct {
74 unsigned degenerate : 1;
75 isl_ast_expr *iterator;
76 isl_ast_expr *init;
77 isl_ast_expr *cond;
78 isl_ast_expr *inc;
79 isl_ast_node *body;
80 } f;
81 struct {
82 isl_ast_expr *expr;
83 } e;
84 struct {
85 isl_id *mark;
86 isl_ast_node *node;
87 } m;
88 } u;
89
90 isl_id *annotation;
91};
92
93__isl_give isl_ast_node *isl_ast_node_alloc_for(__isl_take isl_id *id);
94__isl_give isl_ast_node *isl_ast_node_for_mark_degenerate(
95 __isl_take isl_ast_node *node);
96__isl_give isl_ast_node *isl_ast_node_alloc_if(__isl_take isl_ast_expr *guard);
97__isl_give isl_ast_node *isl_ast_node_alloc_block(
98 __isl_take isl_ast_node_list *list);
99__isl_give isl_ast_node *isl_ast_node_alloc_mark(__isl_take isl_id *id,
100 __isl_take isl_ast_node *node);
101__isl_give isl_ast_node *isl_ast_node_from_ast_node_list(
102 __isl_take isl_ast_node_list *list);
103__isl_give isl_ast_node *isl_ast_node_for_set_init(
104 __isl_take isl_ast_node *node, __isl_take isl_ast_expr *init);
105__isl_give isl_ast_node *isl_ast_node_for_set_cond(
106 __isl_take isl_ast_node *node, __isl_take isl_ast_expr *init);
107__isl_give isl_ast_node *isl_ast_node_for_set_inc(
108 __isl_take isl_ast_node *node, __isl_take isl_ast_expr *init);
109__isl_give isl_ast_node *isl_ast_node_for_set_body(
110 __isl_take isl_ast_node *node, __isl_take isl_ast_node *body);
111__isl_give isl_ast_node *isl_ast_node_if_set_then(
112 __isl_take isl_ast_node *node, __isl_take isl_ast_node *child);
113
114__isl_give isl_ast_node *isl_stream_read_ast_node(__isl_keep isl_stream *s);
115
116struct isl_ast_print_options {
117 int ref;
118 isl_ctx *ctx;
119
120 __isl_give isl_printer *(*print_for)(__isl_take isl_printer *p,
121 __isl_take isl_ast_print_options *options,
122 __isl_keep isl_ast_node *node, void *user);
123 void *print_for_user;
124 __isl_give isl_printer *(*print_user)(__isl_take isl_printer *p,
125 __isl_take isl_ast_print_options *options,
126 __isl_keep isl_ast_node *node, void *user);
127 void *print_user_user;
128};
129
130__isl_give isl_printer *isl_ast_node_list_print(
131 __isl_keep isl_ast_node_list *list, __isl_take isl_printer *p,
132 __isl_keep isl_ast_print_options *options);
133
134#endif
135

source code of polly/lib/External/isl/isl_ast_private.h