Remove outermost loop parameter.
[official-gcc/graphite-test-results.git] / gcc / graphite-scop-detection.c
blob8cd9c505fbd4546bf79b389463a9777dfcdb8896
1 /* Detection of Static Control Parts (SCoP) for Graphite.
2 Copyright (C) 2009, 2010 Free Software Foundation, Inc.
3 Contributed by Sebastian Pop <sebastian.pop@amd.com> and
4 Tobias Grosser <grosser@fim.uni-passau.de>.
6 This file is part of GCC.
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.
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.
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/>. */
22 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "tm.h"
26 #include "ggc.h"
27 #include "tree.h"
28 #include "rtl.h"
29 #include "basic-block.h"
30 #include "diagnostic.h"
31 #include "tree-flow.h"
32 #include "toplev.h"
33 #include "tree-dump.h"
34 #include "timevar.h"
35 #include "cfgloop.h"
36 #include "tree-chrec.h"
37 #include "tree-data-ref.h"
38 #include "tree-scalar-evolution.h"
39 #include "tree-pass.h"
40 #include "domwalk.h"
41 #include "value-prof.h"
42 #include "pointer-set.h"
43 #include "gimple.h"
44 #include "sese.h"
46 #ifdef HAVE_cloog
47 #include "ppl_c.h"
48 #include "graphite-ppl.h"
49 #include "graphite.h"
50 #include "graphite-poly.h"
51 #include "graphite-scop-detection.h"
52 #include "refined-regions.h"
54 /* The type of the analyzed basic block. */
56 typedef enum gbb_type {
57 GBB_UNKNOWN,
58 GBB_LOOP_SING_EXIT_HEADER,
59 GBB_LOOP_MULT_EXIT_HEADER,
60 GBB_LOOP_EXIT,
61 GBB_COND_HEADER,
62 GBB_SIMPLE,
63 GBB_LAST
64 } gbb_type;
66 /* Detect the type of BB. Loop headers are only marked, if they are
67 new. This means their loop_father is different to LAST_LOOP.
68 Otherwise they are treated like any other bb and their type can be
69 any other type. */
71 static gbb_type
72 get_bb_type (basic_block bb, struct loop *last_loop)
74 VEC (basic_block, heap) *dom;
75 int nb_dom, nb_suc;
76 struct loop *loop = bb->loop_father;
78 /* Check, if we entry into a new loop. */
79 if (loop != last_loop)
81 if (single_exit (loop) != NULL)
82 return GBB_LOOP_SING_EXIT_HEADER;
83 else if (loop->num != 0)
84 return GBB_LOOP_MULT_EXIT_HEADER;
85 else
86 return GBB_COND_HEADER;
89 dom = get_dominated_by (CDI_DOMINATORS, bb);
90 nb_dom = VEC_length (basic_block, dom);
91 VEC_free (basic_block, heap, dom);
93 if (nb_dom == 0)
94 return GBB_LAST;
96 nb_suc = VEC_length (edge, bb->succs);
98 if (nb_dom == 1 && nb_suc == 1)
99 return GBB_SIMPLE;
101 return GBB_COND_HEADER;
104 /* A SCoP detection region, defined using bbs as borders.
106 All control flow touching this region, comes in passing basic_block
107 ENTRY and leaves passing basic_block EXIT. By using bbs instead of
108 edges for the borders we are able to represent also regions that do
109 not have a single entry or exit edge.
111 But as they have a single entry basic_block and a single exit
112 basic_block, we are able to generate for every sd_region a single
113 entry and exit edge.
117 3 <- entry
120 / \ This region contains: {3, 4, 5, 6, 7, 8}
125 9 <- exit */
128 typedef struct sd_region_p
130 /* The entry bb dominates all bbs in the sd_region. It is part of
131 the region. */
132 basic_block entry;
134 /* The exit bb postdominates all bbs in the sd_region, but is not
135 part of the region. */
136 basic_block exit;
137 } sd_region;
139 DEF_VEC_O(sd_region);
140 DEF_VEC_ALLOC_O(sd_region, heap);
143 /* Moves the scops from SOURCE to TARGET and clean up SOURCE. */
145 static void
146 move_sd_regions (VEC (sd_region, heap) **source,
147 VEC (sd_region, heap) **target)
149 sd_region *s;
150 int i;
152 for (i = 0; VEC_iterate (sd_region, *source, i, s); i++)
153 VEC_safe_push (sd_region, heap, *target, s);
155 VEC_free (sd_region, heap, *source);
158 /* Something like "n * m" is not allowed. */
160 static bool
161 graphite_can_represent_init (tree e)
163 switch (TREE_CODE (e))
165 case POLYNOMIAL_CHREC:
166 return graphite_can_represent_init (CHREC_LEFT (e))
167 && graphite_can_represent_init (CHREC_RIGHT (e));
169 case MULT_EXPR:
170 if (chrec_contains_symbols (TREE_OPERAND (e, 0)))
171 return graphite_can_represent_init (TREE_OPERAND (e, 0))
172 && host_integerp (TREE_OPERAND (e, 1), 0);
173 else
174 return graphite_can_represent_init (TREE_OPERAND (e, 1))
175 && host_integerp (TREE_OPERAND (e, 0), 0);
177 case PLUS_EXPR:
178 case POINTER_PLUS_EXPR:
179 case MINUS_EXPR:
180 return graphite_can_represent_init (TREE_OPERAND (e, 0))
181 && graphite_can_represent_init (TREE_OPERAND (e, 1));
183 case NEGATE_EXPR:
184 case BIT_NOT_EXPR:
185 CASE_CONVERT:
186 case NON_LVALUE_EXPR:
187 return graphite_can_represent_init (TREE_OPERAND (e, 0));
189 default:
190 break;
193 return true;
196 /* Return true when SCEV can be represented in the polyhedral model.
198 An expression can be represented, if it can be expressed as an
199 affine expression. For loops (i, j) and parameters (m, n) all
200 affine expressions are of the form:
202 x1 * i + x2 * j + x3 * m + x4 * n + x5 * 1 where x1..x5 element of Z
204 1 i + 20 j + (-2) m + 25
206 Something like "i * n" or "n * m" is not allowed. */
208 static bool
209 graphite_can_represent_scev (tree scev)
211 if (chrec_contains_undetermined (scev))
212 return false;
214 switch (TREE_CODE (scev))
216 case PLUS_EXPR:
217 case MINUS_EXPR:
218 return graphite_can_represent_scev (TREE_OPERAND (scev, 0))
219 && graphite_can_represent_scev (TREE_OPERAND (scev, 1));
221 case MULT_EXPR:
222 return !CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (scev, 0)))
223 && !CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (scev, 1)))
224 && !(chrec_contains_symbols (TREE_OPERAND (scev, 0))
225 && chrec_contains_symbols (TREE_OPERAND (scev, 1)))
226 && graphite_can_represent_init (scev)
227 && graphite_can_represent_scev (TREE_OPERAND (scev, 0))
228 && graphite_can_represent_scev (TREE_OPERAND (scev, 1));
230 case POLYNOMIAL_CHREC:
231 /* Check for constant strides. With a non constant stride of
232 'n' we would have a value of 'iv * n'. Also check that the
233 initial value can represented: for example 'n * m' cannot be
234 represented. */
235 if (!evolution_function_right_is_integer_cst (scev)
236 || !graphite_can_represent_init (scev))
237 return false;
239 default:
240 break;
243 /* Only affine functions can be represented. */
244 if (!scev_is_linear_expression (scev))
245 return false;
247 return true;
251 /* Return true when EXPR can be represented in the polyhedral model.
253 This means an expression can be represented, if it is linear with
254 respect to the loops and the strides are non parametric.
255 LOOP is the place where the expr will be evaluated. SCOP_ENTRY defines the
256 entry of the region we analyse. */
258 static bool
259 graphite_can_represent_expr (basic_block scop_entry, loop_p loop,
260 tree expr)
262 tree scev = analyze_scalar_evolution (loop, expr);
264 scev = instantiate_scev (scop_entry, loop, scev);
266 return graphite_can_represent_scev (scev);
269 /* Return true if the data references of STMT can be represented by
270 Graphite. */
272 static bool
273 stmt_has_simple_data_refs_p (loop_p outermost_loop, gimple stmt)
275 data_reference_p dr;
276 unsigned i;
277 int j;
278 bool res = true;
279 VEC (data_reference_p, heap) *drs = VEC_alloc (data_reference_p, heap, 5);
281 graphite_find_data_references_in_stmt (outermost_loop, stmt, &drs);
283 for (j = 0; VEC_iterate (data_reference_p, drs, j, dr); j++)
284 for (i = 0; i < DR_NUM_DIMENSIONS (dr); i++)
285 if (!graphite_can_represent_scev (DR_ACCESS_FN (dr, i)))
287 res = false;
288 goto done;
291 done:
292 free_data_refs (drs);
293 return res;
296 /* Return true only when STMT is simple enough for being handled by
297 Graphite. This depends on SCOP_ENTRY, as the parameters are
298 initialized relatively to this basic block, the linear functions
299 are initialized to OUTERMOST_LOOP and BB is the place where we try
300 to evaluate the STMT. */
302 static bool
303 stmt_simple_for_scop_p (basic_block scop_entry, loop_p outermost_loop,
304 gimple stmt, basic_block bb)
306 loop_p loop = bb->loop_father;
308 gcc_assert (scop_entry);
310 /* GIMPLE_ASM and GIMPLE_CALL may embed arbitrary side effects.
311 Calls have side-effects, except those to const or pure
312 functions. */
313 if (gimple_has_volatile_ops (stmt)
314 || (gimple_code (stmt) == GIMPLE_CALL
315 && !(gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE)))
316 || (gimple_code (stmt) == GIMPLE_ASM))
317 return false;
319 if (is_gimple_debug (stmt))
320 return true;
322 if (!stmt_has_simple_data_refs_p (outermost_loop, stmt))
323 return false;
325 switch (gimple_code (stmt))
327 case GIMPLE_RETURN:
328 case GIMPLE_LABEL:
329 return true;
331 case GIMPLE_COND:
333 tree op;
334 ssa_op_iter op_iter;
335 enum tree_code code = gimple_cond_code (stmt);
337 /* We can handle all binary comparisons. Inequalities are
338 also supported as they can be represented with union of
339 polyhedra. */
340 if (!(code == LT_EXPR
341 || code == GT_EXPR
342 || code == LE_EXPR
343 || code == GE_EXPR
344 || code == EQ_EXPR
345 || code == NE_EXPR))
346 return false;
348 FOR_EACH_SSA_TREE_OPERAND (op, stmt, op_iter, SSA_OP_ALL_USES)
349 if (!graphite_can_represent_expr (scop_entry, loop, op)
350 /* We can not handle REAL_TYPE. Failed for pr39260. */
351 || TREE_CODE (TREE_TYPE (op)) == REAL_TYPE)
352 return false;
354 return true;
357 case GIMPLE_ASSIGN:
358 case GIMPLE_CALL:
359 return true;
361 default:
362 /* These nodes cut a new scope. */
363 return false;
366 return false;
369 /* Returns the statement of BB that contains a harmful operation: that
370 can be a function call with side effects, the induction variables
371 are not linear with respect to SCOP_ENTRY, etc. The current open
372 scop should end before this statement. The evaluation is limited using
373 OUTERMOST_LOOP as outermost loop that may change. */
375 static gimple
376 harmful_stmt_in_bb (basic_block scop_entry, loop_p outer_loop, basic_block bb)
378 gimple_stmt_iterator gsi;
380 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
381 if (!stmt_simple_for_scop_p (scop_entry, outer_loop, gsi_stmt (gsi), bb))
382 return gsi_stmt (gsi);
384 return NULL;
387 /* Return true when it is not possible to represent LOOP in the
388 polyhedral representation. This is evaluated taking SCOP_ENTRY
389 in mind. */
391 static bool
392 graphite_can_represent_loop (basic_block scop_entry, loop_p loop)
394 tree niter = number_of_latch_executions (loop);
396 /* Number of iterations unknown. */
397 if (chrec_contains_undetermined (niter))
398 return false;
400 /* Number of iterations not affine. */
401 if (!graphite_can_represent_expr (scop_entry, loop, niter))
402 return false;
404 return true;
407 /* Store information needed by scopdet_* functions. */
409 struct scopdet_info
411 /* Exit of the open scop would stop if the current BB is harmful. */
412 basic_block exit;
414 /* Where the next scop would start if the current BB is harmful. */
415 basic_block next;
417 /* The bb or one of its children contains open loop exits. That means
418 loop exit nodes that are not surrounded by a loop dominated by bb. */
419 bool exits;
421 /* The bb or one of its children contains only structures we can handle. */
422 bool difficult;
425 static struct scopdet_info build_scops_1 (basic_block, loop_p,
426 VEC (sd_region, heap) **, loop_p);
428 /* Calculates BB infos. If bb is difficult we add valid SCoPs dominated by BB
429 to SCOPS. TYPE is the gbb_type of BB. */
431 static struct scopdet_info
432 scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
433 VEC (sd_region, heap) **scops, gbb_type type)
435 loop_p loop = bb->loop_father;
436 struct scopdet_info result;
437 gimple stmt;
439 /* XXX: ENTRY_BLOCK_PTR could be optimized in later steps. */
440 basic_block entry_block = ENTRY_BLOCK_PTR;
441 stmt = harmful_stmt_in_bb (entry_block, outermost_loop, bb);
442 result.difficult = (stmt != NULL);
443 result.exit = NULL;
445 switch (type)
447 case GBB_LAST:
448 result.next = NULL;
449 result.exits = false;
451 /* Mark bbs terminating a SESE region difficult, if they start
452 a condition. */
453 if (!single_succ_p (bb))
454 result.difficult = true;
455 else
456 result.exit = single_succ (bb);
458 break;
460 case GBB_SIMPLE:
461 result.next = single_succ (bb);
462 result.exits = false;
463 result.exit = single_succ (bb);
464 break;
466 case GBB_LOOP_SING_EXIT_HEADER:
468 VEC (sd_region, heap) *regions = VEC_alloc (sd_region, heap, 3);
469 struct scopdet_info sinfo;
470 edge exit_e = single_exit (loop);
472 sinfo = build_scops_1 (bb, outermost_loop, &regions, loop);
474 if (!graphite_can_represent_loop (entry_block, loop))
475 result.difficult = true;
477 result.difficult |= sinfo.difficult;
479 /* Try again with another loop level. */
480 if (result.difficult
481 && loop_depth (outermost_loop) + 1 == loop_depth (loop))
483 outermost_loop = loop;
485 VEC_free (sd_region, heap, regions);
486 regions = VEC_alloc (sd_region, heap, 3);
488 sinfo = scopdet_basic_block_info (bb, outermost_loop, scops, type);
490 result = sinfo;
491 result.difficult = true;
493 if (sinfo.difficult)
494 move_sd_regions (&regions, scops);
495 else
497 sd_region open_scop;
498 open_scop.entry = bb;
499 open_scop.exit = exit_e->dest;
500 VEC_safe_push (sd_region, heap, *scops, &open_scop);
501 VEC_free (sd_region, heap, regions);
504 else
506 result.exit = exit_e->dest;
507 result.next = exit_e->dest;
509 /* If we do not dominate result.next, remove it. It's either
510 the EXIT_BLOCK_PTR, or another bb dominates it and will
511 call the scop detection for this bb. */
512 if (!dominated_by_p (CDI_DOMINATORS, result.next, bb))
513 result.next = NULL;
515 if (exit_e->src->loop_father != loop)
516 result.next = NULL;
518 result.exits = false;
520 if (result.difficult)
521 move_sd_regions (&regions, scops);
522 else
523 VEC_free (sd_region, heap, regions);
526 break;
529 case GBB_LOOP_MULT_EXIT_HEADER:
531 /* XXX: For now we just do not join loops with multiple exits. If the
532 exits lead to the same bb it may be possible to join the loop. */
533 VEC (sd_region, heap) *regions = VEC_alloc (sd_region, heap, 3);
534 VEC (edge, heap) *exits = get_loop_exit_edges (loop);
535 edge e;
536 int i;
537 build_scops_1 (bb, loop, &regions, loop);
539 /* Scan the code dominated by this loop. This means all bbs, that are
540 are dominated by a bb in this loop, but are not part of this loop.
542 The easiest case:
543 - The loop exit destination is dominated by the exit sources.
545 TODO: We miss here the more complex cases:
546 - The exit destinations are dominated by another bb inside
547 the loop.
548 - The loop dominates bbs, that are not exit destinations. */
549 for (i = 0; VEC_iterate (edge, exits, i, e); i++)
550 if (e->src->loop_father == loop
551 && dominated_by_p (CDI_DOMINATORS, e->dest, e->src))
553 if (loop_outer (outermost_loop))
554 outermost_loop = loop_outer (outermost_loop);
556 /* Pass loop_outer to recognize e->dest as loop header in
557 build_scops_1. */
558 if (e->dest->loop_father->header == e->dest)
559 build_scops_1 (e->dest, outermost_loop, &regions,
560 loop_outer (e->dest->loop_father));
561 else
562 build_scops_1 (e->dest, outermost_loop, &regions,
563 e->dest->loop_father);
566 result.next = NULL;
567 result.exit = NULL;
568 result.difficult = true;
569 result.exits = false;
570 move_sd_regions (&regions, scops);
571 VEC_free (edge, heap, exits);
572 break;
574 case GBB_COND_HEADER:
576 VEC (sd_region, heap) *regions = VEC_alloc (sd_region, heap, 3);
577 struct scopdet_info sinfo;
578 VEC (basic_block, heap) *dominated;
579 int i;
580 basic_block dom_bb;
581 basic_block last_exit = NULL;
582 edge e;
583 result.exits = false;
585 /* First check the successors of BB, and check if it is
586 possible to join the different branches. */
587 for (i = 0; VEC_iterate (edge, bb->succs, i, e); i++)
589 /* Ignore loop exits. They will be handled after the loop
590 body. */
591 if (loop_exits_to_bb_p (loop, e->dest))
593 result.exits = true;
594 continue;
597 /* Do not follow edges that lead to the end of the
598 conditions block. For example, in
601 | /|\
602 | 1 2 |
603 | | | |
604 | 3 4 |
605 | \|/
608 the edge from 0 => 6. Only check if all paths lead to
609 the same node 6. */
611 if (!single_pred_p (e->dest))
613 /* Check, if edge leads directly to the end of this
614 condition. */
615 if (!last_exit)
616 last_exit = e->dest;
618 if (e->dest != last_exit)
619 result.difficult = true;
621 continue;
624 if (!dominated_by_p (CDI_DOMINATORS, e->dest, bb))
626 result.difficult = true;
627 continue;
630 sinfo = build_scops_1 (e->dest, outermost_loop, &regions, loop);
632 result.exits |= sinfo.exits;
633 result.difficult |= sinfo.difficult;
635 /* Checks, if all branches end at the same point.
636 If that is true, the condition stays joinable.
637 Have a look at the example above. */
638 if (sinfo.exit)
640 if (!last_exit)
641 last_exit = sinfo.exit;
643 if (sinfo.exit != last_exit)
644 result.difficult = true;
646 else
647 result.difficult = true;
650 if (!last_exit)
651 result.difficult = true;
653 /* Join the branches of the condition if possible. */
654 if (!result.exits && !result.difficult)
656 /* Only return a next pointer if we dominate this pointer.
657 Otherwise it will be handled by the bb dominating it. */
658 if (dominated_by_p (CDI_DOMINATORS, last_exit, bb)
659 && last_exit != bb)
660 result.next = last_exit;
661 else
662 result.next = NULL;
664 result.exit = last_exit;
666 VEC_free (sd_region, heap, regions);
667 break;
670 /* Scan remaining bbs dominated by BB. */
671 dominated = get_dominated_by (CDI_DOMINATORS, bb);
673 for (i = 0; VEC_iterate (basic_block, dominated, i, dom_bb); i++)
675 /* Ignore loop exits: they will be handled after the loop body. */
676 if (loop_depth (find_common_loop (loop, dom_bb->loop_father))
677 < loop_depth (loop))
679 result.exits = true;
680 continue;
683 /* Ignore the bbs processed above. */
684 if (single_pred_p (dom_bb) && single_pred (dom_bb) == bb)
685 continue;
687 if (loop_depth (loop) > loop_depth (dom_bb->loop_father))
688 sinfo = build_scops_1 (dom_bb, outermost_loop, &regions,
689 loop_outer (loop));
690 else
691 sinfo = build_scops_1 (dom_bb, outermost_loop, &regions, loop);
693 result.exits |= sinfo.exits;
694 result.difficult = true;
695 result.exit = NULL;
698 VEC_free (basic_block, heap, dominated);
700 result.next = NULL;
701 move_sd_regions (&regions, scops);
703 break;
706 default:
707 gcc_unreachable ();
710 return result;
713 /* Starting from CURRENT we walk the dominance tree and add new sd_regions to
714 SCOPS. The analyse if a sd_region can be handled is based on the value
715 of OUTERMOST_LOOP. Only loops inside OUTERMOST loops may change. LOOP
716 is the loop in which CURRENT is handled.
718 TODO: These functions got a little bit big. They definitely should be cleaned
719 up. */
721 static struct scopdet_info
722 build_scops_1 (basic_block current, loop_p outermost_loop,
723 VEC (sd_region, heap) **scops, loop_p loop)
725 bool in_scop = false;
726 sd_region open_scop;
727 struct scopdet_info sinfo;
729 /* Initialize result. */
730 struct scopdet_info result;
731 result.exits = false;
732 result.difficult = false;
733 result.next = NULL;
734 result.exit = NULL;
735 open_scop.entry = NULL;
736 open_scop.exit = NULL;
737 sinfo.exit = NULL;
739 /* Loop over the dominance tree. If we meet a difficult bb, close
740 the current SCoP. Loop and condition header start a new layer,
741 and can only be added if all bbs in deeper layers are simple. */
742 while (current != NULL)
744 sinfo = scopdet_basic_block_info (current, outermost_loop, scops,
745 get_bb_type (current, loop));
747 if (!in_scop && !(sinfo.exits || sinfo.difficult))
749 open_scop.entry = current;
750 open_scop.exit = NULL;
751 in_scop = true;
753 else if (in_scop && (sinfo.exits || sinfo.difficult))
755 open_scop.exit = current;
756 VEC_safe_push (sd_region, heap, *scops, &open_scop);
757 in_scop = false;
760 result.difficult |= sinfo.difficult;
761 result.exits |= sinfo.exits;
763 current = sinfo.next;
766 /* Try to close open_scop, if we are still in an open SCoP. */
767 if (in_scop)
769 open_scop.exit = sinfo.exit;
770 gcc_assert (open_scop.exit);
771 VEC_safe_push (sd_region, heap, *scops, &open_scop);
774 result.exit = sinfo.exit;
775 return result;
778 /* Checks if a bb is contained in REGION. */
780 static bool
781 bb_in_sd_region (basic_block bb, sd_region *region)
783 return bb_in_region (bb, region->entry, region->exit);
786 /* Returns the single entry edge of REGION, if it does not exits NULL. */
788 static edge
789 find_single_entry_edge (sd_region *region)
791 edge e;
792 edge_iterator ei;
793 edge entry = NULL;
795 FOR_EACH_EDGE (e, ei, region->entry->preds)
796 if (!bb_in_sd_region (e->src, region))
798 if (entry)
800 entry = NULL;
801 break;
804 else
805 entry = e;
808 return entry;
811 /* Returns the single exit edge of REGION, if it does not exits NULL. */
813 static edge
814 find_single_exit_edge (sd_region *region)
816 edge e;
817 edge_iterator ei;
818 edge exit = NULL;
820 FOR_EACH_EDGE (e, ei, region->exit->preds)
821 if (bb_in_sd_region (e->src, region))
823 if (exit)
825 exit = NULL;
826 break;
829 else
830 exit = e;
833 return exit;
836 /* Create a single entry edge for REGION. */
838 static void
839 create_single_entry_edge (sd_region *region)
841 if (find_single_entry_edge (region))
842 return;
844 /* There are multiple predecessors for bb_3
846 | 1 2
847 | | /
848 | |/
849 | 3 <- entry
850 | |\
851 | | |
852 | 4 ^
853 | | |
854 | |/
857 There are two edges (1->3, 2->3), that point from outside into the region,
858 and another one (5->3), a loop latch, lead to bb_3.
860 We split bb_3.
862 | 1 2
863 | | /
864 | |/
865 |3.0
866 | |\ (3.0 -> 3.1) = single entry edge
867 |3.1 | <- entry
868 | | |
869 | | |
870 | 4 ^
871 | | |
872 | |/
875 If the loop is part of the SCoP, we have to redirect the loop latches.
877 | 1 2
878 | | /
879 | |/
880 |3.0
881 | | (3.0 -> 3.1) = entry edge
882 |3.1 <- entry
883 | |\
884 | | |
885 | 4 ^
886 | | |
887 | |/
888 | 5 */
890 if (region->entry->loop_father->header != region->entry
891 || dominated_by_p (CDI_DOMINATORS,
892 loop_latch_edge (region->entry->loop_father)->src,
893 region->exit))
895 edge forwarder = split_block_after_labels (region->entry);
896 region->entry = forwarder->dest;
898 else
899 /* This case is never executed, as the loop headers seem always to have a
900 single edge pointing from outside into the loop. */
901 gcc_unreachable ();
903 #ifdef ENABLE_CHECKING
904 gcc_assert (find_single_entry_edge (region));
905 #endif
908 /* Check if the sd_region, mentioned in EDGE, has no exit bb. */
910 static bool
911 sd_region_without_exit (edge e)
913 sd_region *r = (sd_region *) e->aux;
915 if (r)
916 return r->exit == NULL;
917 else
918 return false;
921 /* Create a single exit edge for REGION. */
923 static void
924 create_single_exit_edge (sd_region *region)
926 edge e;
927 edge_iterator ei;
928 edge forwarder = NULL;
929 basic_block exit;
931 /* We create a forwarder bb (5) for all edges leaving this region
932 (3->5, 4->5). All other edges leading to the same bb, are moved
933 to a new bb (6). If these edges where part of another region (2->5)
934 we update the region->exit pointer, of this region.
936 To identify which edge belongs to which region we depend on the e->aux
937 pointer in every edge. It points to the region of the edge or to NULL,
938 if the edge is not part of any region.
940 1 2 3 4 1->5 no region, 2->5 region->exit = 5,
941 \| |/ 3->5 region->exit = NULL, 4->5 region->exit = NULL
942 5 <- exit
944 changes to
946 1 2 3 4 1->6 no region, 2->6 region->exit = 6,
947 | | \/ 3->5 no region, 4->5 no region,
948 | | 5
949 \| / 5->6 region->exit = 6
952 Now there is only a single exit edge (5->6). */
953 exit = region->exit;
954 region->exit = NULL;
955 forwarder = make_forwarder_block (exit, &sd_region_without_exit, NULL);
957 /* Unmark the edges, that are no longer exit edges. */
958 FOR_EACH_EDGE (e, ei, forwarder->src->preds)
959 if (e->aux)
960 e->aux = NULL;
962 /* Mark the new exit edge. */
963 single_succ_edge (forwarder->src)->aux = region;
965 /* Update the exit bb of all regions, where exit edges lead to
966 forwarder->dest. */
967 FOR_EACH_EDGE (e, ei, forwarder->dest->preds)
968 if (e->aux)
969 ((sd_region *) e->aux)->exit = forwarder->dest;
971 #ifdef ENABLE_CHECKING
972 gcc_assert (find_single_exit_edge (region));
973 #endif
976 /* Unmark the exit edges of all REGIONS.
977 See comment in "create_single_exit_edge". */
979 static void
980 unmark_exit_edges (VEC (sd_region, heap) *regions)
982 int i;
983 sd_region *s;
984 edge e;
985 edge_iterator ei;
987 for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
988 FOR_EACH_EDGE (e, ei, s->exit->preds)
989 e->aux = NULL;
993 /* Mark the exit edges of all REGIONS.
994 See comment in "create_single_exit_edge". */
996 static void
997 mark_exit_edges (VEC (sd_region, heap) *regions)
999 int i;
1000 sd_region *s;
1001 edge e;
1002 edge_iterator ei;
1004 for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
1005 FOR_EACH_EDGE (e, ei, s->exit->preds)
1006 if (bb_in_sd_region (e->src, s))
1007 e->aux = s;
1010 /* Create for all scop regions a single entry and a single exit edge. */
1012 static void
1013 create_sese_edges (VEC (sd_region, heap) *regions)
1015 int i;
1016 sd_region *s;
1018 for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
1019 create_single_entry_edge (s);
1021 mark_exit_edges (regions);
1023 for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
1024 /* Don't handle multiple edges exiting the function. */
1025 if (!find_single_exit_edge (s)
1026 && s->exit != EXIT_BLOCK_PTR)
1027 create_single_exit_edge (s);
1029 unmark_exit_edges (regions);
1031 fix_loop_structure (NULL);
1033 #ifdef ENABLE_CHECKING
1034 verify_loop_structure ();
1035 verify_dominators (CDI_DOMINATORS);
1036 verify_ssa (false);
1037 #endif
1040 /* Create graphite SCoPs from an array of scop detection REGIONS. */
1042 static void
1043 build_graphite_scops (VEC (sd_region, heap) *regions,
1044 VEC (scop_p, heap) **scops)
1046 int i;
1047 sd_region *s;
1049 for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
1051 edge entry = find_single_entry_edge (s);
1052 edge exit = find_single_exit_edge (s);
1053 scop_p scop;
1055 if (!exit)
1056 continue;
1058 scop = new_scop (new_sese (entry, exit));
1059 VEC_safe_push (scop_p, heap, *scops, scop);
1061 /* Are there overlapping SCoPs? */
1062 #ifdef ENABLE_CHECKING
1064 int j;
1065 sd_region *s2;
1067 for (j = 0; VEC_iterate (sd_region, regions, j, s2); j++)
1068 if (s != s2)
1069 gcc_assert (!bb_in_sd_region (s->entry, s2));
1071 #endif
1075 /* Returns true when BB contains only close phi nodes. */
1077 static bool
1078 contains_only_close_phi_nodes (basic_block bb)
1080 gimple_stmt_iterator gsi;
1082 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
1083 if (gimple_code (gsi_stmt (gsi)) != GIMPLE_LABEL)
1084 return false;
1086 return true;
1089 /* Print statistics for SCOP to FILE. */
1091 static void
1092 print_graphite_scop_statistics (FILE* file, scop_p scop)
1094 long n_bbs = 0;
1095 long n_loops = 0;
1096 long n_stmts = 0;
1097 long n_conditions = 0;
1098 long n_p_bbs = 0;
1099 long n_p_loops = 0;
1100 long n_p_stmts = 0;
1101 long n_p_conditions = 0;
1103 basic_block bb;
1105 FOR_ALL_BB (bb)
1107 gimple_stmt_iterator psi;
1108 loop_p loop = bb->loop_father;
1110 if (!bb_in_sese_p (bb, SCOP_REGION (scop)))
1111 continue;
1113 n_bbs++;
1114 n_p_bbs += bb->count;
1116 if (VEC_length (edge, bb->succs) > 1)
1118 n_conditions++;
1119 n_p_conditions += bb->count;
1122 for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi))
1124 n_stmts++;
1125 n_p_stmts += bb->count;
1128 if (loop->header == bb && loop_in_sese_p (loop, SCOP_REGION (scop)))
1130 n_loops++;
1131 n_p_loops += bb->count;
1136 fprintf (file, "\nBefore limit_scops SCoP statistics (");
1137 fprintf (file, "BBS:%ld, ", n_bbs);
1138 fprintf (file, "LOOPS:%ld, ", n_loops);
1139 fprintf (file, "CONDITIONS:%ld, ", n_conditions);
1140 fprintf (file, "STMTS:%ld)\n", n_stmts);
1141 fprintf (file, "\nBefore limit_scops SCoP profiling statistics (");
1142 fprintf (file, "BBS:%ld, ", n_p_bbs);
1143 fprintf (file, "LOOPS:%ld, ", n_p_loops);
1144 fprintf (file, "CONDITIONS:%ld, ", n_p_conditions);
1145 fprintf (file, "STMTS:%ld)\n", n_p_stmts);
1148 /* Print statistics for SCOPS to FILE. */
1150 static void
1151 print_graphite_statistics (FILE* file, VEC (scop_p, heap) *scops)
1153 int i;
1154 scop_p scop;
1156 for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
1157 print_graphite_scop_statistics (file, scop);
1160 /* We limit all SCoPs to SCoPs, that are completely surrounded by a loop.
1162 Example:
1164 for (i |
1166 for (j | SCoP 1
1167 for (k |
1170 * SCoP frontier, as this line is not surrounded by any loop. *
1172 for (l | SCoP 2
1174 This is necessary as scalar evolution and parameter detection need a
1175 outermost loop to initialize parameters correctly.
1177 TODO: FIX scalar evolution and parameter detection to allow more flexible
1178 SCoP frontiers. */
1180 static void
1181 limit_scops (VEC (scop_p, heap) **scops)
1183 VEC (sd_region, heap) *regions = VEC_alloc (sd_region, heap, 3);
1185 int i;
1186 scop_p scop;
1188 for (i = 0; VEC_iterate (scop_p, *scops, i, scop); i++)
1190 int j;
1191 loop_p loop;
1192 sese region = SCOP_REGION (scop);
1193 build_sese_loop_nests (region);
1195 for (j = 0; VEC_iterate (loop_p, SESE_LOOP_NEST (region), j, loop); j++)
1196 if (!loop_in_sese_p (loop_outer (loop), region)
1197 && single_exit (loop))
1199 sd_region open_scop;
1200 open_scop.entry = loop->header;
1201 open_scop.exit = single_exit (loop)->dest;
1203 /* This is a hack on top of the limit_scops hack. The
1204 limit_scops hack should disappear all together. */
1205 if (single_succ_p (open_scop.exit)
1206 && contains_only_close_phi_nodes (open_scop.exit))
1207 open_scop.exit = single_succ_edge (open_scop.exit)->dest;
1209 VEC_safe_push (sd_region, heap, regions, &open_scop);
1213 free_scops (*scops);
1214 *scops = VEC_alloc (scop_p, heap, 3);
1216 create_sese_edges (regions);
1217 build_graphite_scops (regions, scops);
1218 VEC_free (sd_region, heap, regions);
1221 /* Transforms LOOP to the canonical loop closed SSA form. */
1223 static void
1224 canonicalize_loop_closed_ssa (loop_p loop)
1226 edge e = single_exit (loop);
1227 basic_block bb;
1229 if (!e || e->flags & EDGE_ABNORMAL)
1230 return;
1232 bb = e->dest;
1234 if (VEC_length (edge, bb->preds) == 1)
1235 split_block_after_labels (bb);
1236 else
1238 gimple_stmt_iterator psi;
1239 basic_block close = split_edge (e);
1241 e = single_succ_edge (close);
1243 for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
1245 gimple phi = gsi_stmt (psi);
1246 unsigned i;
1248 for (i = 0; i < gimple_phi_num_args (phi); i++)
1249 if (gimple_phi_arg_edge (phi, i) == e)
1251 tree res, arg = gimple_phi_arg_def (phi, i);
1252 use_operand_p use_p;
1253 gimple close_phi;
1255 if (TREE_CODE (arg) != SSA_NAME)
1256 continue;
1258 close_phi = create_phi_node (arg, close);
1259 res = create_new_def_for (gimple_phi_result (close_phi),
1260 close_phi,
1261 gimple_phi_result_ptr (close_phi));
1262 add_phi_arg (close_phi, arg,
1263 gimple_phi_arg_edge (close_phi, 0),
1264 UNKNOWN_LOCATION);
1265 use_p = gimple_phi_arg_imm_use_ptr (phi, i);
1266 replace_exp (use_p, res);
1267 update_stmt (phi);
1273 /* Converts the current loop closed SSA form to a canonical form
1274 expected by the Graphite code generation.
1276 The loop closed SSA form has the following invariant: a variable
1277 defined in a loop that is used outside the loop appears only in the
1278 phi nodes in the destination of the loop exit. These phi nodes are
1279 called close phi nodes.
1281 The canonical loop closed SSA form contains the extra invariants:
1283 - when the loop contains only one exit, the close phi nodes contain
1284 only one argument. That implies that the basic block that contains
1285 the close phi nodes has only one predecessor, that is a basic block
1286 in the loop.
1288 - the basic block containing the close phi nodes does not contain
1289 other statements.
1292 static void
1293 canonicalize_loop_closed_ssa_form (void)
1295 loop_iterator li;
1296 loop_p loop;
1298 #ifdef ENABLE_CHECKING
1299 verify_loop_closed_ssa (true);
1300 #endif
1302 FOR_EACH_LOOP (li, loop, 0)
1303 canonicalize_loop_closed_ssa (loop);
1305 rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
1306 update_ssa (TODO_update_ssa);
1308 #ifdef ENABLE_CHECKING
1309 verify_loop_closed_ssa (true);
1310 #endif
1313 /* Check if STMT in BB can be represented by the polyhedral model.
1314 The function is currently incomplete as it requires the data
1315 reference and SCEV representation checks added. */
1317 static bool
1318 is_valid_stmt_p (refined_region_p region ATTRIBUTE_UNUSED,
1319 basic_block bb ATTRIBUTE_UNUSED, gimple stmt)
1321 return !gimple_has_volatile_ops (stmt)
1322 && gimple_code (stmt) != GIMPLE_ASM
1323 && (gimple_code (stmt) != GIMPLE_CALL
1324 || gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE));
1327 /* Check if BB can be represented in the polyhedral model as part
1328 of REGION. Only single-exit loops are currently supported. */
1330 static bool
1331 is_valid_bb_p (refined_region_p region, basic_block bb)
1333 int succ_len = VEC_length (edge, bb->succs);
1334 gimple_stmt_iterator gsi;
1336 /* Perform the control flow graph validity check. */
1338 /* TODO: Is there only well structured control flow in the region?
1339 * All loops have just one exit?
1340 * All loops are detected by gcc's loop detection?
1341 * All conditions are well nested? */
1343 /* BBs without successors or with more than 2 predecessors are currently
1344 unsupported. */
1345 if (succ_len > 2 || succ_len == 0)
1346 return false;
1348 /* Is BB the exiting block of a single-exit loop? */
1349 if (succ_len == 2)
1351 struct loop *loop = bb->loop_father;
1353 /* Single exit loops only. */
1354 if (!single_exit (loop)
1355 || !loop_exits_from_bb_p (loop, bb))
1356 return false;
1359 /* Are there any harmful bbs in the region? (TODO) */
1361 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
1362 if (!is_valid_stmt_p (region, bb, gsi_stmt (gsi)))
1363 return false;
1365 return true;
1369 /* Check if REGION is a valid SCoP. */
1371 static bool
1372 is_scop_p (refined_region_p region)
1374 VEC (basic_block, heap) *bblist = NULL;
1375 int i;
1376 basic_block bb_iter;
1378 get_bbs_in_region (region, &bblist);
1380 for (i = 0; VEC_iterate (basic_block, bblist, i, bb_iter); i++)
1382 if (!is_valid_bb_p (region, bb_iter))
1383 return false;
1385 /* TODO: Do all loops have a number of iterations that can be expressed
1386 by an affine linear function. */
1387 /* ??? */
1390 return true;
1393 /* Find in a structured way Static Control Parts (SCoP) in the current
1394 function. */
1396 static void
1397 build_scops_new (void)
1399 VEC (refined_region_p, heap) *scops = VEC_alloc (refined_region_p, heap, 3);
1400 VEC (refined_region_p, heap) *check = VEC_alloc (refined_region_p, heap, 3);
1402 /* TODO: Call canonicalize_loop_closed_ssa_form() at the right place. */
1404 /* Build new region tree. */
1405 refined_region_p new_region = calculate_region_tree ();
1407 /* Print the region tree with all the basic blocks its regions contain. */
1408 if (dump_file && (dump_flags & TDF_DETAILS))
1410 fprintf (dump_file, "Refined region tree structure:\n\n");
1411 print_refined_region (dump_file, new_region, 0, true);
1412 fprintf (dump_file, "\n");
1415 /* Find the maximal valid regions. */
1416 VEC_safe_push (refined_region_p, heap, check, new_region);
1418 while (VEC_length (refined_region_p, check) != 0)
1420 refined_region_p region = VEC_last (refined_region_p, check);
1421 VEC_pop (refined_region_p, check);
1423 if (is_scop_p (region))
1424 VEC_safe_push (refined_region_p, heap, scops, region);
1425 else
1427 int ix;
1428 refined_region_p subregion;
1430 for (ix = 0;
1431 VEC_iterate (refined_region_p, region->children, ix, subregion);
1432 ix++)
1433 VEC_safe_push (refined_region_p, heap, check, subregion);
1437 /* TODO: Check if we can create even bigger regions by combining
1438 canonical regions, that are executed one after another. */
1439 /* TODO: Create sese edges. */
1440 /* TODO: Create graphite scops. */
1442 VEC_free (refined_region_p, heap, check);
1443 VEC_free (refined_region_p, heap, scops);
1444 free_region_tree (new_region);
1448 /* Find Static Control Parts (SCoP) in the current function and pushes
1449 them to SCOPS. (Old version) */
1451 static void
1452 build_scops_old (VEC (scop_p, heap) **scops)
1454 struct loop *loop = current_loops->tree_root;
1455 VEC (sd_region, heap) *regions = VEC_alloc (sd_region, heap, 3);
1457 canonicalize_loop_closed_ssa_form ();
1458 build_scops_1 (single_succ (ENTRY_BLOCK_PTR), ENTRY_BLOCK_PTR->loop_father,
1459 &regions, loop);
1460 create_sese_edges (regions);
1461 build_graphite_scops (regions, scops);
1463 if (dump_file && (dump_flags & TDF_DETAILS))
1464 print_graphite_statistics (dump_file, *scops);
1466 limit_scops (scops);
1467 VEC_free (sd_region, heap, regions);
1469 if (dump_file && (dump_flags & TDF_DETAILS))
1470 fprintf (dump_file, "\nnumber of SCoPs: %d\n",
1471 VEC_length (scop_p, *scops));
1474 /* Find Static Control Parts (SCoP) in the current function and pushes
1475 them to SCOPS. */
1477 void
1478 build_scops (VEC (scop_p, heap) **scops)
1480 /* Run the new version in parallel to check it. */
1481 build_scops_new ();
1482 build_scops_old (scops);
1485 /* Pretty print to FILE all the SCoPs in DOT format and mark them with
1486 different colors. If there are not enough colors, paint the
1487 remaining SCoPs in gray.
1489 Special nodes:
1490 - "*" after the node number denotes the entry of a SCoP,
1491 - "#" after the node number denotes the exit of a SCoP,
1492 - "()" around the node number denotes the entry or the
1493 exit nodes of the SCOP. These are not part of SCoP. */
1495 static void
1496 dot_all_scops_1 (FILE *file, VEC (scop_p, heap) *scops)
1498 basic_block bb;
1499 edge e;
1500 edge_iterator ei;
1501 scop_p scop;
1502 const char* color;
1503 int i;
1505 /* Disable debugging while printing graph. */
1506 int tmp_dump_flags = dump_flags;
1507 dump_flags = 0;
1509 fprintf (file, "digraph all {\n");
1511 FOR_ALL_BB (bb)
1513 int part_of_scop = false;
1515 /* Use HTML for every bb label. So we are able to print bbs
1516 which are part of two different SCoPs, with two different
1517 background colors. */
1518 fprintf (file, "%d [label=<\n <TABLE BORDER=\"0\" CELLBORDER=\"1\" ",
1519 bb->index);
1520 fprintf (file, "CELLSPACING=\"0\">\n");
1522 /* Select color for SCoP. */
1523 for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
1525 sese region = SCOP_REGION (scop);
1526 if (bb_in_sese_p (bb, region)
1527 || (SESE_EXIT_BB (region) == bb)
1528 || (SESE_ENTRY_BB (region) == bb))
1530 switch (i % 17)
1532 case 0: /* red */
1533 color = "#e41a1c";
1534 break;
1535 case 1: /* blue */
1536 color = "#377eb8";
1537 break;
1538 case 2: /* green */
1539 color = "#4daf4a";
1540 break;
1541 case 3: /* purple */
1542 color = "#984ea3";
1543 break;
1544 case 4: /* orange */
1545 color = "#ff7f00";
1546 break;
1547 case 5: /* yellow */
1548 color = "#ffff33";
1549 break;
1550 case 6: /* brown */
1551 color = "#a65628";
1552 break;
1553 case 7: /* rose */
1554 color = "#f781bf";
1555 break;
1556 case 8:
1557 color = "#8dd3c7";
1558 break;
1559 case 9:
1560 color = "#ffffb3";
1561 break;
1562 case 10:
1563 color = "#bebada";
1564 break;
1565 case 11:
1566 color = "#fb8072";
1567 break;
1568 case 12:
1569 color = "#80b1d3";
1570 break;
1571 case 13:
1572 color = "#fdb462";
1573 break;
1574 case 14:
1575 color = "#b3de69";
1576 break;
1577 case 15:
1578 color = "#fccde5";
1579 break;
1580 case 16:
1581 color = "#bc80bd";
1582 break;
1583 default: /* gray */
1584 color = "#999999";
1587 fprintf (file, " <TR><TD WIDTH=\"50\" BGCOLOR=\"%s\">", color);
1589 if (!bb_in_sese_p (bb, region))
1590 fprintf (file, " (");
1592 if (bb == SESE_ENTRY_BB (region)
1593 && bb == SESE_EXIT_BB (region))
1594 fprintf (file, " %d*# ", bb->index);
1595 else if (bb == SESE_ENTRY_BB (region))
1596 fprintf (file, " %d* ", bb->index);
1597 else if (bb == SESE_EXIT_BB (region))
1598 fprintf (file, " %d# ", bb->index);
1599 else
1600 fprintf (file, " %d ", bb->index);
1602 if (!bb_in_sese_p (bb,region))
1603 fprintf (file, ")");
1605 fprintf (file, "</TD></TR>\n");
1606 part_of_scop = true;
1610 if (!part_of_scop)
1612 fprintf (file, " <TR><TD WIDTH=\"50\" BGCOLOR=\"#ffffff\">");
1613 fprintf (file, " %d </TD></TR>\n", bb->index);
1615 fprintf (file, " </TABLE>>, shape=box, style=\"setlinewidth(0)\"]\n");
1618 FOR_ALL_BB (bb)
1620 FOR_EACH_EDGE (e, ei, bb->succs)
1621 fprintf (file, "%d -> %d;\n", bb->index, e->dest->index);
1624 fputs ("}\n\n", file);
1626 /* Enable debugging again. */
1627 dump_flags = tmp_dump_flags;
1630 /* Display all SCoPs using dotty. */
1632 void
1633 dot_all_scops (VEC (scop_p, heap) *scops)
1635 /* When debugging, enable the following code. This cannot be used
1636 in production compilers because it calls "system". */
1637 #if 1
1638 FILE *stream = fopen ("/tmp/allscops.dot", "w");
1639 gcc_assert (stream);
1641 dot_all_scops_1 (stream, scops);
1642 fclose (stream);
1644 system ("dotty /tmp/allscops.dot &");
1645 #else
1646 dot_all_scops_1 (stderr, scops);
1647 #endif
1650 /* Display all SCoPs using dotty. */
1652 void
1653 dot_scop (scop_p scop)
1655 VEC (scop_p, heap) *scops = NULL;
1657 if (scop)
1658 VEC_safe_push (scop_p, heap, scops, scop);
1660 /* When debugging, enable the following code. This cannot be used
1661 in production compilers because it calls "system". */
1662 #if 1
1664 FILE *stream = fopen ("/tmp/allscops.dot", "w");
1665 gcc_assert (stream);
1667 dot_all_scops_1 (stream, scops);
1668 fclose (stream);
1669 system ("dotty /tmp/allscops.dot &");
1671 #else
1672 dot_all_scops_1 (stderr, scops);
1673 #endif
1675 VEC_free (scop_p, heap, scops);
1678 #endif