aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgrtl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r--gcc/cfgrtl.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 0edad6a..3934d92 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -361,7 +361,7 @@ cfg_layout_create_basic_block (void *head, void *end, basic_block after)
static void
rtl_delete_block (basic_block b)
{
- rtx insn, end, tmp;
+ rtx insn, end;
/* If the head of this block is a CODE_LABEL, then it might be the
label for an exception handler which can't be reached. We need
@@ -370,18 +370,7 @@ rtl_delete_block (basic_block b)
if (LABEL_P (insn))
maybe_remove_eh_handler (insn);
- /* Include any jump table following the basic block. */
- end = BB_END (b);
- if (tablejump_p (end, NULL, &tmp))
- end = tmp;
-
- /* Include any barriers that may follow the basic block. */
- tmp = next_nonnote_insn (end);
- while (tmp && BARRIER_P (tmp))
- {
- end = tmp;
- tmp = next_nonnote_insn (end);
- }
+ end = get_last_bb_insn (b);
/* Selectively delete the entire chain. */
BB_HEAD (b) = NULL;
@@ -1704,6 +1693,29 @@ update_br_prob_note (basic_block bb)
return;
XEXP (note, 0) = GEN_INT (BRANCH_EDGE (bb)->probability);
}
+
+/* Get the last insn associated with block BB (that includes barriers and
+ tablejumps after BB). */
+rtx
+get_last_bb_insn (basic_block bb)
+{
+ rtx tmp;
+ rtx end = BB_END (bb);
+
+ /* Include any jump table following the basic block. */
+ if (tablejump_p (end, NULL, &tmp))
+ end = tmp;
+
+ /* Include any barriers that may follow the basic block. */
+ tmp = next_nonnote_insn (end);
+ while (tmp && BARRIER_P (tmp))
+ {
+ end = tmp;
+ tmp = next_nonnote_insn (end);
+ }
+
+ return end;
+}
/* Verify the CFG and RTL consistency common for both underlying RTL and
cfglayout RTL.