]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ipa-split.c
Convert symtab, cgraph and varpool nodes into a real class hierarchy
[thirdparty/gcc.git] / gcc / ipa-split.c
CommitLineData
3e485f62 1/* Function splitting pass
d1e082c2 2 Copyright (C) 2010-2013 Free Software Foundation, Inc.
3e485f62
JH
3 Contributed by Jan Hubicka <jh@suse.cz>
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21/* The purpose of this pass is to split function bodies to improve
22 inlining. I.e. for function of the form:
23
24 func (...)
25 {
26 if (cheap_test)
27 something_small
28 else
29 something_big
30 }
31
32 Produce:
33
34 func.part (...)
35 {
36 something_big
37 }
38
39 func (...)
40 {
41 if (cheap_test)
42 something_small
43 else
44 func.part (...);
45 }
46
47 When func becomes inlinable and when cheap_test is often true, inlining func,
ed7656f6 48 but not fund.part leads to performance improvement similar as inlining
3e485f62
JH
49 original func while the code size growth is smaller.
50
51 The pass is organized in three stages:
52 1) Collect local info about basic block into BB_INFO structure and
53 compute function body estimated size and time.
54 2) Via DFS walk find all possible basic blocks where we can split
55 and chose best one.
56 3) If split point is found, split at the specified BB by creating a clone
57 and updating function to call it.
58
59 The decisions what functions to split are in execute_split_functions
60 and consider_split.
61
62 There are several possible future improvements for this pass including:
63
64 1) Splitting to break up large functions
65 2) Splitting to reduce stack frame usage
66 3) Allow split part of function to use values computed in the header part.
67 The values needs to be passed to split function, perhaps via same
68 interface as for nested functions or as argument.
69 4) Support for simple rematerialization. I.e. when split part use
70 value computed in header from function parameter in very cheap way, we
71 can just recompute it.
72 5) Support splitting of nested functions.
73 6) Support non-SSA arguments.
74 7) There is nothing preventing us from producing multiple parts of single function
75 when needed or splitting also the parts. */
76
77#include "config.h"
78#include "system.h"
79#include "coretypes.h"
80#include "tree.h"
8e9055ae 81#include "gimple.h"
3e485f62 82#include "target.h"
3e485f62 83#include "ipa-prop.h"
442b4905
AM
84#include "gimple-ssa.h"
85#include "tree-cfg.h"
86#include "tree-phinodes.h"
87#include "ssa-iterators.h"
88#include "tree-ssanames.h"
89#include "tree-into-ssa.h"
90#include "tree-dfa.h"
3e485f62
JH
91#include "tree-pass.h"
92#include "flags.h"
3e485f62
JH
93#include "diagnostic.h"
94#include "tree-dump.h"
95#include "tree-inline.h"
3e485f62
JH
96#include "params.h"
97#include "gimple-pretty-print.h"
e7f23018 98#include "ipa-inline.h"
a9e0d843 99#include "cfgloop.h"
3e485f62
JH
100
101/* Per basic block info. */
102
103typedef struct
104{
105 unsigned int size;
106 unsigned int time;
107} bb_info;
3e485f62 108
9771b263 109static vec<bb_info> bb_info_vec;
3e485f62
JH
110
111/* Description of split point. */
112
113struct split_point
114{
115 /* Size of the partitions. */
116 unsigned int header_time, header_size, split_time, split_size;
117
ed7656f6 118 /* SSA names that need to be passed into spit function. */
3e485f62
JH
119 bitmap ssa_names_to_pass;
120
121 /* Basic block where we split (that will become entry point of new function. */
122 basic_block entry_bb;
123
124 /* Basic blocks we are splitting away. */
125 bitmap split_bbs;
241a2b9e
JH
126
127 /* True when return value is computed on split part and thus it needs
128 to be returned. */
129 bool split_part_set_retval;
3e485f62
JH
130};
131
132/* Best split point found. */
133
134struct split_point best_split_point;
135
b2e25729
BS
136/* Set of basic blocks that are not allowed to dominate a split point. */
137
138static bitmap forbidden_dominators;
139
241a2b9e
JH
140static tree find_retval (basic_block return_bb);
141
1802378d 142/* Callback for walk_stmt_load_store_addr_ops. If T is non-SSA automatic
3e485f62
JH
143 variable, check it if it is present in bitmap passed via DATA. */
144
145static bool
1802378d 146test_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, void *data)
3e485f62
JH
147{
148 t = get_base_address (t);
149
1802378d
EB
150 if (!t || is_gimple_reg (t))
151 return false;
152
153 if (TREE_CODE (t) == PARM_DECL
154 || (TREE_CODE (t) == VAR_DECL
3e485f62 155 && auto_var_in_fn_p (t, current_function_decl))
1802378d
EB
156 || TREE_CODE (t) == RESULT_DECL
157 || TREE_CODE (t) == LABEL_DECL)
3e485f62 158 return bitmap_bit_p ((bitmap)data, DECL_UID (t));
241a2b9e 159
1802378d
EB
160 /* For DECL_BY_REFERENCE, the return value is actually a pointer. We want
161 to pretend that the value pointed to is actual result decl. */
162 if ((TREE_CODE (t) == MEM_REF || INDIRECT_REF_P (t))
241a2b9e 163 && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
70b5e7dc 164 && SSA_NAME_VAR (TREE_OPERAND (t, 0))
241a2b9e
JH
165 && TREE_CODE (SSA_NAME_VAR (TREE_OPERAND (t, 0))) == RESULT_DECL
166 && DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
1802378d
EB
167 return
168 bitmap_bit_p ((bitmap)data,
169 DECL_UID (DECL_RESULT (current_function_decl)));
170
3e485f62
JH
171 return false;
172}
173
174/* Dump split point CURRENT. */
175
176static void
177dump_split_point (FILE * file, struct split_point *current)
178{
179 fprintf (file,
cfef45c8
RG
180 "Split point at BB %i\n"
181 " header time: %i header size: %i\n"
182 " split time: %i split size: %i\n bbs: ",
3e485f62
JH
183 current->entry_bb->index, current->header_time,
184 current->header_size, current->split_time, current->split_size);
185 dump_bitmap (file, current->split_bbs);
186 fprintf (file, " SSA names to pass: ");
187 dump_bitmap (file, current->ssa_names_to_pass);
188}
189
1802378d
EB
190/* Look for all BBs in header that might lead to the split part and verify
191 that they are not defining any non-SSA var used by the split part.
2094f1fc
JH
192 Parameters are the same as for consider_split. */
193
194static bool
195verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
196 basic_block return_bb)
197{
198 bitmap seen = BITMAP_ALLOC (NULL);
6e1aa848 199 vec<basic_block> worklist = vNULL;
2094f1fc
JH
200 edge e;
201 edge_iterator ei;
202 bool ok = true;
1802378d 203
2094f1fc
JH
204 FOR_EACH_EDGE (e, ei, current->entry_bb->preds)
205 if (e->src != ENTRY_BLOCK_PTR
206 && !bitmap_bit_p (current->split_bbs, e->src->index))
207 {
9771b263 208 worklist.safe_push (e->src);
2094f1fc
JH
209 bitmap_set_bit (seen, e->src->index);
210 }
1802378d 211
9771b263 212 while (!worklist.is_empty ())
2094f1fc
JH
213 {
214 gimple_stmt_iterator bsi;
9771b263 215 basic_block bb = worklist.pop ();
2094f1fc
JH
216
217 FOR_EACH_EDGE (e, ei, bb->preds)
218 if (e->src != ENTRY_BLOCK_PTR
fcaa4ca4 219 && bitmap_set_bit (seen, e->src->index))
2094f1fc
JH
220 {
221 gcc_checking_assert (!bitmap_bit_p (current->split_bbs,
222 e->src->index));
9771b263 223 worklist.safe_push (e->src);
2094f1fc
JH
224 }
225 for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
226 {
1802378d
EB
227 gimple stmt = gsi_stmt (bsi);
228 if (is_gimple_debug (stmt))
2094f1fc
JH
229 continue;
230 if (walk_stmt_load_store_addr_ops
1802378d
EB
231 (stmt, non_ssa_vars, test_nonssa_use, test_nonssa_use,
232 test_nonssa_use))
2094f1fc
JH
233 {
234 ok = false;
235 goto done;
236 }
1802378d
EB
237 if (gimple_code (stmt) == GIMPLE_LABEL
238 && test_nonssa_use (stmt, gimple_label_label (stmt),
239 non_ssa_vars))
240 {
241 ok = false;
242 goto done;
243 }
2094f1fc
JH
244 }
245 for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
246 {
247 if (walk_stmt_load_store_addr_ops
1802378d
EB
248 (gsi_stmt (bsi), non_ssa_vars, test_nonssa_use, test_nonssa_use,
249 test_nonssa_use))
2094f1fc
JH
250 {
251 ok = false;
252 goto done;
253 }
254 }
255 FOR_EACH_EDGE (e, ei, bb->succs)
256 {
257 if (e->dest != return_bb)
258 continue;
259 for (bsi = gsi_start_phis (return_bb); !gsi_end_p (bsi);
260 gsi_next (&bsi))
261 {
262 gimple stmt = gsi_stmt (bsi);
263 tree op = gimple_phi_arg_def (stmt, e->dest_idx);
264
ea057359 265 if (virtual_operand_p (gimple_phi_result (stmt)))
2094f1fc
JH
266 continue;
267 if (TREE_CODE (op) != SSA_NAME
268 && test_nonssa_use (stmt, op, non_ssa_vars))
269 {
270 ok = false;
271 goto done;
272 }
273 }
274 }
275 }
276done:
277 BITMAP_FREE (seen);
9771b263 278 worklist.release ();
2094f1fc
JH
279 return ok;
280}
281
b2e25729
BS
282/* If STMT is a call, check the callee against a list of forbidden
283 predicate functions. If a match is found, look for uses of the
284 call result in condition statements that compare against zero.
285 For each such use, find the block targeted by the condition
286 statement for the nonzero result, and set the bit for this block
287 in the forbidden dominators bitmap. The purpose of this is to avoid
288 selecting a split point where we are likely to lose the chance
289 to optimize away an unused function call. */
290
291static void
292check_forbidden_calls (gimple stmt)
293{
294 imm_use_iterator use_iter;
295 use_operand_p use_p;
296 tree lhs;
297
298 /* At the moment, __builtin_constant_p is the only forbidden
299 predicate function call (see PR49642). */
300 if (!gimple_call_builtin_p (stmt, BUILT_IN_CONSTANT_P))
301 return;
302
303 lhs = gimple_call_lhs (stmt);
304
305 if (!lhs || TREE_CODE (lhs) != SSA_NAME)
306 return;
307
308 FOR_EACH_IMM_USE_FAST (use_p, use_iter, lhs)
309 {
310 tree op1;
311 basic_block use_bb, forbidden_bb;
312 enum tree_code code;
313 edge true_edge, false_edge;
314 gimple use_stmt = USE_STMT (use_p);
315
316 if (gimple_code (use_stmt) != GIMPLE_COND)
317 continue;
318
319 /* Assuming canonical form for GIMPLE_COND here, with constant
320 in second position. */
321 op1 = gimple_cond_rhs (use_stmt);
322 code = gimple_cond_code (use_stmt);
323 use_bb = gimple_bb (use_stmt);
324
325 extract_true_false_edges_from_block (use_bb, &true_edge, &false_edge);
326
327 /* We're only interested in comparisons that distinguish
328 unambiguously from zero. */
329 if (!integer_zerop (op1) || code == LE_EXPR || code == GE_EXPR)
330 continue;
331
332 if (code == EQ_EXPR)
333 forbidden_bb = false_edge->dest;
334 else
335 forbidden_bb = true_edge->dest;
336
337 bitmap_set_bit (forbidden_dominators, forbidden_bb->index);
338 }
339}
340
341/* If BB is dominated by any block in the forbidden dominators set,
342 return TRUE; else FALSE. */
343
344static bool
345dominated_by_forbidden (basic_block bb)
346{
347 unsigned dom_bb;
348 bitmap_iterator bi;
349
350 EXECUTE_IF_SET_IN_BITMAP (forbidden_dominators, 1, dom_bb, bi)
351 {
352 if (dominated_by_p (CDI_DOMINATORS, bb, BASIC_BLOCK (dom_bb)))
353 return true;
354 }
355
356 return false;
357}
358
3e485f62
JH
359/* We found an split_point CURRENT. NON_SSA_VARS is bitmap of all non ssa
360 variables used and RETURN_BB is return basic block.
361 See if we can split function here. */
362
363static void
364consider_split (struct split_point *current, bitmap non_ssa_vars,
365 basic_block return_bb)
366{
367 tree parm;
368 unsigned int num_args = 0;
369 unsigned int call_overhead;
370 edge e;
371 edge_iterator ei;
8b3057b3
JH
372 gimple_stmt_iterator bsi;
373 unsigned int i;
ed7656f6 374 int incoming_freq = 0;
241a2b9e 375 tree retval;
e70670cf 376 bool back_edge = false;
8b3057b3 377
3e485f62
JH
378 if (dump_file && (dump_flags & TDF_DETAILS))
379 dump_split_point (dump_file, current);
380
8b3057b3 381 FOR_EACH_EDGE (e, ei, current->entry_bb->preds)
e70670cf
JH
382 {
383 if (e->flags & EDGE_DFS_BACK)
384 back_edge = true;
385 if (!bitmap_bit_p (current->split_bbs, e->src->index))
386 incoming_freq += EDGE_FREQUENCY (e);
387 }
8b3057b3 388
3e485f62 389 /* Do not split when we would end up calling function anyway. */
ed7656f6 390 if (incoming_freq
3e485f62
JH
391 >= (ENTRY_BLOCK_PTR->frequency
392 * PARAM_VALUE (PARAM_PARTIAL_INLINING_ENTRY_PROBABILITY) / 100))
393 {
e70670cf
JH
394 /* When profile is guessed, we can not expect it to give us
395 realistic estimate on likelyness of function taking the
396 complex path. As a special case, when tail of the function is
397 a loop, enable splitting since inlining code skipping the loop
398 is likely noticeable win. */
399 if (back_edge
400 && profile_status != PROFILE_READ
401 && incoming_freq < ENTRY_BLOCK_PTR->frequency)
402 {
403 if (dump_file && (dump_flags & TDF_DETAILS))
404 fprintf (dump_file,
405 " Split before loop, accepting despite low frequencies %i %i.\n",
406 incoming_freq,
407 ENTRY_BLOCK_PTR->frequency);
408 }
409 else
410 {
411 if (dump_file && (dump_flags & TDF_DETAILS))
412 fprintf (dump_file,
413 " Refused: incoming frequency is too large.\n");
414 return;
415 }
3e485f62
JH
416 }
417
418 if (!current->header_size)
419 {
420 if (dump_file && (dump_flags & TDF_DETAILS))
421 fprintf (dump_file, " Refused: header empty\n");
3e485f62
JH
422 return;
423 }
424
ed7656f6
JJ
425 /* Verify that PHI args on entry are either virtual or all their operands
426 incoming from header are the same. */
8b3057b3 427 for (bsi = gsi_start_phis (current->entry_bb); !gsi_end_p (bsi); gsi_next (&bsi))
3e485f62 428 {
8b3057b3
JH
429 gimple stmt = gsi_stmt (bsi);
430 tree val = NULL;
431
ea057359 432 if (virtual_operand_p (gimple_phi_result (stmt)))
8b3057b3
JH
433 continue;
434 for (i = 0; i < gimple_phi_num_args (stmt); i++)
435 {
436 edge e = gimple_phi_arg_edge (stmt, i);
437 if (!bitmap_bit_p (current->split_bbs, e->src->index))
438 {
439 tree edge_val = gimple_phi_arg_def (stmt, i);
440 if (val && edge_val != val)
441 {
442 if (dump_file && (dump_flags & TDF_DETAILS))
443 fprintf (dump_file,
444 " Refused: entry BB has PHI with multiple variants\n");
445 return;
446 }
447 val = edge_val;
448 }
449 }
3e485f62
JH
450 }
451
452
453 /* See what argument we will pass to the split function and compute
454 call overhead. */
455 call_overhead = eni_size_weights.call_cost;
456 for (parm = DECL_ARGUMENTS (current_function_decl); parm;
910ad8de 457 parm = DECL_CHAIN (parm))
3e485f62
JH
458 {
459 if (!is_gimple_reg (parm))
460 {
461 if (bitmap_bit_p (non_ssa_vars, DECL_UID (parm)))
462 {
463 if (dump_file && (dump_flags & TDF_DETAILS))
464 fprintf (dump_file,
465 " Refused: need to pass non-ssa param values\n");
466 return;
467 }
468 }
32244553 469 else
3e485f62 470 {
32244553
RG
471 tree ddef = ssa_default_def (cfun, parm);
472 if (ddef
473 && bitmap_bit_p (current->ssa_names_to_pass,
474 SSA_NAME_VERSION (ddef)))
475 {
476 if (!VOID_TYPE_P (TREE_TYPE (parm)))
477 call_overhead += estimate_move_cost (TREE_TYPE (parm));
478 num_args++;
479 }
3e485f62
JH
480 }
481 }
482 if (!VOID_TYPE_P (TREE_TYPE (current_function_decl)))
483 call_overhead += estimate_move_cost (TREE_TYPE (current_function_decl));
484
485 if (current->split_size <= call_overhead)
486 {
487 if (dump_file && (dump_flags & TDF_DETAILS))
488 fprintf (dump_file,
489 " Refused: split size is smaller than call overhead\n");
490 return;
491 }
492 if (current->header_size + call_overhead
493 >= (unsigned int)(DECL_DECLARED_INLINE_P (current_function_decl)
494 ? MAX_INLINE_INSNS_SINGLE
495 : MAX_INLINE_INSNS_AUTO))
496 {
497 if (dump_file && (dump_flags & TDF_DETAILS))
498 fprintf (dump_file,
499 " Refused: header size is too large for inline candidate\n");
500 return;
501 }
502
503 /* FIXME: we currently can pass only SSA function parameters to the split
d402c33d 504 arguments. Once parm_adjustment infrastructure is supported by cloning,
3e485f62
JH
505 we can pass more than that. */
506 if (num_args != bitmap_count_bits (current->ssa_names_to_pass))
507 {
8b3057b3 508
3e485f62
JH
509 if (dump_file && (dump_flags & TDF_DETAILS))
510 fprintf (dump_file,
511 " Refused: need to pass non-param values\n");
512 return;
513 }
514
515 /* When there are non-ssa vars used in the split region, see if they
516 are used in the header region. If so, reject the split.
517 FIXME: we can use nested function support to access both. */
2094f1fc
JH
518 if (!bitmap_empty_p (non_ssa_vars)
519 && !verify_non_ssa_vars (current, non_ssa_vars, return_bb))
3e485f62 520 {
2094f1fc
JH
521 if (dump_file && (dump_flags & TDF_DETAILS))
522 fprintf (dump_file,
523 " Refused: split part has non-ssa uses\n");
3e485f62
JH
524 return;
525 }
b2e25729
BS
526
527 /* If the split point is dominated by a forbidden block, reject
528 the split. */
529 if (!bitmap_empty_p (forbidden_dominators)
530 && dominated_by_forbidden (current->entry_bb))
531 {
532 if (dump_file && (dump_flags & TDF_DETAILS))
533 fprintf (dump_file,
534 " Refused: split point dominated by forbidden block\n");
535 return;
536 }
537
241a2b9e
JH
538 /* See if retval used by return bb is computed by header or split part.
539 When it is computed by split part, we need to produce return statement
540 in the split part and add code to header to pass it around.
541
542 This is bit tricky to test:
543 1) When there is no return_bb or no return value, we always pass
544 value around.
545 2) Invariants are always computed by caller.
546 3) For SSA we need to look if defining statement is in header or split part
547 4) For non-SSA we need to look where the var is computed. */
548 retval = find_retval (return_bb);
549 if (!retval)
550 current->split_part_set_retval = true;
551 else if (is_gimple_min_invariant (retval))
552 current->split_part_set_retval = false;
553 /* Special case is value returned by reference we record as if it was non-ssa
554 set to result_decl. */
555 else if (TREE_CODE (retval) == SSA_NAME
70b5e7dc 556 && SSA_NAME_VAR (retval)
241a2b9e
JH
557 && TREE_CODE (SSA_NAME_VAR (retval)) == RESULT_DECL
558 && DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
559 current->split_part_set_retval
560 = bitmap_bit_p (non_ssa_vars, DECL_UID (SSA_NAME_VAR (retval)));
561 else if (TREE_CODE (retval) == SSA_NAME)
562 current->split_part_set_retval
563 = (!SSA_NAME_IS_DEFAULT_DEF (retval)
564 && (bitmap_bit_p (current->split_bbs,
565 gimple_bb (SSA_NAME_DEF_STMT (retval))->index)
566 || gimple_bb (SSA_NAME_DEF_STMT (retval)) == return_bb));
567 else if (TREE_CODE (retval) == PARM_DECL)
568 current->split_part_set_retval = false;
569 else if (TREE_CODE (retval) == VAR_DECL
570 || TREE_CODE (retval) == RESULT_DECL)
571 current->split_part_set_retval
572 = bitmap_bit_p (non_ssa_vars, DECL_UID (retval));
573 else
574 current->split_part_set_retval = true;
575
28fc44f3
JJ
576 /* split_function fixes up at most one PHI non-virtual PHI node in return_bb,
577 for the return value. If there are other PHIs, give up. */
578 if (return_bb != EXIT_BLOCK_PTR)
579 {
580 gimple_stmt_iterator psi;
581
582 for (psi = gsi_start_phis (return_bb); !gsi_end_p (psi); gsi_next (&psi))
ea057359 583 if (!virtual_operand_p (gimple_phi_result (gsi_stmt (psi)))
28fc44f3
JJ
584 && !(retval
585 && current->split_part_set_retval
586 && TREE_CODE (retval) == SSA_NAME
587 && !DECL_BY_REFERENCE (DECL_RESULT (current_function_decl))
588 && SSA_NAME_DEF_STMT (retval) == gsi_stmt (psi)))
589 {
590 if (dump_file && (dump_flags & TDF_DETAILS))
591 fprintf (dump_file,
592 " Refused: return bb has extra PHIs\n");
593 return;
594 }
595 }
596
597 if (dump_file && (dump_flags & TDF_DETAILS))
598 fprintf (dump_file, " Accepted!\n");
599
3e485f62
JH
600 /* At the moment chose split point with lowest frequency and that leaves
601 out smallest size of header.
602 In future we might re-consider this heuristics. */
603 if (!best_split_point.split_bbs
604 || best_split_point.entry_bb->frequency > current->entry_bb->frequency
605 || (best_split_point.entry_bb->frequency == current->entry_bb->frequency
606 && best_split_point.split_size < current->split_size))
607
608 {
609 if (dump_file && (dump_flags & TDF_DETAILS))
610 fprintf (dump_file, " New best split point!\n");
611 if (best_split_point.ssa_names_to_pass)
612 {
613 BITMAP_FREE (best_split_point.ssa_names_to_pass);
614 BITMAP_FREE (best_split_point.split_bbs);
615 }
616 best_split_point = *current;
617 best_split_point.ssa_names_to_pass = BITMAP_ALLOC (NULL);
618 bitmap_copy (best_split_point.ssa_names_to_pass,
619 current->ssa_names_to_pass);
620 best_split_point.split_bbs = BITMAP_ALLOC (NULL);
621 bitmap_copy (best_split_point.split_bbs, current->split_bbs);
622 }
623}
624
2094f1fc
JH
625/* Return basic block containing RETURN statement. We allow basic blocks
626 of the form:
627 <retval> = tmp_var;
628 return <retval>
629 but return_bb can not be more complex than this.
630 If nothing is found, return EXIT_BLOCK_PTR.
631
3e485f62
JH
632 When there are multiple RETURN statement, chose one with return value,
633 since that one is more likely shared by multiple code paths.
2094f1fc
JH
634
635 Return BB is special, because for function splitting it is the only
636 basic block that is duplicated in between header and split part of the
637 function.
638
3e485f62
JH
639 TODO: We might support multiple return blocks. */
640
641static basic_block
642find_return_bb (void)
643{
644 edge e;
3e485f62 645 basic_block return_bb = EXIT_BLOCK_PTR;
68457901
JJ
646 gimple_stmt_iterator bsi;
647 bool found_return = false;
648 tree retval = NULL_TREE;
3e485f62 649
68457901
JJ
650 if (!single_pred_p (EXIT_BLOCK_PTR))
651 return return_bb;
652
653 e = single_pred_edge (EXIT_BLOCK_PTR);
654 for (bsi = gsi_last_bb (e->src); !gsi_end_p (bsi); gsi_prev (&bsi))
655 {
656 gimple stmt = gsi_stmt (bsi);
a348dc7f
JJ
657 if (gimple_code (stmt) == GIMPLE_LABEL
658 || is_gimple_debug (stmt)
659 || gimple_clobber_p (stmt))
68457901
JJ
660 ;
661 else if (gimple_code (stmt) == GIMPLE_ASSIGN
662 && found_return
663 && gimple_assign_single_p (stmt)
664 && (auto_var_in_fn_p (gimple_assign_rhs1 (stmt),
665 current_function_decl)
666 || is_gimple_min_invariant (gimple_assign_rhs1 (stmt)))
667 && retval == gimple_assign_lhs (stmt))
668 ;
669 else if (gimple_code (stmt) == GIMPLE_RETURN)
670 {
671 found_return = true;
672 retval = gimple_return_retval (stmt);
673 }
674 else
675 break;
676 }
677 if (gsi_end_p (bsi) && found_return)
678 return_bb = e->src;
3e485f62 679
3e485f62
JH
680 return return_bb;
681}
682
ed7656f6 683/* Given return basic block RETURN_BB, see where return value is really
2094f1fc
JH
684 stored. */
685static tree
686find_retval (basic_block return_bb)
687{
688 gimple_stmt_iterator bsi;
689 for (bsi = gsi_start_bb (return_bb); !gsi_end_p (bsi); gsi_next (&bsi))
690 if (gimple_code (gsi_stmt (bsi)) == GIMPLE_RETURN)
691 return gimple_return_retval (gsi_stmt (bsi));
a348dc7f
JJ
692 else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN
693 && !gimple_clobber_p (gsi_stmt (bsi)))
2094f1fc
JH
694 return gimple_assign_rhs1 (gsi_stmt (bsi));
695 return NULL;
696}
697
1802378d
EB
698/* Callback for walk_stmt_load_store_addr_ops. If T is non-SSA automatic
699 variable, mark it as used in bitmap passed via DATA.
3e485f62
JH
700 Return true when access to T prevents splitting the function. */
701
702static bool
1802378d 703mark_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, void *data)
3e485f62
JH
704{
705 t = get_base_address (t);
706
707 if (!t || is_gimple_reg (t))
708 return false;
709
710 /* At present we can't pass non-SSA arguments to split function.
711 FIXME: this can be relaxed by passing references to arguments. */
712 if (TREE_CODE (t) == PARM_DECL)
713 {
714 if (dump_file && (dump_flags & TDF_DETAILS))
1802378d
EB
715 fprintf (dump_file,
716 "Cannot split: use of non-ssa function parameter.\n");
3e485f62
JH
717 return true;
718 }
719
1802378d
EB
720 if ((TREE_CODE (t) == VAR_DECL
721 && auto_var_in_fn_p (t, current_function_decl))
722 || TREE_CODE (t) == RESULT_DECL
723 || TREE_CODE (t) == LABEL_DECL)
3e485f62 724 bitmap_set_bit ((bitmap)data, DECL_UID (t));
241a2b9e 725
1802378d
EB
726 /* For DECL_BY_REFERENCE, the return value is actually a pointer. We want
727 to pretend that the value pointed to is actual result decl. */
728 if ((TREE_CODE (t) == MEM_REF || INDIRECT_REF_P (t))
241a2b9e 729 && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
70b5e7dc 730 && SSA_NAME_VAR (TREE_OPERAND (t, 0))
241a2b9e
JH
731 && TREE_CODE (SSA_NAME_VAR (TREE_OPERAND (t, 0))) == RESULT_DECL
732 && DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
1802378d
EB
733 return
734 bitmap_bit_p ((bitmap)data,
735 DECL_UID (DECL_RESULT (current_function_decl)));
736
3e485f62
JH
737 return false;
738}
739
740/* Compute local properties of basic block BB we collect when looking for
741 split points. We look for ssa defs and store them in SET_SSA_NAMES,
742 for ssa uses and store them in USED_SSA_NAMES and for any non-SSA automatic
743 vars stored in NON_SSA_VARS.
744
745 When BB has edge to RETURN_BB, collect uses in RETURN_BB too.
746
747 Return false when BB contains something that prevents it from being put into
748 split function. */
749
750static bool
751visit_bb (basic_block bb, basic_block return_bb,
752 bitmap set_ssa_names, bitmap used_ssa_names,
753 bitmap non_ssa_vars)
754{
755 gimple_stmt_iterator bsi;
756 edge e;
757 edge_iterator ei;
758 bool can_split = true;
759
760 for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
761 {
762 gimple stmt = gsi_stmt (bsi);
763 tree op;
764 ssa_op_iter iter;
765 tree decl;
766
767 if (is_gimple_debug (stmt))
768 continue;
769
a348dc7f
JJ
770 if (gimple_clobber_p (stmt))
771 continue;
772
3e485f62
JH
773 /* FIXME: We can split regions containing EH. We can not however
774 split RESX, EH_DISPATCH and EH_POINTER referring to same region
775 into different partitions. This would require tracking of
776 EH regions and checking in consider_split_point if they
777 are not used elsewhere. */
1da7d8c0 778 if (gimple_code (stmt) == GIMPLE_RESX)
3e485f62
JH
779 {
780 if (dump_file && (dump_flags & TDF_DETAILS))
1da7d8c0 781 fprintf (dump_file, "Cannot split: resx.\n");
3e485f62
JH
782 can_split = false;
783 }
784 if (gimple_code (stmt) == GIMPLE_EH_DISPATCH)
785 {
786 if (dump_file && (dump_flags & TDF_DETAILS))
1802378d 787 fprintf (dump_file, "Cannot split: eh dispatch.\n");
3e485f62
JH
788 can_split = false;
789 }
790
791 /* Check builtins that prevent splitting. */
792 if (gimple_code (stmt) == GIMPLE_CALL
793 && (decl = gimple_call_fndecl (stmt)) != NULL_TREE
794 && DECL_BUILT_IN (decl)
795 && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
796 switch (DECL_FUNCTION_CODE (decl))
797 {
798 /* FIXME: once we will allow passing non-parm values to split part,
799 we need to be sure to handle correct builtin_stack_save and
800 builtin_stack_restore. At the moment we are safe; there is no
801 way to store builtin_stack_save result in non-SSA variable
802 since all calls to those are compiler generated. */
803 case BUILT_IN_APPLY:
61e03ffc 804 case BUILT_IN_APPLY_ARGS:
3e485f62
JH
805 case BUILT_IN_VA_START:
806 if (dump_file && (dump_flags & TDF_DETAILS))
1802378d
EB
807 fprintf (dump_file,
808 "Cannot split: builtin_apply and va_start.\n");
3e485f62
JH
809 can_split = false;
810 break;
811 case BUILT_IN_EH_POINTER:
812 if (dump_file && (dump_flags & TDF_DETAILS))
1802378d 813 fprintf (dump_file, "Cannot split: builtin_eh_pointer.\n");
3e485f62
JH
814 can_split = false;
815 break;
816 default:
817 break;
818 }
819
820 FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF)
821 bitmap_set_bit (set_ssa_names, SSA_NAME_VERSION (op));
822 FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
823 bitmap_set_bit (used_ssa_names, SSA_NAME_VERSION (op));
824 can_split &= !walk_stmt_load_store_addr_ops (stmt, non_ssa_vars,
825 mark_nonssa_use,
826 mark_nonssa_use,
827 mark_nonssa_use);
828 }
829 for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
830 {
831 gimple stmt = gsi_stmt (bsi);
8b3057b3 832 unsigned int i;
3e485f62 833
ea057359 834 if (virtual_operand_p (gimple_phi_result (stmt)))
3e485f62 835 continue;
8b3057b3
JH
836 bitmap_set_bit (set_ssa_names,
837 SSA_NAME_VERSION (gimple_phi_result (stmt)));
838 for (i = 0; i < gimple_phi_num_args (stmt); i++)
839 {
840 tree op = gimple_phi_arg_def (stmt, i);
841 if (TREE_CODE (op) == SSA_NAME)
842 bitmap_set_bit (used_ssa_names, SSA_NAME_VERSION (op));
843 }
3e485f62
JH
844 can_split &= !walk_stmt_load_store_addr_ops (stmt, non_ssa_vars,
845 mark_nonssa_use,
846 mark_nonssa_use,
847 mark_nonssa_use);
848 }
ed7656f6 849 /* Record also uses coming from PHI operand in return BB. */
3e485f62
JH
850 FOR_EACH_EDGE (e, ei, bb->succs)
851 if (e->dest == return_bb)
852 {
3e485f62
JH
853 for (bsi = gsi_start_phis (return_bb); !gsi_end_p (bsi); gsi_next (&bsi))
854 {
855 gimple stmt = gsi_stmt (bsi);
856 tree op = gimple_phi_arg_def (stmt, e->dest_idx);
857
ea057359 858 if (virtual_operand_p (gimple_phi_result (stmt)))
3e485f62 859 continue;
3e485f62
JH
860 if (TREE_CODE (op) == SSA_NAME)
861 bitmap_set_bit (used_ssa_names, SSA_NAME_VERSION (op));
862 else
863 can_split &= !mark_nonssa_use (stmt, op, non_ssa_vars);
864 }
3e485f62
JH
865 }
866 return can_split;
867}
868
869/* Stack entry for recursive DFS walk in find_split_point. */
870
871typedef struct
872{
873 /* Basic block we are examining. */
874 basic_block bb;
875
876 /* SSA names set and used by the BB and all BBs reachable
877 from it via DFS walk. */
878 bitmap set_ssa_names, used_ssa_names;
879 bitmap non_ssa_vars;
880
881 /* All BBS visited from this BB via DFS walk. */
882 bitmap bbs_visited;
883
884 /* Last examined edge in DFS walk. Since we walk unoriented graph,
ed7656f6 885 the value is up to sum of incoming and outgoing edges of BB. */
3e485f62
JH
886 unsigned int edge_num;
887
888 /* Stack entry index of earliest BB reachable from current BB
ed7656f6 889 or any BB visited later in DFS walk. */
3e485f62
JH
890 int earliest;
891
892 /* Overall time and size of all BBs reached from this BB in DFS walk. */
893 int overall_time, overall_size;
894
895 /* When false we can not split on this BB. */
896 bool can_split;
897} stack_entry;
3e485f62
JH
898
899
900/* Find all articulations and call consider_split on them.
901 OVERALL_TIME and OVERALL_SIZE is time and size of the function.
902
903 We perform basic algorithm for finding an articulation in a graph
904 created from CFG by considering it to be an unoriented graph.
905
906 The articulation is discovered via DFS walk. We collect earliest
907 basic block on stack that is reachable via backward edge. Articulation
908 is any basic block such that there is no backward edge bypassing it.
909 To reduce stack usage we maintain heap allocated stack in STACK vector.
910 AUX pointer of BB is set to index it appears in the stack or -1 once
911 it is visited and popped off the stack.
912
913 The algorithm finds articulation after visiting the whole component
914 reachable by it. This makes it convenient to collect information about
915 the component used by consider_split. */
916
917static void
918find_split_points (int overall_time, int overall_size)
919{
920 stack_entry first;
6e1aa848 921 vec<stack_entry> stack = vNULL;
3e485f62
JH
922 basic_block bb;
923 basic_block return_bb = find_return_bb ();
924 struct split_point current;
925
926 current.header_time = overall_time;
927 current.header_size = overall_size;
928 current.split_time = 0;
929 current.split_size = 0;
930 current.ssa_names_to_pass = BITMAP_ALLOC (NULL);
931
932 first.bb = ENTRY_BLOCK_PTR;
933 first.edge_num = 0;
934 first.overall_time = 0;
935 first.overall_size = 0;
936 first.earliest = INT_MAX;
937 first.set_ssa_names = 0;
938 first.used_ssa_names = 0;
939 first.bbs_visited = 0;
9771b263 940 stack.safe_push (first);
3e485f62
JH
941 ENTRY_BLOCK_PTR->aux = (void *)(intptr_t)-1;
942
9771b263 943 while (!stack.is_empty ())
3e485f62 944 {
9771b263 945 stack_entry *entry = &stack.last ();
3e485f62
JH
946
947 /* We are walking an acyclic graph, so edge_num counts
948 succ and pred edges together. However when considering
949 articulation, we want to have processed everything reachable
950 from articulation but nothing that reaches into it. */
951 if (entry->edge_num == EDGE_COUNT (entry->bb->succs)
952 && entry->bb != ENTRY_BLOCK_PTR)
953 {
9771b263 954 int pos = stack.length ();
3e485f62
JH
955 entry->can_split &= visit_bb (entry->bb, return_bb,
956 entry->set_ssa_names,
957 entry->used_ssa_names,
958 entry->non_ssa_vars);
959 if (pos <= entry->earliest && !entry->can_split
960 && dump_file && (dump_flags & TDF_DETAILS))
961 fprintf (dump_file,
962 "found articulation at bb %i but can not split\n",
963 entry->bb->index);
964 if (pos <= entry->earliest && entry->can_split)
965 {
966 if (dump_file && (dump_flags & TDF_DETAILS))
967 fprintf (dump_file, "found articulation at bb %i\n",
968 entry->bb->index);
969 current.entry_bb = entry->bb;
970 current.ssa_names_to_pass = BITMAP_ALLOC (NULL);
971 bitmap_and_compl (current.ssa_names_to_pass,
972 entry->used_ssa_names, entry->set_ssa_names);
973 current.header_time = overall_time - entry->overall_time;
974 current.header_size = overall_size - entry->overall_size;
975 current.split_time = entry->overall_time;
976 current.split_size = entry->overall_size;
977 current.split_bbs = entry->bbs_visited;
978 consider_split (&current, entry->non_ssa_vars, return_bb);
979 BITMAP_FREE (current.ssa_names_to_pass);
980 }
981 }
982 /* Do actual DFS walk. */
983 if (entry->edge_num
984 < (EDGE_COUNT (entry->bb->succs)
985 + EDGE_COUNT (entry->bb->preds)))
986 {
987 edge e;
988 basic_block dest;
989 if (entry->edge_num < EDGE_COUNT (entry->bb->succs))
990 {
991 e = EDGE_SUCC (entry->bb, entry->edge_num);
992 dest = e->dest;
993 }
994 else
995 {
996 e = EDGE_PRED (entry->bb, entry->edge_num
997 - EDGE_COUNT (entry->bb->succs));
998 dest = e->src;
999 }
1000
1001 entry->edge_num++;
1002
1003 /* New BB to visit, push it to the stack. */
1004 if (dest != return_bb && dest != EXIT_BLOCK_PTR
1005 && !dest->aux)
1006 {
1007 stack_entry new_entry;
1008
1009 new_entry.bb = dest;
1010 new_entry.edge_num = 0;
1011 new_entry.overall_time
9771b263 1012 = bb_info_vec[dest->index].time;
3e485f62 1013 new_entry.overall_size
9771b263 1014 = bb_info_vec[dest->index].size;
3e485f62
JH
1015 new_entry.earliest = INT_MAX;
1016 new_entry.set_ssa_names = BITMAP_ALLOC (NULL);
1017 new_entry.used_ssa_names = BITMAP_ALLOC (NULL);
1018 new_entry.bbs_visited = BITMAP_ALLOC (NULL);
1019 new_entry.non_ssa_vars = BITMAP_ALLOC (NULL);
1020 new_entry.can_split = true;
1021 bitmap_set_bit (new_entry.bbs_visited, dest->index);
9771b263
DN
1022 stack.safe_push (new_entry);
1023 dest->aux = (void *)(intptr_t)stack.length ();
3e485f62
JH
1024 }
1025 /* Back edge found, record the earliest point. */
1026 else if ((intptr_t)dest->aux > 0
1027 && (intptr_t)dest->aux < entry->earliest)
1028 entry->earliest = (intptr_t)dest->aux;
1029 }
ed7656f6
JJ
1030 /* We are done with examining the edges. Pop off the value from stack
1031 and merge stuff we accumulate during the walk. */
3e485f62
JH
1032 else if (entry->bb != ENTRY_BLOCK_PTR)
1033 {
9771b263 1034 stack_entry *prev = &stack[stack.length () - 2];
3e485f62
JH
1035
1036 entry->bb->aux = (void *)(intptr_t)-1;
1037 prev->can_split &= entry->can_split;
1038 if (prev->set_ssa_names)
1039 {
1040 bitmap_ior_into (prev->set_ssa_names, entry->set_ssa_names);
1041 bitmap_ior_into (prev->used_ssa_names, entry->used_ssa_names);
1042 bitmap_ior_into (prev->bbs_visited, entry->bbs_visited);
1043 bitmap_ior_into (prev->non_ssa_vars, entry->non_ssa_vars);
1044 }
1045 if (prev->earliest > entry->earliest)
1046 prev->earliest = entry->earliest;
1047 prev->overall_time += entry->overall_time;
1048 prev->overall_size += entry->overall_size;
1049 BITMAP_FREE (entry->set_ssa_names);
1050 BITMAP_FREE (entry->used_ssa_names);
1051 BITMAP_FREE (entry->bbs_visited);
1052 BITMAP_FREE (entry->non_ssa_vars);
9771b263 1053 stack.pop ();
3e485f62
JH
1054 }
1055 else
9771b263 1056 stack.pop ();
3e485f62
JH
1057 }
1058 ENTRY_BLOCK_PTR->aux = NULL;
1059 FOR_EACH_BB (bb)
1060 bb->aux = NULL;
9771b263 1061 stack.release ();
3e485f62
JH
1062 BITMAP_FREE (current.ssa_names_to_pass);
1063}
1064
1065/* Split function at SPLIT_POINT. */
1066
1067static void
1068split_function (struct split_point *split_point)
1069{
6e1aa848 1070 vec<tree> args_to_pass = vNULL;
201176d3 1071 bitmap args_to_skip;
3e485f62
JH
1072 tree parm;
1073 int num = 0;
201176d3 1074 struct cgraph_node *node, *cur_node = cgraph_get_node (current_function_decl);
3e485f62
JH
1075 basic_block return_bb = find_return_bb ();
1076 basic_block call_bb;
1077 gimple_stmt_iterator gsi;
1078 gimple call;
1079 edge e;
1080 edge_iterator ei;
1081 tree retval = NULL, real_retval = NULL;
1082 bool split_part_return_p = false;
1083 gimple last_stmt = NULL;
371556ee 1084 unsigned int i;
32244553 1085 tree arg, ddef;
9771b263 1086 vec<tree, va_gc> **debug_args = NULL;
3e485f62
JH
1087
1088 if (dump_file)
1089 {
1090 fprintf (dump_file, "\n\nSplitting function at:\n");
1091 dump_split_point (dump_file, split_point);
1092 }
1093
201176d3
MJ
1094 if (cur_node->local.can_change_signature)
1095 args_to_skip = BITMAP_ALLOC (NULL);
1096 else
1097 args_to_skip = NULL;
1098
3e485f62
JH
1099 /* Collect the parameters of new function and args_to_skip bitmap. */
1100 for (parm = DECL_ARGUMENTS (current_function_decl);
910ad8de 1101 parm; parm = DECL_CHAIN (parm), num++)
201176d3
MJ
1102 if (args_to_skip
1103 && (!is_gimple_reg (parm)
32244553 1104 || (ddef = ssa_default_def (cfun, parm)) == NULL_TREE
201176d3 1105 || !bitmap_bit_p (split_point->ssa_names_to_pass,
32244553 1106 SSA_NAME_VERSION (ddef))))
3e485f62
JH
1107 bitmap_set_bit (args_to_skip, num);
1108 else
371556ee 1109 {
86814190
MJ
1110 /* This parm might not have been used up to now, but is going to be
1111 used, hence register it. */
86814190 1112 if (is_gimple_reg (parm))
32244553 1113 arg = get_or_create_ssa_default_def (cfun, parm);
86814190
MJ
1114 else
1115 arg = parm;
201176d3 1116
2b3c0885
RG
1117 if (!useless_type_conversion_p (DECL_ARG_TYPE (parm), TREE_TYPE (arg)))
1118 arg = fold_convert (DECL_ARG_TYPE (parm), arg);
9771b263 1119 args_to_pass.safe_push (arg);
371556ee 1120 }
3e485f62
JH
1121
1122 /* See if the split function will return. */
1123 FOR_EACH_EDGE (e, ei, return_bb->preds)
1124 if (bitmap_bit_p (split_point->split_bbs, e->src->index))
1125 break;
1126 if (e)
1127 split_part_return_p = true;
1128
241a2b9e
JH
1129 /* Add return block to what will become the split function.
1130 We do not return; no return block is needed. */
1131 if (!split_part_return_p)
1132 ;
1133 /* We have no return block, so nothing is needed. */
1134 else if (return_bb == EXIT_BLOCK_PTR)
1135 ;
1136 /* When we do not want to return value, we need to construct
1137 new return block with empty return statement.
1138 FIXME: Once we are able to change return type, we should change function
1139 to return void instead of just outputting function with undefined return
1140 value. For structures this affects quality of codegen. */
1141 else if (!split_point->split_part_set_retval
1142 && find_retval (return_bb))
1143 {
1144 bool redirected = true;
1145 basic_block new_return_bb = create_basic_block (NULL, 0, return_bb);
1146 gimple_stmt_iterator gsi = gsi_start_bb (new_return_bb);
1147 gsi_insert_after (&gsi, gimple_build_return (NULL), GSI_NEW_STMT);
1148 while (redirected)
1149 {
1150 redirected = false;
1151 FOR_EACH_EDGE (e, ei, return_bb->preds)
1152 if (bitmap_bit_p (split_point->split_bbs, e->src->index))
1153 {
1154 new_return_bb->count += e->count;
1155 new_return_bb->frequency += EDGE_FREQUENCY (e);
1156 redirect_edge_and_branch (e, new_return_bb);
1157 redirected = true;
1158 break;
1159 }
1160 }
1161 e = make_edge (new_return_bb, EXIT_BLOCK_PTR, 0);
1162 e->probability = REG_BR_PROB_BASE;
1163 e->count = new_return_bb->count;
a9e0d843
RB
1164 if (current_loops)
1165 add_bb_to_loop (new_return_bb, current_loops->tree_root);
241a2b9e 1166 bitmap_set_bit (split_point->split_bbs, new_return_bb->index);
2e5e346d
JL
1167 }
1168 /* When we pass around the value, use existing return block. */
1169 else
1170 bitmap_set_bit (split_point->split_bbs, return_bb->index);
1171
1172 /* If RETURN_BB has virtual operand PHIs, they must be removed and the
1173 virtual operand marked for renaming as we change the CFG in a way that
cfef45c8 1174 tree-inline is not able to compensate for.
2e5e346d
JL
1175
1176 Note this can happen whether or not we have a return value. If we have
1177 a return value, then RETURN_BB may have PHIs for real operands too. */
1178 if (return_bb != EXIT_BLOCK_PTR)
1179 {
cfef45c8 1180 bool phi_p = false;
241a2b9e
JH
1181 for (gsi = gsi_start_phis (return_bb); !gsi_end_p (gsi);)
1182 {
1183 gimple stmt = gsi_stmt (gsi);
ea057359 1184 if (!virtual_operand_p (gimple_phi_result (stmt)))
2e5e346d
JL
1185 {
1186 gsi_next (&gsi);
1187 continue;
1188 }
6b8c9df8
RG
1189 mark_virtual_phi_result_for_renaming (stmt);
1190 remove_phi_node (&gsi, true);
cfef45c8 1191 phi_p = true;
241a2b9e 1192 }
cfef45c8
RG
1193 /* In reality we have to rename the reaching definition of the
1194 virtual operand at return_bb as we will eventually release it
1195 when we remove the code region we outlined.
1196 So we have to rename all immediate virtual uses of that region
1197 if we didn't see a PHI definition yet. */
1198 /* ??? In real reality we want to set the reaching vdef of the
1199 entry of the SESE region as the vuse of the call and the reaching
1200 vdef of the exit of the SESE region as the vdef of the call. */
1201 if (!phi_p)
1202 for (gsi = gsi_start_bb (return_bb); !gsi_end_p (gsi); gsi_next (&gsi))
1203 {
1204 gimple stmt = gsi_stmt (gsi);
1205 if (gimple_vuse (stmt))
1206 {
1207 gimple_set_vuse (stmt, NULL_TREE);
1208 update_stmt (stmt);
1209 }
1210 if (gimple_vdef (stmt))
1211 break;
1212 }
241a2b9e 1213 }
3e485f62
JH
1214
1215 /* Now create the actual clone. */
1216 rebuild_cgraph_edges ();
6e1aa848 1217 node = cgraph_function_versioning (cur_node, vNULL,
9771b263
DN
1218 NULL,
1219 args_to_skip,
1a2c27e9 1220 !split_part_return_p,
3e485f62 1221 split_point->split_bbs,
2094f1fc 1222 split_point->entry_bb, "part");
d402c33d
JH
1223 /* For usual cloning it is enough to clear builtin only when signature
1224 changes. For partial inlining we however can not expect the part
1225 of builtin implementation to have same semantic as the whole. */
960bfb69 1226 if (DECL_BUILT_IN (node->symbol.decl))
d402c33d 1227 {
960bfb69
JH
1228 DECL_BUILT_IN_CLASS (node->symbol.decl) = NOT_BUILT_IN;
1229 DECL_FUNCTION_CODE (node->symbol.decl) = (enum built_in_function) 0;
d402c33d 1230 }
9a6af450
EB
1231 /* If the original function is declared inline, there is no point in issuing
1232 a warning for the non-inlinable part. */
1233 DECL_NO_INLINE_WARNING_P (node->symbol.decl) = 1;
201176d3 1234 cgraph_node_remove_callees (cur_node);
71cafea9 1235 ipa_remove_all_references (&cur_node->symbol.ref_list);
3e485f62 1236 if (!split_part_return_p)
960bfb69 1237 TREE_THIS_VOLATILE (node->symbol.decl) = 1;
3e485f62 1238 if (dump_file)
960bfb69 1239 dump_function_to_file (node->symbol.decl, dump_file, dump_flags);
3e485f62
JH
1240
1241 /* Create the basic block we place call into. It is the entry basic block
1242 split after last label. */
1243 call_bb = split_point->entry_bb;
1244 for (gsi = gsi_start_bb (call_bb); !gsi_end_p (gsi);)
1245 if (gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
1246 {
1247 last_stmt = gsi_stmt (gsi);
1248 gsi_next (&gsi);
1249 }
1250 else
1251 break;
1252 e = split_block (split_point->entry_bb, last_stmt);
1253 remove_edge (e);
1254
1255 /* Produce the call statement. */
1256 gsi = gsi_last_bb (call_bb);
9771b263 1257 FOR_EACH_VEC_ELT (args_to_pass, i, arg)
2b3c0885
RG
1258 if (!is_gimple_val (arg))
1259 {
1260 arg = force_gimple_operand_gsi (&gsi, arg, true, NULL_TREE,
f6e52e91 1261 false, GSI_CONTINUE_LINKING);
9771b263 1262 args_to_pass[i] = arg;
2b3c0885 1263 }
960bfb69 1264 call = gimple_build_call_vec (node->symbol.decl, args_to_pass);
3e485f62 1265 gimple_set_block (call, DECL_INITIAL (current_function_decl));
9771b263 1266 args_to_pass.release ();
3e485f62 1267
878eef4a
JJ
1268 /* For optimized away parameters, add on the caller side
1269 before the call
1270 DEBUG D#X => parm_Y(D)
1271 stmts and associate D#X with parm in decl_debug_args_lookup
1272 vector to say for debug info that if parameter parm had been passed,
1273 it would have value parm_Y(D). */
1274 if (args_to_skip)
1275 for (parm = DECL_ARGUMENTS (current_function_decl), num = 0;
1276 parm; parm = DECL_CHAIN (parm), num++)
1277 if (bitmap_bit_p (args_to_skip, num)
1278 && is_gimple_reg (parm))
1279 {
1280 tree ddecl;
1281 gimple def_temp;
1282
1283 /* This needs to be done even without MAY_HAVE_DEBUG_STMTS,
1284 otherwise if it didn't exist before, we'd end up with
1285 different SSA_NAME_VERSIONs between -g and -g0. */
1286 arg = get_or_create_ssa_default_def (cfun, parm);
1287 if (!MAY_HAVE_DEBUG_STMTS)
1288 continue;
1289
1290 if (debug_args == NULL)
1291 debug_args = decl_debug_args_insert (node->symbol.decl);
1292 ddecl = make_node (DEBUG_EXPR_DECL);
1293 DECL_ARTIFICIAL (ddecl) = 1;
1294 TREE_TYPE (ddecl) = TREE_TYPE (parm);
1295 DECL_MODE (ddecl) = DECL_MODE (parm);
9771b263
DN
1296 vec_safe_push (*debug_args, DECL_ORIGIN (parm));
1297 vec_safe_push (*debug_args, ddecl);
878eef4a
JJ
1298 def_temp = gimple_build_debug_bind (ddecl, unshare_expr (arg),
1299 call);
1300 gsi_insert_after (&gsi, def_temp, GSI_NEW_STMT);
1301 }
1302 /* And on the callee side, add
1303 DEBUG D#Y s=> parm
1304 DEBUG var => D#Y
1305 stmts to the first bb where var is a VAR_DECL created for the
1306 optimized away parameter in DECL_INITIAL block. This hints
1307 in the debug info that var (whole DECL_ORIGIN is the parm PARM_DECL)
1308 is optimized away, but could be looked up at the call site
1309 as value of D#X there. */
1310 if (debug_args != NULL)
1311 {
1312 unsigned int i;
1313 tree var, vexpr;
1314 gimple_stmt_iterator cgsi;
1315 gimple def_temp;
1316
1317 push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl));
1318 var = BLOCK_VARS (DECL_INITIAL (node->symbol.decl));
9771b263 1319 i = vec_safe_length (*debug_args);
878eef4a
JJ
1320 cgsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR));
1321 do
1322 {
1323 i -= 2;
1324 while (var != NULL_TREE
9771b263 1325 && DECL_ABSTRACT_ORIGIN (var) != (**debug_args)[i])
878eef4a
JJ
1326 var = TREE_CHAIN (var);
1327 if (var == NULL_TREE)
1328 break;
1329 vexpr = make_node (DEBUG_EXPR_DECL);
9771b263 1330 parm = (**debug_args)[i];
878eef4a
JJ
1331 DECL_ARTIFICIAL (vexpr) = 1;
1332 TREE_TYPE (vexpr) = TREE_TYPE (parm);
1333 DECL_MODE (vexpr) = DECL_MODE (parm);
1334 def_temp = gimple_build_debug_source_bind (vexpr, parm,
1335 NULL);
1336 gsi_insert_before (&cgsi, def_temp, GSI_SAME_STMT);
1337 def_temp = gimple_build_debug_bind (var, vexpr, NULL);
1338 gsi_insert_before (&cgsi, def_temp, GSI_SAME_STMT);
1339 }
1340 while (i);
1341 pop_cfun ();
1342 }
1343
556e9ba0
JH
1344 /* We avoid address being taken on any variable used by split part,
1345 so return slot optimization is always possible. Moreover this is
1346 required to make DECL_BY_REFERENCE work. */
1347 if (aggregate_value_p (DECL_RESULT (current_function_decl),
22110e6c
EB
1348 TREE_TYPE (current_function_decl))
1349 && (!is_gimple_reg_type (TREE_TYPE (DECL_RESULT (current_function_decl)))
1350 || DECL_BY_REFERENCE (DECL_RESULT (current_function_decl))))
556e9ba0
JH
1351 gimple_call_set_return_slot_opt (call, true);
1352
3e485f62
JH
1353 /* Update return value. This is bit tricky. When we do not return,
1354 do nothing. When we return we might need to update return_bb
1355 or produce a new return statement. */
1356 if (!split_part_return_p)
1357 gsi_insert_after (&gsi, call, GSI_NEW_STMT);
1358 else
1359 {
1360 e = make_edge (call_bb, return_bb,
1361 return_bb == EXIT_BLOCK_PTR ? 0 : EDGE_FALLTHRU);
1362 e->count = call_bb->count;
1363 e->probability = REG_BR_PROB_BASE;
6938f93f
JH
1364
1365 /* If there is return basic block, see what value we need to store
1366 return value into and put call just before it. */
3e485f62
JH
1367 if (return_bb != EXIT_BLOCK_PTR)
1368 {
2094f1fc 1369 real_retval = retval = find_retval (return_bb);
6938f93f 1370
241a2b9e 1371 if (real_retval && split_point->split_part_set_retval)
3e485f62
JH
1372 {
1373 gimple_stmt_iterator psi;
1374
6938f93f
JH
1375 /* See if we need new SSA_NAME for the result.
1376 When DECL_BY_REFERENCE is true, retval is actually pointer to
1377 return value and it is constant in whole function. */
1378 if (TREE_CODE (retval) == SSA_NAME
1379 && !DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
3e485f62 1380 {
070ecdfd 1381 retval = copy_ssa_name (retval, call);
6938f93f
JH
1382
1383 /* See if there is PHI defining return value. */
1384 for (psi = gsi_start_phis (return_bb);
1385 !gsi_end_p (psi); gsi_next (&psi))
ea057359 1386 if (!virtual_operand_p (gimple_phi_result (gsi_stmt (psi))))
6938f93f
JH
1387 break;
1388
1389 /* When there is PHI, just update its value. */
3e485f62
JH
1390 if (TREE_CODE (retval) == SSA_NAME
1391 && !gsi_end_p (psi))
9e227d60 1392 add_phi_arg (gsi_stmt (psi), retval, e, UNKNOWN_LOCATION);
6938f93f
JH
1393 /* Otherwise update the return BB itself.
1394 find_return_bb allows at most one assignment to return value,
1395 so update first statement. */
1396 else
3e485f62 1397 {
2094f1fc
JH
1398 gimple_stmt_iterator bsi;
1399 for (bsi = gsi_start_bb (return_bb); !gsi_end_p (bsi);
1400 gsi_next (&bsi))
1401 if (gimple_code (gsi_stmt (bsi)) == GIMPLE_RETURN)
1402 {
1403 gimple_return_set_retval (gsi_stmt (bsi), retval);
1404 break;
1405 }
2e216592
JJ
1406 else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN
1407 && !gimple_clobber_p (gsi_stmt (bsi)))
2094f1fc
JH
1408 {
1409 gimple_assign_set_rhs1 (gsi_stmt (bsi), retval);
1410 break;
1411 }
1412 update_stmt (gsi_stmt (bsi));
3e485f62
JH
1413 }
1414 }
556e9ba0 1415 if (DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
42b05b6e
RG
1416 {
1417 gimple_call_set_lhs (call, build_simple_mem_ref (retval));
1418 gsi_insert_after (&gsi, call, GSI_NEW_STMT);
1419 }
556e9ba0 1420 else
42b05b6e
RG
1421 {
1422 tree restype;
1423 restype = TREE_TYPE (DECL_RESULT (current_function_decl));
1424 gsi_insert_after (&gsi, call, GSI_NEW_STMT);
1425 if (!useless_type_conversion_p (TREE_TYPE (retval), restype))
1426 {
1427 gimple cpy;
1428 tree tem = create_tmp_reg (restype, NULL);
1429 tem = make_ssa_name (tem, call);
1430 cpy = gimple_build_assign_with_ops (NOP_EXPR, retval,
1431 tem, NULL_TREE);
1432 gsi_insert_after (&gsi, cpy, GSI_NEW_STMT);
1433 retval = tem;
1434 }
1435 gimple_call_set_lhs (call, retval);
1436 update_stmt (call);
1437 }
3e485f62 1438 }
42b05b6e
RG
1439 else
1440 gsi_insert_after (&gsi, call, GSI_NEW_STMT);
3e485f62 1441 }
6938f93f
JH
1442 /* We don't use return block (there is either no return in function or
1443 multiple of them). So create new basic block with return statement.
1444 */
3e485f62
JH
1445 else
1446 {
1447 gimple ret;
241a2b9e
JH
1448 if (split_point->split_part_set_retval
1449 && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl))))
3e485f62 1450 {
4021f4a1 1451 retval = DECL_RESULT (current_function_decl);
8a9c1ae6
JH
1452
1453 /* We use temporary register to hold value when aggregate_value_p
1454 is false. Similarly for DECL_BY_REFERENCE we must avoid extra
1455 copy. */
1456 if (!aggregate_value_p (retval, TREE_TYPE (current_function_decl))
1457 && !DECL_BY_REFERENCE (retval))
1458 retval = create_tmp_reg (TREE_TYPE (retval), NULL);
3e485f62 1459 if (is_gimple_reg (retval))
6938f93f
JH
1460 {
1461 /* When returning by reference, there is only one SSA name
1462 assigned to RESULT_DECL (that is pointer to return value).
1463 Look it up or create new one if it is missing. */
1464 if (DECL_BY_REFERENCE (retval))
32244553 1465 retval = get_or_create_ssa_default_def (cfun, retval);
6938f93f
JH
1466 /* Otherwise produce new SSA name for return value. */
1467 else
1468 retval = make_ssa_name (retval, call);
1469 }
556e9ba0
JH
1470 if (DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
1471 gimple_call_set_lhs (call, build_simple_mem_ref (retval));
1472 else
1473 gimple_call_set_lhs (call, retval);
3e485f62
JH
1474 }
1475 gsi_insert_after (&gsi, call, GSI_NEW_STMT);
1476 ret = gimple_build_return (retval);
1477 gsi_insert_after (&gsi, ret, GSI_NEW_STMT);
1478 }
1479 }
1480 free_dominance_info (CDI_DOMINATORS);
1481 free_dominance_info (CDI_POST_DOMINATORS);
632b4f8e 1482 compute_inline_parameters (node, true);
3e485f62
JH
1483}
1484
1485/* Execute function splitting pass. */
1486
1487static unsigned int
1488execute_split_functions (void)
1489{
1490 gimple_stmt_iterator bsi;
1491 basic_block bb;
1492 int overall_time = 0, overall_size = 0;
1493 int todo = 0;
581985d7 1494 struct cgraph_node *node = cgraph_get_node (current_function_decl);
3e485f62 1495
b2d2adc6
RG
1496 if (flags_from_decl_or_type (current_function_decl)
1497 & (ECF_NORETURN|ECF_MALLOC))
3e485f62
JH
1498 {
1499 if (dump_file)
b2d2adc6 1500 fprintf (dump_file, "Not splitting: noreturn/malloc function.\n");
3e485f62
JH
1501 return 0;
1502 }
1503 if (MAIN_NAME_P (DECL_NAME (current_function_decl)))
1504 {
1505 if (dump_file)
1506 fprintf (dump_file, "Not splitting: main function.\n");
1507 return 0;
1508 }
1509 /* This can be relaxed; function might become inlinable after splitting
1510 away the uninlinable part. */
9771b263
DN
1511 if (inline_edge_summary_vec.exists ()
1512 && !inline_summary (node)->inlinable)
3e485f62
JH
1513 {
1514 if (dump_file)
1515 fprintf (dump_file, "Not splitting: not inlinable.\n");
1516 return 0;
1517 }
960bfb69 1518 if (DECL_DISREGARD_INLINE_LIMITS (node->symbol.decl))
3e485f62
JH
1519 {
1520 if (dump_file)
ed7656f6 1521 fprintf (dump_file, "Not splitting: disregarding inline limits.\n");
3e485f62
JH
1522 return 0;
1523 }
1524 /* This can be relaxed; most of versioning tests actually prevents
1525 a duplication. */
1526 if (!tree_versionable_function_p (current_function_decl))
1527 {
1528 if (dump_file)
1529 fprintf (dump_file, "Not splitting: not versionable.\n");
1530 return 0;
1531 }
1532 /* FIXME: we could support this. */
1533 if (DECL_STRUCT_FUNCTION (current_function_decl)->static_chain_decl)
1534 {
1535 if (dump_file)
1536 fprintf (dump_file, "Not splitting: nested function.\n");
1537 return 0;
1538 }
3e485f62
JH
1539
1540 /* See if it makes sense to try to split.
1541 It makes sense to split if we inline, that is if we have direct calls to
1542 handle or direct calls are possibly going to appear as result of indirect
cf9712cc
JH
1543 inlining or LTO. Also handle -fprofile-generate as LTO to allow non-LTO
1544 training for LTO -fprofile-use build.
1545
3e485f62
JH
1546 Note that we are not completely conservative about disqualifying functions
1547 called once. It is possible that the caller is called more then once and
1548 then inlining would still benefit. */
c91061e6
JH
1549 if ((!node->callers
1550 /* Local functions called once will be completely inlined most of time. */
1551 || (!node->callers->next_caller && node->local.local))
960bfb69
JH
1552 && !node->symbol.address_taken
1553 && (!flag_lto || !node->symbol.externally_visible))
3e485f62
JH
1554 {
1555 if (dump_file)
1556 fprintf (dump_file, "Not splitting: not called directly "
1557 "or called once.\n");
1558 return 0;
1559 }
1560
1561 /* FIXME: We can actually split if splitting reduces call overhead. */
1562 if (!flag_inline_small_functions
1563 && !DECL_DECLARED_INLINE_P (current_function_decl))
1564 {
1565 if (dump_file)
1566 fprintf (dump_file, "Not splitting: not autoinlining and function"
1567 " is not inline.\n");
1568 return 0;
1569 }
1570
e70670cf
JH
1571 /* We enforce splitting after loop headers when profile info is not
1572 available. */
1573 if (profile_status != PROFILE_READ)
1574 mark_dfs_back_edges ();
1575
b2e25729
BS
1576 /* Initialize bitmap to track forbidden calls. */
1577 forbidden_dominators = BITMAP_ALLOC (NULL);
1578 calculate_dominance_info (CDI_DOMINATORS);
1579
3e485f62 1580 /* Compute local info about basic blocks and determine function size/time. */
9771b263 1581 bb_info_vec.safe_grow_cleared (last_basic_block + 1);
3e485f62
JH
1582 memset (&best_split_point, 0, sizeof (best_split_point));
1583 FOR_EACH_BB (bb)
1584 {
1585 int time = 0;
1586 int size = 0;
1587 int freq = compute_call_stmt_bb_frequency (current_function_decl, bb);
1588
1589 if (dump_file && (dump_flags & TDF_DETAILS))
1590 fprintf (dump_file, "Basic block %i\n", bb->index);
1591
1592 for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
1593 {
1594 int this_time, this_size;
1595 gimple stmt = gsi_stmt (bsi);
1596
1597 this_size = estimate_num_insns (stmt, &eni_size_weights);
1598 this_time = estimate_num_insns (stmt, &eni_time_weights) * freq;
1599 size += this_size;
1600 time += this_time;
b2e25729 1601 check_forbidden_calls (stmt);
3e485f62
JH
1602
1603 if (dump_file && (dump_flags & TDF_DETAILS))
1604 {
1605 fprintf (dump_file, " freq:%6i size:%3i time:%3i ",
1606 freq, this_size, this_time);
1607 print_gimple_stmt (dump_file, stmt, 0, 0);
1608 }
1609 }
1610 overall_time += time;
1611 overall_size += size;
9771b263
DN
1612 bb_info_vec[bb->index].time = time;
1613 bb_info_vec[bb->index].size = size;
3e485f62
JH
1614 }
1615 find_split_points (overall_time, overall_size);
1616 if (best_split_point.split_bbs)
1617 {
1618 split_function (&best_split_point);
1619 BITMAP_FREE (best_split_point.ssa_names_to_pass);
1620 BITMAP_FREE (best_split_point.split_bbs);
1621 todo = TODO_update_ssa | TODO_cleanup_cfg;
1622 }
b2e25729 1623 BITMAP_FREE (forbidden_dominators);
9771b263 1624 bb_info_vec.release ();
3e485f62
JH
1625 return todo;
1626}
1627
cf9712cc
JH
1628/* Gate function splitting pass. When doing profile feedback, we want
1629 to execute the pass after profiling is read. So disable one in
1630 early optimization. */
1631
3e485f62
JH
1632static bool
1633gate_split_functions (void)
1634{
cf9712cc
JH
1635 return (flag_partial_inlining
1636 && !profile_arc_flag && !flag_branch_probabilities);
3e485f62
JH
1637}
1638
27a4cd48
DM
1639namespace {
1640
1641const pass_data pass_data_split_functions =
3e485f62 1642{
27a4cd48
DM
1643 GIMPLE_PASS, /* type */
1644 "fnsplit", /* name */
1645 OPTGROUP_NONE, /* optinfo_flags */
1646 true, /* has_gate */
1647 true, /* has_execute */
1648 TV_IPA_FNSPLIT, /* tv_id */
1649 PROP_cfg, /* properties_required */
1650 0, /* properties_provided */
1651 0, /* properties_destroyed */
1652 0, /* todo_flags_start */
1653 TODO_verify_all, /* todo_flags_finish */
3e485f62 1654};
cf9712cc 1655
27a4cd48
DM
1656class pass_split_functions : public gimple_opt_pass
1657{
1658public:
c3284718
RS
1659 pass_split_functions (gcc::context *ctxt)
1660 : gimple_opt_pass (pass_data_split_functions, ctxt)
27a4cd48
DM
1661 {}
1662
1663 /* opt_pass methods: */
1664 bool gate () { return gate_split_functions (); }
1665 unsigned int execute () { return execute_split_functions (); }
1666
1667}; // class pass_split_functions
1668
1669} // anon namespace
1670
1671gimple_opt_pass *
1672make_pass_split_functions (gcc::context *ctxt)
1673{
1674 return new pass_split_functions (ctxt);
1675}
1676
cf9712cc
JH
1677/* Gate feedback driven function splitting pass.
1678 We don't need to split when profiling at all, we are producing
1679 lousy code anyway. */
1680
1681static bool
1682gate_feedback_split_functions (void)
1683{
1684 return (flag_partial_inlining
1685 && flag_branch_probabilities);
1686}
1687
1688/* Execute function splitting pass. */
1689
1690static unsigned int
1691execute_feedback_split_functions (void)
1692{
1693 unsigned int retval = execute_split_functions ();
1694 if (retval)
1695 retval |= TODO_rebuild_cgraph_edges;
1696 return retval;
1697}
1698
27a4cd48
DM
1699namespace {
1700
1701const pass_data pass_data_feedback_split_functions =
cf9712cc 1702{
27a4cd48
DM
1703 GIMPLE_PASS, /* type */
1704 "feedback_fnsplit", /* name */
1705 OPTGROUP_NONE, /* optinfo_flags */
1706 true, /* has_gate */
1707 true, /* has_execute */
1708 TV_IPA_FNSPLIT, /* tv_id */
1709 PROP_cfg, /* properties_required */
1710 0, /* properties_provided */
1711 0, /* properties_destroyed */
1712 0, /* todo_flags_start */
1713 TODO_verify_all, /* todo_flags_finish */
cf9712cc 1714};
27a4cd48
DM
1715
1716class pass_feedback_split_functions : public gimple_opt_pass
1717{
1718public:
c3284718
RS
1719 pass_feedback_split_functions (gcc::context *ctxt)
1720 : gimple_opt_pass (pass_data_feedback_split_functions, ctxt)
27a4cd48
DM
1721 {}
1722
1723 /* opt_pass methods: */
1724 bool gate () { return gate_feedback_split_functions (); }
1725 unsigned int execute () { return execute_feedback_split_functions (); }
1726
1727}; // class pass_feedback_split_functions
1728
1729} // anon namespace
1730
1731gimple_opt_pass *
1732make_pass_feedback_split_functions (gcc::context *ctxt)
1733{
1734 return new pass_feedback_split_functions (ctxt);
1735}