1#ifndef ISL_AST_GRAFT_PRIVATE_H
2#define ISL_AST_GRAFT_PRIVATE_H
3
4#include <isl/ast.h>
5#include <isl/set.h>
6#include <isl/list.h>
7#include <isl/printer.h>
8
9struct isl_ast_graft;
10typedef struct isl_ast_graft isl_ast_graft;
11
12/* Representation of part of an AST ("node") with some additional polyhedral
13 * information about the tree.
14 *
15 * "guard" contains conditions that should still be enforced by
16 * some ancestor of the current tree.  In particular, the already
17 * generated tree assumes that these conditions hold, but may not
18 * enforced them itself.
19 * The guard should not contain any unknown divs as it will be used
20 * to generate an if condition.
21 *
22 * "enforced" expresses constraints that are already enforced by the for
23 * nodes in the current tree and that therefore do not need to be enforced
24 * by any ancestor.
25 * The constraints only involve outer loop iterators.
26 */
27struct isl_ast_graft {
28	int ref;
29
30	isl_ast_node *node;
31
32	isl_set *guard;
33	isl_basic_set *enforced;
34};
35
36ISL_DECLARE_LIST(ast_graft)
37
38#undef EL
39#define EL isl_ast_graft
40
41#include <isl_list_templ.h>
42
43isl_ctx *isl_ast_graft_get_ctx(__isl_keep isl_ast_graft *graft);
44
45__isl_give isl_ast_graft *isl_ast_graft_alloc(
46	__isl_take isl_ast_node *node, __isl_keep isl_ast_build *build);
47__isl_give isl_ast_graft *isl_ast_graft_alloc_level(
48	__isl_take isl_ast_graft_list *children,
49	__isl_keep isl_ast_build *build, __isl_keep isl_ast_build *sub_build);
50__isl_give isl_ast_graft_list *isl_ast_graft_list_fuse(
51	__isl_take isl_ast_graft_list *children,
52	__isl_keep isl_ast_build *build);
53__isl_give isl_ast_graft *isl_ast_graft_alloc_domain(
54	__isl_take isl_map *schedule, __isl_keep isl_ast_build *build);
55void *isl_ast_graft_free(__isl_take isl_ast_graft *graft);
56__isl_give isl_ast_graft_list *isl_ast_graft_list_sort_guard(
57	__isl_take isl_ast_graft_list *list);
58
59__isl_give isl_ast_graft_list *isl_ast_graft_list_merge(
60	__isl_take isl_ast_graft_list *list1,
61	__isl_take isl_ast_graft_list *list2,
62	__isl_keep isl_ast_build *build);
63
64__isl_give isl_ast_node *isl_ast_graft_get_node(
65	__isl_keep isl_ast_graft *graft);
66__isl_give isl_basic_set *isl_ast_graft_get_enforced(
67	__isl_keep isl_ast_graft *graft);
68__isl_give isl_set *isl_ast_graft_get_guard(__isl_keep isl_ast_graft *graft);
69
70__isl_give isl_ast_graft *isl_ast_graft_insert_for(
71	__isl_take isl_ast_graft *graft, __isl_take isl_ast_node *node);
72__isl_give isl_ast_graft *isl_ast_graft_add_guard(
73	__isl_take isl_ast_graft *graft,
74	__isl_take isl_set *guard, __isl_keep isl_ast_build *build);
75__isl_give isl_ast_graft *isl_ast_graft_enforce(
76	__isl_take isl_ast_graft *graft, __isl_take isl_basic_set *enforced);
77
78__isl_give isl_ast_graft_list *isl_ast_graft_list_unembed(
79	__isl_take isl_ast_graft_list *list, int product);
80__isl_give isl_ast_graft_list *isl_ast_graft_list_preimage_multi_aff(
81	__isl_take isl_ast_graft_list *list, __isl_take isl_multi_aff *ma);
82
83__isl_give isl_ast_node *isl_ast_node_from_graft_list(
84	__isl_take isl_ast_graft_list *list, __isl_keep isl_ast_build *build);
85
86__isl_give isl_printer *isl_printer_print_ast_graft(__isl_take isl_printer *p,
87	__isl_keep isl_ast_graft *graft);
88
89#endif
90