]>
Commit | Line | Data |
---|---|---|
2abae5f1 | 1 | /* Graphite polyhedral representation. |
85ec4feb | 2 | Copyright (C) 2009-2018 Free Software Foundation, Inc. |
2abae5f1 SP |
3 | Contributed by Sebastian Pop <sebastian.pop@amd.com> and |
4 | Tobias Grosser <grosser@fim.uni-passau.de>. | |
5 | ||
6 | This file is part of GCC. | |
7 | ||
8 | GCC is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 3, or (at your option) | |
11 | any later version. | |
12 | ||
13 | GCC is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GCC; see the file COPYING3. If not see | |
20 | <http://www.gnu.org/licenses/>. */ | |
33ad93b9 | 21 | |
4d776011 DE |
22 | #define USES_ISL |
23 | ||
2abae5f1 | 24 | #include "config.h" |
33ad93b9 | 25 | |
eae1a5d4 | 26 | #ifdef HAVE_isl |
4d776011 DE |
27 | |
28 | #include "system.h" | |
29 | #include "coretypes.h" | |
30 | #include "backend.h" | |
31 | #include "tree.h" | |
32 | #include "gimple.h" | |
33 | #include "cfghooks.h" | |
4d776011 DE |
34 | #include "diagnostic-core.h" |
35 | #include "fold-const.h" | |
36 | #include "gimple-iterator.h" | |
37 | #include "tree-ssa-loop.h" | |
38 | #include "cfgloop.h" | |
39 | #include "tree-data-ref.h" | |
040b0c97 AK |
40 | #include "pretty-print.h" |
41 | #include "gimple-pretty-print.h" | |
cf98f0f4 | 42 | #include "graphite.h" |
31cf88b6 | 43 | #include "dumpfile.h" |
2abae5f1 | 44 | |
33ad93b9 RG |
45 | /* Print to STDERR the GMP value VAL. */ |
46 | ||
47 | DEBUG_FUNCTION void | |
48 | debug_gmp_value (mpz_t val) | |
49 | { | |
8ac16127 | 50 | gmp_fprintf (stderr, "%Zd", val); |
33ad93b9 RG |
51 | } |
52 | ||
5c24066b | 53 | /* Prints to FILE the iteration domain of PBB. */ |
2abae5f1 SP |
54 | |
55 | void | |
5c24066b | 56 | print_iteration_domain (FILE *file, poly_bb_p pbb) |
2abae5f1 | 57 | { |
5c24066b | 58 | print_pbb_domain (file, pbb); |
2abae5f1 SP |
59 | } |
60 | ||
5c24066b | 61 | /* Prints to FILE the iteration domains of every PBB of SCOP. */ |
2abae5f1 SP |
62 | |
63 | void | |
5c24066b | 64 | print_iteration_domains (FILE *file, scop_p scop) |
2abae5f1 SP |
65 | { |
66 | int i; | |
67 | poly_bb_p pbb; | |
68 | ||
b0b5710c | 69 | FOR_EACH_VEC_ELT (scop->pbbs, i, pbb) |
5c24066b | 70 | print_iteration_domain (file, pbb); |
2abae5f1 SP |
71 | } |
72 | ||
5c24066b | 73 | /* Prints to STDERR the iteration domain of PBB. */ |
2abae5f1 | 74 | |
24e47c76 | 75 | DEBUG_FUNCTION void |
5c24066b | 76 | debug_iteration_domain (poly_bb_p pbb) |
2abae5f1 | 77 | { |
5c24066b | 78 | print_iteration_domain (stderr, pbb); |
2abae5f1 SP |
79 | } |
80 | ||
5c24066b | 81 | /* Prints to STDERR the iteration domains of every PBB of SCOP. */ |
2abae5f1 | 82 | |
24e47c76 | 83 | DEBUG_FUNCTION void |
5c24066b | 84 | debug_iteration_domains (scop_p scop) |
2abae5f1 | 85 | { |
5c24066b | 86 | print_iteration_domains (stderr, scop); |
2abae5f1 SP |
87 | } |
88 | ||
25d7cc15 SP |
89 | /* Create a new polyhedral data reference and add it to PBB. It is |
90 | defined by its ACCESSES, its TYPE, and the number of subscripts | |
91 | NB_SUBSCRIPTS. */ | |
2abae5f1 SP |
92 | |
93 | void | |
65b016eb | 94 | new_poly_dr (poly_bb_p pbb, gimple *stmt, enum poly_dr_type type, |
24757752 | 95 | isl_map *acc, isl_set *subscript_sizes) |
2abae5f1 | 96 | { |
afae0207 | 97 | static int id = 0; |
211694b6 | 98 | poly_dr_p pdr = XNEW (struct poly_dr); |
2abae5f1 | 99 | |
65b016eb | 100 | pdr->stmt = stmt; |
afae0207 | 101 | PDR_ID (pdr) = id++; |
7bd2a8a7 | 102 | PDR_NB_REFS (pdr) = 1; |
2abae5f1 | 103 | PDR_PBB (pdr) = pbb; |
33ad93b9 | 104 | pdr->accesses = acc; |
24757752 | 105 | pdr->subscript_sizes = subscript_sizes; |
2abae5f1 | 106 | PDR_TYPE (pdr) = type; |
9771b263 | 107 | PBB_DRS (pbb).safe_push (pdr); |
040b0c97 AK |
108 | |
109 | if (dump_file) | |
110 | { | |
111 | fprintf (dump_file, "Converting dr: "); | |
112 | print_pdr (dump_file, pdr); | |
113 | fprintf (dump_file, "To polyhedral representation:\n"); | |
114 | fprintf (dump_file, " - access functions: "); | |
115 | print_isl_map (dump_file, acc); | |
116 | fprintf (dump_file, " - subscripts: "); | |
117 | print_isl_set (dump_file, subscript_sizes); | |
118 | } | |
2abae5f1 SP |
119 | } |
120 | ||
121 | /* Free polyhedral data reference PDR. */ | |
122 | ||
adba512d | 123 | static void |
2abae5f1 SP |
124 | free_poly_dr (poly_dr_p pdr) |
125 | { | |
33ad93b9 | 126 | isl_map_free (pdr->accesses); |
24757752 | 127 | isl_set_free (pdr->subscript_sizes); |
2abae5f1 SP |
128 | XDELETE (pdr); |
129 | } | |
130 | ||
131 | /* Create a new polyhedral black box. */ | |
132 | ||
efa21390 | 133 | poly_bb_p |
8e4dc590 | 134 | new_poly_bb (scop_p scop, gimple_poly_bb_p black_box) |
2abae5f1 SP |
135 | { |
136 | poly_bb_p pbb = XNEW (struct poly_bb); | |
137 | ||
33ad93b9 | 138 | pbb->domain = NULL; |
adba512d | 139 | pbb->iterators = NULL; |
2abae5f1 SP |
140 | PBB_SCOP (pbb) = scop; |
141 | pbb_set_black_box (pbb, black_box); | |
9771b263 | 142 | PBB_DRS (pbb).create (3); |
65ef70d6 | 143 | GBB_PBB ((gimple_poly_bb_p) black_box) = pbb; |
efa21390 SP |
144 | |
145 | return pbb; | |
2abae5f1 SP |
146 | } |
147 | ||
148 | /* Free polyhedral black box. */ | |
149 | ||
adba512d | 150 | static void |
2abae5f1 SP |
151 | free_poly_bb (poly_bb_p pbb) |
152 | { | |
153 | int i; | |
154 | poly_dr_p pdr; | |
155 | ||
33ad93b9 | 156 | isl_set_free (pbb->domain); |
adba512d | 157 | pbb->domain = NULL; |
adba512d AK |
158 | isl_set_free (pbb->iterators); |
159 | pbb->iterators = NULL; | |
2abae5f1 | 160 | |
9771b263 DN |
161 | if (PBB_DRS (pbb).exists ()) |
162 | FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr) | |
2abae5f1 SP |
163 | free_poly_dr (pdr); |
164 | ||
9771b263 | 165 | PBB_DRS (pbb).release (); |
2abae5f1 SP |
166 | XDELETE (pbb); |
167 | } | |
168 | ||
5c24066b | 169 | /* Prints to FILE the polyhedral data reference PDR. */ |
2abae5f1 SP |
170 | |
171 | void | |
5c24066b | 172 | print_pdr (FILE *file, poly_dr_p pdr) |
2abae5f1 | 173 | { |
5c24066b | 174 | fprintf (file, "pdr_%d (", PDR_ID (pdr)); |
2abae5f1 | 175 | |
5c24066b AK |
176 | switch (PDR_TYPE (pdr)) |
177 | { | |
178 | case PDR_READ: | |
179 | fprintf (file, "read \n"); | |
180 | break; | |
2abae5f1 | 181 | |
5c24066b AK |
182 | case PDR_WRITE: |
183 | fprintf (file, "write \n"); | |
184 | break; | |
2abae5f1 | 185 | |
5c24066b AK |
186 | case PDR_MAY_WRITE: |
187 | fprintf (file, "may_write \n"); | |
188 | break; | |
40bf935e | 189 | |
5c24066b AK |
190 | default: |
191 | gcc_unreachable (); | |
2abae5f1 SP |
192 | } |
193 | ||
65b016eb | 194 | fprintf (file, "in gimple stmt: "); |
ef6cb4c7 | 195 | print_gimple_stmt (file, pdr->stmt, 0); |
5c24066b AK |
196 | fprintf (file, "data accesses: "); |
197 | print_isl_map (file, pdr->accesses); | |
198 | fprintf (file, "subscript sizes: "); | |
199 | print_isl_set (file, pdr->subscript_sizes); | |
200 | fprintf (file, ")\n"); | |
2abae5f1 SP |
201 | } |
202 | ||
5c24066b | 203 | /* Prints to STDERR the polyhedral data reference PDR. */ |
2abae5f1 | 204 | |
24e47c76 | 205 | DEBUG_FUNCTION void |
5c24066b | 206 | debug_pdr (poly_dr_p pdr) |
2abae5f1 | 207 | { |
5c24066b | 208 | print_pdr (stderr, pdr); |
2abae5f1 SP |
209 | } |
210 | ||
87ccab5d AK |
211 | /* Store the GRAPHITE representation of BB. */ |
212 | ||
213 | gimple_poly_bb_p | |
65b016eb AK |
214 | new_gimple_poly_bb (basic_block bb, vec<data_reference_p> drs, |
215 | vec<scalar_use> reads, vec<tree> writes) | |
87ccab5d | 216 | { |
65b016eb | 217 | gimple_poly_bb_p gbb = XNEW (struct gimple_poly_bb); |
87ccab5d AK |
218 | GBB_BB (gbb) = bb; |
219 | GBB_DATA_REFS (gbb) = drs; | |
65b016eb AK |
220 | gbb->read_scalar_refs = reads; |
221 | gbb->write_scalar_refs = writes; | |
87ccab5d AK |
222 | GBB_CONDITIONS (gbb).create (0); |
223 | GBB_CONDITION_CASES (gbb).create (0); | |
224 | ||
225 | return gbb; | |
226 | } | |
227 | ||
87ccab5d AK |
228 | /* Frees GBB. */ |
229 | ||
adba512d | 230 | static void |
87ccab5d AK |
231 | free_gimple_poly_bb (gimple_poly_bb_p gbb) |
232 | { | |
87ccab5d | 233 | free_data_refs (GBB_DATA_REFS (gbb)); |
87ccab5d AK |
234 | GBB_CONDITIONS (gbb).release (); |
235 | GBB_CONDITION_CASES (gbb).release (); | |
65b016eb AK |
236 | gbb->read_scalar_refs.release (); |
237 | gbb->write_scalar_refs.release (); | |
87ccab5d AK |
238 | XDELETE (gbb); |
239 | } | |
240 | ||
241 | /* Deletes all gimple bbs in SCOP. */ | |
242 | ||
243 | static void | |
244 | remove_gbbs_in_scop (scop_p scop) | |
245 | { | |
246 | int i; | |
247 | poly_bb_p pbb; | |
248 | ||
b0b5710c | 249 | FOR_EACH_VEC_ELT (scop->pbbs, i, pbb) |
87ccab5d AK |
250 | free_gimple_poly_bb (PBB_BLACK_BOX (pbb)); |
251 | } | |
252 | ||
253 | /* Creates a new SCOP containing the region (ENTRY, EXIT). */ | |
2abae5f1 SP |
254 | |
255 | scop_p | |
87ccab5d | 256 | new_scop (edge entry, edge exit) |
2abae5f1 | 257 | { |
bafcb153 | 258 | sese_info_p region = new_sese_info (entry, exit); |
9625f2a2 | 259 | scop_p s = XNEW (struct scop); |
0f7a02a3 | 260 | |
adba512d AK |
261 | s->original_schedule = NULL; |
262 | s->transformed_schedule = NULL; | |
0f7a02a3 AK |
263 | s->param_context = NULL; |
264 | scop_set_region (s, region); | |
265 | s->pbbs.create (3); | |
266 | s->drs.create (3); | |
267 | s->dependence = NULL; | |
268 | return s; | |
2abae5f1 SP |
269 | } |
270 | ||
271 | /* Deletes SCOP. */ | |
272 | ||
273 | void | |
274 | free_scop (scop_p scop) | |
275 | { | |
276 | int i; | |
277 | poly_bb_p pbb; | |
278 | ||
87ccab5d | 279 | remove_gbbs_in_scop (scop); |
d37fc3aa | 280 | free_sese_info (scop->scop_info); |
87ccab5d | 281 | |
b0b5710c | 282 | FOR_EACH_VEC_ELT (scop->pbbs, i, pbb) |
2abae5f1 SP |
283 | free_poly_bb (pbb); |
284 | ||
b0b5710c | 285 | scop->pbbs.release (); |
ec17e433 | 286 | scop->drs.release (); |
2abae5f1 | 287 | |
8e4dc590 | 288 | isl_set_free (scop->param_context); |
adba512d | 289 | scop->param_context = NULL; |
0f7a02a3 AK |
290 | isl_union_map_free (scop->dependence); |
291 | scop->dependence = NULL; | |
adba512d AK |
292 | isl_schedule_free (scop->original_schedule); |
293 | scop->original_schedule = NULL; | |
294 | isl_schedule_free (scop->transformed_schedule); | |
295 | scop->transformed_schedule = NULL; | |
2abae5f1 SP |
296 | XDELETE (scop); |
297 | } | |
298 | ||
5c24066b | 299 | /* Print to FILE the domain of PBB. */ |
2abae5f1 SP |
300 | |
301 | void | |
5c24066b | 302 | print_pbb_domain (FILE *file, poly_bb_p pbb) |
2abae5f1 | 303 | { |
33ad93b9 | 304 | print_isl_set (file, pbb->domain); |
2abae5f1 SP |
305 | } |
306 | ||
307 | /* Dump the cases of a graphite basic block GBB on FILE. */ | |
308 | ||
309 | static void | |
65ef70d6 | 310 | dump_gbb_cases (FILE *file, gimple_poly_bb_p gbb) |
2abae5f1 SP |
311 | { |
312 | int i; | |
355fe088 TS |
313 | gimple *stmt; |
314 | vec<gimple *> cases; | |
2abae5f1 SP |
315 | |
316 | if (!gbb) | |
317 | return; | |
318 | ||
319 | cases = GBB_CONDITION_CASES (gbb); | |
9771b263 | 320 | if (cases.is_empty ()) |
2abae5f1 SP |
321 | return; |
322 | ||
5c24066b | 323 | fprintf (file, "cases bb_%d (\n", GBB_BB (gbb)->index); |
2abae5f1 | 324 | |
9771b263 | 325 | FOR_EACH_VEC_ELT (cases, i, stmt) |
ef6cb4c7 | 326 | print_gimple_stmt (file, stmt, 0); |
2abae5f1 | 327 | |
5c24066b | 328 | fprintf (file, ")\n"); |
2abae5f1 SP |
329 | } |
330 | ||
331 | /* Dump conditions of a graphite basic block GBB on FILE. */ | |
332 | ||
333 | static void | |
65ef70d6 | 334 | dump_gbb_conditions (FILE *file, gimple_poly_bb_p gbb) |
2abae5f1 SP |
335 | { |
336 | int i; | |
355fe088 TS |
337 | gimple *stmt; |
338 | vec<gimple *> conditions; | |
2abae5f1 SP |
339 | |
340 | if (!gbb) | |
341 | return; | |
342 | ||
343 | conditions = GBB_CONDITIONS (gbb); | |
9771b263 | 344 | if (conditions.is_empty ()) |
2abae5f1 SP |
345 | return; |
346 | ||
5c24066b | 347 | fprintf (file, "conditions bb_%d (\n", GBB_BB (gbb)->index); |
2abae5f1 | 348 | |
9771b263 | 349 | FOR_EACH_VEC_ELT (conditions, i, stmt) |
ef6cb4c7 | 350 | print_gimple_stmt (file, stmt, 0); |
2abae5f1 | 351 | |
5c24066b | 352 | fprintf (file, ")\n"); |
2abae5f1 SP |
353 | } |
354 | ||
5c24066b | 355 | /* Print to FILE all the data references of PBB. */ |
2abae5f1 SP |
356 | |
357 | void | |
5c24066b | 358 | print_pdrs (FILE *file, poly_bb_p pbb) |
2abae5f1 SP |
359 | { |
360 | int i; | |
361 | poly_dr_p pdr; | |
03922af3 SP |
362 | int nb_reads = 0; |
363 | int nb_writes = 0; | |
2abae5f1 | 364 | |
5c24066b AK |
365 | if (PBB_DRS (pbb).is_empty ()) |
366 | return; | |
40bf935e | 367 | |
5c24066b | 368 | fprintf (file, "Data references (\n"); |
03922af3 | 369 | |
9771b263 | 370 | FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr) |
03922af3 SP |
371 | if (PDR_TYPE (pdr) == PDR_READ) |
372 | nb_reads++; | |
373 | else | |
374 | nb_writes++; | |
375 | ||
5c24066b | 376 | fprintf (file, "Read data references (\n"); |
40bf935e | 377 | |
9771b263 | 378 | FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr) |
03922af3 | 379 | if (PDR_TYPE (pdr) == PDR_READ) |
5c24066b | 380 | print_pdr (file, pdr); |
03922af3 | 381 | |
5c24066b AK |
382 | fprintf (file, ")\n"); |
383 | fprintf (file, "Write data references (\n"); | |
9771b263 | 384 | FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr) |
03922af3 | 385 | if (PDR_TYPE (pdr) != PDR_READ) |
5c24066b AK |
386 | print_pdr (file, pdr); |
387 | fprintf (file, ")\n"); | |
388 | fprintf (file, ")\n"); | |
2abae5f1 SP |
389 | } |
390 | ||
391 | /* Print to STDERR all the data references of PBB. */ | |
392 | ||
24e47c76 | 393 | DEBUG_FUNCTION void |
5c24066b | 394 | debug_pdrs (poly_bb_p pbb) |
2abae5f1 | 395 | { |
5c24066b | 396 | print_pdrs (stderr, pbb); |
2abae5f1 SP |
397 | } |
398 | ||
5c24066b | 399 | /* Print to FILE the body of PBB. */ |
03922af3 SP |
400 | |
401 | static void | |
5c24066b | 402 | print_pbb_body (FILE *file, poly_bb_p pbb) |
03922af3 | 403 | { |
5c24066b | 404 | fprintf (file, "Body (\n"); |
512ab654 | 405 | dump_bb (file, pbb_bb (pbb), 0, 0); |
5c24066b | 406 | fprintf (file, ")\n"); |
03922af3 SP |
407 | } |
408 | ||
5c24066b | 409 | /* Print to FILE the domain and scattering function of PBB. */ |
2abae5f1 SP |
410 | |
411 | void | |
5c24066b | 412 | print_pbb (FILE *file, poly_bb_p pbb) |
40bf935e | 413 | { |
5c24066b AK |
414 | fprintf (file, "pbb_%d (\n", pbb_index (pbb)); |
415 | dump_gbb_conditions (file, PBB_BLACK_BOX (pbb)); | |
416 | dump_gbb_cases (file, PBB_BLACK_BOX (pbb)); | |
40bf935e | 417 | |
5c24066b AK |
418 | print_pbb_domain (file, pbb); |
419 | print_pdrs (file, pbb); | |
420 | print_pbb_body (file, pbb); | |
40bf935e | 421 | |
5c24066b | 422 | fprintf (file, ")\n"); |
2abae5f1 SP |
423 | } |
424 | ||
5c24066b | 425 | /* Print to FILE the parameters of SCOP. */ |
2abae5f1 SP |
426 | |
427 | void | |
5c24066b | 428 | print_scop_params (FILE *file, scop_p scop) |
2abae5f1 | 429 | { |
65b016eb | 430 | if (scop->scop_info->params.is_empty ()) |
5c24066b AK |
431 | return; |
432 | ||
2abae5f1 SP |
433 | int i; |
434 | tree t; | |
5c24066b | 435 | fprintf (file, "parameters ("); |
65b016eb | 436 | FOR_EACH_VEC_ELT (scop->scop_info->params, i, t) |
2abae5f1 | 437 | { |
ef6cb4c7 | 438 | print_generic_expr (file, t); |
5c24066b | 439 | fprintf (file, ", "); |
2abae5f1 | 440 | } |
5c24066b | 441 | fprintf (file, ")\n"); |
2abae5f1 SP |
442 | } |
443 | ||
5c24066b | 444 | /* Print to FILE the context of SCoP. */ |
40bf935e | 445 | |
2abae5f1 | 446 | void |
5c24066b | 447 | print_scop_context (FILE *file, scop_p scop) |
2abae5f1 | 448 | { |
5c24066b AK |
449 | if (!scop->param_context) |
450 | return; | |
2abae5f1 | 451 | |
5c24066b AK |
452 | fprintf (file, "Context (\n"); |
453 | print_isl_set (file, scop->param_context); | |
454 | fprintf (file, ")\n"); | |
2abae5f1 SP |
455 | } |
456 | ||
5c24066b | 457 | /* Print to FILE the SCOP. */ |
2abae5f1 | 458 | |
0ba82567 | 459 | void |
5c24066b | 460 | print_scop (FILE *file, scop_p scop) |
2abae5f1 | 461 | { |
0ba82567 SP |
462 | int i; |
463 | poly_bb_p pbb; | |
464 | ||
5c24066b AK |
465 | fprintf (file, "SCoP (\n"); |
466 | print_scop_context (file, scop); | |
467 | print_scop_params (file, scop); | |
40bf935e | 468 | |
5c24066b | 469 | fprintf (file, "Number of statements: "); |
b0b5710c | 470 | fprintf (file, "%d\n", scop->pbbs.length ()); |
2abae5f1 | 471 | |
b0b5710c | 472 | FOR_EACH_VEC_ELT (scop->pbbs, i, pbb) |
5c24066b | 473 | print_pbb (file, pbb); |
e31a5bd4 | 474 | |
5c24066b | 475 | fprintf (file, ")\n"); |
2abae5f1 SP |
476 | } |
477 | ||
5c24066b | 478 | /* Print to STDERR the domain of PBB. */ |
2abae5f1 | 479 | |
24e47c76 | 480 | DEBUG_FUNCTION void |
5c24066b | 481 | debug_pbb_domain (poly_bb_p pbb) |
2abae5f1 | 482 | { |
5c24066b | 483 | print_pbb_domain (stderr, pbb); |
2abae5f1 SP |
484 | } |
485 | ||
5c24066b | 486 | /* Print to FILE the domain and scattering function of PBB. */ |
2abae5f1 | 487 | |
24e47c76 | 488 | DEBUG_FUNCTION void |
5c24066b | 489 | debug_pbb (poly_bb_p pbb) |
2abae5f1 | 490 | { |
5c24066b | 491 | print_pbb (stderr, pbb); |
2abae5f1 SP |
492 | } |
493 | ||
5c24066b | 494 | /* Print to STDERR the context of SCOP. */ |
2abae5f1 | 495 | |
24e47c76 | 496 | DEBUG_FUNCTION void |
5c24066b | 497 | debug_scop_context (scop_p scop) |
2abae5f1 | 498 | { |
5c24066b | 499 | print_scop_context (stderr, scop); |
2abae5f1 SP |
500 | } |
501 | ||
5c24066b | 502 | /* Print to STDERR the SCOP. */ |
2abae5f1 | 503 | |
24e47c76 | 504 | DEBUG_FUNCTION void |
5c24066b | 505 | debug_scop (scop_p scop) |
2abae5f1 | 506 | { |
5c24066b | 507 | print_scop (stderr, scop); |
2abae5f1 SP |
508 | } |
509 | ||
5c24066b | 510 | /* Print to STDERR the parameters of SCOP. */ |
2abae5f1 | 511 | |
24e47c76 | 512 | DEBUG_FUNCTION void |
5c24066b | 513 | debug_scop_params (scop_p scop) |
2abae5f1 | 514 | { |
5c24066b | 515 | print_scop_params (stderr, scop); |
2abae5f1 SP |
516 | } |
517 | ||
33ad93b9 RG |
518 | extern isl_ctx *the_isl_ctx; |
519 | void | |
adba512d | 520 | print_isl_set (FILE *f, __isl_keep isl_set *set) |
2abae5f1 | 521 | { |
33ad93b9 | 522 | isl_printer *p = isl_printer_to_file (the_isl_ctx, f); |
adba512d | 523 | p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK); |
33ad93b9 | 524 | p = isl_printer_print_set (p, set); |
d6bb5ccf | 525 | p = isl_printer_print_str (p, "\n"); |
33ad93b9 RG |
526 | isl_printer_free (p); |
527 | } | |
2abae5f1 | 528 | |
33ad93b9 | 529 | DEBUG_FUNCTION void |
adba512d | 530 | debug_isl_set (__isl_keep isl_set *set) |
33ad93b9 RG |
531 | { |
532 | print_isl_set (stderr, set); | |
533 | } | |
2abae5f1 | 534 | |
33ad93b9 | 535 | void |
adba512d | 536 | print_isl_map (FILE *f, __isl_keep isl_map *map) |
33ad93b9 RG |
537 | { |
538 | isl_printer *p = isl_printer_to_file (the_isl_ctx, f); | |
adba512d | 539 | p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK); |
33ad93b9 | 540 | p = isl_printer_print_map (p, map); |
d6bb5ccf | 541 | p = isl_printer_print_str (p, "\n"); |
33ad93b9 RG |
542 | isl_printer_free (p); |
543 | } | |
2abae5f1 | 544 | |
33ad93b9 | 545 | DEBUG_FUNCTION void |
adba512d | 546 | debug_isl_map (__isl_keep isl_map *map) |
33ad93b9 RG |
547 | { |
548 | print_isl_map (stderr, map); | |
549 | } | |
2abae5f1 | 550 | |
ea17c0fe | 551 | void |
adba512d | 552 | print_isl_union_map (FILE *f, __isl_keep isl_union_map *map) |
ea17c0fe AK |
553 | { |
554 | isl_printer *p = isl_printer_to_file (the_isl_ctx, f); | |
adba512d | 555 | p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK); |
ea17c0fe AK |
556 | p = isl_printer_print_union_map (p, map); |
557 | p = isl_printer_print_str (p, "\n"); | |
558 | isl_printer_free (p); | |
559 | } | |
560 | ||
561 | DEBUG_FUNCTION void | |
adba512d | 562 | debug_isl_union_map (__isl_keep isl_union_map *map) |
ea17c0fe AK |
563 | { |
564 | print_isl_union_map (stderr, map); | |
565 | } | |
566 | ||
33ad93b9 | 567 | void |
adba512d | 568 | print_isl_aff (FILE *f, __isl_keep isl_aff *aff) |
33ad93b9 RG |
569 | { |
570 | isl_printer *p = isl_printer_to_file (the_isl_ctx, f); | |
571 | p = isl_printer_print_aff (p, aff); | |
d6bb5ccf | 572 | p = isl_printer_print_str (p, "\n"); |
33ad93b9 RG |
573 | isl_printer_free (p); |
574 | } | |
2abae5f1 | 575 | |
33ad93b9 | 576 | DEBUG_FUNCTION void |
adba512d | 577 | debug_isl_aff (__isl_keep isl_aff *aff) |
33ad93b9 RG |
578 | { |
579 | print_isl_aff (stderr, aff); | |
580 | } | |
2abae5f1 | 581 | |
33ad93b9 | 582 | void |
adba512d | 583 | print_isl_constraint (FILE *f, __isl_keep isl_constraint *c) |
33ad93b9 RG |
584 | { |
585 | isl_printer *p = isl_printer_to_file (the_isl_ctx, f); | |
586 | p = isl_printer_print_constraint (p, c); | |
d6bb5ccf | 587 | p = isl_printer_print_str (p, "\n"); |
33ad93b9 RG |
588 | isl_printer_free (p); |
589 | } | |
2abae5f1 | 590 | |
33ad93b9 | 591 | DEBUG_FUNCTION void |
adba512d | 592 | debug_isl_constraint (__isl_keep isl_constraint *c) |
33ad93b9 RG |
593 | { |
594 | print_isl_constraint (stderr, c); | |
2abae5f1 SP |
595 | } |
596 | ||
adba512d AK |
597 | void |
598 | print_isl_schedule (FILE *f, __isl_keep isl_schedule *s) | |
599 | { | |
600 | isl_printer *p = isl_printer_to_file (the_isl_ctx, f); | |
adba512d | 601 | p = isl_printer_set_yaml_style (p, ISL_YAML_STYLE_BLOCK); |
adba512d AK |
602 | p = isl_printer_print_schedule (p, s); |
603 | p = isl_printer_print_str (p, "\n"); | |
604 | isl_printer_free (p); | |
605 | } | |
606 | ||
607 | DEBUG_FUNCTION void | |
608 | debug_isl_schedule (__isl_keep isl_schedule *s) | |
609 | { | |
610 | print_isl_schedule (stderr, s); | |
611 | } | |
baf4b881 KT |
612 | |
613 | void | |
adba512d AK |
614 | print_isl_ast (FILE *file, __isl_keep isl_ast_node *n) |
615 | { | |
616 | isl_printer *prn = isl_printer_to_file (the_isl_ctx, file); | |
617 | prn = isl_printer_set_output_format (prn, ISL_FORMAT_C); | |
618 | prn = isl_printer_print_ast_node (prn, n); | |
619 | prn = isl_printer_print_str (prn, "\n"); | |
620 | isl_printer_free (prn); | |
621 | } | |
622 | ||
623 | DEBUG_FUNCTION void | |
624 | debug_isl_ast (isl_ast_node *n) | |
625 | { | |
626 | print_isl_ast (stderr, n); | |
627 | } | |
628 | ||
629 | DEBUG_FUNCTION void | |
630 | debug_scop_pbb (scop_p scop, int i) | |
631 | { | |
632 | debug_pbb (scop->pbbs[i]); | |
baf4b881 KT |
633 | } |
634 | ||
9c358739 | 635 | #endif /* HAVE_isl */ |
2abae5f1 | 636 |