]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/graphite-poly.c
Re-factor inclusion of tree.h.
[thirdparty/gcc.git] / gcc / graphite-poly.c
CommitLineData
c6bb733d 1/* Graphite polyhedral representation.
711789cc 2 Copyright (C) 2009-2013 Free Software Foundation, Inc.
c6bb733d 3 Contributed by Sebastian Pop <sebastian.pop@amd.com> and
4 Tobias Grosser <grosser@fim.uni-passau.de>.
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GCC is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
87e20041 21
c6bb733d 22#include "config.h"
87e20041 23
24#ifdef HAVE_cloog
25#include <isl/set.h>
26#include <isl/map.h>
27#include <isl/union_map.h>
28#include <isl/constraint.h>
29#include <isl/ilp.h>
30#include <isl/aff.h>
31#include <cloog/cloog.h>
32#include <cloog/isl/domain.h>
33#endif
34
c6bb733d 35#include "system.h"
36#include "coretypes.h"
52f91c04 37#include "diagnostic-core.h"
41a8aa41 38#include "tree.h"
69ee5dbb 39#include "tree-ssa.h"
b9ed1410 40#include "dumpfile.h"
1e5b7b1f 41#include "gimple-pretty-print.h"
c6bb733d 42#include "cfgloop.h"
43#include "tree-chrec.h"
44#include "tree-data-ref.h"
45#include "tree-scalar-evolution.h"
1e5b7b1f 46#include "sese.h"
c6bb733d 47
48#ifdef HAVE_cloog
c6bb733d 49#include "graphite-poly.h"
c6bb733d 50
63b03ccf 51#define OPENSCOP_MAX_STRING 256
52
87e20041 53
54/* Print to STDERR the GMP value VAL. */
55
56DEBUG_FUNCTION void
57debug_gmp_value (mpz_t val)
58{
de2e6b8a 59 gmp_fprintf (stderr, "%Zd", val);
87e20041 60}
61
c6bb733d 62/* Return the maximal loop depth in SCOP. */
63
64int
65scop_max_loop_depth (scop_p scop)
66{
67 int i;
68 poly_bb_p pbb;
69 int max_nb_loops = 0;
70
f1f41a6c 71 FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
c6bb733d 72 {
73 int nb_loops = pbb_dim_iter_domain (pbb);
74 if (max_nb_loops < nb_loops)
75 max_nb_loops = nb_loops;
76 }
77
78 return max_nb_loops;
79}
80
ff4c7a5a 81/* Prints to FILE the scattering function of PBB, at some VERBOSITY
82 level. */
c6bb733d 83
1f8d6d4d 84static void
ff4c7a5a 85print_scattering_function_1 (FILE *file, poly_bb_p pbb, int verbosity)
c6bb733d 86{
87 graphite_dim_t i;
88
ff4c7a5a 89 if (verbosity > 0)
90 {
91 fprintf (file, "# scattering bb_%d (\n", pbb_index (pbb));
086610eb 92 fprintf (file, "#eq");
c6bb733d 93
ff4c7a5a 94 for (i = 0; i < pbb_nb_scattering_transform (pbb); i++)
95 fprintf (file, " s%d", (int) i);
c6bb733d 96
ff4c7a5a 97 for (i = 0; i < pbb_nb_local_vars (pbb); i++)
98 fprintf (file, " lv%d", (int) i);
c6bb733d 99
ff4c7a5a 100 for (i = 0; i < pbb_dim_iter_domain (pbb); i++)
101 fprintf (file, " i%d", (int) i);
c6bb733d 102
ff4c7a5a 103 for (i = 0; i < pbb_nb_params (pbb); i++)
104 fprintf (file, " p%d", (int) i);
c6bb733d 105
ff4c7a5a 106 fprintf (file, " cst\n");
107 }
c6bb733d 108
87e20041 109 fprintf (file, "isl\n");
110 print_isl_map (file, pbb->transformed ? pbb->transformed : pbb->schedule);
c6bb733d 111
ff4c7a5a 112 if (verbosity > 0)
113 fprintf (file, "#)\n");
c6bb733d 114}
115
ff4c7a5a 116/* Prints to FILE the scattering function of PBB, at some VERBOSITY
117 level. */
1f8d6d4d 118
119void
ff4c7a5a 120print_scattering_function (FILE *file, poly_bb_p pbb, int verbosity)
1f8d6d4d 121{
122 if (!PBB_TRANSFORMED (pbb))
123 return;
124
87e20041 125 if (pbb->schedule || pbb->transformed)
ff4c7a5a 126 {
127 if (verbosity > 0)
128 fprintf (file, "# Scattering function is provided\n");
129
130 fprintf (file, "1\n");
131 }
1f8d6d4d 132 else
133 {
ff4c7a5a 134 if (verbosity > 0)
135 fprintf (file, "# Scattering function is not provided\n");
136
137 fprintf (file, "0\n");
1f8d6d4d 138 return;
139 }
140
87e20041 141 print_scattering_function_1 (file, pbb, verbosity);
8c4b14b0 142
143 if (verbosity > 0)
144 fprintf (file, "# Scattering names are not provided\n");
145
146 fprintf (file, "0\n");
147
1f8d6d4d 148}
149
ff4c7a5a 150/* Prints to FILE the iteration domain of PBB, at some VERBOSITY
151 level. */
c6bb733d 152
153void
ff4c7a5a 154print_iteration_domain (FILE *file, poly_bb_p pbb, int verbosity)
c6bb733d 155{
ff4c7a5a 156 print_pbb_domain (file, pbb, verbosity);
c6bb733d 157}
158
159/* Prints to FILE the scattering functions of every PBB of SCOP. */
160
161void
ff4c7a5a 162print_scattering_functions (FILE *file, scop_p scop, int verbosity)
c6bb733d 163{
164 int i;
165 poly_bb_p pbb;
166
f1f41a6c 167 FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
ff4c7a5a 168 print_scattering_function (file, pbb, verbosity);
c6bb733d 169}
170
ff4c7a5a 171/* Prints to FILE the iteration domains of every PBB of SCOP, at some
172 VERBOSITY level. */
c6bb733d 173
174void
ff4c7a5a 175print_iteration_domains (FILE *file, scop_p scop, int verbosity)
c6bb733d 176{
177 int i;
178 poly_bb_p pbb;
179
f1f41a6c 180 FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
ff4c7a5a 181 print_iteration_domain (file, pbb, verbosity);
c6bb733d 182}
183
ff4c7a5a 184/* Prints to STDERR the scattering function of PBB, at some VERBOSITY
185 level. */
c6bb733d 186
4b987fac 187DEBUG_FUNCTION void
ff4c7a5a 188debug_scattering_function (poly_bb_p pbb, int verbosity)
c6bb733d 189{
ff4c7a5a 190 print_scattering_function (stderr, pbb, verbosity);
c6bb733d 191}
192
ff4c7a5a 193/* Prints to STDERR the iteration domain of PBB, at some VERBOSITY
194 level. */
c6bb733d 195
4b987fac 196DEBUG_FUNCTION void
ff4c7a5a 197debug_iteration_domain (poly_bb_p pbb, int verbosity)
c6bb733d 198{
ff4c7a5a 199 print_iteration_domain (stderr, pbb, verbosity);
c6bb733d 200}
201
ff4c7a5a 202/* Prints to STDERR the scattering functions of every PBB of SCOP, at
203 some VERBOSITY level. */
c6bb733d 204
4b987fac 205DEBUG_FUNCTION void
ff4c7a5a 206debug_scattering_functions (scop_p scop, int verbosity)
c6bb733d 207{
ff4c7a5a 208 print_scattering_functions (stderr, scop, verbosity);
c6bb733d 209}
210
ff4c7a5a 211/* Prints to STDERR the iteration domains of every PBB of SCOP, at
212 some VERBOSITY level. */
c6bb733d 213
4b987fac 214DEBUG_FUNCTION void
ff4c7a5a 215debug_iteration_domains (scop_p scop, int verbosity)
c6bb733d 216{
ff4c7a5a 217 print_iteration_domains (stderr, scop, verbosity);
c6bb733d 218}
219
220/* Apply graphite transformations to all the basic blocks of SCOP. */
221
222bool
223apply_poly_transforms (scop_p scop)
224{
225 bool transform_done = false;
63b03ccf 226
c6bb733d 227 /* Generate code even if we did not apply any real transformation.
228 This also allows to check the performance for the identity
229 transformation: GIMPLE -> GRAPHITE -> GIMPLE
230 Keep in mind that CLooG optimizes in control, so the loop structure
231 may change, even if we only use -fgraphite-identity. */
232 if (flag_graphite_identity)
233 transform_done = true;
234
16848556 235 if (flag_loop_parallelize_all)
c6bb733d 236 transform_done = true;
237
238 if (flag_loop_block)
64d8f27a 239 transform_done |= scop_do_block (scop);
dbe2e816 240 else
241 {
242 if (flag_loop_strip_mine)
68f6634f 243 transform_done |= scop_do_strip_mine (scop, 0);
c6bb733d 244
dbe2e816 245 if (flag_loop_interchange)
246 transform_done |= scop_do_interchange (scop);
247 }
c6bb733d 248
89049f25 249 /* This pass needs to be run at the final stage, as it does not
250 update the lst. */
251 if (flag_loop_optimize_isl)
252 transform_done |= optimize_isl (scop);
253
c6bb733d 254 return transform_done;
255}
256
85f74b79 257/* Create a new polyhedral data reference and add it to PBB. It is
258 defined by its ACCESSES, its TYPE, and the number of subscripts
259 NB_SUBSCRIPTS. */
c6bb733d 260
261void
ae11f03b 262new_poly_dr (poly_bb_p pbb, int dr_base_object_set,
87e20041 263 enum poly_dr_type type, void *cdr, graphite_dim_t nb_subscripts,
264 isl_map *acc, isl_set *extent)
c6bb733d 265{
96b6d5d7 266 static int id = 0;
9e3531b5 267 poly_dr_p pdr = XNEW (struct poly_dr);
c6bb733d 268
96b6d5d7 269 PDR_ID (pdr) = id++;
ae11f03b 270 PDR_BASE_OBJECT_SET (pdr) = dr_base_object_set;
11b2102e 271 PDR_NB_REFS (pdr) = 1;
c6bb733d 272 PDR_PBB (pdr) = pbb;
87e20041 273 pdr->accesses = acc;
274 pdr->extent = extent;
c6bb733d 275 PDR_TYPE (pdr) = type;
276 PDR_CDR (pdr) = cdr;
85f74b79 277 PDR_NB_SUBSCRIPTS (pdr) = nb_subscripts;
f1f41a6c 278 PBB_DRS (pbb).safe_push (pdr);
c6bb733d 279}
280
281/* Free polyhedral data reference PDR. */
282
283void
284free_poly_dr (poly_dr_p pdr)
285{
87e20041 286 isl_map_free (pdr->accesses);
287 isl_set_free (pdr->extent);
c6bb733d 288 XDELETE (pdr);
289}
290
291/* Create a new polyhedral black box. */
292
8c6b3774 293poly_bb_p
294new_poly_bb (scop_p scop, void *black_box)
c6bb733d 295{
296 poly_bb_p pbb = XNEW (struct poly_bb);
297
87e20041 298 pbb->domain = NULL;
299 pbb->schedule = NULL;
300 pbb->transformed = NULL;
301 pbb->saved = NULL;
c6bb733d 302 PBB_SCOP (pbb) = scop;
303 pbb_set_black_box (pbb, black_box);
a741358d 304 PBB_TRANSFORMED (pbb) = NULL;
305 PBB_SAVED (pbb) = NULL;
306 PBB_ORIGINAL (pbb) = NULL;
f1f41a6c 307 PBB_DRS (pbb).create (3);
8c6b3774 308 PBB_IS_REDUCTION (pbb) = false;
8c6b3774 309 GBB_PBB ((gimple_bb_p) black_box) = pbb;
310
311 return pbb;
c6bb733d 312}
313
314/* Free polyhedral black box. */
315
316void
317free_poly_bb (poly_bb_p pbb)
318{
319 int i;
320 poly_dr_p pdr;
321
87e20041 322 isl_set_free (pbb->domain);
323 isl_map_free (pbb->schedule);
324 isl_map_free (pbb->transformed);
325 isl_map_free (pbb->saved);
c6bb733d 326
f1f41a6c 327 if (PBB_DRS (pbb).exists ())
328 FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr)
c6bb733d 329 free_poly_dr (pdr);
330
f1f41a6c 331 PBB_DRS (pbb).release ();
c6bb733d 332 XDELETE (pbb);
333}
334
335static void
8c4b14b0 336print_pdr_access_layout (FILE *file, poly_bb_p pbb, poly_dr_p pdr)
c6bb733d 337{
338 graphite_dim_t i;
339
340 fprintf (file, "# eq");
341
8c4b14b0 342 fprintf (file, " alias");
c6bb733d 343
85f74b79 344 for (i = 0; i < PDR_NB_SUBSCRIPTS (pdr); i++)
c6bb733d 345 fprintf (file, " sub%d", (int) i);
346
8c4b14b0 347 for (i = 0; i < pbb_dim_iter_domain (pbb); i++)
348 fprintf (file, " i%d", (int) i);
349
350 for (i = 0; i < pbb_nb_params (pbb); i++)
351 fprintf (file, " p%d", (int) i);
352
c6bb733d 353 fprintf (file, " cst\n");
354}
355
ff4c7a5a 356/* Prints to FILE the polyhedral data reference PDR, at some VERBOSITY
357 level. */
c6bb733d 358
359void
ff4c7a5a 360print_pdr (FILE *file, poly_dr_p pdr, int verbosity)
c6bb733d 361{
ff4c7a5a 362 if (verbosity > 1)
c6bb733d 363 {
ff4c7a5a 364 fprintf (file, "# pdr_%d (", PDR_ID (pdr));
365
366 switch (PDR_TYPE (pdr))
367 {
368 case PDR_READ:
369 fprintf (file, "read \n");
370 break;
c6bb733d 371
ff4c7a5a 372 case PDR_WRITE:
373 fprintf (file, "write \n");
374 break;
c6bb733d 375
ff4c7a5a 376 case PDR_MAY_WRITE:
377 fprintf (file, "may_write \n");
378 break;
c6bb733d 379
ff4c7a5a 380 default:
381 gcc_unreachable ();
382 }
383
384 dump_data_reference (file, (data_reference_p) PDR_CDR (pdr));
c6bb733d 385 }
386
ff4c7a5a 387 if (verbosity > 0)
388 {
389 fprintf (file, "# data accesses (\n");
8c4b14b0 390 print_pdr_access_layout (file, PDR_PBB (pdr), pdr);
ff4c7a5a 391 }
c6bb733d 392
87e20041 393 /* XXX isl dump accesses/subscripts */
c6bb733d 394
ff4c7a5a 395 if (verbosity > 0)
396 fprintf (file, "#)\n");
397
398 if (verbosity > 1)
399 fprintf (file, "#)\n");
c6bb733d 400}
401
ff4c7a5a 402/* Prints to STDERR the polyhedral data reference PDR, at some
403 VERBOSITY level. */
c6bb733d 404
4b987fac 405DEBUG_FUNCTION void
ff4c7a5a 406debug_pdr (poly_dr_p pdr, int verbosity)
c6bb733d 407{
ff4c7a5a 408 print_pdr (stderr, pdr, verbosity);
c6bb733d 409}
410
411/* Creates a new SCOP containing REGION. */
412
413scop_p
414new_scop (void *region)
415{
416 scop_p scop = XNEW (struct scop);
417
87e20041 418 scop->context = NULL;
419 scop->must_raw = NULL;
420 scop->may_raw = NULL;
421 scop->must_raw_no_source = NULL;
422 scop->may_raw_no_source = NULL;
423 scop->must_war = NULL;
424 scop->may_war = NULL;
425 scop->must_war_no_source = NULL;
426 scop->may_war_no_source = NULL;
427 scop->must_waw = NULL;
428 scop->may_waw = NULL;
429 scop->must_waw_no_source = NULL;
430 scop->may_waw_no_source = NULL;
c6bb733d 431 scop_set_region (scop, region);
f1f41a6c 432 SCOP_BBS (scop).create (3);
7e7ffe19 433 SCOP_ORIGINAL_SCHEDULE (scop) = NULL;
434 SCOP_TRANSFORMED_SCHEDULE (scop) = NULL;
435 SCOP_SAVED_SCHEDULE (scop) = NULL;
94bdcd77 436 POLY_SCOP_P (scop) = false;
437
c6bb733d 438 return scop;
439}
440
441/* Deletes SCOP. */
442
443void
444free_scop (scop_p scop)
445{
446 int i;
447 poly_bb_p pbb;
448
f1f41a6c 449 FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
c6bb733d 450 free_poly_bb (pbb);
451
f1f41a6c 452 SCOP_BBS (scop).release ();
c6bb733d 453
87e20041 454 isl_set_free (scop->context);
455 isl_union_map_free (scop->must_raw);
456 isl_union_map_free (scop->may_raw);
457 isl_union_map_free (scop->must_raw_no_source);
458 isl_union_map_free (scop->may_raw_no_source);
459 isl_union_map_free (scop->must_war);
460 isl_union_map_free (scop->may_war);
461 isl_union_map_free (scop->must_war_no_source);
462 isl_union_map_free (scop->may_war_no_source);
463 isl_union_map_free (scop->must_waw);
464 isl_union_map_free (scop->may_waw);
465 isl_union_map_free (scop->must_waw_no_source);
466 isl_union_map_free (scop->may_waw_no_source);
7e7ffe19 467 free_lst (SCOP_ORIGINAL_SCHEDULE (scop));
468 free_lst (SCOP_TRANSFORMED_SCHEDULE (scop));
469 free_lst (SCOP_SAVED_SCHEDULE (scop));
c6bb733d 470 XDELETE (scop);
471}
472
8c4b14b0 473/* Print to FILE the domain of PBB in OpenScop format, at some VERBOSITY
474 level. */
475
476static void
477openscop_print_pbb_domain (FILE *file, poly_bb_p pbb, int verbosity)
478{
479 graphite_dim_t i;
480 gimple_bb_p gbb = PBB_BLACK_BOX (pbb);
481
87e20041 482 if (!pbb->domain)
8c4b14b0 483 return;
484
485 if (verbosity > 0)
486 {
487 fprintf (file, "\n# Iteration domain of bb_%d (\n", GBB_BB (gbb)->index);
086610eb 488 fprintf (file, "#eq");
8c4b14b0 489
490 for (i = 0; i < pbb_dim_iter_domain (pbb); i++)
491 fprintf (file, " i%d", (int) i);
492
493 for (i = 0; i < pbb_nb_params (pbb); i++)
494 fprintf (file, " p%d", (int) i);
495
496 fprintf (file, " cst\n");
497 }
498
87e20041 499 fprintf (file, "XXX isl\n");
8c4b14b0 500
501 if (verbosity > 0)
502 fprintf (file, "#)\n");
503}
504
ff4c7a5a 505/* Print to FILE the domain of PBB, at some VERBOSITY level. */
c6bb733d 506
507void
87e20041 508print_pbb_domain (FILE *file, poly_bb_p pbb, int verbosity ATTRIBUTE_UNUSED)
c6bb733d 509{
87e20041 510 print_isl_set (file, pbb->domain);
c6bb733d 511}
512
513/* Dump the cases of a graphite basic block GBB on FILE. */
514
515static void
516dump_gbb_cases (FILE *file, gimple_bb_p gbb)
517{
518 int i;
519 gimple stmt;
f1f41a6c 520 vec<gimple> cases;
c6bb733d 521
522 if (!gbb)
523 return;
524
525 cases = GBB_CONDITION_CASES (gbb);
f1f41a6c 526 if (cases.is_empty ())
c6bb733d 527 return;
528
5dc5fe13 529 fprintf (file, "# cases bb_%d (\n", GBB_BB (gbb)->index);
c6bb733d 530
f1f41a6c 531 FOR_EACH_VEC_ELT (cases, i, stmt)
5dc5fe13 532 {
533 fprintf (file, "# ");
534 print_gimple_stmt (file, stmt, 0, 0);
535 }
c6bb733d 536
5dc5fe13 537 fprintf (file, "#)\n");
c6bb733d 538}
539
540/* Dump conditions of a graphite basic block GBB on FILE. */
541
542static void
543dump_gbb_conditions (FILE *file, gimple_bb_p gbb)
544{
545 int i;
546 gimple stmt;
f1f41a6c 547 vec<gimple> conditions;
c6bb733d 548
549 if (!gbb)
550 return;
551
552 conditions = GBB_CONDITIONS (gbb);
f1f41a6c 553 if (conditions.is_empty ())
c6bb733d 554 return;
555
5dc5fe13 556 fprintf (file, "# conditions bb_%d (\n", GBB_BB (gbb)->index);
c6bb733d 557
f1f41a6c 558 FOR_EACH_VEC_ELT (conditions, i, stmt)
5dc5fe13 559 {
560 fprintf (file, "# ");
561 print_gimple_stmt (file, stmt, 0, 0);
562 }
c6bb733d 563
5dc5fe13 564 fprintf (file, "#)\n");
c6bb733d 565}
566
ff4c7a5a 567/* Print to FILE all the data references of PBB, at some VERBOSITY
568 level. */
c6bb733d 569
570void
ff4c7a5a 571print_pdrs (FILE *file, poly_bb_p pbb, int verbosity)
c6bb733d 572{
573 int i;
574 poly_dr_p pdr;
5dc5fe13 575 int nb_reads = 0;
576 int nb_writes = 0;
c6bb733d 577
f1f41a6c 578 if (PBB_DRS (pbb).length () == 0)
5dc5fe13 579 {
ff4c7a5a 580 if (verbosity > 0)
581 fprintf (file, "# Access informations are not provided\n");\
582 fprintf (file, "0\n");
5dc5fe13 583 return;
584 }
585
ff4c7a5a 586 if (verbosity > 1)
587 fprintf (file, "# Data references (\n");
588
589 if (verbosity > 0)
590 fprintf (file, "# Access informations are provided\n");
591 fprintf (file, "1\n");
5dc5fe13 592
f1f41a6c 593 FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr)
5dc5fe13 594 if (PDR_TYPE (pdr) == PDR_READ)
595 nb_reads++;
596 else
597 nb_writes++;
598
ff4c7a5a 599 if (verbosity > 1)
600 fprintf (file, "# Read data references (\n");
601
602 if (verbosity > 0)
603 fprintf (file, "# Read access informations\n");
604 fprintf (file, "%d\n", nb_reads);
605
f1f41a6c 606 FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr)
5dc5fe13 607 if (PDR_TYPE (pdr) == PDR_READ)
ff4c7a5a 608 print_pdr (file, pdr, verbosity);
609
610 if (verbosity > 1)
611 fprintf (file, "#)\n");
612
613 if (verbosity > 1)
614 fprintf (file, "# Write data references (\n");
615
616 if (verbosity > 0)
617 fprintf (file, "# Write access informations\n");
618 fprintf (file, "%d\n", nb_writes);
5dc5fe13 619
f1f41a6c 620 FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr)
5dc5fe13 621 if (PDR_TYPE (pdr) != PDR_READ)
ff4c7a5a 622 print_pdr (file, pdr, verbosity);
623
624 if (verbosity > 1)
625 fprintf (file, "#)\n");
626
627 if (verbosity > 1)
628 fprintf (file, "#)\n");
c6bb733d 629}
630
631/* Print to STDERR all the data references of PBB. */
632
4b987fac 633DEBUG_FUNCTION void
ff4c7a5a 634debug_pdrs (poly_bb_p pbb, int verbosity)
c6bb733d 635{
ff4c7a5a 636 print_pdrs (stderr, pbb, verbosity);
c6bb733d 637}
638
8c4b14b0 639/* Print to FILE the body of PBB, at some VERBOSITY level.
640 If statement_body_provided is false statement body is not printed. */
5dc5fe13 641
642static void
8c4b14b0 643print_pbb_body (FILE *file, poly_bb_p pbb, int verbosity,
644 bool statement_body_provided)
5dc5fe13 645{
ff4c7a5a 646 if (verbosity > 1)
647 fprintf (file, "# Body (\n");
648
8c4b14b0 649 if (!statement_body_provided)
d2cd543b 650 {
651 if (verbosity > 0)
652 fprintf (file, "# Statement body is not provided\n");
653
654 fprintf (file, "0\n");
8c4b14b0 655
d2cd543b 656 if (verbosity > 1)
657 fprintf (file, "#)\n");
658 return;
659 }
8c4b14b0 660
ff4c7a5a 661 if (verbosity > 0)
662 fprintf (file, "# Statement body is provided\n");
663 fprintf (file, "1\n");
664
665 if (verbosity > 0)
666 fprintf (file, "# Original iterator names\n# Iterator names are not provided yet.\n");
667
668 if (verbosity > 0)
669 fprintf (file, "# Statement body\n");
670
5dc5fe13 671 fprintf (file, "{\n");
35e5655c 672 dump_bb (file, pbb_bb (pbb), 0, 0);
5dc5fe13 673 fprintf (file, "}\n");
ff4c7a5a 674
675 if (verbosity > 1)
676 fprintf (file, "#)\n");
5dc5fe13 677}
678
ff4c7a5a 679/* Print to FILE the domain and scattering function of PBB, at some
680 VERBOSITY level. */
c6bb733d 681
682void
ff4c7a5a 683print_pbb (FILE *file, poly_bb_p pbb, int verbosity)
684{
685 if (verbosity > 1)
686 {
687 fprintf (file, "# pbb_%d (\n", pbb_index (pbb));
688 dump_gbb_conditions (file, PBB_BLACK_BOX (pbb));
689 dump_gbb_cases (file, PBB_BLACK_BOX (pbb));
690 }
691
8c4b14b0 692 openscop_print_pbb_domain (file, pbb, verbosity);
ff4c7a5a 693 print_scattering_function (file, pbb, verbosity);
694 print_pdrs (file, pbb, verbosity);
8c4b14b0 695 print_pbb_body (file, pbb, verbosity, false);
ff4c7a5a 696
697 if (verbosity > 1)
698 fprintf (file, "#)\n");
c6bb733d 699}
700
ff4c7a5a 701/* Print to FILE the parameters of SCOP, at some VERBOSITY level. */
c6bb733d 702
703void
ff4c7a5a 704print_scop_params (FILE *file, scop_p scop, int verbosity)
c6bb733d 705{
706 int i;
707 tree t;
708
ff4c7a5a 709 if (verbosity > 1)
710 fprintf (file, "# parameters (\n");
5dc5fe13 711
f1f41a6c 712 if (SESE_PARAMS (SCOP_REGION (scop)).length ())
ff4c7a5a 713 {
714 if (verbosity > 0)
715 fprintf (file, "# Parameter names are provided\n");
716
717 fprintf (file, "1\n");
718
719 if (verbosity > 0)
720 fprintf (file, "# Parameter names\n");
721 }
5dc5fe13 722 else
ff4c7a5a 723 {
724 if (verbosity > 0)
725 fprintf (file, "# Parameter names are not provided\n");
726 fprintf (file, "0\n");
727 }
5dc5fe13 728
f1f41a6c 729 FOR_EACH_VEC_ELT (SESE_PARAMS (SCOP_REGION (scop)), i, t)
c6bb733d 730 {
c6bb733d 731 print_generic_expr (file, t, 0);
1f8d6d4d 732 fprintf (file, " ");
c6bb733d 733 }
ff4c7a5a 734
735 fprintf (file, "\n");
736
737 if (verbosity > 1)
738 fprintf (file, "#)\n");
c6bb733d 739}
740
8c4b14b0 741/* Print to FILE the context of SCoP in OpenScop format, at some VERBOSITY
742 level. */
743
744static void
745openscop_print_scop_context (FILE *file, scop_p scop, int verbosity)
746{
747 graphite_dim_t i;
748
749 if (verbosity > 0)
750 {
751 fprintf (file, "# Context (\n");
086610eb 752 fprintf (file, "#eq");
8c4b14b0 753
754 for (i = 0; i < scop_nb_params (scop); i++)
755 fprintf (file, " p%d", (int) i);
756
757 fprintf (file, " cst\n");
758 }
759
87e20041 760 if (scop->context)
761 /* XXX isl print context */
762 fprintf (file, "XXX isl\n");
8c4b14b0 763 else
764 fprintf (file, "0 %d 0 0 0 %d\n", (int) scop_nb_params (scop) + 2,
765 (int) scop_nb_params (scop));
766
767 if (verbosity > 0)
768 fprintf (file, "# )\n");
769}
770
ff4c7a5a 771/* Print to FILE the context of SCoP, at some VERBOSITY level. */
772
c6bb733d 773void
ff4c7a5a 774print_scop_context (FILE *file, scop_p scop, int verbosity)
c6bb733d 775{
776 graphite_dim_t i;
777
ff4c7a5a 778 if (verbosity > 0)
779 {
780 fprintf (file, "# Context (\n");
086610eb 781 fprintf (file, "#eq");
c6bb733d 782
ff4c7a5a 783 for (i = 0; i < scop_nb_params (scop); i++)
784 fprintf (file, " p%d", (int) i);
c6bb733d 785
ff4c7a5a 786 fprintf (file, " cst\n");
787 }
c6bb733d 788
87e20041 789 if (scop->context)
790 print_isl_set (file, scop->context);
5dc5fe13 791 else
87e20041 792 fprintf (file, "no isl context %d\n", (int) scop_nb_params (scop) + 2);
c6bb733d 793
ff4c7a5a 794 if (verbosity > 0)
795 fprintf (file, "# )\n");
c6bb733d 796}
797
d2cd543b 798/* Print to FILE the SCOP, at some VERBOSITY level. */
c6bb733d 799
d2cd543b 800void
801print_scop (FILE *file, scop_p scop, int verbosity)
c6bb733d 802{
d2cd543b 803 int i;
804 poly_bb_p pbb;
805
8c4b14b0 806 fprintf (file, "SCoP 1\n#(\n");
5dc5fe13 807 fprintf (file, "# Language\nGimple\n");
8c4b14b0 808 openscop_print_scop_context (file, scop, verbosity);
ff4c7a5a 809 print_scop_params (file, scop, verbosity);
810
811 if (verbosity > 0)
812 fprintf (file, "# Number of statements\n");
813
f1f41a6c 814 fprintf (file, "%d\n", SCOP_BBS (scop).length ());
c6bb733d 815
f1f41a6c 816 FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
ff4c7a5a 817 print_pbb (file, pbb, verbosity);
95b2e0d3 818
ff4c7a5a 819 if (verbosity > 1)
820 {
821 fprintf (file, "# original_lst (\n");
822 print_lst (file, SCOP_ORIGINAL_SCHEDULE (scop), 0);
823 fprintf (file, "\n#)\n");
f77385d3 824
ff4c7a5a 825 fprintf (file, "# transformed_lst (\n");
826 print_lst (file, SCOP_TRANSFORMED_SCHEDULE (scop), 0);
827 fprintf (file, "\n#)\n");
828 }
9b6c835c 829
5dc5fe13 830 fprintf (file, "#)\n");
c6bb733d 831}
832
ff4c7a5a 833/* Print to FILE the input file that CLooG would expect as input, at
834 some VERBOSITY level. */
1f8d6d4d 835
836void
ff4c7a5a 837print_cloog (FILE *file, scop_p scop, int verbosity)
1f8d6d4d 838{
839 int i;
840 poly_bb_p pbb;
841
842 fprintf (file, "# SCoP (generated by GCC/Graphite\n");
ff4c7a5a 843 if (verbosity > 0)
844 fprintf (file, "# CLooG output language\n");
845 fprintf (file, "c\n");
846
847 print_scop_context (file, scop, verbosity);
848 print_scop_params (file, scop, verbosity);
849
850 if (verbosity > 0)
851 fprintf (file, "# Number of statements\n");
852
f1f41a6c 853 fprintf (file, "%d\n", SCOP_BBS (scop).length ());
1f8d6d4d 854
f1f41a6c 855 FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
1f8d6d4d 856 {
ff4c7a5a 857 if (verbosity > 1)
858 fprintf (file, "# pbb_%d (\n", pbb_index (pbb));
859
860 print_pbb_domain (file, pbb, verbosity);
861 fprintf (file, "0 0 0");
862
863 if (verbosity > 0)
864 fprintf (file, "# For future CLooG options.\n");
865 else
866 fprintf (file, "\n");
867
868 if (verbosity > 1)
869 fprintf (file, "#)\n");
1f8d6d4d 870 }
871
ff4c7a5a 872 fprintf (file, "0");
873 if (verbosity > 0)
874 fprintf (file, "# Don't set the iterator names.\n");
875 else
876 fprintf (file, "\n");
877
878 if (verbosity > 0)
879 fprintf (file, "# Number of scattering functions\n");
1f8d6d4d 880
f1f41a6c 881 fprintf (file, "%d\n", SCOP_BBS (scop).length ());
1f8d6d4d 882
f1f41a6c 883 FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
1f8d6d4d 884 {
87e20041 885 if (!(pbb->transformed || pbb->schedule))
1f8d6d4d 886 continue;
887
ff4c7a5a 888 if (verbosity > 1)
889 fprintf (file, "# pbb_%d (\n", pbb_index (pbb));
890
891 print_scattering_function_1 (file, pbb, verbosity);
892
893 if (verbosity > 1)
894 fprintf (file, "#)\n");
1f8d6d4d 895 }
896
ff4c7a5a 897 fprintf (file, "0");
898 if (verbosity > 0)
899 fprintf (file, "# Don't set the scattering dimension names.\n");
900 else
901 fprintf (file, "\n");
902
1f8d6d4d 903 fprintf (file, "#)\n");
904}
905
ff4c7a5a 906/* Print to STDERR the domain of PBB, at some VERBOSITY level. */
c6bb733d 907
4b987fac 908DEBUG_FUNCTION void
ff4c7a5a 909debug_pbb_domain (poly_bb_p pbb, int verbosity)
c6bb733d 910{
ff4c7a5a 911 print_pbb_domain (stderr, pbb, verbosity);
c6bb733d 912}
913
ff4c7a5a 914/* Print to FILE the domain and scattering function of PBB, at some
915 VERBOSITY level. */
c6bb733d 916
4b987fac 917DEBUG_FUNCTION void
ff4c7a5a 918debug_pbb (poly_bb_p pbb, int verbosity)
c6bb733d 919{
ff4c7a5a 920 print_pbb (stderr, pbb, verbosity);
c6bb733d 921}
922
ff4c7a5a 923/* Print to STDERR the context of SCOP, at some VERBOSITY level. */
c6bb733d 924
4b987fac 925DEBUG_FUNCTION void
ff4c7a5a 926debug_scop_context (scop_p scop, int verbosity)
c6bb733d 927{
ff4c7a5a 928 print_scop_context (stderr, scop, verbosity);
c6bb733d 929}
930
ff4c7a5a 931/* Print to STDERR the SCOP, at some VERBOSITY level. */
c6bb733d 932
4b987fac 933DEBUG_FUNCTION void
ff4c7a5a 934debug_scop (scop_p scop, int verbosity)
c6bb733d 935{
ff4c7a5a 936 print_scop (stderr, scop, verbosity);
c6bb733d 937}
938
ff4c7a5a 939/* Print to STDERR the SCOP under CLooG format, at some VERBOSITY
940 level. */
1f8d6d4d 941
4b987fac 942DEBUG_FUNCTION void
ff4c7a5a 943debug_cloog (scop_p scop, int verbosity)
1f8d6d4d 944{
ff4c7a5a 945 print_cloog (stderr, scop, verbosity);
1f8d6d4d 946}
947
ff4c7a5a 948/* Print to STDERR the parameters of SCOP, at some VERBOSITY
949 level. */
c6bb733d 950
4b987fac 951DEBUG_FUNCTION void
ff4c7a5a 952debug_scop_params (scop_p scop, int verbosity)
c6bb733d 953{
ff4c7a5a 954 print_scop_params (stderr, scop, verbosity);
c6bb733d 955}
956
87e20041 957extern isl_ctx *the_isl_ctx;
958void
959print_isl_set (FILE *f, isl_set *set)
c6bb733d 960{
87e20041 961 isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
962 p = isl_printer_print_set (p, set);
963 isl_printer_free (p);
964}
c6bb733d 965
87e20041 966DEBUG_FUNCTION void
967debug_isl_set (isl_set *set)
968{
969 print_isl_set (stderr, set);
970}
c6bb733d 971
87e20041 972void
973print_isl_map (FILE *f, isl_map *map)
974{
975 isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
976 p = isl_printer_print_map (p, map);
977 isl_printer_free (p);
978}
c6bb733d 979
87e20041 980DEBUG_FUNCTION void
981debug_isl_map (isl_map *map)
982{
983 print_isl_map (stderr, map);
984}
c6bb733d 985
87e20041 986void
987print_isl_aff (FILE *f, isl_aff *aff)
988{
989 isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
990 p = isl_printer_print_aff (p, aff);
991 isl_printer_free (p);
992}
c6bb733d 993
87e20041 994DEBUG_FUNCTION void
995debug_isl_aff (isl_aff *aff)
996{
997 print_isl_aff (stderr, aff);
998}
c6bb733d 999
87e20041 1000void
1001print_isl_constraint (FILE *f, isl_constraint *c)
1002{
1003 isl_printer *p = isl_printer_to_file (the_isl_ctx, f);
1004 p = isl_printer_print_constraint (p, c);
1005 isl_printer_free (p);
1006}
c6bb733d 1007
87e20041 1008DEBUG_FUNCTION void
1009debug_isl_constraint (isl_constraint *c)
1010{
1011 print_isl_constraint (stderr, c);
c6bb733d 1012}
1013
bd432164 1014/* Returns the number of iterations RES of the loop around PBB at
ee0d08ad 1015 time(scattering) dimension TIME_DEPTH. */
1016
1017void
1018pbb_number_of_iterations_at_time (poly_bb_p pbb,
1019 graphite_dim_t time_depth,
bd432164 1020 mpz_t res)
ee0d08ad 1021{
87e20041 1022 isl_set *transdomain;
1023 isl_space *dc;
1024 isl_aff *aff;
1025 isl_int isllb, islub;
ee0d08ad 1026
87e20041 1027 isl_int_init (isllb);
1028 isl_int_init (islub);
d9e94834 1029
87e20041 1030 /* Map the iteration domain through the current scatter, and work
1031 on the resulting set. */
1032 transdomain = isl_set_apply (isl_set_copy (pbb->domain),
1033 isl_map_copy (pbb->transformed));
d9e94834 1034
87e20041 1035 /* Select the time_depth' dimension via an affine expression. */
1036 dc = isl_set_get_space (transdomain);
1037 aff = isl_aff_zero_on_domain (isl_local_space_from_space (dc));
1038 aff = isl_aff_set_coefficient_si (aff, isl_dim_in, time_depth, 1);
dd37d9f7 1039
87e20041 1040 /* And find the min/max for that function. */
1041 /* XXX isl check results? */
1042 isl_set_min (transdomain, aff, &isllb);
1043 isl_set_max (transdomain, aff, &islub);
d9e94834 1044
87e20041 1045 isl_int_sub (islub, islub, isllb);
1046 isl_int_add_ui (islub, islub, 1);
1047 isl_int_get_gmp (islub, res);
ee0d08ad 1048
87e20041 1049 isl_int_clear (isllb);
1050 isl_int_clear (islub);
1051 isl_aff_free (aff);
1052 isl_set_free (transdomain);
ee0d08ad 1053}
1054
f77385d3 1055/* Translates LOOP to LST. */
1056
1057static lst_p
f1f41a6c 1058loop_to_lst (loop_p loop, vec<poly_bb_p> bbs, int *i)
f77385d3 1059{
1060 poly_bb_p pbb;
f1f41a6c 1061 vec<lst_p> seq;
1062 seq.create (5);
f77385d3 1063
f1f41a6c 1064 for (; bbs.iterate (*i, &pbb); (*i)++)
f77385d3 1065 {
1066 lst_p stmt;
1067 basic_block bb = GBB_BB (PBB_BLACK_BOX (pbb));
1068
1069 if (bb->loop_father == loop)
1070 stmt = new_lst_stmt (pbb);
71b90bc3 1071 else if (flow_bb_inside_loop_p (loop, bb))
f77385d3 1072 {
71b90bc3 1073 loop_p next = loop->inner;
f77385d3 1074
71b90bc3 1075 while (next && !flow_bb_inside_loop_p (next, bb))
1076 next = next->next;
f77385d3 1077
71b90bc3 1078 stmt = loop_to_lst (next, bbs, i);
1079 }
1080 else
1081 {
1082 (*i)--;
1083 return new_lst_loop (seq);
f77385d3 1084 }
1085
f1f41a6c 1086 seq.safe_push (stmt);
f77385d3 1087 }
1088
1089 return new_lst_loop (seq);
1090}
1091
1092/* Reads the original scattering of the SCOP and returns an LST
1093 representing it. */
1094
1095void
1096scop_to_lst (scop_p scop)
1097{
43217ce9 1098 lst_p res;
f1f41a6c 1099 int i, n = SCOP_BBS (scop).length ();
1100 vec<lst_p> seq;
1101 seq.create (5);
43217ce9 1102 sese region = SCOP_REGION (scop);
1103
1104 for (i = 0; i < n; i++)
1105 {
f1f41a6c 1106 poly_bb_p pbb = SCOP_BBS (scop)[i];
43217ce9 1107 loop_p loop = outermost_loop_in_sese (region, GBB_BB (PBB_BLACK_BOX (pbb)));
1108
1109 if (loop_in_sese_p (loop, region))
1110 res = loop_to_lst (loop, SCOP_BBS (scop), &i);
1111 else
1112 res = new_lst_stmt (pbb);
1113
f1f41a6c 1114 seq.safe_push (res);
43217ce9 1115 }
f77385d3 1116
43217ce9 1117 res = new_lst_loop (seq);
1118 SCOP_ORIGINAL_SCHEDULE (scop) = res;
1119 SCOP_TRANSFORMED_SCHEDULE (scop) = copy_lst (res);
f77385d3 1120}
1121
5dc5fe13 1122/* Print to FILE on a new line COLUMN white spaces. */
1123
1124static void
1125lst_indent_to (FILE *file, int column)
1126{
1127 int i;
1128
1129 if (column > 0)
1130 fprintf (file, "\n#");
1131
1132 for (i = 0; i < column; i++)
1133 fprintf (file, " ");
1134}
1135
f77385d3 1136/* Print LST to FILE with INDENT spaces of indentation. */
1137
1138void
1139print_lst (FILE *file, lst_p lst, int indent)
1140{
1141 if (!lst)
1142 return;
1143
5dc5fe13 1144 lst_indent_to (file, indent);
f77385d3 1145
1146 if (LST_LOOP_P (lst))
1147 {
1148 int i;
1149 lst_p l;
1150
43217ce9 1151 if (LST_LOOP_FATHER (lst))
1152 fprintf (file, "%d (loop", lst_dewey_number (lst));
1153 else
5dc5fe13 1154 fprintf (file, "#(root");
f77385d3 1155
f1f41a6c 1156 FOR_EACH_VEC_ELT (LST_SEQ (lst), i, l)
f77385d3 1157 print_lst (file, l, indent + 2);
1158
1159 fprintf (file, ")");
1160 }
1161 else
1162 fprintf (file, "%d stmt_%d", lst_dewey_number (lst), pbb_index (LST_PBB (lst)));
1163}
1164
1165/* Print LST to STDERR. */
1166
4b987fac 1167DEBUG_FUNCTION void
f77385d3 1168debug_lst (lst_p lst)
1169{
1170 print_lst (stderr, lst, 0);
1171}
1172
4938b827 1173/* Pretty print to FILE the loop statement tree LST in DOT format. */
1174
1175static void
1176dot_lst_1 (FILE *file, lst_p lst)
1177{
1178 if (!lst)
1179 return;
1180
1181 if (LST_LOOP_P (lst))
1182 {
1183 int i;
1184 lst_p l;
1185
1186 if (!LST_LOOP_FATHER (lst))
1187 fprintf (file, "L -> L_%d_%d\n",
1188 lst_depth (lst),
1189 lst_dewey_number (lst));
1190 else
1191 fprintf (file, "L_%d_%d -> L_%d_%d\n",
1192 lst_depth (LST_LOOP_FATHER (lst)),
1193 lst_dewey_number (LST_LOOP_FATHER (lst)),
1194 lst_depth (lst),
1195 lst_dewey_number (lst));
1196
f1f41a6c 1197 FOR_EACH_VEC_ELT (LST_SEQ (lst), i, l)
4938b827 1198 dot_lst_1 (file, l);
1199 }
1200
1201 else
1202 fprintf (file, "L_%d_%d -> S_%d\n",
1203 lst_depth (LST_LOOP_FATHER (lst)),
1204 lst_dewey_number (LST_LOOP_FATHER (lst)),
1205 pbb_index (LST_PBB (lst)));
1206
1207}
1208
1209/* Display the LST using dotty. */
1210
6b5822fe 1211DEBUG_FUNCTION void
4938b827 1212dot_lst (lst_p lst)
1213{
1214 /* When debugging, enable the following code. This cannot be used
1215 in production compilers because it calls "system". */
1216#if 0
4938b827 1217 FILE *stream = fopen ("/tmp/lst.dot", "w");
1218 gcc_assert (stream);
1219
1220 fputs ("digraph all {\n", stream);
1221 dot_lst_1 (stream, lst);
1222 fputs ("}\n\n", stream);
1223 fclose (stream);
1224
97b0e4df 1225 system ("dotty /tmp/lst.dot &");
4938b827 1226#else
1227 fputs ("digraph all {\n", stderr);
1228 dot_lst_1 (stderr, lst);
1229 fputs ("}\n\n", stderr);
1230
1231#endif
1232}
1233
079f4f8c 1234/* Computes a checksum for the code generated by CLooG for SCOP. */
1235
1236DEBUG_FUNCTION void
1237cloog_checksum (scop_p scop ATTRIBUTE_UNUSED)
1238{
1239 /* When debugging, enable the following code. This cannot be used
1240 in production compilers because it calls "system". */
1241#if 0
1242 FILE *stream = fopen ("/tmp/scop.cloog", "w");
1243 gcc_assert (stream);
1244 print_cloog (stream, scop, 0);
1245 fclose (stream);
1246
1247 fputs ("\n", stdout);
1248 system ("cloog -compilable 1 /tmp/scop.cloog > /tmp/scop.c ; gcc -O0 -g /tmp/scop.c -lm -o /tmp/scop; /tmp/scop | md5sum ");
1249#endif
1250}
1251
87e20041 1252/* Reverse the loop around PBB at level DEPTH. */
1253
1254isl_map *
1255reverse_loop_at_level (poly_bb_p pbb, int depth)
1256{
1257 unsigned i, depth_dim = psct_dynamic_dim (pbb, depth);
1258 isl_space *d = isl_map_get_space (pbb->transformed);
1259 isl_space *d1 = isl_space_range (d);
1260 unsigned n = isl_space_dim (d1, isl_dim_out);
1261 isl_space *d2 = isl_space_add_dims (d1, isl_dim_in, n);
1262 isl_map *x = isl_map_universe (isl_space_copy (d2));
1263 isl_constraint *c = isl_equality_alloc (isl_local_space_from_space (d2));
1264
1265 for (i = 0; i < n; i++)
1266 if (i != depth_dim)
1267 x = isl_map_equate (x, isl_dim_in, i, isl_dim_out, i);
1268
1269 c = isl_constraint_set_coefficient_si (c, isl_dim_in, depth_dim, 1);
1270 c = isl_constraint_set_coefficient_si (c, isl_dim_out, depth_dim, 1);
1271 x = isl_map_add_constraint (x, c);
1272 return x;
1273}
1274
1275/* Reverse the loop at level DEPTH for all the PBBS. */
1276
1277isl_union_map *
f1f41a6c 1278reverse_loop_for_pbbs (scop_p scop, vec<poly_bb_p> pbbs, int depth)
87e20041 1279{
1280 poly_bb_p pbb;
1281 int i;
1282 isl_space *space = isl_space_from_domain (isl_set_get_space (scop->context));
1283 isl_union_map *res = isl_union_map_empty (space);
1284
f1f41a6c 1285 for (i = 0; pbbs.iterate (i, &pbb); i++)
87e20041 1286 res = isl_union_map_add_map (res, reverse_loop_at_level (pbb, depth));
1287
1288 return res;
1289}
1290
1291
c6bb733d 1292#endif
1293