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