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