1 /* Detection of Static Control Parts (SCoP) for Graphite.
2 Copyright (C) 2009-2015 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)
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/>. */
25 /* Workaround for GMP 5.1.3 bug, see PR56019. */
28 #include <isl/constraint.h>
31 #include <isl/union_map.h>
34 #include "coretypes.h"
42 #include "fold-const.h"
43 #include "gimple-iterator.h"
45 #include "tree-ssa-loop-manip.h"
46 #include "tree-ssa-loop-niter.h"
47 #include "tree-ssa-loop.h"
48 #include "tree-into-ssa.h"
51 #include "tree-data-ref.h"
52 #include "tree-scalar-evolution.h"
53 #include "tree-pass.h"
54 #include "graphite-poly.h"
55 #include "tree-ssa-propagate.h"
56 #include "graphite-scop-detection.h"
57 #include "gimple-pretty-print.h"
66 set_dump_file (FILE *f
)
72 friend debug_printer
&
73 operator<< (debug_printer
&output
, int i
)
75 fprintf (output
.dump_file
, "%d", i
);
78 friend debug_printer
&
79 operator<< (debug_printer
&output
, const char *s
)
81 fprintf (output
.dump_file
, "%s", s
);
86 #define DEBUG_PRINT(args) do \
88 if (dump_file && (dump_flags & TDF_DETAILS)) { args; } \
92 /* Return true if BB is empty, contains only DEBUG_INSNs. */
95 trivially_empty_bb_p (basic_block bb
)
97 gimple_stmt_iterator gsi
;
99 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
100 if (gimple_code (gsi_stmt (gsi
)) != GIMPLE_DEBUG
)
106 /* Returns true when P1 and P2 are close phis with the same
110 same_close_phi_node (gphi
*p1
, gphi
*p2
)
112 return operand_equal_p (gimple_phi_arg_def (p1
, 0),
113 gimple_phi_arg_def (p2
, 0), 0);
116 static void make_close_phi_nodes_unique (basic_block bb
);
118 /* Remove the close phi node at GSI and replace its rhs with the rhs
122 remove_duplicate_close_phi (gphi
*phi
, gphi_iterator
*gsi
)
126 imm_use_iterator imm_iter
;
127 tree res
= gimple_phi_result (phi
);
128 tree def
= gimple_phi_result (gsi
->phi ());
130 gcc_assert (same_close_phi_node (phi
, gsi
->phi ()));
132 FOR_EACH_IMM_USE_STMT (use_stmt
, imm_iter
, def
)
134 FOR_EACH_IMM_USE_ON_STMT (use_p
, imm_iter
)
135 SET_USE (use_p
, res
);
137 update_stmt (use_stmt
);
139 /* It is possible that we just created a duplicate close-phi
140 for an already-processed containing loop. Check for this
141 case and clean it up. */
142 if (gimple_code (use_stmt
) == GIMPLE_PHI
143 && gimple_phi_num_args (use_stmt
) == 1)
144 make_close_phi_nodes_unique (gimple_bb (use_stmt
));
147 remove_phi_node (gsi
, true);
150 /* Removes all the close phi duplicates from BB. */
153 make_close_phi_nodes_unique (basic_block bb
)
157 for (psi
= gsi_start_phis (bb
); !gsi_end_p (psi
); gsi_next (&psi
))
159 gphi_iterator gsi
= psi
;
160 gphi
*phi
= psi
.phi ();
162 /* At this point, PHI should be a close phi in normal form. */
163 gcc_assert (gimple_phi_num_args (phi
) == 1);
165 /* Iterate over the next phis and remove duplicates. */
167 while (!gsi_end_p (gsi
))
168 if (same_close_phi_node (phi
, gsi
.phi ()))
169 remove_duplicate_close_phi (phi
, &gsi
);
175 /* Transforms LOOP to the canonical loop closed SSA form. */
178 canonicalize_loop_closed_ssa (loop_p loop
)
180 edge e
= single_exit (loop
);
183 if (!e
|| e
->flags
& EDGE_ABNORMAL
)
188 if (single_pred_p (bb
))
190 e
= split_block_after_labels (bb
);
191 DEBUG_PRINT (dp
<< "\nSplitting bb_" << bb
->index
);
192 make_close_phi_nodes_unique (e
->src
);
197 basic_block close
= split_edge (e
);
199 e
= single_succ_edge (close
);
200 DEBUG_PRINT (dp
<< "\nSplitting edge (" << e
->src
->index
<< ","
201 << e
->dest
->index
<< ")\n");
203 for (psi
= gsi_start_phis (bb
); !gsi_end_p (psi
); gsi_next (&psi
))
205 gphi
*phi
= psi
.phi ();
208 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
209 if (gimple_phi_arg_edge (phi
, i
) == e
)
211 tree res
, arg
= gimple_phi_arg_def (phi
, i
);
215 if (TREE_CODE (arg
) != SSA_NAME
)
218 close_phi
= create_phi_node (NULL_TREE
, close
);
219 res
= create_new_def_for (arg
, close_phi
,
220 gimple_phi_result_ptr (close_phi
));
221 add_phi_arg (close_phi
, arg
,
222 gimple_phi_arg_edge (close_phi
, 0),
224 use_p
= gimple_phi_arg_imm_use_ptr (phi
, i
);
225 replace_exp (use_p
, res
);
230 make_close_phi_nodes_unique (close
);
233 /* The code above does not properly handle changes in the post dominance
234 information (yet). */
235 recompute_all_dominators ();
238 /* Converts the current loop closed SSA form to a canonical form
239 expected by the Graphite code generation.
241 The loop closed SSA form has the following invariant: a variable
242 defined in a loop that is used outside the loop appears only in the
243 phi nodes in the destination of the loop exit. These phi nodes are
244 called close phi nodes.
246 The canonical loop closed SSA form contains the extra invariants:
248 - when the loop contains only one exit, the close phi nodes contain
249 only one argument. That implies that the basic block that contains
250 the close phi nodes has only one predecessor, that is a basic block
253 - the basic block containing the close phi nodes does not contain
256 - there exist only one phi node per definition in the loop.
260 canonicalize_loop_closed_ssa_form (void)
264 #ifdef ENABLE_CHECKING
265 verify_loop_closed_ssa (true);
268 FOR_EACH_LOOP (loop
, 0)
269 canonicalize_loop_closed_ssa (loop
);
271 rewrite_into_loop_closed_ssa (NULL
, TODO_update_ssa
);
272 update_ssa (TODO_update_ssa
);
274 #ifdef ENABLE_CHECKING
275 verify_loop_closed_ssa (true);
279 /* Can all ivs be represented by a signed integer?
280 As ISL might generate negative values in its expressions, signed loop ivs
281 are required in the backend. */
284 loop_ivs_can_be_represented (loop_p loop
)
286 unsigned type_long_long
= TYPE_PRECISION (long_long_integer_type_node
);
287 for (gphi_iterator psi
= gsi_start_phis (loop
->header
); !gsi_end_p (psi
);
290 gphi
*phi
= psi
.phi ();
291 tree res
= PHI_RESULT (phi
);
292 tree type
= TREE_TYPE (res
);
294 if (TYPE_UNSIGNED (type
) && TYPE_PRECISION (type
) >= type_long_long
)
301 /* Returns a COND_EXPR statement when BB has a single predecessor, the
302 edge between BB and its predecessor is not a loop exit edge, and
303 the last statement of the single predecessor is a COND_EXPR. */
306 single_pred_cond_non_loop_exit (basic_block bb
)
308 if (single_pred_p (bb
))
310 edge e
= single_pred_edge (bb
);
311 basic_block pred
= e
->src
;
314 if (loop_depth (pred
->loop_father
) > loop_depth (bb
->loop_father
))
317 stmt
= last_stmt (pred
);
319 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
320 return as_a
<gcond
*> (stmt
);
329 /* Build the maximal scop containing LOOPs and add it to SCOPS. */
334 scop_detection () : scops (vNULL
) {}
336 /* A marker for invalid sese_l. */
337 static sese_l invalid_sese
;
339 /* Return the SCOPS in this SCOP_DETECTION. */
347 /* Return an sese_l around the LOOP. */
349 sese_l
get_sese (loop_p loop
);
351 /* Return the closest dominator with a single entry edge. In case of a
352 back-loop the back-edge is not counted. */
354 static edge
get_nearest_dom_with_single_entry (basic_block dom
);
356 /* Return the closest post-dominator with a single exit edge. In case of a
357 back-loop the back-edge is not counted. */
359 static edge
get_nearest_pdom_with_single_exit (basic_block dom
);
361 /* Print S to FILE. */
363 static void print_sese (FILE *file
, sese_l s
);
365 /* Merge scops at same loop depth and returns the new sese.
366 Returns a new SESE when merge was successful, INVALID_SESE otherwise. */
368 sese_l
merge_sese (sese_l first
, sese_l second
) const;
370 /* Build scop outer->inner if possible. */
372 sese_l
build_scop_depth (sese_l s
, loop_p loop
);
374 /* If loop and loop->next are valid scops, try to merge them. */
376 sese_l
build_scop_breadth (sese_l s1
, loop_p loop
);
378 /* Return true when LOOP is a valid scop, that is a Static Control Part, a
379 region of code that can be represented in the polyhedral model. SCOP
380 defines the region we analyse. */
382 bool loop_is_valid_scop (loop_p loop
, sese_l scop
) const;
384 /* Return true when BEGIN is the preheader edge of a loop with a single exit
387 static bool region_has_one_loop (sese_l s
);
389 /* Add to SCOPS a scop starting at SCOP_BEGIN and ending at SCOP_END. */
391 void add_scop (sese_l s
);
393 /* Returns true if S1 subsumes/surrounds S2. */
394 static bool subsumes (sese_l s1
, sese_l s2
);
396 /* Remove a SCoP which is subsumed by S1. */
397 void remove_subscops (sese_l s1
);
399 /* Returns true if S1 intersects with S2. Since we already know that S1 does
400 not subsume S2 or vice-versa, we only check for entry bbs. */
402 static bool intersects (sese_l s1
, sese_l s2
);
404 /* Remove one of the scops when it intersects with any other. */
406 void remove_intersecting_scops (sese_l s1
);
408 /* Return true when the body of LOOP has statements that can be represented
411 bool loop_body_is_valid_scop (loop_p loop
, sese_l scop
) const;
413 /* Return true when BB contains a harmful operation for a scop: that
414 can be a function call with side effects, the induction variables
415 are not linear with respect to SCOP, etc. The current open
416 scop should end before this statement. */
418 bool harmful_stmt_in_bb (sese_l scop
, basic_block bb
) const;
420 /* Return true when a statement in SCOP cannot be represented by Graphite.
421 The assumptions are that L1 dominates L2, and SCOP->entry dominates L1.
422 Limit the number of bbs between adjacent loops to
423 PARAM_SCOP_MAX_NUM_BBS_BETWEEN_LOOPS. */
425 bool harmful_stmt_in_region (sese_l scop
) const;
427 /* Return true only when STMT is simple enough for being handled by Graphite.
428 This depends on SCOP, as the parameters are initialized relatively to
429 this basic block, the linear functions are initialized based on the
430 outermost loop containing STMT inside the SCOP. BB is the place where we
431 try to evaluate the STMT. */
433 bool stmt_simple_for_scop_p (sese_l scop
, gimple
*stmt
,
434 basic_block bb
) const;
436 /* Something like "n * m" is not allowed. */
438 static bool graphite_can_represent_init (tree e
);
440 /* Return true when SCEV can be represented in the polyhedral model.
442 An expression can be represented, if it can be expressed as an
443 affine expression. For loops (i, j) and parameters (m, n) all
444 affine expressions are of the form:
446 x1 * i + x2 * j + x3 * m + x4 * n + x5 * 1 where x1..x5 element of Z
448 1 i + 20 j + (-2) m + 25
450 Something like "i * n" or "n * m" is not allowed. */
452 static bool graphite_can_represent_scev (tree scev
);
454 /* Return true when EXPR can be represented in the polyhedral model.
456 This means an expression can be represented, if it is linear with respect
457 to the loops and the strides are non parametric. LOOP is the place where
458 the expr will be evaluated. SCOP defines the region we analyse. */
460 static bool graphite_can_represent_expr (sese_l scop
, loop_p loop
,
463 /* Return true if the data references of STMT can be represented by Graphite.
464 We try to analyze the data references in a loop contained in the SCOP. */
466 static bool stmt_has_simple_data_refs_p (sese_l scop
, gimple
*stmt
);
468 /* Remove the close phi node at GSI and replace its rhs with the rhs
471 static void remove_duplicate_close_phi (gphi
*phi
, gphi_iterator
*gsi
);
473 /* Returns true when Graphite can represent LOOP in SCOP.
474 FIXME: For the moment, graphite cannot be used on loops that iterate using
475 induction variables that wrap. */
477 static bool can_represent_loop_1 (loop_p loop
, sese_l scop
);
479 /* Return true when all the loops within LOOP can be represented by
482 static bool can_represent_loop (loop_p loop
, sese_l scop
);
484 /* Returns the number of pbbs that are in loops contained in SCOP. */
486 static int nb_pbbs_in_loops (scop_p scop
);
488 static bool graphite_can_represent_stmt (sese_l
, gimple
*, basic_block
);
494 sese_l
scop_detection::invalid_sese (0);
496 /* Return an sese_l around the LOOP. */
499 scop_detection::get_sese (loop_p loop
)
504 if (!loops_state_satisfies_p (LOOPS_HAVE_PREHEADERS
))
506 edge scop_end
= single_exit (loop
);
509 edge scop_begin
= loop_preheader_edge (loop
);
510 sese_l
s (scop_begin
, scop_end
);
514 /* Return the closest dominator with a single entry edge. */
517 scop_detection::get_nearest_dom_with_single_entry (basic_block dom
)
521 /* If e1->src dominates e2->src then e1->src will also dominate dom. */
522 if (dom
->preds
->length () == 2)
524 edge e1
= (*dom
->preds
)[0];
525 edge e2
= (*dom
->preds
)[1];
526 if (dominated_by_p (CDI_DOMINATORS
, e2
->src
, e1
->src
))
528 if (dominated_by_p (CDI_DOMINATORS
, e1
->src
, e2
->src
))
532 while (dom
->preds
->length () != 1)
534 if (dom
->preds
->length () < 1)
536 dom
= get_immediate_dominator (CDI_DOMINATORS
, dom
);
540 return (*dom
->preds
)[0];
543 /* Return the closest post-dominator with a single exit edge. In case of a
544 back-loop the back-edge is not counted. */
547 scop_detection::get_nearest_pdom_with_single_exit (basic_block dom
)
551 if (dom
->succs
->length () == 2)
553 edge e1
= (*dom
->succs
)[0];
554 edge e2
= (*dom
->succs
)[1];
555 if (dominated_by_p (CDI_POST_DOMINATORS
, e2
->dest
, e1
->dest
))
557 if (dominated_by_p (CDI_POST_DOMINATORS
, e1
->dest
, e2
->dest
))
561 while (dom
->succs
->length () != 1)
563 if (dom
->succs
->length () < 1)
565 dom
= get_immediate_dominator (CDI_POST_DOMINATORS
, dom
);
569 return (*dom
->succs
)[0];
572 /* Print S to FILE. */
575 scop_detection::print_sese (FILE *file
, sese_l s
)
577 fprintf (file
, "(entry_edge (bb_%d, bb_%d), exit_edge (bb_%d, bb_%d))\n",
578 s
.entry
->src
->index
, s
.entry
->dest
->index
,
579 s
.exit
->src
->index
, s
.exit
->dest
->index
);
582 /* Merge scops at same loop depth and returns the new sese.
583 Returns a new SESE when merge was successful, INVALID_SESE otherwise. */
586 scop_detection::merge_sese (sese_l first
, sese_l second
) const
588 /* In the trivial case first/second may be NULL. */
594 DEBUG_PRINT (dp
<< "[try-merging-sese] s1: "; print_sese (dump_file
, first
);
595 dp
<< "[try-merging-sese] s2: ";
596 print_sese (dump_file
, second
));
598 /* Assumption: Both the sese's should be at the same loop depth or one scop
599 should subsume the other like in case of nested loops. */
601 /* Find the common dominators for entry,
602 and common post-dominators for the exit. */
603 basic_block dom
= nearest_common_dominator (CDI_DOMINATORS
,
604 get_entry_bb (first
),
605 get_entry_bb (second
));
607 edge entry
= get_nearest_dom_with_single_entry (dom
);
611 basic_block pdom
= nearest_common_dominator (CDI_POST_DOMINATORS
,
613 get_exit_bb (second
));
614 pdom
= nearest_common_dominator (CDI_POST_DOMINATORS
, dom
, pdom
);
616 edge exit
= get_nearest_pdom_with_single_exit (pdom
);
620 sese_l
combined (entry
, exit
);
622 /* FIXME: We could iterate to find the dom which dominates pdom, and pdom
623 which post-dominates dom, until it stabilizes. Also, ENTRY->SRC and
624 EXIT->DEST should be in the same loop nest. */
625 if (!dominated_by_p (CDI_DOMINATORS
, pdom
, dom
)
626 || loop_depth (entry
->src
->loop_father
)
627 != loop_depth (exit
->dest
->loop_father
))
630 /* For now we just want to bail out when exit does not post-dominate entry.
631 TODO: We might just add a basic_block at the exit to make exit
632 post-dominate entry (the entire region). */
633 if (!dominated_by_p (CDI_POST_DOMINATORS
, get_entry_bb (combined
),
634 get_exit_bb (combined
))
635 || !dominated_by_p (CDI_DOMINATORS
, get_exit_bb (combined
),
636 get_entry_bb (combined
)))
638 DEBUG_PRINT (dp
<< "[scop-detection-fail] cannot merge seses.\n");
642 /* FIXME: We should remove this piece of code once
643 canonicalize_loop_closed_ssa has been removed, because that function
644 adds a BB with single exit. */
645 if (!trivially_empty_bb_p (get_exit_bb (combined
)))
647 /* Find the first empty succ (with single exit) of combined.exit. */
648 basic_block imm_succ
= combined
.exit
->dest
;
649 if (single_succ_p (imm_succ
) && trivially_empty_bb_p (imm_succ
))
650 combined
.exit
= single_succ_edge (imm_succ
);
653 DEBUG_PRINT (dp
<< "\n[scop-detection-fail] Discarding SCoP because "
654 << "no single exit (empty succ) for sese exit";
655 print_sese (dump_file
, combined
));
660 /* Analyze all the BBs in new sese. */
661 if (harmful_stmt_in_region (combined
))
664 DEBUG_PRINT (dp
<< "[merged-sese] s1: "; print_sese (dump_file
, combined
));
669 /* Build scop outer->inner if possible. */
672 scop_detection::build_scop_depth (sese_l s
, loop_p loop
)
677 DEBUG_PRINT (dp
<< "\n[Depth loop_" << loop
->num
<< "]");
678 s
= build_scop_depth (s
, loop
->inner
);
680 sese_l s2
= merge_sese (s
, get_sese (loop
));
683 /* s might be a valid scop, so return it and start analyzing from the
685 build_scop_depth (invalid_sese
, loop
->next
);
689 if (!loop_is_valid_scop (loop
, s2
))
690 return build_scop_depth (invalid_sese
, loop
->next
);
692 return build_scop_breadth (s2
, loop
);
695 /* If loop and loop->next are valid scops, try to merge them. */
698 scop_detection::build_scop_breadth (sese_l s1
, loop_p loop
)
702 DEBUG_PRINT (dp
<< "\n[Breadth loop_" << loop
->num
<< "]");
706 sese_l s2
= build_scop_depth (invalid_sese
, l
->next
);
714 sese_l combined
= merge_sese (s1
, s2
);
726 /* Returns true when Graphite can represent LOOP in SCOP.
727 FIXME: For the moment, graphite cannot be used on loops that iterate using
728 induction variables that wrap. */
731 scop_detection::can_represent_loop_1 (loop_p loop
, sese_l scop
)
734 struct tree_niter_desc niter_desc
;
736 return single_exit (loop
)
737 && number_of_iterations_exit (loop
, single_exit (loop
), &niter_desc
, false)
738 && niter_desc
.control
.no_overflow
739 && (niter
= number_of_latch_executions (loop
))
740 && !chrec_contains_undetermined (niter
)
741 && graphite_can_represent_expr (scop
, loop
, niter
);
744 /* Return true when all the loops within LOOP can be represented by
748 scop_detection::can_represent_loop (loop_p loop
, sese_l scop
)
750 if (!can_represent_loop_1 (loop
, scop
))
752 if (loop
->inner
&& !can_represent_loop (loop
->inner
, scop
))
754 if (loop
->next
&& !can_represent_loop (loop
->next
, scop
))
760 /* Return true when LOOP is a valid scop, that is a Static Control Part, a
761 region of code that can be represented in the polyhedral model. SCOP
762 defines the region we analyse. */
765 scop_detection::loop_is_valid_scop (loop_p loop
, sese_l scop
) const
770 if (!can_represent_loop (loop
, scop
))
772 DEBUG_PRINT (dp
<< "[scop-detection-fail] cannot represent loop_"
773 << loop
->num
<< "\n");
777 if (loop_body_is_valid_scop (loop
, scop
))
779 DEBUG_PRINT (dp
<< "[valid-scop] loop_" << loop
->num
780 << "is a valid scop.\n");
786 /* Return true when BEGIN is the preheader edge of a loop with a single exit
790 scop_detection::region_has_one_loop (sese_l s
)
792 edge begin
= s
.entry
;
794 /* Check for a single perfectly nested loop. */
795 if (begin
->dest
->loop_father
->inner
)
798 /* Otherwise, check whether we have adjacent loops. */
799 return begin
->dest
->loop_father
== end
->src
->loop_father
;
802 /* Add to SCOPS a scop starting at SCOP_BEGIN and ending at SCOP_END. */
805 scop_detection::add_scop (sese_l s
)
809 /* Do not add scops with only one loop. */
810 if (region_has_one_loop (s
))
812 DEBUG_PRINT (dp
<< "\n[scop-detection-fail] Discarding one loop SCoP";
813 print_sese (dump_file
, s
));
817 if (get_exit_bb (s
) == EXIT_BLOCK_PTR_FOR_FN (cfun
))
819 DEBUG_PRINT (dp
<< "\n[scop-detection-fail] "
820 << "Discarding SCoP exiting to return";
821 print_sese (dump_file
, s
));
825 /* Remove all the scops which are subsumed by s. */
828 /* Replace this with split-intersecting scops. */
829 remove_intersecting_scops (s
);
832 DEBUG_PRINT (dp
<< "\nAdding SCoP "; print_sese (dump_file
, s
));
835 /* Return true when a statement in SCOP cannot be represented by Graphite.
836 The assumptions are that L1 dominates L2, and SCOP->entry dominates L1.
837 Limit the number of bbs between adjacent loops to
838 PARAM_SCOP_MAX_NUM_BBS_BETWEEN_LOOPS. */
841 scop_detection::harmful_stmt_in_region (sese_l scop
) const
843 basic_block exit_bb
= get_exit_bb (scop
);
844 basic_block entry_bb
= get_entry_bb (scop
);
846 DEBUG_PRINT (dp
<< "\n[checking-harmful-bbs] ";
847 print_sese (dump_file
, scop
));
848 gcc_assert (dominated_by_p (CDI_DOMINATORS
, exit_bb
, entry_bb
));
850 int depth
= bb_dom_dfs_in (CDI_DOMINATORS
, exit_bb
)
851 - bb_dom_dfs_in (CDI_DOMINATORS
, entry_bb
);
853 gcc_assert (depth
> 0);
856 = get_dominated_to_depth (CDI_DOMINATORS
, entry_bb
, depth
);
859 FOR_EACH_VEC_ELT (dom
, i
, bb
)
861 DEBUG_PRINT (dp
<< "\nVisiting bb_" << bb
->index
);
863 /* We don't want to analyze any bb outside sese. */
864 if (!dominated_by_p (CDI_POST_DOMINATORS
, bb
, exit_bb
))
867 if (harmful_stmt_in_bb (scop
, bb
))
874 /* Returns true if S1 subsumes/surrounds S2. */
876 scop_detection::subsumes (sese_l s1
, sese_l s2
)
878 if (dominated_by_p (CDI_DOMINATORS
, get_entry_bb (s2
),
880 && dominated_by_p (CDI_POST_DOMINATORS
, s2
.exit
->dest
,
886 /* Remove a SCoP which is subsumed by S1. */
888 scop_detection::remove_subscops (sese_l s1
)
892 FOR_EACH_VEC_ELT_REVERSE (scops
, j
, s2
)
894 if (subsumes (s1
, s2
))
896 DEBUG_PRINT (dp
<< "\nRemoving sub-SCoP";
897 print_sese (dump_file
, s2
));
898 scops
.unordered_remove (j
);
903 /* Returns true if S1 intersects with S2. Since we already know that S1 does
904 not subsume S2 or vice-versa, we only check for entry bbs. */
907 scop_detection::intersects (sese_l s1
, sese_l s2
)
909 if (dominated_by_p (CDI_DOMINATORS
, get_entry_bb (s2
),
911 && !dominated_by_p (CDI_DOMINATORS
, get_entry_bb (s2
),
914 if ((s1
.exit
== s2
.entry
) || (s2
.exit
== s1
.entry
))
920 /* Remove one of the scops when it intersects with any other. */
923 scop_detection::remove_intersecting_scops (sese_l s1
)
927 FOR_EACH_VEC_ELT_REVERSE (scops
, j
, s2
)
929 if (intersects (s1
, s2
))
931 DEBUG_PRINT (dp
<< "\nRemoving intersecting SCoP";
932 print_sese (dump_file
, s2
); dp
<< "Intersects with:";
933 print_sese (dump_file
, s1
));
934 scops
.unordered_remove (j
);
939 /* Something like "n * m" is not allowed. */
942 scop_detection::graphite_can_represent_init (tree e
)
944 switch (TREE_CODE (e
))
946 case POLYNOMIAL_CHREC
:
947 return graphite_can_represent_init (CHREC_LEFT (e
))
948 && graphite_can_represent_init (CHREC_RIGHT (e
));
951 if (chrec_contains_symbols (TREE_OPERAND (e
, 0)))
952 return graphite_can_represent_init (TREE_OPERAND (e
, 0))
953 && tree_fits_shwi_p (TREE_OPERAND (e
, 1));
955 return graphite_can_represent_init (TREE_OPERAND (e
, 1))
956 && tree_fits_shwi_p (TREE_OPERAND (e
, 0));
959 case POINTER_PLUS_EXPR
:
961 return graphite_can_represent_init (TREE_OPERAND (e
, 0))
962 && graphite_can_represent_init (TREE_OPERAND (e
, 1));
967 case NON_LVALUE_EXPR
:
968 return graphite_can_represent_init (TREE_OPERAND (e
, 0));
977 /* Return true when SCEV can be represented in the polyhedral model.
979 An expression can be represented, if it can be expressed as an
980 affine expression. For loops (i, j) and parameters (m, n) all
981 affine expressions are of the form:
983 x1 * i + x2 * j + x3 * m + x4 * n + x5 * 1 where x1..x5 element of Z
985 1 i + 20 j + (-2) m + 25
987 Something like "i * n" or "n * m" is not allowed. */
990 scop_detection::graphite_can_represent_scev (tree scev
)
992 if (chrec_contains_undetermined (scev
))
995 /* We disable the handling of pointer types, because it’s currently not
996 supported by Graphite with the ISL AST generator. SSA_NAME nodes are
997 the only nodes, which are disabled in case they are pointers to object
998 types, but this can be changed. */
1000 if (POINTER_TYPE_P (TREE_TYPE (scev
)) && TREE_CODE (scev
) == SSA_NAME
)
1003 switch (TREE_CODE (scev
))
1008 case NON_LVALUE_EXPR
:
1009 return graphite_can_represent_scev (TREE_OPERAND (scev
, 0));
1012 case POINTER_PLUS_EXPR
:
1014 return graphite_can_represent_scev (TREE_OPERAND (scev
, 0))
1015 && graphite_can_represent_scev (TREE_OPERAND (scev
, 1));
1018 return !CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (scev
, 0)))
1019 && !CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (scev
, 1)))
1020 && !(chrec_contains_symbols (TREE_OPERAND (scev
, 0))
1021 && chrec_contains_symbols (TREE_OPERAND (scev
, 1)))
1022 && graphite_can_represent_init (scev
)
1023 && graphite_can_represent_scev (TREE_OPERAND (scev
, 0))
1024 && graphite_can_represent_scev (TREE_OPERAND (scev
, 1));
1026 case POLYNOMIAL_CHREC
:
1027 /* Check for constant strides. With a non constant stride of
1028 'n' we would have a value of 'iv * n'. Also check that the
1029 initial value can represented: for example 'n * m' cannot be
1031 if (!evolution_function_right_is_integer_cst (scev
)
1032 || !graphite_can_represent_init (scev
))
1034 return graphite_can_represent_scev (CHREC_LEFT (scev
));
1040 /* Only affine functions can be represented. */
1041 if (tree_contains_chrecs (scev
, NULL
) || !scev_is_linear_expression (scev
))
1047 /* Return true when EXPR can be represented in the polyhedral model.
1049 This means an expression can be represented, if it is linear with respect to
1050 the loops and the strides are non parametric. LOOP is the place where the
1051 expr will be evaluated. SCOP defines the region we analyse. */
1054 scop_detection::graphite_can_represent_expr (sese_l scop
, loop_p loop
,
1057 tree scev
= scalar_evolution_in_region (scop
, loop
, expr
);
1058 return graphite_can_represent_scev (scev
);
1061 /* Return true if the data references of STMT can be represented by Graphite.
1062 We try to analyze the data references in a loop contained in the SCOP. */
1065 scop_detection::stmt_has_simple_data_refs_p (sese_l scop
, gimple
*stmt
)
1067 loop_p nest
= outermost_loop_in_sese (scop
, gimple_bb (stmt
));
1068 loop_p loop
= loop_containing_stmt (stmt
);
1069 vec
<data_reference_p
> drs
= vNULL
;
1071 graphite_find_data_references_in_stmt (nest
, loop
, stmt
, &drs
);
1074 data_reference_p dr
;
1075 FOR_EACH_VEC_ELT (drs
, j
, dr
)
1077 int nb_subscripts
= DR_NUM_DIMENSIONS (dr
);
1079 if (nb_subscripts
< 1)
1081 free_data_refs (drs
);
1085 tree ref
= DR_REF (dr
);
1087 for (int i
= nb_subscripts
- 1; i
>= 0; i
--)
1089 if (!graphite_can_represent_scev (DR_ACCESS_FN (dr
, i
))
1090 || (TREE_CODE (ref
) != ARRAY_REF
&& TREE_CODE (ref
) != MEM_REF
1091 && TREE_CODE (ref
) != COMPONENT_REF
))
1093 free_data_refs (drs
);
1097 ref
= TREE_OPERAND (ref
, 0);
1101 free_data_refs (drs
);
1105 /* GIMPLE_ASM and GIMPLE_CALL may embed arbitrary side effects.
1106 Calls have side-effects, except those to const or pure
1110 stmt_has_side_effects (gimple
*stmt
)
1112 if (gimple_has_volatile_ops (stmt
)
1113 || (gimple_code (stmt
) == GIMPLE_CALL
1114 && !(gimple_call_flags (stmt
) & (ECF_CONST
| ECF_PURE
)))
1115 || (gimple_code (stmt
) == GIMPLE_ASM
))
1117 DEBUG_PRINT (dp
<< "[scop-detection-fail] "
1118 << "Statement has side-effects:\n";
1119 print_gimple_stmt (dump_file
, stmt
, 0, TDF_VOPS
| TDF_MEMSYMS
));
1125 /* Returns true if STMT can be represented in polyhedral model. LABEL,
1126 simple COND stmts, pure calls, and assignments can be repesented. */
1129 scop_detection::graphite_can_represent_stmt (sese_l scop
, gimple
*stmt
,
1132 loop_p loop
= bb
->loop_father
;
1133 switch (gimple_code (stmt
))
1140 /* We can handle all binary comparisons. Inequalities are
1141 also supported as they can be represented with union of
1143 enum tree_code code
= gimple_cond_code (stmt
);
1144 if (!(code
== LT_EXPR
1149 || code
== NE_EXPR
))
1151 DEBUG_PRINT (dp
<< "[scop-detection-fail] "
1152 << "Graphite cannot handle cond stmt:\n";
1153 print_gimple_stmt (dump_file
, stmt
, 0,
1154 TDF_VOPS
| TDF_MEMSYMS
));
1158 for (unsigned i
= 0; i
< 2; ++i
)
1160 tree op
= gimple_op (stmt
, i
);
1161 if (!graphite_can_represent_expr (scop
, loop
, op
)
1162 /* We can only constrain on integer type. */
1163 || (TREE_CODE (TREE_TYPE (op
)) != INTEGER_TYPE
))
1165 DEBUG_PRINT (dp
<< "[scop-detection-fail] "
1166 << "Graphite cannot represent stmt:\n";
1167 print_gimple_stmt (dump_file
, stmt
, 0,
1168 TDF_VOPS
| TDF_MEMSYMS
));
1181 /* These nodes cut a new scope. */
1183 dp
<< "[scop-detection-fail] "
1184 << "Gimple stmt not handled in Graphite:\n";
1185 print_gimple_stmt (dump_file
, stmt
, 0, TDF_VOPS
| TDF_MEMSYMS
));
1190 /* Return true only when STMT is simple enough for being handled by Graphite.
1191 This depends on SCOP, as the parameters are initialized relatively to
1192 this basic block, the linear functions are initialized based on the outermost
1193 loop containing STMT inside the SCOP. BB is the place where we try to
1194 evaluate the STMT. */
1197 scop_detection::stmt_simple_for_scop_p (sese_l scop
, gimple
*stmt
,
1198 basic_block bb
) const
1202 if (is_gimple_debug (stmt
))
1205 if (stmt_has_side_effects (stmt
))
1208 if (!stmt_has_simple_data_refs_p (scop
, stmt
))
1210 DEBUG_PRINT (dp
<< "[scop-detection-fail] "
1211 << "Graphite cannot handle data-refs in stmt:\n";
1212 print_gimple_stmt (dump_file
, stmt
, 0, TDF_VOPS
|TDF_MEMSYMS
););
1216 return graphite_can_represent_stmt (scop
, stmt
, bb
);
1219 /* Return true when BB contains a harmful operation for a scop: that
1220 can be a function call with side effects, the induction variables
1221 are not linear with respect to SCOP, etc. The current open
1222 scop should end before this statement. */
1225 scop_detection::harmful_stmt_in_bb (sese_l scop
, basic_block bb
) const
1227 gimple_stmt_iterator gsi
;
1229 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
1230 if (!stmt_simple_for_scop_p (scop
, gsi_stmt (gsi
), bb
))
1236 /* Pretty print to FILE all the SCoPs in DOT format and mark them with
1237 different colors. If there are not enough colors, paint the
1238 remaining SCoPs in gray.
1241 - "*" after the node number denotes the entry of a SCoP,
1242 - "#" after the node number denotes the exit of a SCoP,
1243 - "()" around the node number denotes the entry or the
1244 exit nodes of the SCOP. These are not part of SCoP. */
1247 dot_all_scops_1 (FILE *file
, vec
<scop_p
> scops
)
1256 /* Disable debugging while printing graph. */
1257 int tmp_dump_flags
= dump_flags
;
1260 fprintf (file
, "digraph all {\n");
1262 FOR_ALL_BB_FN (bb
, cfun
)
1264 int part_of_scop
= false;
1266 /* Use HTML for every bb label. So we are able to print bbs
1267 which are part of two different SCoPs, with two different
1268 background colors. */
1269 fprintf (file
, "%d [label=<\n <TABLE BORDER=\"0\" CELLBORDER=\"1\" ",
1271 fprintf (file
, "CELLSPACING=\"0\">\n");
1273 /* Select color for SCoP. */
1274 FOR_EACH_VEC_ELT (scops
, i
, scop
)
1276 sese_l region
= scop
->region
->region
;
1277 if (bb_in_sese_p (bb
, region
) || (region
.exit
->dest
== bb
)
1278 || (region
.entry
->dest
== bb
))
1291 case 3: /* purple */
1294 case 4: /* orange */
1297 case 5: /* yellow */
1337 fprintf (file
, " <TR><TD WIDTH=\"50\" BGCOLOR=\"%s\">",
1340 if (!bb_in_sese_p (bb
, region
))
1341 fprintf (file
, " (");
1343 if (bb
== region
.entry
->dest
&& bb
== region
.exit
->dest
)
1344 fprintf (file
, " %d*# ", bb
->index
);
1345 else if (bb
== region
.entry
->dest
)
1346 fprintf (file
, " %d* ", bb
->index
);
1347 else if (bb
== region
.exit
->dest
)
1348 fprintf (file
, " %d# ", bb
->index
);
1350 fprintf (file
, " %d ", bb
->index
);
1352 fprintf (file
, "{lp_%d}", bb
->loop_father
->num
);
1354 if (!bb_in_sese_p (bb
, region
))
1355 fprintf (file
, ")");
1357 fprintf (file
, "</TD></TR>\n");
1358 part_of_scop
= true;
1364 fprintf (file
, " <TR><TD WIDTH=\"50\" BGCOLOR=\"#ffffff\">");
1365 fprintf (file
, " %d {lp_%d} </TD></TR>\n", bb
->index
,
1366 bb
->loop_father
->num
);
1368 fprintf (file
, " </TABLE>>, shape=box, style=\"setlinewidth(0)\"]\n");
1371 FOR_ALL_BB_FN (bb
, cfun
)
1373 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1374 fprintf (file
, "%d -> %d;\n", bb
->index
, e
->dest
->index
);
1377 fputs ("}\n\n", file
);
1379 /* Enable debugging again. */
1380 dump_flags
= tmp_dump_flags
;
1383 /* Display all SCoPs using dotty. */
1386 dot_all_scops (vec
<scop_p
> scops
)
1388 /* When debugging, enable the following code. This cannot be used
1389 in production compilers because it calls "system". */
1392 FILE *stream
= fopen ("/tmp/allscops.dot", "w");
1393 gcc_assert (stream
);
1395 dot_all_scops_1 (stream
, scops
);
1398 x
= system ("dotty /tmp/allscops.dot &");
1400 dot_all_scops_1 (stderr
, scops
);
1404 /* Display all SCoPs using dotty. */
1407 dot_scop (scop_p scop
)
1409 auto_vec
<scop_p
, 1> scops
;
1412 scops
.safe_push (scop
);
1414 /* When debugging, enable the following code. This cannot be used
1415 in production compilers because it calls "system". */
1419 FILE *stream
= fopen ("/tmp/allscops.dot", "w");
1420 gcc_assert (stream
);
1422 dot_all_scops_1 (stream
, scops
);
1424 x
= system ("dotty /tmp/allscops.dot &");
1427 dot_all_scops_1 (stderr
, scops
);
1431 /* Return true when the body of LOOP has statements that can be represented as a
1435 scop_detection::loop_body_is_valid_scop (loop_p loop
, sese_l scop
) const
1437 if (!loop_ivs_can_be_represented (loop
))
1439 DEBUG_PRINT (dp
<< "[scop-detection-fail] loop_" << loop
->num
1440 << "IV cannot be represented.\n");
1444 if (!loop_nest_has_data_refs (loop
))
1446 DEBUG_PRINT (dp
<< "[scop-detection-fail] loop_" << loop
->num
1447 << "does not have any data reference.\n");
1451 basic_block
*bbs
= get_loop_body (loop
);
1452 for (unsigned i
= 0; i
< loop
->num_nodes
; i
++)
1454 basic_block bb
= bbs
[i
];
1456 if (harmful_stmt_in_bb (scop
, bb
))
1466 if (!loop_body_is_valid_scop (loop
, scop
))
1475 /* Returns the number of pbbs that are in loops contained in SCOP. */
1478 scop_detection::nb_pbbs_in_loops (scop_p scop
)
1484 FOR_EACH_VEC_ELT (scop
->pbbs
, i
, pbb
)
1485 if (loop_in_sese_p (gbb_loop (PBB_BLACK_BOX (pbb
)), scop
->region
->region
))
1491 /* When parameter NAME is in REGION, returns its index in SESE_PARAMS.
1492 Otherwise returns -1. */
1495 parameter_index_in_region_1 (tree name
, sese_info_p region
)
1500 gcc_assert (TREE_CODE (name
) == SSA_NAME
);
1502 FOR_EACH_VEC_ELT (SESE_PARAMS (region
), i
, p
)
1509 /* When the parameter NAME is in REGION, returns its index in
1510 SESE_PARAMS. Otherwise this function inserts NAME in SESE_PARAMS
1511 and returns the index of NAME. */
1514 parameter_index_in_region (tree name
, sese_info_p region
)
1518 gcc_assert (TREE_CODE (name
) == SSA_NAME
);
1520 /* Cannot constrain on anything else than INTEGER_TYPE parameters. */
1521 if (TREE_CODE (TREE_TYPE (name
)) != INTEGER_TYPE
)
1524 if (!invariant_in_sese_p_rec (name
, region
->region
))
1527 i
= parameter_index_in_region_1 (name
, region
);
1531 i
= SESE_PARAMS (region
).length ();
1532 SESE_PARAMS (region
).safe_push (name
);
1536 /* In the context of sese S, scan the expression E and translate it to
1537 a linear expression C. When parsing a symbolic multiplication, K
1538 represents the constant multiplier of an expression containing
1542 scan_tree_for_params (sese_info_p s
, tree e
)
1544 if (e
== chrec_dont_know
)
1547 switch (TREE_CODE (e
))
1549 case POLYNOMIAL_CHREC
:
1550 scan_tree_for_params (s
, CHREC_LEFT (e
));
1554 if (chrec_contains_symbols (TREE_OPERAND (e
, 0)))
1555 scan_tree_for_params (s
, TREE_OPERAND (e
, 0));
1557 scan_tree_for_params (s
, TREE_OPERAND (e
, 1));
1561 case POINTER_PLUS_EXPR
:
1563 scan_tree_for_params (s
, TREE_OPERAND (e
, 0));
1564 scan_tree_for_params (s
, TREE_OPERAND (e
, 1));
1570 case NON_LVALUE_EXPR
:
1571 scan_tree_for_params (s
, TREE_OPERAND (e
, 0));
1575 parameter_index_in_region (e
, s
);
1591 /* Find parameters with respect to REGION in BB. We are looking in memory
1592 access functions, conditions and loop bounds. */
1595 find_params_in_bb (sese_info_p region
, gimple_poly_bb_p gbb
)
1597 /* Find parameters in the access functions of data references. */
1599 data_reference_p dr
;
1600 FOR_EACH_VEC_ELT (GBB_DATA_REFS (gbb
), i
, dr
)
1601 for (unsigned j
= 0; j
< DR_NUM_DIMENSIONS (dr
); j
++)
1602 scan_tree_for_params (region
, DR_ACCESS_FN (dr
, j
));
1604 /* Find parameters in conditional statements. */
1606 loop_p loop
= GBB_BB (gbb
)->loop_father
;
1607 FOR_EACH_VEC_ELT (GBB_CONDITIONS (gbb
), i
, stmt
)
1609 tree lhs
= scalar_evolution_in_region (region
->region
, loop
,
1610 gimple_cond_lhs (stmt
));
1611 tree rhs
= scalar_evolution_in_region (region
->region
, loop
,
1612 gimple_cond_rhs (stmt
));
1614 scan_tree_for_params (region
, lhs
);
1615 scan_tree_for_params (region
, rhs
);
1619 /* Record the parameters used in the SCOP. A variable is a parameter
1620 in a scop if it does not vary during the execution of that scop. */
1623 find_scop_parameters (scop_p scop
)
1626 sese_info_p region
= scop
->region
;
1629 /* Find the parameters used in the loop bounds. */
1630 FOR_EACH_VEC_ELT (SESE_LOOP_NEST (region
), i
, loop
)
1632 tree nb_iters
= number_of_latch_executions (loop
);
1634 if (!chrec_contains_symbols (nb_iters
))
1637 nb_iters
= scalar_evolution_in_region (region
->region
, loop
, nb_iters
);
1638 scan_tree_for_params (region
, nb_iters
);
1641 /* Find the parameters used in data accesses. */
1643 FOR_EACH_VEC_ELT (scop
->pbbs
, i
, pbb
)
1644 find_params_in_bb (region
, PBB_BLACK_BOX (pbb
));
1646 int nbp
= sese_nb_params (region
);
1647 scop_set_nb_params (scop
, nbp
);
1650 /* Generates a polyhedral black box only if the bb contains interesting
1653 static gimple_poly_bb_p
1654 try_generate_gimple_bb (scop_p scop
, basic_block bb
)
1656 vec
<data_reference_p
> drs
;
1658 sese_l region
= scop
->region
->region
;
1659 loop_p nest
= outermost_loop_in_sese (region
, bb
);
1661 loop_p loop
= bb
->loop_father
;
1662 if (!loop_in_sese_p (loop
, region
))
1665 gimple_stmt_iterator gsi
;
1666 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
1668 gimple
*stmt
= gsi_stmt (gsi
);
1669 if (is_gimple_debug (stmt
))
1672 graphite_find_data_references_in_stmt (nest
, loop
, stmt
, &drs
);
1675 return new_gimple_poly_bb (bb
, drs
);
1678 /* Gather BBs and conditions for a SCOP. */
1679 class gather_bbs
: public dom_walker
1682 gather_bbs (cdi_direction
, scop_p
);
1684 virtual void before_dom_children (basic_block
);
1685 virtual void after_dom_children (basic_block
);
1688 auto_vec
<gimple
*, 3> conditions
, cases
;
1692 gather_bbs::gather_bbs (cdi_direction direction
, scop_p scop
)
1693 : dom_walker (direction
), scop (scop
)
1697 /* Call-back for dom_walk executed before visiting the dominated
1701 gather_bbs::before_dom_children (basic_block bb
)
1703 if (!bb_in_sese_p (bb
, scop
->region
->region
))
1706 gcond
*stmt
= single_pred_cond_non_loop_exit (bb
);
1710 edge e
= single_pred_edge (bb
);
1712 conditions
.safe_push (stmt
);
1714 if (e
->flags
& EDGE_TRUE_VALUE
)
1715 cases
.safe_push (stmt
);
1717 cases
.safe_push (NULL
);
1720 scop
->region
->bbs
.safe_push (bb
);
1722 gimple_poly_bb_p gbb
= try_generate_gimple_bb (scop
, bb
);
1723 GBB_CONDITIONS (gbb
) = conditions
.copy ();
1724 GBB_CONDITION_CASES (gbb
) = cases
.copy ();
1726 poly_bb_p pbb
= new_poly_bb (scop
, gbb
);
1727 scop
->pbbs
.safe_push (pbb
);
1730 /* Call-back for dom_walk executed after visiting the dominated
1734 gather_bbs::after_dom_children (basic_block bb
)
1736 if (!bb_in_sese_p (bb
, scop
->region
->region
))
1739 if (single_pred_cond_non_loop_exit (bb
))
1746 /* Find Static Control Parts (SCoP) in the current function and pushes
1750 build_scops (vec
<scop_p
> *scops
)
1753 dp
.set_dump_file (dump_file
);
1755 canonicalize_loop_closed_ssa_form ();
1758 sb
.build_scop_depth (scop_detection::invalid_sese
, current_loops
->tree_root
);
1760 /* Now create scops from the lightweight SESEs. */
1761 vec
<sese_l
> scops_l
= sb
.get_scops ();
1764 FOR_EACH_VEC_ELT (scops_l
, i
, s
)
1766 scop_p scop
= new_scop (s
.entry
, s
.exit
);
1768 /* Record all basic blocks and their conditions in REGION. */
1769 gather_bbs (CDI_DOMINATORS
, scop
).walk (cfun
->cfg
->x_entry_block_ptr
);
1771 /* Do not optimize a scop containing only PBBs that do not belong
1773 if (sb
.nb_pbbs_in_loops (scop
) == 0)
1775 DEBUG_PRINT (dp
<< "[scop-detection-fail] no data references.\n");
1780 build_sese_loop_nests (scop
->region
);
1782 find_scop_parameters (scop
);
1783 graphite_dim_t max_dim
= PARAM_VALUE (PARAM_GRAPHITE_MAX_NB_SCOP_PARAMS
);
1785 if (scop_nb_params (scop
) > max_dim
)
1787 DEBUG_PRINT (dp
<< "[scop-detection-fail] too many parameters: "
1788 << scop_nb_params (scop
)
1789 << " larger than --param graphite-max-nb-scop-params="
1790 << max_dim
<< ".\n");
1796 scops
->safe_push (scop
);
1799 DEBUG_PRINT (dp
<< "number of SCoPs: " << (scops
? scops
->length () : 0););
1802 #endif /* HAVE_isl */