live-out computation: only remove elements that are actually killed
[ppcg.git] / ppcg.h
blobd64ea67c12d56fe229d8fec90c2a9700dc0e1e5f
1 #ifndef PPCG_H
2 #define PPCG_H
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>
11 #include "ppcg_options.h"
13 const char *ppcg_base_name(const char *filename);
14 int ppcg_extract_base_name(char *name, const char *input);
16 /* Representation of the scop for use inside PPCG.
18 * "options" are the options specified by the user.
19 * Some fields in this structure may depend on some of the options.
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 * "tagged_must_kills" contains all definite kill accesses with
41 * a reference identifier in the domain.
43 * "tagger" maps tagged iteration domains to the corresponding untagged
44 * iteration domain.
46 * "independence" is the union of all independence filters.
48 * "dep_flow" represents the potential flow dependences.
49 * "tagged_dep_flow" is the same as "dep_flow", except that both domain and
50 * range are wrapped relations mapping an iteration domain to
51 * a reference identifier. May be NULL if not computed.
52 * "dep_false" represents the potential false (anti and output) dependences.
53 * "dep_forced" represents the validity constraints that should be enforced
54 * even when live-range reordering is used.
55 * In particular, these constraints ensure that all live-in
56 * accesses remain live-in and that all live-out accesses remain live-out
57 * and that multiple potential sources for the same read are
58 * executed in the original order.
59 * "dep_order"/"tagged_dep_order" represents the order dependences between
60 * the live range intervals in "dep_flow"/"tagged_dep_flow".
61 * It is only used if the live_range_reordering
62 * option is set. Otherwise it is NULL.
63 * If "dep_order" is used, then "dep_false" only contains a limited
64 * set of anti and output dependences.
65 * "schedule" represents the (original) schedule.
67 * "names" contains all variable names that are in use by the scop.
68 * The names are mapped to a dummy value.
70 * "pet" is the original pet_scop.
72 struct ppcg_scop {
73 struct ppcg_options *options;
75 unsigned start;
76 unsigned end;
78 isl_set *context;
79 isl_union_set *domain;
80 isl_union_set *call;
81 isl_union_map *tagged_reads;
82 isl_union_map *reads;
83 isl_union_map *live_in;
84 isl_union_map *tagged_may_writes;
85 isl_union_map *may_writes;
86 isl_union_map *tagged_must_writes;
87 isl_union_map *must_writes;
88 isl_union_map *live_out;
89 isl_union_map *tagged_must_kills;
91 isl_union_pw_multi_aff *tagger;
93 isl_union_map *independence;
95 isl_union_map *dep_flow;
96 isl_union_map *tagged_dep_flow;
97 isl_union_map *dep_false;
98 isl_union_map *dep_forced;
99 isl_union_map *dep_order;
100 isl_union_map *tagged_dep_order;
101 isl_schedule *schedule;
103 isl_id_to_ast_expr *names;
105 struct pet_scop *pet;
108 int ppcg_scop_any_hidden_declarations(struct ppcg_scop *scop);
109 __isl_give isl_id_list *ppcg_scop_generate_names(struct ppcg_scop *scop,
110 int n, const char *prefix);
112 int ppcg_transform(isl_ctx *ctx, const char *input, FILE *out,
113 struct ppcg_options *options,
114 __isl_give isl_printer *(*fn)(__isl_take isl_printer *p,
115 struct ppcg_scop *scop, void *user), void *user);
117 #endif