graphite.h revision 1.2.10.2 1 1.2.10.1 pgoyette /* Graphite polyhedral representation.
2 1.2.10.1 pgoyette Copyright (C) 2009-2016 Free Software Foundation, Inc.
3 1.2.10.1 pgoyette Contributed by Sebastian Pop <sebastian.pop (at) amd.com> and
4 1.2.10.1 pgoyette Tobias Grosser <grosser (at) fim.uni-passau.de>.
5 1.1 mrg
6 1.1 mrg This file is part of GCC.
7 1.1 mrg
8 1.1 mrg GCC is free software; you can redistribute it and/or modify
9 1.1 mrg it under the terms of the GNU General Public License as published by
10 1.1 mrg the Free Software Foundation; either version 3, or (at your option)
11 1.1 mrg any later version.
12 1.1 mrg
13 1.1 mrg GCC is distributed in the hope that it will be useful,
14 1.1 mrg but WITHOUT ANY WARRANTY; without even the implied warranty of
15 1.1 mrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 1.1 mrg GNU General Public License for more details.
17 1.1 mrg
18 1.1 mrg You should have received a copy of the GNU General Public License
19 1.1 mrg along with GCC; see the file COPYING3. If not see
20 1.1 mrg <http://www.gnu.org/licenses/>. */
21 1.1 mrg
22 1.2.10.1 pgoyette #ifndef GCC_GRAPHITE_POLY_H
23 1.2.10.1 pgoyette #define GCC_GRAPHITE_POLY_H
24 1.1 mrg
25 1.2.10.1 pgoyette #include "sese.h"
26 1.2.10.1 pgoyette #include <isl/options.h>
27 1.2.10.1 pgoyette #include <isl/ctx.h>
28 1.2.10.1 pgoyette #include <isl/val_gmp.h>
29 1.2.10.1 pgoyette #include <isl/set.h>
30 1.2.10.1 pgoyette #include <isl/union_set.h>
31 1.2.10.1 pgoyette #include <isl/map.h>
32 1.2.10.1 pgoyette #include <isl/union_map.h>
33 1.2.10.1 pgoyette #include <isl/aff.h>
34 1.2.10.1 pgoyette #include <isl/constraint.h>
35 1.2.10.1 pgoyette #include <isl/flow.h>
36 1.2.10.1 pgoyette #include <isl/ilp.h>
37 1.2.10.1 pgoyette #include <isl/schedule.h>
38 1.2.10.1 pgoyette #include <isl/ast_build.h>
39 1.2.10.1 pgoyette
40 1.2.10.1 pgoyette #ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
41 1.2.10.1 pgoyette /* isl 0.15 or later. */
42 1.2.10.1 pgoyette #include <isl/schedule_node.h>
43 1.2.10.2 pgoyette #include <isl/id.h>
44 1.2.10.2 pgoyette #include <isl/space.h>
45 1.2.10.1 pgoyette
46 1.2.10.1 pgoyette #else
47 1.2.10.1 pgoyette /* isl 0.14 or 0.13. */
48 1.2.10.1 pgoyette # define isl_stat int
49 1.2.10.1 pgoyette # define isl_stat_ok 0
50 1.2.10.1 pgoyette #endif
51 1.2.10.1 pgoyette
52 1.2.10.1 pgoyette typedef struct poly_dr *poly_dr_p;
53 1.2.10.1 pgoyette
54 1.2.10.1 pgoyette typedef struct poly_bb *poly_bb_p;
55 1.2.10.1 pgoyette
56 1.2.10.1 pgoyette typedef struct scop *scop_p;
57 1.2.10.1 pgoyette
58 1.2.10.1 pgoyette typedef unsigned graphite_dim_t;
59 1.2.10.1 pgoyette
60 1.2.10.1 pgoyette static inline graphite_dim_t scop_nb_params (scop_p);
61 1.2.10.1 pgoyette
62 1.2.10.1 pgoyette /* A data reference can write or read some memory or we
63 1.2.10.1 pgoyette just know it may write some memory. */
64 1.2.10.1 pgoyette enum poly_dr_type
65 1.2.10.1 pgoyette {
66 1.2.10.1 pgoyette PDR_READ,
67 1.2.10.1 pgoyette /* PDR_MAY_READs are represented using PDR_READS. This does not
68 1.2.10.1 pgoyette limit the expressiveness. */
69 1.2.10.1 pgoyette PDR_WRITE,
70 1.2.10.1 pgoyette PDR_MAY_WRITE
71 1.2.10.1 pgoyette };
72 1.2.10.1 pgoyette
73 1.2.10.1 pgoyette struct poly_dr
74 1.2.10.1 pgoyette {
75 1.2.10.1 pgoyette /* An identifier for this PDR. */
76 1.2.10.1 pgoyette int id;
77 1.2.10.1 pgoyette
78 1.2.10.1 pgoyette /* The number of data refs identical to this one in the PBB. */
79 1.2.10.1 pgoyette int nb_refs;
80 1.2.10.1 pgoyette
81 1.2.10.1 pgoyette /* A pointer to the gimple stmt containing this reference. */
82 1.2.10.1 pgoyette gimple *stmt;
83 1.2.10.1 pgoyette
84 1.2.10.1 pgoyette /* A pointer to the PBB that contains this data reference. */
85 1.2.10.1 pgoyette poly_bb_p pbb;
86 1.2.10.1 pgoyette
87 1.2.10.1 pgoyette enum poly_dr_type type;
88 1.2.10.1 pgoyette
89 1.2.10.1 pgoyette /* The access polyhedron contains the polyhedral space this data
90 1.2.10.1 pgoyette reference will access.
91 1.2.10.1 pgoyette
92 1.2.10.1 pgoyette The polyhedron contains these dimensions:
93 1.2.10.1 pgoyette
94 1.2.10.1 pgoyette - The alias set (a):
95 1.2.10.1 pgoyette Every memory access is classified in at least one alias set.
96 1.2.10.1 pgoyette
97 1.2.10.1 pgoyette - The subscripts (s_0, ..., s_n):
98 1.2.10.1 pgoyette The memory is accessed using zero or more subscript dimensions.
99 1.2.10.1 pgoyette
100 1.2.10.1 pgoyette - The iteration domain (variables and parameters)
101 1.2.10.1 pgoyette
102 1.2.10.1 pgoyette Do not hardcode the dimensions. Use the following accessor functions:
103 1.2.10.1 pgoyette - pdr_alias_set_dim
104 1.2.10.1 pgoyette - pdr_subscript_dim
105 1.2.10.1 pgoyette - pdr_iterator_dim
106 1.2.10.1 pgoyette - pdr_parameter_dim
107 1.2.10.1 pgoyette
108 1.2.10.1 pgoyette Example:
109 1.2.10.1 pgoyette
110 1.2.10.1 pgoyette | int A[1335][123];
111 1.2.10.1 pgoyette | int *p = malloc ();
112 1.2.10.1 pgoyette |
113 1.2.10.1 pgoyette | k = ...
114 1.2.10.1 pgoyette | for i
115 1.2.10.1 pgoyette | {
116 1.2.10.1 pgoyette | if (unknown_function ())
117 1.2.10.1 pgoyette | p = A;
118 1.2.10.1 pgoyette | ... = p[?][?];
119 1.2.10.1 pgoyette | for j
120 1.2.10.1 pgoyette | A[i][j+k] = m;
121 1.2.10.1 pgoyette | }
122 1.2.10.1 pgoyette
123 1.2.10.1 pgoyette The data access A[i][j+k] in alias set "5" is described like this:
124 1.2.10.1 pgoyette
125 1.2.10.1 pgoyette | i j k a s0 s1 1
126 1.2.10.1 pgoyette | 0 0 0 1 0 0 -5 = 0
127 1.2.10.1 pgoyette |-1 0 0 0 1 0 0 = 0
128 1.2.10.1 pgoyette | 0 -1 -1 0 0 1 0 = 0
129 1.2.10.1 pgoyette | 0 0 0 0 1 0 0 >= 0 # The last four lines describe the
130 1.2.10.1 pgoyette | 0 0 0 0 0 1 0 >= 0 # array size.
131 1.2.10.1 pgoyette | 0 0 0 0 -1 0 1335 >= 0
132 1.2.10.1 pgoyette | 0 0 0 0 0 -1 123 >= 0
133 1.2.10.1 pgoyette
134 1.2.10.1 pgoyette The pointer "*p" in alias set "5" and "7" is described as a union of
135 1.2.10.1 pgoyette polyhedron:
136 1.2.10.1 pgoyette
137 1.2.10.1 pgoyette
138 1.2.10.1 pgoyette | i k a s0 1
139 1.2.10.1 pgoyette | 0 0 1 0 -5 = 0
140 1.2.10.1 pgoyette | 0 0 0 1 0 >= 0
141 1.2.10.1 pgoyette
142 1.2.10.1 pgoyette "or"
143 1.2.10.1 pgoyette
144 1.2.10.1 pgoyette | i k a s0 1
145 1.2.10.1 pgoyette | 0 0 1 0 -7 = 0
146 1.2.10.1 pgoyette | 0 0 0 1 0 >= 0
147 1.2.10.1 pgoyette
148 1.2.10.1 pgoyette "*p" accesses all of the object allocated with 'malloc'.
149 1.2.10.1 pgoyette
150 1.2.10.1 pgoyette The scalar data access "m" is represented as an array with zero subscript
151 1.2.10.1 pgoyette dimensions.
152 1.2.10.1 pgoyette
153 1.2.10.1 pgoyette | i j k a 1
154 1.2.10.1 pgoyette | 0 0 0 -1 15 = 0
155 1.2.10.1 pgoyette
156 1.2.10.1 pgoyette The difference between the graphite internal format for access data and
157 1.2.10.1 pgoyette the OpenSop format is in the order of columns.
158 1.2.10.1 pgoyette Instead of having:
159 1.2.10.1 pgoyette
160 1.2.10.1 pgoyette | i j k a s0 s1 1
161 1.2.10.1 pgoyette | 0 0 0 1 0 0 -5 = 0
162 1.2.10.1 pgoyette |-1 0 0 0 1 0 0 = 0
163 1.2.10.1 pgoyette | 0 -1 -1 0 0 1 0 = 0
164 1.2.10.1 pgoyette | 0 0 0 0 1 0 0 >= 0 # The last four lines describe the
165 1.2.10.1 pgoyette | 0 0 0 0 0 1 0 >= 0 # array size.
166 1.2.10.1 pgoyette | 0 0 0 0 -1 0 1335 >= 0
167 1.2.10.1 pgoyette | 0 0 0 0 0 -1 123 >= 0
168 1.2.10.1 pgoyette
169 1.2.10.1 pgoyette In OpenScop we have:
170 1.2.10.1 pgoyette
171 1.2.10.1 pgoyette | a s0 s1 i j k 1
172 1.2.10.1 pgoyette | 1 0 0 0 0 0 -5 = 0
173 1.2.10.1 pgoyette | 0 1 0 -1 0 0 0 = 0
174 1.2.10.1 pgoyette | 0 0 1 0 -1 -1 0 = 0
175 1.2.10.1 pgoyette | 0 1 0 0 0 0 0 >= 0 # The last four lines describe the
176 1.2.10.1 pgoyette | 0 0 1 0 0 0 0 >= 0 # array size.
177 1.2.10.1 pgoyette | 0 -1 0 0 0 0 1335 >= 0
178 1.2.10.1 pgoyette | 0 0 -1 0 0 0 123 >= 0
179 1.2.10.1 pgoyette
180 1.2.10.1 pgoyette The OpenScop access function is printed as follows:
181 1.2.10.1 pgoyette
182 1.2.10.1 pgoyette | 1 # The number of disjunct components in a union of access functions.
183 1.2.10.1 pgoyette | R C O I L P # Described bellow.
184 1.2.10.1 pgoyette | a s0 s1 i j k 1
185 1.2.10.1 pgoyette | 1 0 0 0 0 0 -5 = 0
186 1.2.10.1 pgoyette | 0 1 0 -1 0 0 0 = 0
187 1.2.10.1 pgoyette | 0 0 1 0 -1 -1 0 = 0
188 1.2.10.1 pgoyette | 0 1 0 0 0 0 0 >= 0 # The last four lines describe the
189 1.2.10.1 pgoyette | 0 0 1 0 0 0 0 >= 0 # array size.
190 1.2.10.1 pgoyette | 0 -1 0 0 0 0 1335 >= 0
191 1.2.10.1 pgoyette | 0 0 -1 0 0 0 123 >= 0
192 1.2.10.1 pgoyette
193 1.2.10.1 pgoyette Where:
194 1.2.10.1 pgoyette - R: Number of rows.
195 1.2.10.1 pgoyette - C: Number of columns.
196 1.2.10.1 pgoyette - O: Number of output dimensions = alias set + number of subscripts.
197 1.2.10.1 pgoyette - I: Number of input dimensions (iterators).
198 1.2.10.1 pgoyette - L: Number of local (existentially quantified) dimensions.
199 1.2.10.1 pgoyette - P: Number of parameters.
200 1.2.10.1 pgoyette
201 1.2.10.1 pgoyette In the example, the vector "R C O I L P" is "7 7 3 2 0 1". */
202 1.2.10.1 pgoyette isl_map *accesses;
203 1.2.10.1 pgoyette isl_set *subscript_sizes;
204 1.2.10.1 pgoyette };
205 1.2.10.1 pgoyette
206 1.2.10.1 pgoyette #define PDR_ID(PDR) (PDR->id)
207 1.2.10.1 pgoyette #define PDR_NB_REFS(PDR) (PDR->nb_refs)
208 1.2.10.1 pgoyette #define PDR_PBB(PDR) (PDR->pbb)
209 1.2.10.1 pgoyette #define PDR_TYPE(PDR) (PDR->type)
210 1.2.10.1 pgoyette #define PDR_ACCESSES(PDR) (NULL)
211 1.2.10.1 pgoyette
212 1.2.10.1 pgoyette void new_poly_dr (poly_bb_p, gimple *, enum poly_dr_type,
213 1.2.10.1 pgoyette isl_map *, isl_set *);
214 1.2.10.1 pgoyette void debug_pdr (poly_dr_p);
215 1.2.10.1 pgoyette void print_pdr (FILE *, poly_dr_p);
216 1.2.10.1 pgoyette
217 1.2.10.1 pgoyette static inline bool
218 1.2.10.1 pgoyette pdr_read_p (poly_dr_p pdr)
219 1.2.10.1 pgoyette {
220 1.2.10.1 pgoyette return PDR_TYPE (pdr) == PDR_READ;
221 1.2.10.1 pgoyette }
222 1.2.10.1 pgoyette
223 1.2.10.1 pgoyette /* Returns true when PDR is a "write". */
224 1.2.10.1 pgoyette
225 1.2.10.1 pgoyette static inline bool
226 1.2.10.1 pgoyette pdr_write_p (poly_dr_p pdr)
227 1.2.10.1 pgoyette {
228 1.2.10.1 pgoyette return PDR_TYPE (pdr) == PDR_WRITE;
229 1.2.10.1 pgoyette }
230 1.2.10.1 pgoyette
231 1.2.10.1 pgoyette /* Returns true when PDR is a "may write". */
232 1.2.10.1 pgoyette
233 1.2.10.1 pgoyette static inline bool
234 1.2.10.1 pgoyette pdr_may_write_p (poly_dr_p pdr)
235 1.2.10.1 pgoyette {
236 1.2.10.1 pgoyette return PDR_TYPE (pdr) == PDR_MAY_WRITE;
237 1.2.10.1 pgoyette }
238 1.2.10.1 pgoyette
239 1.2.10.1 pgoyette /* POLY_BB represents a blackbox in the polyhedral model. */
240 1.2.10.1 pgoyette
241 1.2.10.1 pgoyette struct poly_bb
242 1.2.10.1 pgoyette {
243 1.2.10.1 pgoyette /* Pointer to a basic block or a statement in the compiler. */
244 1.2.10.1 pgoyette gimple_poly_bb_p black_box;
245 1.2.10.1 pgoyette
246 1.2.10.1 pgoyette /* Pointer to the SCOP containing this PBB. */
247 1.2.10.1 pgoyette scop_p scop;
248 1.2.10.1 pgoyette
249 1.2.10.1 pgoyette /* The iteration domain of this bb. The layout of this polyhedron
250 1.2.10.1 pgoyette is I|G with I the iteration domain, G the context parameters.
251 1.2.10.1 pgoyette
252 1.2.10.1 pgoyette Example:
253 1.2.10.1 pgoyette
254 1.2.10.1 pgoyette for (i = a - 7*b + 8; i <= 3*a + 13*b + 20; i++)
255 1.2.10.1 pgoyette for (j = 2; j <= 2*i + 5; j++)
256 1.2.10.1 pgoyette for (k = 0; k <= 5; k++)
257 1.2.10.1 pgoyette S (i,j,k)
258 1.2.10.1 pgoyette
259 1.2.10.1 pgoyette Loop iterators: i, j, k
260 1.2.10.1 pgoyette Parameters: a, b
261 1.2.10.1 pgoyette
262 1.2.10.1 pgoyette | i >= a - 7b + 8
263 1.2.10.1 pgoyette | i <= 3a + 13b + 20
264 1.2.10.1 pgoyette | j >= 2
265 1.2.10.1 pgoyette | j <= 2i + 5
266 1.2.10.1 pgoyette | k >= 0
267 1.2.10.1 pgoyette | k <= 5
268 1.2.10.1 pgoyette
269 1.2.10.1 pgoyette The number of variables in the DOMAIN may change and is not
270 1.2.10.1 pgoyette related to the number of loops in the original code. */
271 1.2.10.1 pgoyette isl_set *domain;
272 1.2.10.1 pgoyette #ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
273 1.2.10.1 pgoyette isl_set *iterators;
274 1.2.10.1 pgoyette #else
275 1.2.10.1 pgoyette /* The original scattering. */
276 1.2.10.1 pgoyette isl_map *schedule;
277 1.2.10.1 pgoyette
278 1.2.10.1 pgoyette /* The transformed scattering. */
279 1.2.10.1 pgoyette isl_map *transformed;
280 1.2.10.1 pgoyette
281 1.2.10.1 pgoyette /* A copy of the transformed scattering. */
282 1.2.10.1 pgoyette isl_map *saved;
283 1.2.10.1 pgoyette #endif
284 1.2.10.1 pgoyette
285 1.2.10.1 pgoyette /* The data references we access. */
286 1.2.10.1 pgoyette vec<poly_dr_p> drs;
287 1.2.10.1 pgoyette
288 1.2.10.1 pgoyette /* The last basic block generated for this pbb. */
289 1.2.10.1 pgoyette basic_block new_bb;
290 1.2.10.1 pgoyette };
291 1.2.10.1 pgoyette
292 1.2.10.1 pgoyette #define PBB_BLACK_BOX(PBB) ((gimple_poly_bb_p) PBB->black_box)
293 1.2.10.1 pgoyette #define PBB_SCOP(PBB) (PBB->scop)
294 1.2.10.1 pgoyette #define PBB_DRS(PBB) (PBB->drs)
295 1.2.10.1 pgoyette
296 1.2.10.1 pgoyette extern poly_bb_p new_poly_bb (scop_p, gimple_poly_bb_p);
297 1.2.10.1 pgoyette extern void print_pbb_domain (FILE *, poly_bb_p);
298 1.2.10.1 pgoyette extern void print_pbb (FILE *, poly_bb_p);
299 1.2.10.1 pgoyette extern void print_scop_context (FILE *, scop_p);
300 1.2.10.1 pgoyette extern void print_scop (FILE *, scop_p);
301 1.2.10.1 pgoyette extern void debug_pbb_domain (poly_bb_p);
302 1.2.10.1 pgoyette extern void debug_pbb (poly_bb_p);
303 1.2.10.1 pgoyette extern void print_pdrs (FILE *, poly_bb_p);
304 1.2.10.1 pgoyette extern void debug_pdrs (poly_bb_p);
305 1.2.10.1 pgoyette extern void debug_scop_context (scop_p);
306 1.2.10.1 pgoyette extern void debug_scop (scop_p);
307 1.2.10.1 pgoyette extern void print_scop_params (FILE *, scop_p);
308 1.2.10.1 pgoyette extern void debug_scop_params (scop_p);
309 1.2.10.1 pgoyette extern void print_iteration_domain (FILE *, poly_bb_p);
310 1.2.10.1 pgoyette extern void print_iteration_domains (FILE *, scop_p);
311 1.2.10.1 pgoyette extern void debug_iteration_domain (poly_bb_p);
312 1.2.10.1 pgoyette extern void debug_iteration_domains (scop_p);
313 1.2.10.1 pgoyette extern void print_isl_set (FILE *, isl_set *);
314 1.2.10.1 pgoyette extern void print_isl_map (FILE *, isl_map *);
315 1.2.10.1 pgoyette extern void print_isl_union_map (FILE *, isl_union_map *);
316 1.2.10.1 pgoyette extern void print_isl_aff (FILE *, isl_aff *);
317 1.2.10.1 pgoyette extern void print_isl_constraint (FILE *, isl_constraint *);
318 1.2.10.1 pgoyette extern void print_isl_schedule (FILE *, isl_schedule *);
319 1.2.10.1 pgoyette extern void debug_isl_schedule (isl_schedule *);
320 1.2.10.1 pgoyette extern void print_isl_ast (FILE *, isl_ast_node *);
321 1.2.10.1 pgoyette extern void debug_isl_ast (isl_ast_node *);
322 1.2.10.1 pgoyette extern void debug_isl_set (isl_set *);
323 1.2.10.1 pgoyette extern void debug_isl_map (isl_map *);
324 1.2.10.1 pgoyette extern void debug_isl_union_map (isl_union_map *);
325 1.2.10.1 pgoyette extern void debug_isl_aff (isl_aff *);
326 1.2.10.1 pgoyette extern void debug_isl_constraint (isl_constraint *);
327 1.2.10.1 pgoyette extern void debug_gmp_value (mpz_t);
328 1.2.10.1 pgoyette extern void debug_scop_pbb (scop_p scop, int i);
329 1.2.10.1 pgoyette extern void print_schedule_ast (FILE *, __isl_keep isl_schedule *, scop_p);
330 1.2.10.1 pgoyette extern void debug_schedule_ast (__isl_keep isl_schedule *, scop_p);
331 1.2.10.1 pgoyette
332 1.2.10.1 pgoyette /* The basic block of the PBB. */
333 1.2.10.1 pgoyette
334 1.2.10.1 pgoyette static inline basic_block
335 1.2.10.1 pgoyette pbb_bb (poly_bb_p pbb)
336 1.2.10.1 pgoyette {
337 1.2.10.1 pgoyette return GBB_BB (PBB_BLACK_BOX (pbb));
338 1.2.10.1 pgoyette }
339 1.2.10.1 pgoyette
340 1.2.10.1 pgoyette static inline int
341 1.2.10.1 pgoyette pbb_index (poly_bb_p pbb)
342 1.2.10.1 pgoyette {
343 1.2.10.1 pgoyette return pbb_bb (pbb)->index;
344 1.2.10.1 pgoyette }
345 1.2.10.1 pgoyette
346 1.2.10.1 pgoyette /* The loop of the PBB. */
347 1.2.10.1 pgoyette
348 1.2.10.1 pgoyette static inline loop_p
349 1.2.10.1 pgoyette pbb_loop (poly_bb_p pbb)
350 1.2.10.1 pgoyette {
351 1.2.10.1 pgoyette return gbb_loop (PBB_BLACK_BOX (pbb));
352 1.2.10.1 pgoyette }
353 1.2.10.1 pgoyette
354 1.2.10.1 pgoyette /* The scop that contains the PDR. */
355 1.2.10.1 pgoyette
356 1.2.10.1 pgoyette static inline scop_p
357 1.2.10.1 pgoyette pdr_scop (poly_dr_p pdr)
358 1.2.10.1 pgoyette {
359 1.2.10.1 pgoyette return PBB_SCOP (PDR_PBB (pdr));
360 1.2.10.1 pgoyette }
361 1.2.10.1 pgoyette
362 1.2.10.1 pgoyette /* Set black box of PBB to BLACKBOX. */
363 1.2.10.1 pgoyette
364 1.2.10.1 pgoyette static inline void
365 1.2.10.1 pgoyette pbb_set_black_box (poly_bb_p pbb, gimple_poly_bb_p black_box)
366 1.2.10.1 pgoyette {
367 1.2.10.1 pgoyette pbb->black_box = black_box;
368 1.2.10.1 pgoyette }
369 1.2.10.1 pgoyette
370 1.2.10.1 pgoyette /* A helper structure to keep track of data references, polyhedral BBs, and
371 1.2.10.1 pgoyette alias sets. */
372 1.2.10.1 pgoyette
373 1.2.10.1 pgoyette struct dr_info
374 1.2.10.1 pgoyette {
375 1.2.10.1 pgoyette enum {
376 1.2.10.1 pgoyette invalid_alias_set = -1
377 1.2.10.1 pgoyette };
378 1.2.10.1 pgoyette /* The data reference. */
379 1.2.10.1 pgoyette data_reference_p dr;
380 1.2.10.1 pgoyette
381 1.2.10.1 pgoyette /* The polyhedral BB containing this DR. */
382 1.2.10.1 pgoyette poly_bb_p pbb;
383 1.2.10.1 pgoyette
384 1.2.10.1 pgoyette /* ALIAS_SET is the SCC number assigned by a graph_dfs of the alias graph.
385 1.2.10.1 pgoyette -1 is an invalid alias set. */
386 1.2.10.1 pgoyette int alias_set;
387 1.2.10.1 pgoyette
388 1.2.10.1 pgoyette /* Construct a DR_INFO from a data reference DR, an ALIAS_SET, and a PBB. */
389 1.2.10.1 pgoyette dr_info (data_reference_p dr, poly_bb_p pbb,
390 1.2.10.1 pgoyette int alias_set = invalid_alias_set)
391 1.2.10.1 pgoyette : dr (dr), pbb (pbb), alias_set (alias_set) {}
392 1.2.10.1 pgoyette };
393 1.2.10.1 pgoyette
394 1.2.10.1 pgoyette /* A SCOP is a Static Control Part of the program, simple enough to be
395 1.2.10.1 pgoyette represented in polyhedral form. */
396 1.2.10.1 pgoyette struct scop
397 1.2.10.1 pgoyette {
398 1.2.10.1 pgoyette /* A SCOP is defined as a SESE region. */
399 1.2.10.1 pgoyette sese_info_p scop_info;
400 1.2.10.1 pgoyette
401 1.2.10.1 pgoyette /* Number of parameters in SCoP. */
402 1.2.10.1 pgoyette graphite_dim_t nb_params;
403 1.2.10.1 pgoyette
404 1.2.10.1 pgoyette /* All the basic blocks in this scop that contain memory references
405 1.2.10.1 pgoyette and that will be represented as statements in the polyhedral
406 1.2.10.1 pgoyette representation. */
407 1.2.10.1 pgoyette vec<poly_bb_p> pbbs;
408 1.2.10.1 pgoyette
409 1.2.10.1 pgoyette /* All the data references in this scop. */
410 1.2.10.1 pgoyette vec<dr_info> drs;
411 1.2.10.1 pgoyette
412 1.2.10.1 pgoyette /* The context describes known restrictions concerning the parameters
413 1.2.10.1 pgoyette and relations in between the parameters.
414 1.2.10.1 pgoyette
415 1.2.10.1 pgoyette void f (int8_t a, uint_16_t b) {
416 1.2.10.1 pgoyette c = 2 a + b;
417 1.2.10.1 pgoyette ...
418 1.2.10.1 pgoyette }
419 1.2.10.1 pgoyette
420 1.2.10.1 pgoyette Here we can add these restrictions to the context:
421 1.2.10.1 pgoyette
422 1.2.10.1 pgoyette -128 >= a >= 127
423 1.2.10.1 pgoyette 0 >= b >= 65,535
424 1.2.10.1 pgoyette c = 2a + b */
425 1.2.10.1 pgoyette isl_set *param_context;
426 1.2.10.1 pgoyette
427 1.2.10.1 pgoyette /* The context used internally by isl. */
428 1.2.10.1 pgoyette isl_ctx *isl_context;
429 1.2.10.1 pgoyette
430 1.2.10.1 pgoyette #ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
431 1.2.10.1 pgoyette /* SCoP original schedule. */
432 1.2.10.1 pgoyette isl_schedule *original_schedule;
433 1.2.10.1 pgoyette
434 1.2.10.1 pgoyette /* SCoP transformed schedule. */
435 1.2.10.1 pgoyette isl_schedule *transformed_schedule;
436 1.2.10.1 pgoyette #else
437 1.2.10.1 pgoyette /* SCoP final schedule. */
438 1.2.10.1 pgoyette isl_schedule *schedule;
439 1.2.10.1 pgoyette #endif
440 1.2.10.1 pgoyette
441 1.2.10.1 pgoyette /* The data dependence relation among the data references in this scop. */
442 1.2.10.1 pgoyette isl_union_map *dependence;
443 1.2.10.1 pgoyette };
444 1.2.10.1 pgoyette
445 1.2.10.1 pgoyette extern scop_p new_scop (edge, edge);
446 1.2.10.1 pgoyette extern void free_scop (scop_p);
447 1.2.10.1 pgoyette extern gimple_poly_bb_p new_gimple_poly_bb (basic_block, vec<data_reference_p>,
448 1.2.10.1 pgoyette vec<scalar_use>, vec<tree>);
449 1.2.10.1 pgoyette extern bool apply_poly_transforms (scop_p);
450 1.2.10.1 pgoyette
451 1.2.10.1 pgoyette /* Set the region of SCOP to REGION. */
452 1.2.10.1 pgoyette
453 1.2.10.1 pgoyette static inline void
454 1.2.10.1 pgoyette scop_set_region (scop_p scop, sese_info_p region)
455 1.2.10.1 pgoyette {
456 1.2.10.1 pgoyette scop->scop_info = region;
457 1.2.10.1 pgoyette }
458 1.2.10.1 pgoyette
459 1.2.10.1 pgoyette /* Returns the number of parameters for SCOP. */
460 1.2.10.1 pgoyette
461 1.2.10.1 pgoyette static inline graphite_dim_t
462 1.2.10.1 pgoyette scop_nb_params (scop_p scop)
463 1.2.10.1 pgoyette {
464 1.2.10.1 pgoyette return scop->nb_params;
465 1.2.10.1 pgoyette }
466 1.2.10.1 pgoyette
467 1.2.10.1 pgoyette /* Set the number of params of SCOP to NB_PARAMS. */
468 1.2.10.1 pgoyette
469 1.2.10.1 pgoyette static inline void
470 1.2.10.1 pgoyette scop_set_nb_params (scop_p scop, graphite_dim_t nb_params)
471 1.2.10.1 pgoyette {
472 1.2.10.1 pgoyette scop->nb_params = nb_params;
473 1.2.10.1 pgoyette }
474 1.2.10.1 pgoyette
475 1.2.10.1 pgoyette #ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
476 1.2.10.1 pgoyette extern void scop_get_dependences (scop_p scop);
477 1.2.10.1 pgoyette #else
478 1.2.10.1 pgoyette extern isl_union_map *scop_get_dependences (scop_p scop);
479 1.2.10.1 pgoyette #endif
480 1.2.10.1 pgoyette
481 1.2.10.1 pgoyette bool
482 1.2.10.1 pgoyette carries_deps (__isl_keep isl_union_map *schedule,
483 1.2.10.1 pgoyette __isl_keep isl_union_map *deps,
484 1.2.10.1 pgoyette int depth);
485 1.2.10.1 pgoyette
486 1.2.10.1 pgoyette extern bool build_poly_scop (scop_p);
487 1.2.10.1 pgoyette extern bool graphite_regenerate_ast_isl (scop_p);
488 1.2.10.1 pgoyette extern void build_scops (vec<scop_p> *);
489 1.2.10.1 pgoyette extern void dot_all_sese (FILE *, vec<sese_l> &);
490 1.2.10.1 pgoyette extern void dot_sese (sese_l &);
491 1.2.10.1 pgoyette extern void dot_cfg ();
492 1.2.10.1 pgoyette
493 1.2.10.1 pgoyette #endif
494