1 #ifndef ISL_AST_PRIVATE_H
2 #define ISL_AST_PRIVATE_H
10 #include <isl/stream.h>
13 #define EL isl_ast_expr
15 #include <isl_list_templ.h>
17 /* An expression is either an integer, an identifier or an operation
18 * with zero or more arguments.
25 enum isl_ast_expr_type type
;
31 enum isl_ast_expr_op_type op
;
32 isl_ast_expr_list
*args
;
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
);
46 __isl_give isl_ast_expr
*isl_stream_read_ast_expr(__isl_keep isl_stream
*s
);
49 #define EL isl_ast_node
51 #include <isl_list_templ.h>
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.
62 enum isl_ast_node_type type
;
66 isl_ast_node_list
*children
;
71 isl_ast_node
*else_node
;
74 unsigned degenerate
: 1;
75 isl_ast_expr
*iterator
;
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
);
114 __isl_give isl_ast_node
*isl_stream_read_ast_node(__isl_keep isl_stream
*s
);
116 struct isl_ast_print_options
{
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
;
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
);