1 /* Control flow graph manipulation code for GNU compiler.
2 Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 /* This file contains low level functions to manipulate the CFG and analyze it
23 that are aware of the RTL intermediate language.
25 Available functionality:
26 - Basic CFG/RTL manipulation API documented in cfghooks.h
27 - CFG-aware instruction chain manipulation
28 delete_insn, delete_insn_chain
29 - Edge splitting and committing to edges
30 insert_insn_on_edge, commit_edge_insertions
31 - CFG updating after insn simplification
32 purge_dead_edges, purge_all_dead_edges
33 - CFG fixing after coarse manipulation
36 Functions not supposed for generic use:
37 - Infrastructure to determine quickly basic block for insn
38 compute_bb_for_insn, update_bb_for_insn, set_block_for_insn,
39 - Edge redirection with updating and optimizing of insn chain
40 block_label, tidy_fallthru_edge, force_nonfallthru */
44 #include "coretypes.h"
47 #include "hard-reg-set.h"
48 #include "basic-block.h"
54 #include "rtl-error.h"
57 #include "insn-attr.h"
58 #include "insn-config.h"
59 #include "cfglayout.h"
64 #include "tree-pass.h"
67 static int can_delete_note_p (const_rtx
);
68 static int can_delete_label_p (const_rtx
);
69 static basic_block
rtl_split_edge (edge
);
70 static bool rtl_move_block_after (basic_block
, basic_block
);
71 static int rtl_verify_flow_info (void);
72 static basic_block
cfg_layout_split_block (basic_block
, void *);
73 static edge
cfg_layout_redirect_edge_and_branch (edge
, basic_block
);
74 static basic_block
cfg_layout_redirect_edge_and_branch_force (edge
, basic_block
);
75 static void cfg_layout_delete_block (basic_block
);
76 static void rtl_delete_block (basic_block
);
77 static basic_block
rtl_redirect_edge_and_branch_force (edge
, basic_block
);
78 static edge
rtl_redirect_edge_and_branch (edge
, basic_block
);
79 static basic_block
rtl_split_block (basic_block
, void *);
80 static void rtl_dump_bb (basic_block
, FILE *, int, int);
81 static int rtl_verify_flow_info_1 (void);
82 static void rtl_make_forwarder_block (edge
);
84 /* Return true if NOTE is not one of the ones that must be kept paired,
85 so that we may simply delete it. */
88 can_delete_note_p (const_rtx note
)
90 switch (NOTE_KIND (note
))
92 case NOTE_INSN_DELETED
:
93 case NOTE_INSN_BASIC_BLOCK
:
94 case NOTE_INSN_EPILOGUE_BEG
:
102 /* True if a given label can be deleted. */
105 can_delete_label_p (const_rtx label
)
107 return (!LABEL_PRESERVE_P (label
)
108 /* User declared labels must be preserved. */
109 && LABEL_NAME (label
) == 0
110 && !in_expr_list_p (forced_labels
, label
));
113 /* Delete INSN by patching it out. Return the next insn. */
116 delete_insn (rtx insn
)
118 rtx next
= NEXT_INSN (insn
);
120 bool really_delete
= true;
124 /* Some labels can't be directly removed from the INSN chain, as they
125 might be references via variables, constant pool etc.
126 Convert them to the special NOTE_INSN_DELETED_LABEL note. */
127 if (! can_delete_label_p (insn
))
129 const char *name
= LABEL_NAME (insn
);
131 really_delete
= false;
132 PUT_CODE (insn
, NOTE
);
133 NOTE_KIND (insn
) = NOTE_INSN_DELETED_LABEL
;
134 NOTE_DELETED_LABEL_NAME (insn
) = name
;
137 remove_node_from_expr_list (insn
, &nonlocal_goto_handler_labels
);
142 /* If this insn has already been deleted, something is very wrong. */
143 gcc_assert (!INSN_DELETED_P (insn
));
145 INSN_DELETED_P (insn
) = 1;
148 /* If deleting a jump, decrement the use count of the label. Deleting
149 the label itself should happen in the normal course of block merging. */
152 if (JUMP_LABEL (insn
)
153 && LABEL_P (JUMP_LABEL (insn
)))
154 LABEL_NUSES (JUMP_LABEL (insn
))--;
156 /* If there are more targets, remove them too. */
158 = find_reg_note (insn
, REG_LABEL_TARGET
, NULL_RTX
)) != NULL_RTX
159 && LABEL_P (XEXP (note
, 0)))
161 LABEL_NUSES (XEXP (note
, 0))--;
162 remove_note (insn
, note
);
166 /* Also if deleting any insn that references a label as an operand. */
167 while ((note
= find_reg_note (insn
, REG_LABEL_OPERAND
, NULL_RTX
)) != NULL_RTX
168 && LABEL_P (XEXP (note
, 0)))
170 LABEL_NUSES (XEXP (note
, 0))--;
171 remove_note (insn
, note
);
174 if (JUMP_TABLE_DATA_P (insn
))
176 rtx pat
= PATTERN (insn
);
177 int diff_vec_p
= GET_CODE (PATTERN (insn
)) == ADDR_DIFF_VEC
;
178 int len
= XVECLEN (pat
, diff_vec_p
);
181 for (i
= 0; i
< len
; i
++)
183 rtx label
= XEXP (XVECEXP (pat
, diff_vec_p
, i
), 0);
185 /* When deleting code in bulk (e.g. removing many unreachable
186 blocks) we can delete a label that's a target of the vector
187 before deleting the vector itself. */
189 LABEL_NUSES (label
)--;
196 /* Like delete_insn but also purge dead edges from BB. */
199 delete_insn_and_edges (rtx insn
)
205 && BLOCK_FOR_INSN (insn
)
206 && BB_END (BLOCK_FOR_INSN (insn
)) == insn
)
208 x
= delete_insn (insn
);
210 purge_dead_edges (BLOCK_FOR_INSN (insn
));
214 /* Unlink a chain of insns between START and FINISH, leaving notes
215 that must be paired. If CLEAR_BB is true, we set bb field for
216 insns that cannot be removed to NULL. */
219 delete_insn_chain (rtx start
, rtx finish
, bool clear_bb
)
223 /* Unchain the insns one by one. It would be quicker to delete all of these
224 with a single unchaining, rather than one at a time, but we need to keep
228 next
= NEXT_INSN (start
);
229 if (NOTE_P (start
) && !can_delete_note_p (start
))
232 next
= delete_insn (start
);
234 if (clear_bb
&& !INSN_DELETED_P (start
))
235 set_block_for_insn (start
, NULL
);
243 /* Create a new basic block consisting of the instructions between HEAD and END
244 inclusive. This function is designed to allow fast BB construction - reuses
245 the note and basic block struct in BB_NOTE, if any and do not grow
246 BASIC_BLOCK chain and should be used directly only by CFG construction code.
247 END can be NULL in to create new empty basic block before HEAD. Both END
248 and HEAD can be NULL to create basic block at the end of INSN chain.
249 AFTER is the basic block we should be put after. */
252 create_basic_block_structure (rtx head
, rtx end
, rtx bb_note
, basic_block after
)
257 && (bb
= NOTE_BASIC_BLOCK (bb_note
)) != NULL
260 /* If we found an existing note, thread it back onto the chain. */
268 after
= PREV_INSN (head
);
272 if (after
!= bb_note
&& NEXT_INSN (after
) != bb_note
)
273 reorder_insns_nobb (bb_note
, bb_note
, after
);
277 /* Otherwise we must create a note and a basic block structure. */
281 init_rtl_bb_info (bb
);
284 = emit_note_after (NOTE_INSN_BASIC_BLOCK
, get_last_insn ());
285 else if (LABEL_P (head
) && end
)
287 bb_note
= emit_note_after (NOTE_INSN_BASIC_BLOCK
, head
);
293 bb_note
= emit_note_before (NOTE_INSN_BASIC_BLOCK
, head
);
299 NOTE_BASIC_BLOCK (bb_note
) = bb
;
302 /* Always include the bb note in the block. */
303 if (NEXT_INSN (end
) == bb_note
)
308 bb
->index
= last_basic_block
++;
309 bb
->flags
= BB_NEW
| BB_RTL
;
310 link_block (bb
, after
);
311 SET_BASIC_BLOCK (bb
->index
, bb
);
312 df_bb_refs_record (bb
->index
, false);
313 update_bb_for_insn (bb
);
314 BB_SET_PARTITION (bb
, BB_UNPARTITIONED
);
316 /* Tag the block so that we know it has been used when considering
317 other basic block notes. */
323 /* Create new basic block consisting of instructions in between HEAD and END
324 and place it to the BB chain after block AFTER. END can be NULL in to
325 create new empty basic block before HEAD. Both END and HEAD can be NULL to
326 create basic block at the end of INSN chain. */
329 rtl_create_basic_block (void *headp
, void *endp
, basic_block after
)
331 rtx head
= (rtx
) headp
, end
= (rtx
) endp
;
334 /* Grow the basic block array if needed. */
335 if ((size_t) last_basic_block
>= VEC_length (basic_block
, basic_block_info
))
337 size_t new_size
= last_basic_block
+ (last_basic_block
+ 3) / 4;
338 VEC_safe_grow_cleared (basic_block
, gc
, basic_block_info
, new_size
);
343 bb
= create_basic_block_structure (head
, end
, NULL
, after
);
349 cfg_layout_create_basic_block (void *head
, void *end
, basic_block after
)
351 basic_block newbb
= rtl_create_basic_block (head
, end
, after
);
356 /* Delete the insns in a (non-live) block. We physically delete every
357 non-deleted-note insn, and update the flow graph appropriately.
359 Return nonzero if we deleted an exception handler. */
361 /* ??? Preserving all such notes strikes me as wrong. It would be nice
362 to post-process the stream to remove empty blocks, loops, ranges, etc. */
365 rtl_delete_block (basic_block b
)
369 /* If the head of this block is a CODE_LABEL, then it might be the
370 label for an exception handler which can't be reached. We need
371 to remove the label from the exception_handler_label list. */
374 end
= get_last_bb_insn (b
);
376 /* Selectively delete the entire chain. */
378 delete_insn_chain (insn
, end
, true);
382 fprintf (dump_file
, "deleting block %d\n", b
->index
);
383 df_bb_delete (b
->index
);
386 /* Records the basic block struct in BLOCK_FOR_INSN for every insn. */
389 compute_bb_for_insn (void)
395 rtx end
= BB_END (bb
);
398 for (insn
= BB_HEAD (bb
); ; insn
= NEXT_INSN (insn
))
400 BLOCK_FOR_INSN (insn
) = bb
;
407 /* Release the basic_block_for_insn array. */
410 free_bb_for_insn (void)
413 for (insn
= get_insns (); insn
; insn
= NEXT_INSN (insn
))
414 if (!BARRIER_P (insn
))
415 BLOCK_FOR_INSN (insn
) = NULL
;
420 rest_of_pass_free_cfg (void)
423 /* The resource.c machinery uses DF but the CFG isn't guaranteed to be
424 valid at that point so it would be too late to call df_analyze. */
425 if (optimize
> 0 && flag_delayed_branch
)
427 df_note_add_problem ();
436 struct rtl_opt_pass pass_free_cfg
=
440 "*free_cfg", /* name */
442 rest_of_pass_free_cfg
, /* execute */
445 0, /* static_pass_number */
447 0, /* properties_required */
448 0, /* properties_provided */
449 PROP_cfg
, /* properties_destroyed */
450 0, /* todo_flags_start */
451 0, /* todo_flags_finish */
455 /* Return RTX to emit after when we want to emit code on the entry of function. */
457 entry_of_function (void)
459 return (n_basic_blocks
> NUM_FIXED_BLOCKS
?
460 BB_HEAD (ENTRY_BLOCK_PTR
->next_bb
) : get_insns ());
463 /* Emit INSN at the entry point of the function, ensuring that it is only
464 executed once per function. */
466 emit_insn_at_entry (rtx insn
)
468 edge_iterator ei
= ei_start (ENTRY_BLOCK_PTR
->succs
);
469 edge e
= ei_safe_edge (ei
);
470 gcc_assert (e
->flags
& EDGE_FALLTHRU
);
472 insert_insn_on_edge (insn
, e
);
473 commit_edge_insertions ();
476 /* Update BLOCK_FOR_INSN of insns between BEGIN and END
477 (or BARRIER if found) and notify df of the bb change.
478 The insn chain range is inclusive
479 (i.e. both BEGIN and END will be updated. */
482 update_bb_for_insn_chain (rtx begin
, rtx end
, basic_block bb
)
486 end
= NEXT_INSN (end
);
487 for (insn
= begin
; insn
!= end
; insn
= NEXT_INSN (insn
))
488 if (!BARRIER_P (insn
))
489 df_insn_change_bb (insn
, bb
);
492 /* Update BLOCK_FOR_INSN of insns in BB to BB,
493 and notify df of the change. */
496 update_bb_for_insn (basic_block bb
)
498 update_bb_for_insn_chain (BB_HEAD (bb
), BB_END (bb
), bb
);
502 /* Return the INSN immediately following the NOTE_INSN_BASIC_BLOCK
503 note associated with the BLOCK. */
506 first_insn_after_basic_block_note (basic_block block
)
510 /* Get the first instruction in the block. */
511 insn
= BB_HEAD (block
);
513 if (insn
== NULL_RTX
)
516 insn
= NEXT_INSN (insn
);
517 gcc_assert (NOTE_INSN_BASIC_BLOCK_P (insn
));
519 return NEXT_INSN (insn
);
522 /* Creates a new basic block just after basic block B by splitting
523 everything after specified instruction I. */
526 rtl_split_block (basic_block bb
, void *insnp
)
529 rtx insn
= (rtx
) insnp
;
535 insn
= first_insn_after_basic_block_note (bb
);
541 insn
= PREV_INSN (insn
);
543 /* If the block contains only debug insns, insn would have
544 been NULL in a non-debug compilation, and then we'd end
545 up emitting a DELETED note. For -fcompare-debug
546 stability, emit the note too. */
547 if (insn
!= BB_END (bb
)
548 && DEBUG_INSN_P (next
)
549 && DEBUG_INSN_P (BB_END (bb
)))
551 while (next
!= BB_END (bb
) && DEBUG_INSN_P (next
))
552 next
= NEXT_INSN (next
);
554 if (next
== BB_END (bb
))
555 emit_note_after (NOTE_INSN_DELETED
, next
);
559 insn
= get_last_insn ();
562 /* We probably should check type of the insn so that we do not create
563 inconsistent cfg. It is checked in verify_flow_info anyway, so do not
565 if (insn
== BB_END (bb
))
566 emit_note_after (NOTE_INSN_DELETED
, insn
);
568 /* Create the new basic block. */
569 new_bb
= create_basic_block (NEXT_INSN (insn
), BB_END (bb
), bb
);
570 BB_COPY_PARTITION (new_bb
, bb
);
573 /* Redirect the outgoing edges. */
574 new_bb
->succs
= bb
->succs
;
576 FOR_EACH_EDGE (e
, ei
, new_bb
->succs
)
579 /* The new block starts off being dirty. */
580 df_set_bb_dirty (bb
);
584 /* Blocks A and B are to be merged into a single block A. The insns
585 are already contiguous. */
588 rtl_merge_blocks (basic_block a
, basic_block b
)
590 rtx b_head
= BB_HEAD (b
), b_end
= BB_END (b
), a_end
= BB_END (a
);
591 rtx del_first
= NULL_RTX
, del_last
= NULL_RTX
;
592 rtx b_debug_start
= b_end
, b_debug_end
= b_end
;
593 bool forwarder_p
= (b
->flags
& BB_FORWARDER_BLOCK
) != 0;
597 fprintf (dump_file
, "Merging block %d into block %d...\n", b
->index
,
600 while (DEBUG_INSN_P (b_end
))
601 b_end
= PREV_INSN (b_debug_start
= b_end
);
603 /* If there was a CODE_LABEL beginning B, delete it. */
604 if (LABEL_P (b_head
))
606 /* Detect basic blocks with nothing but a label. This can happen
607 in particular at the end of a function. */
611 del_first
= del_last
= b_head
;
612 b_head
= NEXT_INSN (b_head
);
615 /* Delete the basic block note and handle blocks containing just that
617 if (NOTE_INSN_BASIC_BLOCK_P (b_head
))
625 b_head
= NEXT_INSN (b_head
);
628 /* If there was a jump out of A, delete it. */
633 for (prev
= PREV_INSN (a_end
); ; prev
= PREV_INSN (prev
))
635 || NOTE_INSN_BASIC_BLOCK_P (prev
)
636 || prev
== BB_HEAD (a
))
642 /* If this was a conditional jump, we need to also delete
643 the insn that set cc0. */
644 if (only_sets_cc0_p (prev
))
648 prev
= prev_nonnote_insn (prev
);
655 a_end
= PREV_INSN (del_first
);
657 else if (BARRIER_P (NEXT_INSN (a_end
)))
658 del_first
= NEXT_INSN (a_end
);
660 /* Delete everything marked above as well as crap that might be
661 hanging out between the two blocks. */
663 delete_insn_chain (del_first
, del_last
, true);
665 /* Reassociate the insns of B with A. */
668 update_bb_for_insn_chain (a_end
, b_debug_end
, a
);
672 else if (b_end
!= b_debug_end
)
674 /* Move any deleted labels and other notes between the end of A
675 and the debug insns that make up B after the debug insns,
676 bringing the debug insns into A while keeping the notes after
678 if (NEXT_INSN (a_end
) != b_debug_start
)
679 reorder_insns_nobb (NEXT_INSN (a_end
), PREV_INSN (b_debug_start
),
681 update_bb_for_insn_chain (b_debug_start
, b_debug_end
, a
);
685 df_bb_delete (b
->index
);
688 /* If B was a forwarder block, propagate the locus on the edge. */
689 if (forwarder_p
&& !EDGE_SUCC (b
, 0)->goto_locus
)
690 EDGE_SUCC (b
, 0)->goto_locus
= EDGE_SUCC (a
, 0)->goto_locus
;
693 fprintf (dump_file
, "Merged blocks %d and %d.\n", a
->index
, b
->index
);
697 /* Return true when block A and B can be merged. */
700 rtl_can_merge_blocks (basic_block a
, basic_block b
)
702 /* If we are partitioning hot/cold basic blocks, we don't want to
703 mess up unconditional or indirect jumps that cross between hot
706 Basic block partitioning may result in some jumps that appear to
707 be optimizable (or blocks that appear to be mergeable), but which really
708 must be left untouched (they are required to make it safely across
709 partition boundaries). See the comments at the top of
710 bb-reorder.c:partition_hot_cold_basic_blocks for complete details. */
712 if (BB_PARTITION (a
) != BB_PARTITION (b
))
715 /* There must be exactly one edge in between the blocks. */
716 return (single_succ_p (a
)
717 && single_succ (a
) == b
720 /* Must be simple edge. */
721 && !(single_succ_edge (a
)->flags
& EDGE_COMPLEX
)
723 && a
!= ENTRY_BLOCK_PTR
&& b
!= EXIT_BLOCK_PTR
724 /* If the jump insn has side effects,
725 we can't kill the edge. */
726 && (!JUMP_P (BB_END (a
))
728 ? simplejump_p (BB_END (a
)) : onlyjump_p (BB_END (a
)))));
731 /* Return the label in the head of basic block BLOCK. Create one if it doesn't
735 block_label (basic_block block
)
737 if (block
== EXIT_BLOCK_PTR
)
740 if (!LABEL_P (BB_HEAD (block
)))
742 BB_HEAD (block
) = emit_label_before (gen_label_rtx (), BB_HEAD (block
));
745 return BB_HEAD (block
);
748 /* Attempt to perform edge redirection by replacing possibly complex jump
749 instruction by unconditional jump or removing jump completely. This can
750 apply only if all edges now point to the same block. The parameters and
751 return values are equivalent to redirect_edge_and_branch. */
754 try_redirect_by_replacing_jump (edge e
, basic_block target
, bool in_cfglayout
)
756 basic_block src
= e
->src
;
757 rtx insn
= BB_END (src
), kill_from
;
761 /* If we are partitioning hot/cold basic blocks, we don't want to
762 mess up unconditional or indirect jumps that cross between hot
765 Basic block partitioning may result in some jumps that appear to
766 be optimizable (or blocks that appear to be mergeable), but which really
767 must be left untouched (they are required to make it safely across
768 partition boundaries). See the comments at the top of
769 bb-reorder.c:partition_hot_cold_basic_blocks for complete details. */
771 if (find_reg_note (insn
, REG_CROSSING_JUMP
, NULL_RTX
)
772 || BB_PARTITION (src
) != BB_PARTITION (target
))
775 /* We can replace or remove a complex jump only when we have exactly
776 two edges. Also, if we have exactly one outgoing edge, we can
778 if (EDGE_COUNT (src
->succs
) >= 3
779 /* Verify that all targets will be TARGET. Specifically, the
780 edge that is not E must also go to TARGET. */
781 || (EDGE_COUNT (src
->succs
) == 2
782 && EDGE_SUCC (src
, EDGE_SUCC (src
, 0) == e
)->dest
!= target
))
785 if (!onlyjump_p (insn
))
787 if ((!optimize
|| reload_completed
) && tablejump_p (insn
, NULL
, NULL
))
790 /* Avoid removing branch with side effects. */
791 set
= single_set (insn
);
792 if (!set
|| side_effects_p (set
))
795 /* In case we zap a conditional jump, we'll need to kill
796 the cc0 setter too. */
799 if (reg_mentioned_p (cc0_rtx
, PATTERN (insn
))
800 && only_sets_cc0_p (PREV_INSN (insn
)))
801 kill_from
= PREV_INSN (insn
);
804 /* See if we can create the fallthru edge. */
805 if (in_cfglayout
|| can_fallthru (src
, target
))
808 fprintf (dump_file
, "Removing jump %i.\n", INSN_UID (insn
));
811 /* Selectively unlink whole insn chain. */
814 rtx insn
= src
->il
.rtl
->footer
;
816 delete_insn_chain (kill_from
, BB_END (src
), false);
818 /* Remove barriers but keep jumptables. */
821 if (BARRIER_P (insn
))
823 if (PREV_INSN (insn
))
824 NEXT_INSN (PREV_INSN (insn
)) = NEXT_INSN (insn
);
826 src
->il
.rtl
->footer
= NEXT_INSN (insn
);
827 if (NEXT_INSN (insn
))
828 PREV_INSN (NEXT_INSN (insn
)) = PREV_INSN (insn
);
832 insn
= NEXT_INSN (insn
);
836 delete_insn_chain (kill_from
, PREV_INSN (BB_HEAD (target
)),
840 /* If this already is simplejump, redirect it. */
841 else if (simplejump_p (insn
))
843 if (e
->dest
== target
)
846 fprintf (dump_file
, "Redirecting jump %i from %i to %i.\n",
847 INSN_UID (insn
), e
->dest
->index
, target
->index
);
848 if (!redirect_jump (insn
, block_label (target
), 0))
850 gcc_assert (target
== EXIT_BLOCK_PTR
);
855 /* Cannot do anything for target exit block. */
856 else if (target
== EXIT_BLOCK_PTR
)
859 /* Or replace possibly complicated jump insn by simple jump insn. */
862 rtx target_label
= block_label (target
);
863 rtx barrier
, label
, table
;
865 emit_jump_insn_after_noloc (gen_jump (target_label
), insn
);
866 JUMP_LABEL (BB_END (src
)) = target_label
;
867 LABEL_NUSES (target_label
)++;
869 fprintf (dump_file
, "Replacing insn %i by jump %i\n",
870 INSN_UID (insn
), INSN_UID (BB_END (src
)));
873 delete_insn_chain (kill_from
, insn
, false);
875 /* Recognize a tablejump that we are converting to a
876 simple jump and remove its associated CODE_LABEL
877 and ADDR_VEC or ADDR_DIFF_VEC. */
878 if (tablejump_p (insn
, &label
, &table
))
879 delete_insn_chain (label
, table
, false);
881 barrier
= next_nonnote_insn (BB_END (src
));
882 if (!barrier
|| !BARRIER_P (barrier
))
883 emit_barrier_after (BB_END (src
));
886 if (barrier
!= NEXT_INSN (BB_END (src
)))
888 /* Move the jump before barrier so that the notes
889 which originally were or were created before jump table are
890 inside the basic block. */
891 rtx new_insn
= BB_END (src
);
893 update_bb_for_insn_chain (NEXT_INSN (BB_END (src
)),
894 PREV_INSN (barrier
), src
);
896 NEXT_INSN (PREV_INSN (new_insn
)) = NEXT_INSN (new_insn
);
897 PREV_INSN (NEXT_INSN (new_insn
)) = PREV_INSN (new_insn
);
899 NEXT_INSN (new_insn
) = barrier
;
900 NEXT_INSN (PREV_INSN (barrier
)) = new_insn
;
902 PREV_INSN (new_insn
) = PREV_INSN (barrier
);
903 PREV_INSN (barrier
) = new_insn
;
908 /* Keep only one edge out and set proper flags. */
909 if (!single_succ_p (src
))
911 gcc_assert (single_succ_p (src
));
913 e
= single_succ_edge (src
);
915 e
->flags
= EDGE_FALLTHRU
;
919 e
->probability
= REG_BR_PROB_BASE
;
920 e
->count
= src
->count
;
922 if (e
->dest
!= target
)
923 redirect_edge_succ (e
, target
);
927 /* Subroutine of redirect_branch_edge that tries to patch the jump
928 instruction INSN so that it reaches block NEW. Do this
929 only when it originally reached block OLD. Return true if this
930 worked or the original target wasn't OLD, return false if redirection
934 patch_jump_insn (rtx insn
, rtx old_label
, basic_block new_bb
)
937 /* Recognize a tablejump and adjust all matching cases. */
938 if (tablejump_p (insn
, NULL
, &tmp
))
942 rtx new_label
= block_label (new_bb
);
944 if (new_bb
== EXIT_BLOCK_PTR
)
946 if (GET_CODE (PATTERN (tmp
)) == ADDR_VEC
)
947 vec
= XVEC (PATTERN (tmp
), 0);
949 vec
= XVEC (PATTERN (tmp
), 1);
951 for (j
= GET_NUM_ELEM (vec
) - 1; j
>= 0; --j
)
952 if (XEXP (RTVEC_ELT (vec
, j
), 0) == old_label
)
954 RTVEC_ELT (vec
, j
) = gen_rtx_LABEL_REF (Pmode
, new_label
);
955 --LABEL_NUSES (old_label
);
956 ++LABEL_NUSES (new_label
);
959 /* Handle casesi dispatch insns. */
960 if ((tmp
= single_set (insn
)) != NULL
961 && SET_DEST (tmp
) == pc_rtx
962 && GET_CODE (SET_SRC (tmp
)) == IF_THEN_ELSE
963 && GET_CODE (XEXP (SET_SRC (tmp
), 2)) == LABEL_REF
964 && XEXP (XEXP (SET_SRC (tmp
), 2), 0) == old_label
)
966 XEXP (SET_SRC (tmp
), 2) = gen_rtx_LABEL_REF (Pmode
,
968 --LABEL_NUSES (old_label
);
969 ++LABEL_NUSES (new_label
);
972 else if ((tmp
= extract_asm_operands (PATTERN (insn
))) != NULL
)
974 int i
, n
= ASM_OPERANDS_LABEL_LENGTH (tmp
);
977 if (new_bb
== EXIT_BLOCK_PTR
)
979 new_label
= block_label (new_bb
);
981 for (i
= 0; i
< n
; ++i
)
983 rtx old_ref
= ASM_OPERANDS_LABEL (tmp
, i
);
984 gcc_assert (GET_CODE (old_ref
) == LABEL_REF
);
985 if (XEXP (old_ref
, 0) == old_label
)
987 ASM_OPERANDS_LABEL (tmp
, i
)
988 = gen_rtx_LABEL_REF (Pmode
, new_label
);
989 --LABEL_NUSES (old_label
);
990 ++LABEL_NUSES (new_label
);
994 if (JUMP_LABEL (insn
) == old_label
)
996 JUMP_LABEL (insn
) = new_label
;
997 note
= find_reg_note (insn
, REG_LABEL_TARGET
, new_label
);
999 remove_note (insn
, note
);
1003 note
= find_reg_note (insn
, REG_LABEL_TARGET
, old_label
);
1005 remove_note (insn
, note
);
1006 if (JUMP_LABEL (insn
) != new_label
1007 && !find_reg_note (insn
, REG_LABEL_TARGET
, new_label
))
1008 add_reg_note (insn
, REG_LABEL_TARGET
, new_label
);
1010 while ((note
= find_reg_note (insn
, REG_LABEL_OPERAND
, old_label
))
1012 XEXP (note
, 0) = new_label
;
1016 /* ?? We may play the games with moving the named labels from
1017 one basic block to the other in case only one computed_jump is
1019 if (computed_jump_p (insn
)
1020 /* A return instruction can't be redirected. */
1021 || returnjump_p (insn
))
1024 if (!currently_expanding_to_rtl
|| JUMP_LABEL (insn
) == old_label
)
1026 /* If the insn doesn't go where we think, we're confused. */
1027 gcc_assert (JUMP_LABEL (insn
) == old_label
);
1029 /* If the substitution doesn't succeed, die. This can happen
1030 if the back end emitted unrecognizable instructions or if
1031 target is exit block on some arches. */
1032 if (!redirect_jump (insn
, block_label (new_bb
), 0))
1034 gcc_assert (new_bb
== EXIT_BLOCK_PTR
);
1043 /* Redirect edge representing branch of (un)conditional jump or tablejump,
1046 redirect_branch_edge (edge e
, basic_block target
)
1048 rtx old_label
= BB_HEAD (e
->dest
);
1049 basic_block src
= e
->src
;
1050 rtx insn
= BB_END (src
);
1052 /* We can only redirect non-fallthru edges of jump insn. */
1053 if (e
->flags
& EDGE_FALLTHRU
)
1055 else if (!JUMP_P (insn
) && !currently_expanding_to_rtl
)
1058 if (!currently_expanding_to_rtl
)
1060 if (!patch_jump_insn (insn
, old_label
, target
))
1064 /* When expanding this BB might actually contain multiple
1065 jumps (i.e. not yet split by find_many_sub_basic_blocks).
1066 Redirect all of those that match our label. */
1067 FOR_BB_INSNS (src
, insn
)
1068 if (JUMP_P (insn
) && !patch_jump_insn (insn
, old_label
, target
))
1072 fprintf (dump_file
, "Edge %i->%i redirected to %i\n",
1073 e
->src
->index
, e
->dest
->index
, target
->index
);
1075 if (e
->dest
!= target
)
1076 e
= redirect_edge_succ_nodup (e
, target
);
1081 /* Attempt to change code to redirect edge E to TARGET. Don't do that on
1082 expense of adding new instructions or reordering basic blocks.
1084 Function can be also called with edge destination equivalent to the TARGET.
1085 Then it should try the simplifications and do nothing if none is possible.
1087 Return edge representing the branch if transformation succeeded. Return NULL
1089 We still return NULL in case E already destinated TARGET and we didn't
1090 managed to simplify instruction stream. */
1093 rtl_redirect_edge_and_branch (edge e
, basic_block target
)
1096 basic_block src
= e
->src
;
1098 if (e
->flags
& (EDGE_ABNORMAL_CALL
| EDGE_EH
))
1101 if (e
->dest
== target
)
1104 if ((ret
= try_redirect_by_replacing_jump (e
, target
, false)) != NULL
)
1106 df_set_bb_dirty (src
);
1110 ret
= redirect_branch_edge (e
, target
);
1114 df_set_bb_dirty (src
);
1118 /* Like force_nonfallthru below, but additionally performs redirection
1119 Used by redirect_edge_and_branch_force. */
1122 force_nonfallthru_and_redirect (edge e
, basic_block target
)
1124 basic_block jump_block
, new_bb
= NULL
, src
= e
->src
;
1127 int abnormal_edge_flags
= 0;
1130 /* In the case the last instruction is conditional jump to the next
1131 instruction, first redirect the jump itself and then continue
1132 by creating a basic block afterwards to redirect fallthru edge. */
1133 if (e
->src
!= ENTRY_BLOCK_PTR
&& e
->dest
!= EXIT_BLOCK_PTR
1134 && any_condjump_p (BB_END (e
->src
))
1135 && JUMP_LABEL (BB_END (e
->src
)) == BB_HEAD (e
->dest
))
1138 edge b
= unchecked_make_edge (e
->src
, target
, 0);
1141 redirected
= redirect_jump (BB_END (e
->src
), block_label (target
), 0);
1142 gcc_assert (redirected
);
1144 note
= find_reg_note (BB_END (e
->src
), REG_BR_PROB
, NULL_RTX
);
1147 int prob
= INTVAL (XEXP (note
, 0));
1149 b
->probability
= prob
;
1150 b
->count
= e
->count
* prob
/ REG_BR_PROB_BASE
;
1151 e
->probability
-= e
->probability
;
1152 e
->count
-= b
->count
;
1153 if (e
->probability
< 0)
1160 if (e
->flags
& EDGE_ABNORMAL
)
1162 /* Irritating special case - fallthru edge to the same block as abnormal
1164 We can't redirect abnormal edge, but we still can split the fallthru
1165 one and create separate abnormal edge to original destination.
1166 This allows bb-reorder to make such edge non-fallthru. */
1167 gcc_assert (e
->dest
== target
);
1168 abnormal_edge_flags
= e
->flags
& ~(EDGE_FALLTHRU
| EDGE_CAN_FALLTHRU
);
1169 e
->flags
&= EDGE_FALLTHRU
| EDGE_CAN_FALLTHRU
;
1173 gcc_assert (e
->flags
& EDGE_FALLTHRU
);
1174 if (e
->src
== ENTRY_BLOCK_PTR
)
1176 /* We can't redirect the entry block. Create an empty block
1177 at the start of the function which we use to add the new
1183 basic_block bb
= create_basic_block (BB_HEAD (e
->dest
), NULL
, ENTRY_BLOCK_PTR
);
1185 /* Change the existing edge's source to be the new block, and add
1186 a new edge from the entry block to the new block. */
1188 for (ei
= ei_start (ENTRY_BLOCK_PTR
->succs
); (tmp
= ei_safe_edge (ei
)); )
1192 VEC_unordered_remove (edge
, ENTRY_BLOCK_PTR
->succs
, ei
.index
);
1202 VEC_safe_push (edge
, gc
, bb
->succs
, e
);
1203 make_single_succ_edge (ENTRY_BLOCK_PTR
, bb
, EDGE_FALLTHRU
);
1207 if (EDGE_COUNT (e
->src
->succs
) >= 2 || abnormal_edge_flags
)
1209 /* Create the new structures. */
1211 /* If the old block ended with a tablejump, skip its table
1212 by searching forward from there. Otherwise start searching
1213 forward from the last instruction of the old block. */
1214 if (!tablejump_p (BB_END (e
->src
), NULL
, ¬e
))
1215 note
= BB_END (e
->src
);
1216 note
= NEXT_INSN (note
);
1218 jump_block
= create_basic_block (note
, NULL
, e
->src
);
1219 jump_block
->count
= e
->count
;
1220 jump_block
->frequency
= EDGE_FREQUENCY (e
);
1221 jump_block
->loop_depth
= target
->loop_depth
;
1223 /* Make sure new block ends up in correct hot/cold section. */
1225 BB_COPY_PARTITION (jump_block
, e
->src
);
1226 if (flag_reorder_blocks_and_partition
1227 && targetm
.have_named_sections
1228 && JUMP_P (BB_END (jump_block
))
1229 && !any_condjump_p (BB_END (jump_block
))
1230 && (EDGE_SUCC (jump_block
, 0)->flags
& EDGE_CROSSING
))
1231 add_reg_note (BB_END (jump_block
), REG_CROSSING_JUMP
, NULL_RTX
);
1234 new_edge
= make_edge (e
->src
, jump_block
, EDGE_FALLTHRU
);
1235 new_edge
->probability
= e
->probability
;
1236 new_edge
->count
= e
->count
;
1238 /* Redirect old edge. */
1239 redirect_edge_pred (e
, jump_block
);
1240 e
->probability
= REG_BR_PROB_BASE
;
1242 new_bb
= jump_block
;
1245 jump_block
= e
->src
;
1247 if (e
->goto_locus
&& e
->goto_block
== NULL
)
1248 loc
= e
->goto_locus
;
1251 e
->flags
&= ~EDGE_FALLTHRU
;
1252 if (target
== EXIT_BLOCK_PTR
)
1255 emit_jump_insn_after_setloc (gen_return (), BB_END (jump_block
), loc
);
1262 rtx label
= block_label (target
);
1263 emit_jump_insn_after_setloc (gen_jump (label
), BB_END (jump_block
), loc
);
1264 JUMP_LABEL (BB_END (jump_block
)) = label
;
1265 LABEL_NUSES (label
)++;
1268 emit_barrier_after (BB_END (jump_block
));
1269 redirect_edge_succ_nodup (e
, target
);
1271 if (abnormal_edge_flags
)
1272 make_edge (src
, target
, abnormal_edge_flags
);
1274 df_mark_solutions_dirty ();
1278 /* Edge E is assumed to be fallthru edge. Emit needed jump instruction
1279 (and possibly create new basic block) to make edge non-fallthru.
1280 Return newly created BB or NULL if none. */
1283 force_nonfallthru (edge e
)
1285 return force_nonfallthru_and_redirect (e
, e
->dest
);
1288 /* Redirect edge even at the expense of creating new jump insn or
1289 basic block. Return new basic block if created, NULL otherwise.
1290 Conversion must be possible. */
1293 rtl_redirect_edge_and_branch_force (edge e
, basic_block target
)
1295 if (redirect_edge_and_branch (e
, target
)
1296 || e
->dest
== target
)
1299 /* In case the edge redirection failed, try to force it to be non-fallthru
1300 and redirect newly created simplejump. */
1301 df_set_bb_dirty (e
->src
);
1302 return force_nonfallthru_and_redirect (e
, target
);
1305 /* The given edge should potentially be a fallthru edge. If that is in
1306 fact true, delete the jump and barriers that are in the way. */
1309 rtl_tidy_fallthru_edge (edge e
)
1312 basic_block b
= e
->src
, c
= b
->next_bb
;
1314 /* ??? In a late-running flow pass, other folks may have deleted basic
1315 blocks by nopping out blocks, leaving multiple BARRIERs between here
1316 and the target label. They ought to be chastised and fixed.
1318 We can also wind up with a sequence of undeletable labels between
1319 one block and the next.
1321 So search through a sequence of barriers, labels, and notes for
1322 the head of block C and assert that we really do fall through. */
1324 for (q
= NEXT_INSN (BB_END (b
)); q
!= BB_HEAD (c
); q
= NEXT_INSN (q
))
1328 /* Remove what will soon cease being the jump insn from the source block.
1329 If block B consisted only of this single jump, turn it into a deleted
1334 && (any_uncondjump_p (q
)
1335 || single_succ_p (b
)))
1338 /* If this was a conditional jump, we need to also delete
1339 the insn that set cc0. */
1340 if (any_condjump_p (q
) && only_sets_cc0_p (PREV_INSN (q
)))
1347 /* Selectively unlink the sequence. */
1348 if (q
!= PREV_INSN (BB_HEAD (c
)))
1349 delete_insn_chain (NEXT_INSN (q
), PREV_INSN (BB_HEAD (c
)), false);
1351 e
->flags
|= EDGE_FALLTHRU
;
1354 /* Should move basic block BB after basic block AFTER. NIY. */
1357 rtl_move_block_after (basic_block bb ATTRIBUTE_UNUSED
,
1358 basic_block after ATTRIBUTE_UNUSED
)
1363 /* Split a (typically critical) edge. Return the new block.
1364 The edge must not be abnormal.
1366 ??? The code generally expects to be called on critical edges.
1367 The case of a block ending in an unconditional jump to a
1368 block with multiple predecessors is not handled optimally. */
1371 rtl_split_edge (edge edge_in
)
1376 /* Abnormal edges cannot be split. */
1377 gcc_assert (!(edge_in
->flags
& EDGE_ABNORMAL
));
1379 /* We are going to place the new block in front of edge destination.
1380 Avoid existence of fallthru predecessors. */
1381 if ((edge_in
->flags
& EDGE_FALLTHRU
) == 0)
1383 edge e
= find_fallthru_edge (edge_in
->dest
->preds
);
1386 force_nonfallthru (e
);
1389 /* Create the basic block note. */
1390 if (edge_in
->dest
!= EXIT_BLOCK_PTR
)
1391 before
= BB_HEAD (edge_in
->dest
);
1395 /* If this is a fall through edge to the exit block, the blocks might be
1396 not adjacent, and the right place is the after the source. */
1397 if (edge_in
->flags
& EDGE_FALLTHRU
&& edge_in
->dest
== EXIT_BLOCK_PTR
)
1399 before
= NEXT_INSN (BB_END (edge_in
->src
));
1400 bb
= create_basic_block (before
, NULL
, edge_in
->src
);
1401 BB_COPY_PARTITION (bb
, edge_in
->src
);
1405 bb
= create_basic_block (before
, NULL
, edge_in
->dest
->prev_bb
);
1406 /* ??? Why not edge_in->dest->prev_bb here? */
1407 BB_COPY_PARTITION (bb
, edge_in
->dest
);
1410 make_single_succ_edge (bb
, edge_in
->dest
, EDGE_FALLTHRU
);
1412 /* For non-fallthru edges, we must adjust the predecessor's
1413 jump instruction to target our new block. */
1414 if ((edge_in
->flags
& EDGE_FALLTHRU
) == 0)
1416 edge redirected
= redirect_edge_and_branch (edge_in
, bb
);
1417 gcc_assert (redirected
);
1421 if (edge_in
->src
!= ENTRY_BLOCK_PTR
)
1423 /* For asm goto even splitting of fallthru edge might
1424 need insn patching, as other labels might point to the
1426 rtx last
= BB_END (edge_in
->src
);
1429 && edge_in
->dest
!= EXIT_BLOCK_PTR
1430 && extract_asm_operands (PATTERN (last
)) != NULL_RTX
1431 && patch_jump_insn (last
, before
, bb
))
1432 df_set_bb_dirty (edge_in
->src
);
1434 redirect_edge_succ (edge_in
, bb
);
1440 /* Queue instructions for insertion on an edge between two basic blocks.
1441 The new instructions and basic blocks (if any) will not appear in the
1442 CFG until commit_edge_insertions is called. */
1445 insert_insn_on_edge (rtx pattern
, edge e
)
1447 /* We cannot insert instructions on an abnormal critical edge.
1448 It will be easier to find the culprit if we die now. */
1449 gcc_assert (!((e
->flags
& EDGE_ABNORMAL
) && EDGE_CRITICAL_P (e
)));
1451 if (e
->insns
.r
== NULL_RTX
)
1454 push_to_sequence (e
->insns
.r
);
1456 emit_insn (pattern
);
1458 e
->insns
.r
= get_insns ();
1462 /* Update the CFG for the instructions queued on edge E. */
1465 commit_one_edge_insertion (edge e
)
1467 rtx before
= NULL_RTX
, after
= NULL_RTX
, insns
, tmp
, last
;
1468 basic_block bb
= NULL
;
1470 /* Pull the insns off the edge now since the edge might go away. */
1472 e
->insns
.r
= NULL_RTX
;
1474 if (!before
&& !after
)
1476 /* Figure out where to put these things. If the destination has
1477 one predecessor, insert there. Except for the exit block. */
1478 if (single_pred_p (e
->dest
) && e
->dest
!= EXIT_BLOCK_PTR
)
1482 /* Get the location correct wrt a code label, and "nice" wrt
1483 a basic block note, and before everything else. */
1486 tmp
= NEXT_INSN (tmp
);
1487 if (NOTE_INSN_BASIC_BLOCK_P (tmp
))
1488 tmp
= NEXT_INSN (tmp
);
1489 if (tmp
== BB_HEAD (bb
))
1492 after
= PREV_INSN (tmp
);
1494 after
= get_last_insn ();
1497 /* If the source has one successor and the edge is not abnormal,
1498 insert there. Except for the entry block. */
1499 else if ((e
->flags
& EDGE_ABNORMAL
) == 0
1500 && single_succ_p (e
->src
)
1501 && e
->src
!= ENTRY_BLOCK_PTR
)
1505 /* It is possible to have a non-simple jump here. Consider a target
1506 where some forms of unconditional jumps clobber a register. This
1507 happens on the fr30 for example.
1509 We know this block has a single successor, so we can just emit
1510 the queued insns before the jump. */
1511 if (JUMP_P (BB_END (bb
)))
1512 before
= BB_END (bb
);
1515 /* We'd better be fallthru, or we've lost track of
1517 gcc_assert (e
->flags
& EDGE_FALLTHRU
);
1519 after
= BB_END (bb
);
1522 /* Otherwise we must split the edge. */
1525 bb
= split_edge (e
);
1526 after
= BB_END (bb
);
1528 if (flag_reorder_blocks_and_partition
1529 && targetm
.have_named_sections
1530 && e
->src
!= ENTRY_BLOCK_PTR
1531 && BB_PARTITION (e
->src
) == BB_COLD_PARTITION
1532 && !(e
->flags
& EDGE_CROSSING
)
1534 && !any_condjump_p (after
)
1535 && (single_succ_edge (bb
)->flags
& EDGE_CROSSING
))
1536 add_reg_note (after
, REG_CROSSING_JUMP
, NULL_RTX
);
1540 /* Now that we've found the spot, do the insertion. */
1544 emit_insn_before_noloc (insns
, before
, bb
);
1545 last
= prev_nonnote_insn (before
);
1548 last
= emit_insn_after_noloc (insns
, after
, bb
);
1550 if (returnjump_p (last
))
1552 /* ??? Remove all outgoing edges from BB and add one for EXIT.
1553 This is not currently a problem because this only happens
1554 for the (single) epilogue, which already has a fallthru edge
1557 e
= single_succ_edge (bb
);
1558 gcc_assert (e
->dest
== EXIT_BLOCK_PTR
1559 && single_succ_p (bb
) && (e
->flags
& EDGE_FALLTHRU
));
1561 e
->flags
&= ~EDGE_FALLTHRU
;
1562 emit_barrier_after (last
);
1565 delete_insn (before
);
1568 gcc_assert (!JUMP_P (last
));
1570 /* Mark the basic block for find_many_sub_basic_blocks. */
1571 if (current_ir_type () != IR_RTL_CFGLAYOUT
)
1575 /* Update the CFG for all queued instructions. */
1578 commit_edge_insertions (void)
1582 bool changed
= false;
1584 #ifdef ENABLE_CHECKING
1585 verify_flow_info ();
1588 FOR_BB_BETWEEN (bb
, ENTRY_BLOCK_PTR
, EXIT_BLOCK_PTR
, next_bb
)
1593 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1597 commit_one_edge_insertion (e
);
1604 /* In the old rtl CFG API, it was OK to insert control flow on an
1605 edge, apparently? In cfglayout mode, this will *not* work, and
1606 the caller is responsible for making sure that control flow is
1607 valid at all times. */
1608 if (current_ir_type () == IR_RTL_CFGLAYOUT
)
1611 blocks
= sbitmap_alloc (last_basic_block
);
1612 sbitmap_zero (blocks
);
1616 SET_BIT (blocks
, bb
->index
);
1617 /* Check for forgotten bb->aux values before commit_edge_insertions
1619 gcc_assert (bb
->aux
== &bb
->aux
);
1622 find_many_sub_basic_blocks (blocks
);
1623 sbitmap_free (blocks
);
1627 /* Print out RTL-specific basic block information (live information
1628 at start and end). */
1631 rtl_dump_bb (basic_block bb
, FILE *outf
, int indent
, int flags ATTRIBUTE_UNUSED
)
1637 s_indent
= (char *) alloca ((size_t) indent
+ 1);
1638 memset (s_indent
, ' ', (size_t) indent
);
1639 s_indent
[indent
] = '\0';
1643 df_dump_top (bb
, outf
);
1647 for (insn
= BB_HEAD (bb
), last
= NEXT_INSN (BB_END (bb
)); insn
!= last
;
1648 insn
= NEXT_INSN (insn
))
1649 print_rtl_single (outf
, insn
);
1653 df_dump_bottom (bb
, outf
);
1659 /* Like print_rtl, but also print out live information for the start of each
1663 print_rtl_with_bb (FILE *outf
, const_rtx rtx_first
)
1667 fprintf (outf
, "(nil)\n");
1670 enum bb_state
{ NOT_IN_BB
, IN_ONE_BB
, IN_MULTIPLE_BB
};
1671 int max_uid
= get_max_uid ();
1672 basic_block
*start
= XCNEWVEC (basic_block
, max_uid
);
1673 basic_block
*end
= XCNEWVEC (basic_block
, max_uid
);
1674 enum bb_state
*in_bb_p
= XCNEWVEC (enum bb_state
, max_uid
);
1679 df_dump_start (outf
);
1681 FOR_EACH_BB_REVERSE (bb
)
1685 start
[INSN_UID (BB_HEAD (bb
))] = bb
;
1686 end
[INSN_UID (BB_END (bb
))] = bb
;
1687 for (x
= BB_HEAD (bb
); x
!= NULL_RTX
; x
= NEXT_INSN (x
))
1689 enum bb_state state
= IN_MULTIPLE_BB
;
1691 if (in_bb_p
[INSN_UID (x
)] == NOT_IN_BB
)
1693 in_bb_p
[INSN_UID (x
)] = state
;
1695 if (x
== BB_END (bb
))
1700 for (tmp_rtx
= rtx_first
; NULL
!= tmp_rtx
; tmp_rtx
= NEXT_INSN (tmp_rtx
))
1703 if ((bb
= start
[INSN_UID (tmp_rtx
)]) != NULL
)
1708 fprintf (outf
, ";; Start of basic block (");
1709 FOR_EACH_EDGE (e
, ei
, bb
->preds
)
1710 fprintf (outf
, " %d", e
->src
->index
);
1711 fprintf (outf
, ") -> %d\n", bb
->index
);
1715 df_dump_top (bb
, outf
);
1718 FOR_EACH_EDGE (e
, ei
, bb
->preds
)
1720 fputs (";; Pred edge ", outf
);
1721 dump_edge_info (outf
, e
, 0);
1726 if (in_bb_p
[INSN_UID (tmp_rtx
)] == NOT_IN_BB
1727 && !NOTE_P (tmp_rtx
)
1728 && !BARRIER_P (tmp_rtx
))
1729 fprintf (outf
, ";; Insn is not within a basic block\n");
1730 else if (in_bb_p
[INSN_UID (tmp_rtx
)] == IN_MULTIPLE_BB
)
1731 fprintf (outf
, ";; Insn is in multiple basic blocks\n");
1733 did_output
= print_rtl_single (outf
, tmp_rtx
);
1735 if ((bb
= end
[INSN_UID (tmp_rtx
)]) != NULL
)
1740 fprintf (outf
, ";; End of basic block %d -> (", bb
->index
);
1741 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1742 fprintf (outf
, " %d", e
->dest
->index
);
1743 fprintf (outf
, ")\n");
1747 df_dump_bottom (bb
, outf
);
1751 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1753 fputs (";; Succ edge ", outf
);
1754 dump_edge_info (outf
, e
, 1);
1767 if (crtl
->epilogue_delay_list
!= 0)
1769 fprintf (outf
, "\n;; Insns in epilogue delay list:\n\n");
1770 for (tmp_rtx
= crtl
->epilogue_delay_list
; tmp_rtx
!= 0;
1771 tmp_rtx
= XEXP (tmp_rtx
, 1))
1772 print_rtl_single (outf
, XEXP (tmp_rtx
, 0));
1777 update_br_prob_note (basic_block bb
)
1780 if (!JUMP_P (BB_END (bb
)))
1782 note
= find_reg_note (BB_END (bb
), REG_BR_PROB
, NULL_RTX
);
1783 if (!note
|| INTVAL (XEXP (note
, 0)) == BRANCH_EDGE (bb
)->probability
)
1785 XEXP (note
, 0) = GEN_INT (BRANCH_EDGE (bb
)->probability
);
1788 /* Get the last insn associated with block BB (that includes barriers and
1789 tablejumps after BB). */
1791 get_last_bb_insn (basic_block bb
)
1794 rtx end
= BB_END (bb
);
1796 /* Include any jump table following the basic block. */
1797 if (tablejump_p (end
, NULL
, &tmp
))
1800 /* Include any barriers that may follow the basic block. */
1801 tmp
= next_nonnote_insn_bb (end
);
1802 while (tmp
&& BARRIER_P (tmp
))
1805 tmp
= next_nonnote_insn_bb (end
);
1811 /* Verify the CFG and RTL consistency common for both underlying RTL and
1814 Currently it does following checks:
1816 - overlapping of basic blocks
1817 - insns with wrong BLOCK_FOR_INSN pointers
1818 - headers of basic blocks (the NOTE_INSN_BASIC_BLOCK note)
1819 - tails of basic blocks (ensure that boundary is necessary)
1820 - scans body of the basic block for JUMP_INSN, CODE_LABEL
1821 and NOTE_INSN_BASIC_BLOCK
1822 - verify that no fall_thru edge crosses hot/cold partition boundaries
1823 - verify that there are no pending RTL branch predictions
1825 In future it can be extended check a lot of other stuff as well
1826 (reachability of basic blocks, life information, etc. etc.). */
1829 rtl_verify_flow_info_1 (void)
1835 /* Check the general integrity of the basic blocks. */
1836 FOR_EACH_BB_REVERSE (bb
)
1840 if (!(bb
->flags
& BB_RTL
))
1842 error ("BB_RTL flag not set for block %d", bb
->index
);
1846 FOR_BB_INSNS (bb
, insn
)
1847 if (BLOCK_FOR_INSN (insn
) != bb
)
1849 error ("insn %d basic block pointer is %d, should be %d",
1851 BLOCK_FOR_INSN (insn
) ? BLOCK_FOR_INSN (insn
)->index
: 0,
1856 for (insn
= bb
->il
.rtl
->header
; insn
; insn
= NEXT_INSN (insn
))
1857 if (!BARRIER_P (insn
)
1858 && BLOCK_FOR_INSN (insn
) != NULL
)
1860 error ("insn %d in header of bb %d has non-NULL basic block",
1861 INSN_UID (insn
), bb
->index
);
1864 for (insn
= bb
->il
.rtl
->footer
; insn
; insn
= NEXT_INSN (insn
))
1865 if (!BARRIER_P (insn
)
1866 && BLOCK_FOR_INSN (insn
) != NULL
)
1868 error ("insn %d in footer of bb %d has non-NULL basic block",
1869 INSN_UID (insn
), bb
->index
);
1874 /* Now check the basic blocks (boundaries etc.) */
1875 FOR_EACH_BB_REVERSE (bb
)
1877 int n_fallthru
= 0, n_eh
= 0, n_call
= 0, n_abnormal
= 0, n_branch
= 0;
1878 edge e
, fallthru
= NULL
;
1882 if (JUMP_P (BB_END (bb
))
1883 && (note
= find_reg_note (BB_END (bb
), REG_BR_PROB
, NULL_RTX
))
1884 && EDGE_COUNT (bb
->succs
) >= 2
1885 && any_condjump_p (BB_END (bb
)))
1887 if (INTVAL (XEXP (note
, 0)) != BRANCH_EDGE (bb
)->probability
1888 && profile_status
!= PROFILE_ABSENT
)
1890 error ("verify_flow_info: REG_BR_PROB does not match cfg %wi %i",
1891 INTVAL (XEXP (note
, 0)), BRANCH_EDGE (bb
)->probability
);
1895 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1897 if (e
->flags
& EDGE_FALLTHRU
)
1899 n_fallthru
++, fallthru
= e
;
1900 if ((e
->flags
& EDGE_CROSSING
)
1901 || (BB_PARTITION (e
->src
) != BB_PARTITION (e
->dest
)
1902 && e
->src
!= ENTRY_BLOCK_PTR
1903 && e
->dest
!= EXIT_BLOCK_PTR
))
1905 error ("fallthru edge crosses section boundary (bb %i)",
1911 if ((e
->flags
& ~(EDGE_DFS_BACK
1913 | EDGE_IRREDUCIBLE_LOOP
1915 | EDGE_CROSSING
)) == 0)
1918 if (e
->flags
& EDGE_ABNORMAL_CALL
)
1921 if (e
->flags
& EDGE_EH
)
1923 else if (e
->flags
& EDGE_ABNORMAL
)
1927 if (n_eh
&& !find_reg_note (BB_END (bb
), REG_EH_REGION
, NULL_RTX
))
1929 error ("missing REG_EH_REGION note in the end of bb %i", bb
->index
);
1934 error ("too many eh edges %i", bb
->index
);
1938 && (!JUMP_P (BB_END (bb
))
1939 || (n_branch
> 1 && (any_uncondjump_p (BB_END (bb
))
1940 || any_condjump_p (BB_END (bb
))))))
1942 error ("too many outgoing branch edges from bb %i", bb
->index
);
1945 if (n_fallthru
&& any_uncondjump_p (BB_END (bb
)))
1947 error ("fallthru edge after unconditional jump %i", bb
->index
);
1950 if (n_branch
!= 1 && any_uncondjump_p (BB_END (bb
)))
1952 error ("wrong number of branch edges after unconditional jump %i",
1956 if (n_branch
!= 1 && any_condjump_p (BB_END (bb
))
1957 && JUMP_LABEL (BB_END (bb
)) != BB_HEAD (fallthru
->dest
))
1959 error ("wrong amount of branch edges after conditional jump %i",
1963 if (n_call
&& !CALL_P (BB_END (bb
)))
1965 error ("call edges for non-call insn in bb %i", bb
->index
);
1969 && (!CALL_P (BB_END (bb
)) && n_call
!= n_abnormal
)
1970 && (!JUMP_P (BB_END (bb
))
1971 || any_condjump_p (BB_END (bb
))
1972 || any_uncondjump_p (BB_END (bb
))))
1974 error ("abnormal edges for no purpose in bb %i", bb
->index
);
1978 for (x
= BB_HEAD (bb
); x
!= NEXT_INSN (BB_END (bb
)); x
= NEXT_INSN (x
))
1979 /* We may have a barrier inside a basic block before dead code
1980 elimination. There is no BLOCK_FOR_INSN field in a barrier. */
1981 if (!BARRIER_P (x
) && BLOCK_FOR_INSN (x
) != bb
)
1984 if (! BLOCK_FOR_INSN (x
))
1986 ("insn %d inside basic block %d but block_for_insn is NULL",
1987 INSN_UID (x
), bb
->index
);
1990 ("insn %d inside basic block %d but block_for_insn is %i",
1991 INSN_UID (x
), bb
->index
, BLOCK_FOR_INSN (x
)->index
);
1996 /* OK pointers are correct. Now check the header of basic
1997 block. It ought to contain optional CODE_LABEL followed
1998 by NOTE_BASIC_BLOCK. */
2002 if (BB_END (bb
) == x
)
2004 error ("NOTE_INSN_BASIC_BLOCK is missing for block %d",
2012 if (!NOTE_INSN_BASIC_BLOCK_P (x
) || NOTE_BASIC_BLOCK (x
) != bb
)
2014 error ("NOTE_INSN_BASIC_BLOCK is missing for block %d",
2019 if (BB_END (bb
) == x
)
2020 /* Do checks for empty blocks here. */
2023 for (x
= NEXT_INSN (x
); x
; x
= NEXT_INSN (x
))
2025 if (NOTE_INSN_BASIC_BLOCK_P (x
))
2027 error ("NOTE_INSN_BASIC_BLOCK %d in middle of basic block %d",
2028 INSN_UID (x
), bb
->index
);
2032 if (x
== BB_END (bb
))
2035 if (control_flow_insn_p (x
))
2037 error ("in basic block %d:", bb
->index
);
2038 fatal_insn ("flow control insn inside a basic block", x
);
2047 /* Verify the CFG and RTL consistency common for both underlying RTL and
2050 Currently it does following checks:
2051 - all checks of rtl_verify_flow_info_1
2052 - test head/end pointers
2053 - check that all insns are in the basic blocks
2054 (except the switch handling code, barriers and notes)
2055 - check that all returns are followed by barriers
2056 - check that all fallthru edge points to the adjacent blocks. */
2059 rtl_verify_flow_info (void)
2062 int err
= rtl_verify_flow_info_1 ();
2064 rtx last_head
= get_last_insn ();
2065 basic_block
*bb_info
;
2067 const rtx rtx_first
= get_insns ();
2068 basic_block last_bb_seen
= ENTRY_BLOCK_PTR
, curr_bb
= NULL
;
2069 const int max_uid
= get_max_uid ();
2071 bb_info
= XCNEWVEC (basic_block
, max_uid
);
2073 FOR_EACH_BB_REVERSE (bb
)
2076 rtx head
= BB_HEAD (bb
);
2077 rtx end
= BB_END (bb
);
2079 for (x
= last_head
; x
!= NULL_RTX
; x
= PREV_INSN (x
))
2081 /* Verify the end of the basic block is in the INSN chain. */
2085 /* And that the code outside of basic blocks has NULL bb field. */
2087 && BLOCK_FOR_INSN (x
) != NULL
)
2089 error ("insn %d outside of basic blocks has non-NULL bb field",
2097 error ("end insn %d for block %d not found in the insn stream",
2098 INSN_UID (end
), bb
->index
);
2102 /* Work backwards from the end to the head of the basic block
2103 to verify the head is in the RTL chain. */
2104 for (; x
!= NULL_RTX
; x
= PREV_INSN (x
))
2106 /* While walking over the insn chain, verify insns appear
2107 in only one basic block. */
2108 if (bb_info
[INSN_UID (x
)] != NULL
)
2110 error ("insn %d is in multiple basic blocks (%d and %d)",
2111 INSN_UID (x
), bb
->index
, bb_info
[INSN_UID (x
)]->index
);
2115 bb_info
[INSN_UID (x
)] = bb
;
2122 error ("head insn %d for block %d not found in the insn stream",
2123 INSN_UID (head
), bb
->index
);
2127 last_head
= PREV_INSN (x
);
2129 e
= find_fallthru_edge (bb
->succs
);
2134 /* Ensure existence of barrier in BB with no fallthru edges. */
2135 for (insn
= NEXT_INSN (BB_END (bb
)); ; insn
= NEXT_INSN (insn
))
2137 if (!insn
|| NOTE_INSN_BASIC_BLOCK_P (insn
))
2139 error ("missing barrier after block %i", bb
->index
);
2143 if (BARRIER_P (insn
))
2147 else if (e
->src
!= ENTRY_BLOCK_PTR
2148 && e
->dest
!= EXIT_BLOCK_PTR
)
2152 if (e
->src
->next_bb
!= e
->dest
)
2155 ("verify_flow_info: Incorrect blocks for fallthru %i->%i",
2156 e
->src
->index
, e
->dest
->index
);
2160 for (insn
= NEXT_INSN (BB_END (e
->src
)); insn
!= BB_HEAD (e
->dest
);
2161 insn
= NEXT_INSN (insn
))
2162 if (BARRIER_P (insn
) || INSN_P (insn
))
2164 error ("verify_flow_info: Incorrect fallthru %i->%i",
2165 e
->src
->index
, e
->dest
->index
);
2166 fatal_insn ("wrong insn in the fallthru edge", insn
);
2172 for (x
= last_head
; x
!= NULL_RTX
; x
= PREV_INSN (x
))
2174 /* Check that the code before the first basic block has NULL
2177 && BLOCK_FOR_INSN (x
) != NULL
)
2179 error ("insn %d outside of basic blocks has non-NULL bb field",
2187 last_bb_seen
= ENTRY_BLOCK_PTR
;
2189 for (x
= rtx_first
; x
; x
= NEXT_INSN (x
))
2191 if (NOTE_INSN_BASIC_BLOCK_P (x
))
2193 bb
= NOTE_BASIC_BLOCK (x
);
2196 if (bb
!= last_bb_seen
->next_bb
)
2197 internal_error ("basic blocks not laid down consecutively");
2199 curr_bb
= last_bb_seen
= bb
;
2204 switch (GET_CODE (x
))
2211 /* An addr_vec is placed outside any basic block. */
2213 && JUMP_TABLE_DATA_P (NEXT_INSN (x
)))
2216 /* But in any case, non-deletable labels can appear anywhere. */
2220 fatal_insn ("insn outside basic block", x
);
2225 && returnjump_p (x
) && ! condjump_p (x
)
2226 && ! (next_nonnote_insn (x
) && BARRIER_P (next_nonnote_insn (x
))))
2227 fatal_insn ("return not followed by barrier", x
);
2228 if (curr_bb
&& x
== BB_END (curr_bb
))
2232 if (num_bb_notes
!= n_basic_blocks
- NUM_FIXED_BLOCKS
)
2234 ("number of bb notes in insn chain (%d) != n_basic_blocks (%d)",
2235 num_bb_notes
, n_basic_blocks
);
2240 /* Assume that the preceding pass has possibly eliminated jump instructions
2241 or converted the unconditional jumps. Eliminate the edges from CFG.
2242 Return true if any edges are eliminated. */
2245 purge_dead_edges (basic_block bb
)
2248 rtx insn
= BB_END (bb
), note
;
2249 bool purged
= false;
2253 if (DEBUG_INSN_P (insn
) && insn
!= BB_HEAD (bb
))
2255 insn
= PREV_INSN (insn
);
2256 while ((DEBUG_INSN_P (insn
) || NOTE_P (insn
)) && insn
!= BB_HEAD (bb
));
2258 /* If this instruction cannot trap, remove REG_EH_REGION notes. */
2259 if (NONJUMP_INSN_P (insn
)
2260 && (note
= find_reg_note (insn
, REG_EH_REGION
, NULL
)))
2264 if (! may_trap_p (PATTERN (insn
))
2265 || ((eqnote
= find_reg_equal_equiv_note (insn
))
2266 && ! may_trap_p (XEXP (eqnote
, 0))))
2267 remove_note (insn
, note
);
2270 /* Cleanup abnormal edges caused by exceptions or non-local gotos. */
2271 for (ei
= ei_start (bb
->succs
); (e
= ei_safe_edge (ei
)); )
2273 bool remove
= false;
2275 /* There are three types of edges we need to handle correctly here: EH
2276 edges, abnormal call EH edges, and abnormal call non-EH edges. The
2277 latter can appear when nonlocal gotos are used. */
2278 if (e
->flags
& EDGE_ABNORMAL_CALL
)
2282 else if (can_nonlocal_goto (insn
))
2284 else if ((e
->flags
& EDGE_EH
) && can_throw_internal (insn
))
2289 else if (e
->flags
& EDGE_EH
)
2290 remove
= !can_throw_internal (insn
);
2295 df_set_bb_dirty (bb
);
2308 /* We do care only about conditional jumps and simplejumps. */
2309 if (!any_condjump_p (insn
)
2310 && !returnjump_p (insn
)
2311 && !simplejump_p (insn
))
2314 /* Branch probability/prediction notes are defined only for
2315 condjumps. We've possibly turned condjump into simplejump. */
2316 if (simplejump_p (insn
))
2318 note
= find_reg_note (insn
, REG_BR_PROB
, NULL
);
2320 remove_note (insn
, note
);
2321 while ((note
= find_reg_note (insn
, REG_BR_PRED
, NULL
)))
2322 remove_note (insn
, note
);
2325 for (ei
= ei_start (bb
->succs
); (e
= ei_safe_edge (ei
)); )
2327 /* Avoid abnormal flags to leak from computed jumps turned
2328 into simplejumps. */
2330 e
->flags
&= ~EDGE_ABNORMAL
;
2332 /* See if this edge is one we should keep. */
2333 if ((e
->flags
& EDGE_FALLTHRU
) && any_condjump_p (insn
))
2334 /* A conditional jump can fall through into the next
2335 block, so we should keep the edge. */
2340 else if (e
->dest
!= EXIT_BLOCK_PTR
2341 && BB_HEAD (e
->dest
) == JUMP_LABEL (insn
))
2342 /* If the destination block is the target of the jump,
2348 else if (e
->dest
== EXIT_BLOCK_PTR
&& returnjump_p (insn
))
2349 /* If the destination block is the exit block, and this
2350 instruction is a return, then keep the edge. */
2355 else if ((e
->flags
& EDGE_EH
) && can_throw_internal (insn
))
2356 /* Keep the edges that correspond to exceptions thrown by
2357 this instruction and rematerialize the EDGE_ABNORMAL
2358 flag we just cleared above. */
2360 e
->flags
|= EDGE_ABNORMAL
;
2365 /* We do not need this edge. */
2366 df_set_bb_dirty (bb
);
2371 if (EDGE_COUNT (bb
->succs
) == 0 || !purged
)
2375 fprintf (dump_file
, "Purged edges from bb %i\n", bb
->index
);
2380 /* Redistribute probabilities. */
2381 if (single_succ_p (bb
))
2383 single_succ_edge (bb
)->probability
= REG_BR_PROB_BASE
;
2384 single_succ_edge (bb
)->count
= bb
->count
;
2388 note
= find_reg_note (insn
, REG_BR_PROB
, NULL
);
2392 b
= BRANCH_EDGE (bb
);
2393 f
= FALLTHRU_EDGE (bb
);
2394 b
->probability
= INTVAL (XEXP (note
, 0));
2395 f
->probability
= REG_BR_PROB_BASE
- b
->probability
;
2396 b
->count
= bb
->count
* b
->probability
/ REG_BR_PROB_BASE
;
2397 f
->count
= bb
->count
* f
->probability
/ REG_BR_PROB_BASE
;
2402 else if (CALL_P (insn
) && SIBLING_CALL_P (insn
))
2404 /* First, there should not be any EH or ABCALL edges resulting
2405 from non-local gotos and the like. If there were, we shouldn't
2406 have created the sibcall in the first place. Second, there
2407 should of course never have been a fallthru edge. */
2408 gcc_assert (single_succ_p (bb
));
2409 gcc_assert (single_succ_edge (bb
)->flags
2410 == (EDGE_SIBCALL
| EDGE_ABNORMAL
));
2415 /* If we don't see a jump insn, we don't know exactly why the block would
2416 have been broken at this point. Look for a simple, non-fallthru edge,
2417 as these are only created by conditional branches. If we find such an
2418 edge we know that there used to be a jump here and can then safely
2419 remove all non-fallthru edges. */
2421 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
2422 if (! (e
->flags
& (EDGE_COMPLEX
| EDGE_FALLTHRU
)))
2431 /* Remove all but the fake and fallthru edges. The fake edge may be
2432 the only successor for this block in the case of noreturn
2434 for (ei
= ei_start (bb
->succs
); (e
= ei_safe_edge (ei
)); )
2436 if (!(e
->flags
& (EDGE_FALLTHRU
| EDGE_FAKE
)))
2438 df_set_bb_dirty (bb
);
2446 gcc_assert (single_succ_p (bb
));
2448 single_succ_edge (bb
)->probability
= REG_BR_PROB_BASE
;
2449 single_succ_edge (bb
)->count
= bb
->count
;
2452 fprintf (dump_file
, "Purged non-fallthru edges from bb %i\n",
2457 /* Search all basic blocks for potentially dead edges and purge them. Return
2458 true if some edge has been eliminated. */
2461 purge_all_dead_edges (void)
2468 bool purged_here
= purge_dead_edges (bb
);
2470 purged
|= purged_here
;
2476 /* This is used by a few passes that emit some instructions after abnormal
2477 calls, moving the basic block's end, while they in fact do want to emit
2478 them on the fallthru edge. Look for abnormal call edges, find backward
2479 the call in the block and insert the instructions on the edge instead.
2481 Similarly, handle instructions throwing exceptions internally.
2483 Return true when instructions have been found and inserted on edges. */
2486 fixup_abnormal_edges (void)
2488 bool inserted
= false;
2496 /* Look for cases we are interested in - calls or instructions causing
2498 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
2499 if ((e
->flags
& EDGE_ABNORMAL_CALL
)
2500 || ((e
->flags
& (EDGE_ABNORMAL
| EDGE_EH
))
2501 == (EDGE_ABNORMAL
| EDGE_EH
)))
2504 if (e
&& !CALL_P (BB_END (bb
)) && !can_throw_internal (BB_END (bb
)))
2508 /* Get past the new insns generated. Allow notes, as the insns
2509 may be already deleted. */
2511 while ((NONJUMP_INSN_P (insn
) || NOTE_P (insn
))
2512 && !can_throw_internal (insn
)
2513 && insn
!= BB_HEAD (bb
))
2514 insn
= PREV_INSN (insn
);
2516 if (CALL_P (insn
) || can_throw_internal (insn
))
2520 e
= find_fallthru_edge (bb
->succs
);
2522 stop
= NEXT_INSN (BB_END (bb
));
2525 for (insn
= NEXT_INSN (insn
); insn
!= stop
; insn
= next
)
2527 next
= NEXT_INSN (insn
);
2532 /* Sometimes there's still the return value USE.
2533 If it's placed after a trapping call (i.e. that
2534 call is the last insn anyway), we have no fallthru
2535 edge. Simply delete this use and don't try to insert
2536 on the non-existent edge. */
2537 if (GET_CODE (PATTERN (insn
)) != USE
)
2539 /* We're not deleting it, we're moving it. */
2540 INSN_DELETED_P (insn
) = 0;
2541 PREV_INSN (insn
) = NULL_RTX
;
2542 NEXT_INSN (insn
) = NULL_RTX
;
2544 insert_insn_on_edge (insn
, e
);
2548 else if (!BARRIER_P (insn
))
2549 set_block_for_insn (insn
, NULL
);
2553 /* It may be that we don't find any trapping insn. In this
2554 case we discovered quite late that the insn that had been
2555 marked as can_throw_internal in fact couldn't trap at all.
2556 So we should in fact delete the EH edges out of the block. */
2558 purge_dead_edges (bb
);
2565 /* Same as split_block but update cfg_layout structures. */
2568 cfg_layout_split_block (basic_block bb
, void *insnp
)
2570 rtx insn
= (rtx
) insnp
;
2571 basic_block new_bb
= rtl_split_block (bb
, insn
);
2573 new_bb
->il
.rtl
->footer
= bb
->il
.rtl
->footer
;
2574 bb
->il
.rtl
->footer
= NULL
;
2579 /* Redirect Edge to DEST. */
2581 cfg_layout_redirect_edge_and_branch (edge e
, basic_block dest
)
2583 basic_block src
= e
->src
;
2586 if (e
->flags
& (EDGE_ABNORMAL_CALL
| EDGE_EH
))
2589 if (e
->dest
== dest
)
2592 if (e
->src
!= ENTRY_BLOCK_PTR
2593 && (ret
= try_redirect_by_replacing_jump (e
, dest
, true)))
2595 df_set_bb_dirty (src
);
2599 if (e
->src
== ENTRY_BLOCK_PTR
2600 && (e
->flags
& EDGE_FALLTHRU
) && !(e
->flags
& EDGE_COMPLEX
))
2603 fprintf (dump_file
, "Redirecting entry edge from bb %i to %i\n",
2604 e
->src
->index
, dest
->index
);
2606 df_set_bb_dirty (e
->src
);
2607 redirect_edge_succ (e
, dest
);
2611 /* Redirect_edge_and_branch may decide to turn branch into fallthru edge
2612 in the case the basic block appears to be in sequence. Avoid this
2615 if (e
->flags
& EDGE_FALLTHRU
)
2617 /* Redirect any branch edges unified with the fallthru one. */
2618 if (JUMP_P (BB_END (src
))
2619 && label_is_jump_target_p (BB_HEAD (e
->dest
),
2625 fprintf (dump_file
, "Fallthru edge unified with branch "
2626 "%i->%i redirected to %i\n",
2627 e
->src
->index
, e
->dest
->index
, dest
->index
);
2628 e
->flags
&= ~EDGE_FALLTHRU
;
2629 redirected
= redirect_branch_edge (e
, dest
);
2630 gcc_assert (redirected
);
2631 redirected
->flags
|= EDGE_FALLTHRU
;
2632 df_set_bb_dirty (redirected
->src
);
2635 /* In case we are redirecting fallthru edge to the branch edge
2636 of conditional jump, remove it. */
2637 if (EDGE_COUNT (src
->succs
) == 2)
2639 /* Find the edge that is different from E. */
2640 edge s
= EDGE_SUCC (src
, EDGE_SUCC (src
, 0) == e
);
2643 && any_condjump_p (BB_END (src
))
2644 && onlyjump_p (BB_END (src
)))
2645 delete_insn (BB_END (src
));
2648 fprintf (dump_file
, "Fallthru edge %i->%i redirected to %i\n",
2649 e
->src
->index
, e
->dest
->index
, dest
->index
);
2650 ret
= redirect_edge_succ_nodup (e
, dest
);
2653 ret
= redirect_branch_edge (e
, dest
);
2655 /* We don't want simplejumps in the insn stream during cfglayout. */
2656 gcc_assert (!simplejump_p (BB_END (src
)));
2658 df_set_bb_dirty (src
);
2662 /* Simple wrapper as we always can redirect fallthru edges. */
2664 cfg_layout_redirect_edge_and_branch_force (edge e
, basic_block dest
)
2666 edge redirected
= cfg_layout_redirect_edge_and_branch (e
, dest
);
2668 gcc_assert (redirected
);
2672 /* Same as delete_basic_block but update cfg_layout structures. */
2675 cfg_layout_delete_block (basic_block bb
)
2677 rtx insn
, next
, prev
= PREV_INSN (BB_HEAD (bb
)), *to
, remaints
;
2679 if (bb
->il
.rtl
->header
)
2681 next
= BB_HEAD (bb
);
2683 NEXT_INSN (prev
) = bb
->il
.rtl
->header
;
2685 set_first_insn (bb
->il
.rtl
->header
);
2686 PREV_INSN (bb
->il
.rtl
->header
) = prev
;
2687 insn
= bb
->il
.rtl
->header
;
2688 while (NEXT_INSN (insn
))
2689 insn
= NEXT_INSN (insn
);
2690 NEXT_INSN (insn
) = next
;
2691 PREV_INSN (next
) = insn
;
2693 next
= NEXT_INSN (BB_END (bb
));
2694 if (bb
->il
.rtl
->footer
)
2696 insn
= bb
->il
.rtl
->footer
;
2699 if (BARRIER_P (insn
))
2701 if (PREV_INSN (insn
))
2702 NEXT_INSN (PREV_INSN (insn
)) = NEXT_INSN (insn
);
2704 bb
->il
.rtl
->footer
= NEXT_INSN (insn
);
2705 if (NEXT_INSN (insn
))
2706 PREV_INSN (NEXT_INSN (insn
)) = PREV_INSN (insn
);
2710 insn
= NEXT_INSN (insn
);
2712 if (bb
->il
.rtl
->footer
)
2715 NEXT_INSN (insn
) = bb
->il
.rtl
->footer
;
2716 PREV_INSN (bb
->il
.rtl
->footer
) = insn
;
2717 while (NEXT_INSN (insn
))
2718 insn
= NEXT_INSN (insn
);
2719 NEXT_INSN (insn
) = next
;
2721 PREV_INSN (next
) = insn
;
2723 set_last_insn (insn
);
2726 if (bb
->next_bb
!= EXIT_BLOCK_PTR
)
2727 to
= &bb
->next_bb
->il
.rtl
->header
;
2729 to
= &cfg_layout_function_footer
;
2731 rtl_delete_block (bb
);
2734 prev
= NEXT_INSN (prev
);
2736 prev
= get_insns ();
2738 next
= PREV_INSN (next
);
2740 next
= get_last_insn ();
2742 if (next
&& NEXT_INSN (next
) != prev
)
2744 remaints
= unlink_insn_chain (prev
, next
);
2746 while (NEXT_INSN (insn
))
2747 insn
= NEXT_INSN (insn
);
2748 NEXT_INSN (insn
) = *to
;
2750 PREV_INSN (*to
) = insn
;
2755 /* Return true when blocks A and B can be safely merged. */
2758 cfg_layout_can_merge_blocks_p (basic_block a
, basic_block b
)
2760 /* If we are partitioning hot/cold basic blocks, we don't want to
2761 mess up unconditional or indirect jumps that cross between hot
2764 Basic block partitioning may result in some jumps that appear to
2765 be optimizable (or blocks that appear to be mergeable), but which really
2766 must be left untouched (they are required to make it safely across
2767 partition boundaries). See the comments at the top of
2768 bb-reorder.c:partition_hot_cold_basic_blocks for complete details. */
2770 if (BB_PARTITION (a
) != BB_PARTITION (b
))
2773 /* There must be exactly one edge in between the blocks. */
2774 return (single_succ_p (a
)
2775 && single_succ (a
) == b
2776 && single_pred_p (b
) == 1
2778 /* Must be simple edge. */
2779 && !(single_succ_edge (a
)->flags
& EDGE_COMPLEX
)
2780 && a
!= ENTRY_BLOCK_PTR
&& b
!= EXIT_BLOCK_PTR
2781 /* If the jump insn has side effects, we can't kill the edge.
2782 When not optimizing, try_redirect_by_replacing_jump will
2783 not allow us to redirect an edge by replacing a table jump. */
2784 && (!JUMP_P (BB_END (a
))
2785 || ((!optimize
|| reload_completed
)
2786 ? simplejump_p (BB_END (a
)) : onlyjump_p (BB_END (a
)))));
2789 /* Merge block A and B. The blocks must be mergeable. */
2792 cfg_layout_merge_blocks (basic_block a
, basic_block b
)
2794 bool forwarder_p
= (b
->flags
& BB_FORWARDER_BLOCK
) != 0;
2796 gcc_checking_assert (cfg_layout_can_merge_blocks_p (a
, b
));
2799 fprintf (dump_file
, "Merging block %d into block %d...\n", b
->index
,
2802 /* If there was a CODE_LABEL beginning B, delete it. */
2803 if (LABEL_P (BB_HEAD (b
)))
2805 delete_insn (BB_HEAD (b
));
2808 /* We should have fallthru edge in a, or we can do dummy redirection to get
2810 if (JUMP_P (BB_END (a
)))
2811 try_redirect_by_replacing_jump (EDGE_SUCC (a
, 0), b
, true);
2812 gcc_assert (!JUMP_P (BB_END (a
)));
2814 /* When not optimizing and the edge is the only place in RTL which holds
2815 some unique locus, emit a nop with that locus in between. */
2816 if (!optimize
&& EDGE_SUCC (a
, 0)->goto_locus
)
2818 rtx insn
= BB_END (a
), end
= PREV_INSN (BB_HEAD (a
));
2819 int goto_locus
= EDGE_SUCC (a
, 0)->goto_locus
;
2821 while (insn
!= end
&& (!INSN_P (insn
) || INSN_LOCATOR (insn
) == 0))
2822 insn
= PREV_INSN (insn
);
2823 if (insn
!= end
&& locator_eq (INSN_LOCATOR (insn
), goto_locus
))
2828 end
= NEXT_INSN (BB_END (b
));
2829 while (insn
!= end
&& !INSN_P (insn
))
2830 insn
= NEXT_INSN (insn
);
2831 if (insn
!= end
&& INSN_LOCATOR (insn
) != 0
2832 && locator_eq (INSN_LOCATOR (insn
), goto_locus
))
2837 BB_END (a
) = emit_insn_after_noloc (gen_nop (), BB_END (a
), a
);
2838 INSN_LOCATOR (BB_END (a
)) = goto_locus
;
2842 /* Possible line number notes should appear in between. */
2843 if (b
->il
.rtl
->header
)
2845 rtx first
= BB_END (a
), last
;
2847 last
= emit_insn_after_noloc (b
->il
.rtl
->header
, BB_END (a
), a
);
2848 delete_insn_chain (NEXT_INSN (first
), last
, false);
2849 b
->il
.rtl
->header
= NULL
;
2852 /* In the case basic blocks are not adjacent, move them around. */
2853 if (NEXT_INSN (BB_END (a
)) != BB_HEAD (b
))
2855 rtx first
= unlink_insn_chain (BB_HEAD (b
), BB_END (b
));
2857 emit_insn_after_noloc (first
, BB_END (a
), a
);
2858 /* Skip possible DELETED_LABEL insn. */
2859 if (!NOTE_INSN_BASIC_BLOCK_P (first
))
2860 first
= NEXT_INSN (first
);
2861 gcc_assert (NOTE_INSN_BASIC_BLOCK_P (first
));
2864 /* emit_insn_after_noloc doesn't call df_insn_change_bb.
2865 We need to explicitly call. */
2866 update_bb_for_insn_chain (NEXT_INSN (first
),
2870 delete_insn (first
);
2872 /* Otherwise just re-associate the instructions. */
2877 update_bb_for_insn_chain (BB_HEAD (b
), BB_END (b
), a
);
2880 /* Skip possible DELETED_LABEL insn. */
2881 if (!NOTE_INSN_BASIC_BLOCK_P (insn
))
2882 insn
= NEXT_INSN (insn
);
2883 gcc_assert (NOTE_INSN_BASIC_BLOCK_P (insn
));
2885 BB_END (a
) = BB_END (b
);
2889 df_bb_delete (b
->index
);
2891 /* Possible tablejumps and barriers should appear after the block. */
2892 if (b
->il
.rtl
->footer
)
2894 if (!a
->il
.rtl
->footer
)
2895 a
->il
.rtl
->footer
= b
->il
.rtl
->footer
;
2898 rtx last
= a
->il
.rtl
->footer
;
2900 while (NEXT_INSN (last
))
2901 last
= NEXT_INSN (last
);
2902 NEXT_INSN (last
) = b
->il
.rtl
->footer
;
2903 PREV_INSN (b
->il
.rtl
->footer
) = last
;
2905 b
->il
.rtl
->footer
= NULL
;
2908 /* If B was a forwarder block, propagate the locus on the edge. */
2909 if (forwarder_p
&& !EDGE_SUCC (b
, 0)->goto_locus
)
2910 EDGE_SUCC (b
, 0)->goto_locus
= EDGE_SUCC (a
, 0)->goto_locus
;
2913 fprintf (dump_file
, "Merged blocks %d and %d.\n", a
->index
, b
->index
);
2919 cfg_layout_split_edge (edge e
)
2921 basic_block new_bb
=
2922 create_basic_block (e
->src
!= ENTRY_BLOCK_PTR
2923 ? NEXT_INSN (BB_END (e
->src
)) : get_insns (),
2926 if (e
->dest
== EXIT_BLOCK_PTR
)
2927 BB_COPY_PARTITION (new_bb
, e
->src
);
2929 BB_COPY_PARTITION (new_bb
, e
->dest
);
2930 make_edge (new_bb
, e
->dest
, EDGE_FALLTHRU
);
2931 redirect_edge_and_branch_force (e
, new_bb
);
2936 /* Do postprocessing after making a forwarder block joined by edge FALLTHRU. */
2939 rtl_make_forwarder_block (edge fallthru ATTRIBUTE_UNUSED
)
2943 /* Return 1 if BB ends with a call, possibly followed by some
2944 instructions that must stay with the call, 0 otherwise. */
2947 rtl_block_ends_with_call_p (basic_block bb
)
2949 rtx insn
= BB_END (bb
);
2951 while (!CALL_P (insn
)
2952 && insn
!= BB_HEAD (bb
)
2953 && (keep_with_call_p (insn
)
2955 || DEBUG_INSN_P (insn
)))
2956 insn
= PREV_INSN (insn
);
2957 return (CALL_P (insn
));
2960 /* Return 1 if BB ends with a conditional branch, 0 otherwise. */
2963 rtl_block_ends_with_condjump_p (const_basic_block bb
)
2965 return any_condjump_p (BB_END (bb
));
2968 /* Return true if we need to add fake edge to exit.
2969 Helper function for rtl_flow_call_edges_add. */
2972 need_fake_edge_p (const_rtx insn
)
2978 && !SIBLING_CALL_P (insn
)
2979 && !find_reg_note (insn
, REG_NORETURN
, NULL
)
2980 && !(RTL_CONST_OR_PURE_CALL_P (insn
))))
2983 return ((GET_CODE (PATTERN (insn
)) == ASM_OPERANDS
2984 && MEM_VOLATILE_P (PATTERN (insn
)))
2985 || (GET_CODE (PATTERN (insn
)) == PARALLEL
2986 && asm_noperands (insn
) != -1
2987 && MEM_VOLATILE_P (XVECEXP (PATTERN (insn
), 0, 0)))
2988 || GET_CODE (PATTERN (insn
)) == ASM_INPUT
);
2991 /* Add fake edges to the function exit for any non constant and non noreturn
2992 calls, volatile inline assembly in the bitmap of blocks specified by
2993 BLOCKS or to the whole CFG if BLOCKS is zero. Return the number of blocks
2996 The goal is to expose cases in which entering a basic block does not imply
2997 that all subsequent instructions must be executed. */
3000 rtl_flow_call_edges_add (sbitmap blocks
)
3003 int blocks_split
= 0;
3004 int last_bb
= last_basic_block
;
3005 bool check_last_block
= false;
3007 if (n_basic_blocks
== NUM_FIXED_BLOCKS
)
3011 check_last_block
= true;
3013 check_last_block
= TEST_BIT (blocks
, EXIT_BLOCK_PTR
->prev_bb
->index
);
3015 /* In the last basic block, before epilogue generation, there will be
3016 a fallthru edge to EXIT. Special care is required if the last insn
3017 of the last basic block is a call because make_edge folds duplicate
3018 edges, which would result in the fallthru edge also being marked
3019 fake, which would result in the fallthru edge being removed by
3020 remove_fake_edges, which would result in an invalid CFG.
3022 Moreover, we can't elide the outgoing fake edge, since the block
3023 profiler needs to take this into account in order to solve the minimal
3024 spanning tree in the case that the call doesn't return.
3026 Handle this by adding a dummy instruction in a new last basic block. */
3027 if (check_last_block
)
3029 basic_block bb
= EXIT_BLOCK_PTR
->prev_bb
;
3030 rtx insn
= BB_END (bb
);
3032 /* Back up past insns that must be kept in the same block as a call. */
3033 while (insn
!= BB_HEAD (bb
)
3034 && keep_with_call_p (insn
))
3035 insn
= PREV_INSN (insn
);
3037 if (need_fake_edge_p (insn
))
3041 e
= find_edge (bb
, EXIT_BLOCK_PTR
);
3044 insert_insn_on_edge (gen_use (const0_rtx
), e
);
3045 commit_edge_insertions ();
3050 /* Now add fake edges to the function exit for any non constant
3051 calls since there is no way that we can determine if they will
3054 for (i
= NUM_FIXED_BLOCKS
; i
< last_bb
; i
++)
3056 basic_block bb
= BASIC_BLOCK (i
);
3063 if (blocks
&& !TEST_BIT (blocks
, i
))
3066 for (insn
= BB_END (bb
); ; insn
= prev_insn
)
3068 prev_insn
= PREV_INSN (insn
);
3069 if (need_fake_edge_p (insn
))
3072 rtx split_at_insn
= insn
;
3074 /* Don't split the block between a call and an insn that should
3075 remain in the same block as the call. */
3077 while (split_at_insn
!= BB_END (bb
)
3078 && keep_with_call_p (NEXT_INSN (split_at_insn
)))
3079 split_at_insn
= NEXT_INSN (split_at_insn
);
3081 /* The handling above of the final block before the epilogue
3082 should be enough to verify that there is no edge to the exit
3083 block in CFG already. Calling make_edge in such case would
3084 cause us to mark that edge as fake and remove it later. */
3086 #ifdef ENABLE_CHECKING
3087 if (split_at_insn
== BB_END (bb
))
3089 e
= find_edge (bb
, EXIT_BLOCK_PTR
);
3090 gcc_assert (e
== NULL
);
3094 /* Note that the following may create a new basic block
3095 and renumber the existing basic blocks. */
3096 if (split_at_insn
!= BB_END (bb
))
3098 e
= split_block (bb
, split_at_insn
);
3103 make_edge (bb
, EXIT_BLOCK_PTR
, EDGE_FAKE
);
3106 if (insn
== BB_HEAD (bb
))
3112 verify_flow_info ();
3114 return blocks_split
;
3117 /* Add COMP_RTX as a condition at end of COND_BB. FIRST_HEAD is
3118 the conditional branch target, SECOND_HEAD should be the fall-thru
3119 there is no need to handle this here the loop versioning code handles
3120 this. the reason for SECON_HEAD is that it is needed for condition
3121 in trees, and this should be of the same type since it is a hook. */
3123 rtl_lv_add_condition_to_bb (basic_block first_head
,
3124 basic_block second_head ATTRIBUTE_UNUSED
,
3125 basic_block cond_bb
, void *comp_rtx
)
3127 rtx label
, seq
, jump
;
3128 rtx op0
= XEXP ((rtx
)comp_rtx
, 0);
3129 rtx op1
= XEXP ((rtx
)comp_rtx
, 1);
3130 enum rtx_code comp
= GET_CODE ((rtx
)comp_rtx
);
3131 enum machine_mode mode
;
3134 label
= block_label (first_head
);
3135 mode
= GET_MODE (op0
);
3136 if (mode
== VOIDmode
)
3137 mode
= GET_MODE (op1
);
3140 op0
= force_operand (op0
, NULL_RTX
);
3141 op1
= force_operand (op1
, NULL_RTX
);
3142 do_compare_rtx_and_jump (op0
, op1
, comp
, 0,
3143 mode
, NULL_RTX
, NULL_RTX
, label
, -1);
3144 jump
= get_last_insn ();
3145 JUMP_LABEL (jump
) = label
;
3146 LABEL_NUSES (label
)++;
3150 /* Add the new cond , in the new head. */
3151 emit_insn_after(seq
, BB_END(cond_bb
));
3155 /* Given a block B with unconditional branch at its end, get the
3156 store the return the branch edge and the fall-thru edge in
3157 BRANCH_EDGE and FALLTHRU_EDGE respectively. */
3159 rtl_extract_cond_bb_edges (basic_block b
, edge
*branch_edge
,
3160 edge
*fallthru_edge
)
3162 edge e
= EDGE_SUCC (b
, 0);
3164 if (e
->flags
& EDGE_FALLTHRU
)
3167 *branch_edge
= EDGE_SUCC (b
, 1);
3172 *fallthru_edge
= EDGE_SUCC (b
, 1);
3177 init_rtl_bb_info (basic_block bb
)
3179 gcc_assert (!bb
->il
.rtl
);
3180 bb
->il
.rtl
= ggc_alloc_cleared_rtl_bb_info ();
3183 /* Returns true if it is possible to remove edge E by redirecting
3184 it to the destination of the other edge from E->src. */
3187 rtl_can_remove_branch_p (const_edge e
)
3189 const_basic_block src
= e
->src
;
3190 const_basic_block target
= EDGE_SUCC (src
, EDGE_SUCC (src
, 0) == e
)->dest
;
3191 const_rtx insn
= BB_END (src
), set
;
3193 /* The conditions are taken from try_redirect_by_replacing_jump. */
3194 if (target
== EXIT_BLOCK_PTR
)
3197 if (e
->flags
& (EDGE_ABNORMAL_CALL
| EDGE_EH
))
3200 if (find_reg_note (insn
, REG_CROSSING_JUMP
, NULL_RTX
)
3201 || BB_PARTITION (src
) != BB_PARTITION (target
))
3204 if (!onlyjump_p (insn
)
3205 || tablejump_p (insn
, NULL
, NULL
))
3208 set
= single_set (insn
);
3209 if (!set
|| side_effects_p (set
))
3215 /* Implementation of CFG manipulation for linearized RTL. */
3216 struct cfg_hooks rtl_cfg_hooks
= {
3218 rtl_verify_flow_info
,
3220 rtl_create_basic_block
,
3221 rtl_redirect_edge_and_branch
,
3222 rtl_redirect_edge_and_branch_force
,
3223 rtl_can_remove_branch_p
,
3226 rtl_move_block_after
,
3227 rtl_can_merge_blocks
, /* can_merge_blocks_p */
3231 NULL
, /* can_duplicate_block_p */
3232 NULL
, /* duplicate_block */
3234 rtl_make_forwarder_block
,
3235 rtl_tidy_fallthru_edge
,
3236 rtl_block_ends_with_call_p
,
3237 rtl_block_ends_with_condjump_p
,
3238 rtl_flow_call_edges_add
,
3239 NULL
, /* execute_on_growing_pred */
3240 NULL
, /* execute_on_shrinking_pred */
3241 NULL
, /* duplicate loop for trees */
3242 NULL
, /* lv_add_condition_to_bb */
3243 NULL
, /* lv_adjust_loop_header_phi*/
3244 NULL
, /* extract_cond_bb_edges */
3245 NULL
/* flush_pending_stmts */
3248 /* Implementation of CFG manipulation for cfg layout RTL, where
3249 basic block connected via fallthru edges does not have to be adjacent.
3250 This representation will hopefully become the default one in future
3251 version of the compiler. */
3253 /* We do not want to declare these functions in a header file, since they
3254 should only be used through the cfghooks interface, and we do not want to
3255 move them here since it would require also moving quite a lot of related
3256 code. They are in cfglayout.c. */
3257 extern bool cfg_layout_can_duplicate_bb_p (const_basic_block
);
3258 extern basic_block
cfg_layout_duplicate_bb (basic_block
);
3260 struct cfg_hooks cfg_layout_rtl_cfg_hooks
= {
3262 rtl_verify_flow_info_1
,
3264 cfg_layout_create_basic_block
,
3265 cfg_layout_redirect_edge_and_branch
,
3266 cfg_layout_redirect_edge_and_branch_force
,
3267 rtl_can_remove_branch_p
,
3268 cfg_layout_delete_block
,
3269 cfg_layout_split_block
,
3270 rtl_move_block_after
,
3271 cfg_layout_can_merge_blocks_p
,
3272 cfg_layout_merge_blocks
,
3275 cfg_layout_can_duplicate_bb_p
,
3276 cfg_layout_duplicate_bb
,
3277 cfg_layout_split_edge
,
3278 rtl_make_forwarder_block
,
3280 rtl_block_ends_with_call_p
,
3281 rtl_block_ends_with_condjump_p
,
3282 rtl_flow_call_edges_add
,
3283 NULL
, /* execute_on_growing_pred */
3284 NULL
, /* execute_on_shrinking_pred */
3285 duplicate_loop_to_header_edge
, /* duplicate loop for trees */
3286 rtl_lv_add_condition_to_bb
, /* lv_add_condition_to_bb */
3287 NULL
, /* lv_adjust_loop_header_phi*/
3288 rtl_extract_cond_bb_edges
, /* extract_cond_bb_edges */
3289 NULL
/* flush_pending_stmts */