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