1 #ifndef PPCG_H 2 #define PPCG_H 3 4 #include <isl/schedule.h> 5 #include <isl/set.h> 6 #include <isl/union_set.h> 7 #include <isl/union_map.h> 8 #include <isl/id_to_ast_expr.h> 9 #include <pet.h> 10 11 #include "ppcg_options.h" 12 13 const char *ppcg_base_name(const char *filename); 14 int ppcg_extract_base_name(char *name, const char *input); 15 16 /* Representation of the scop for use inside PPCG. 17 * 18 * "options" are the options specified by the user. 19 * Some fields in this structure may depend on some of the options. 20 * 21 * "start" and "end" are file offsets of the corresponding program text. 22 * "context" represents constraints on the parameters. 23 * "domain" is the union of all iteration domains. 24 * "call" contains the iteration domains of statements with a call expression. 25 * "reads" contains all potential read accesses. 26 * "tagged_reads" is the same as "reads", except that the domain is a wrapped 27 * relation mapping an iteration domain to a reference identifier 28 * "live_in" contains the potential read accesses that potentially 29 * have no corresponding writes in the scop. 30 * "may_writes" contains all potential write accesses. 31 * "tagged_may_writes" is the same as "may_writes", except that the domain 32 * is a wrapped relation mapping an iteration domain 33 * to a reference identifier 34 * "must_writes" contains all definite write accesses. 35 * "tagged_must_writes" is the same as "must_writes", except that the domain 36 * is a wrapped relation mapping an iteration domain 37 * to a reference identifier 38 * "live_out" contains the potential write accesses that are potentially 39 * not killed by any kills or any other writes. 40 * "must_kills" contains all definite kill accesses. 41 * "tagged_must_kills" is the same as "must_kills", except that the domain 42 * is a wrapped relation mapping an iteration domain 43 * to a reference identifier. 44 * 45 * "tagger" maps tagged iteration domains to the corresponding untagged 46 * iteration domain. 47 * 48 * "independence" is the union of all independence filters. 49 * 50 * "dep_flow" represents the potential flow dependences. 51 * "tagged_dep_flow" is the same as "dep_flow", except that both domain and 52 * range are wrapped relations mapping an iteration domain to 53 * a reference identifier. May be NULL if not computed. 54 * "dep_false" represents the potential false (anti and output) dependences. 55 * "dep_forced" represents the validity constraints that should be enforced 56 * even when live-range reordering is used. 57 * In particular, these constraints ensure that all live-in 58 * accesses remain live-in and that all live-out accesses remain live-out 59 * and that multiple potential sources for the same read are 60 * executed in the original order. 61 * "dep_order"/"tagged_dep_order" represents the order dependences between 62 * the live range intervals in "dep_flow"/"tagged_dep_flow". 63 * It is only used if the live_range_reordering 64 * option is set. Otherwise it is NULL. 65 * If "dep_order" is used, then "dep_false" only contains a limited 66 * set of anti and output dependences. 67 * "schedule" represents the (original) schedule. 68 * 69 * "names" contains all variable names that are in use by the scop. 70 * The names are mapped to a dummy value. 71 * 72 * "pet" is the original pet_scop. 73 */ 74 struct ppcg_scop { 75 struct ppcg_options *options; 76 77 unsigned start; 78 unsigned end; 79 80 isl_set *context; 81 isl_union_set *domain; 82 isl_union_set *call; 83 isl_union_map *tagged_reads; 84 isl_union_map *reads; 85 isl_union_map *live_in; 86 isl_union_map *tagged_may_writes; 87 isl_union_map *may_writes; 88 isl_union_map *tagged_must_writes; 89 isl_union_map *must_writes; 90 isl_union_map *live_out; 91 isl_union_map *tagged_must_kills; 92 isl_union_map *must_kills; 93 94 isl_union_pw_multi_aff *tagger; 95 96 isl_union_map *independence; 97 98 isl_union_map *dep_flow; 99 isl_union_map *tagged_dep_flow; 100 isl_union_map *dep_false; 101 isl_union_map *dep_forced; 102 isl_union_map *dep_order; 103 isl_union_map *tagged_dep_order; 104 isl_schedule *schedule; 105 106 isl_id_to_ast_expr *names; 107 108 struct pet_scop *pet; 109 }; 110 111 int ppcg_scop_any_hidden_declarations(struct ppcg_scop *scop); 112 __isl_give isl_id_list *ppcg_scop_generate_names(struct ppcg_scop *scop, 113 int n, const char *prefix); 114 115 int ppcg_transform(isl_ctx *ctx, const char *input, FILE *out, 116 struct ppcg_options *options, 117 __isl_give isl_printer *(*fn)(__isl_take isl_printer *p, 118 struct ppcg_scop *scop, void *user), void *user); 119 120 __isl_give isl_schedule *ppcg_compute_schedule( 121 __isl_take isl_schedule_constraints *sc, 122 __isl_keep isl_schedule *schedule, struct ppcg_options *options); 123 124 void compute_tagger(struct ppcg_scop *ps); 125 void compute_dependences(struct ppcg_scop *scop); 126 void eliminate_dead_code(struct ppcg_scop *ps); 127 void *ppcg_scop_free(struct ppcg_scop *ps); 128 #endif 129