summaryrefslogtreecommitdiff
path: root/gcc/bb-reorder.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/bb-reorder.c')
-rw-r--r--gcc/bb-reorder.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index a97c2cd4c97..20e15fc9fdc 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -1736,9 +1736,11 @@ set_edge_can_fallthru_flag (void)
continue;
if (!any_condjump_p (BB_END (bb)))
continue;
- if (!invert_jump (BB_END (bb), JUMP_LABEL (BB_END (bb)), 0))
+
+ rtx_jump_insn *bb_end_jump = as_a <rtx_jump_insn *> (BB_END (bb));
+ if (!invert_jump (bb_end_jump, JUMP_LABEL (bb_end_jump), 0))
continue;
- invert_jump (BB_END (bb), JUMP_LABEL (BB_END (bb)), 0);
+ invert_jump (bb_end_jump, JUMP_LABEL (bb_end_jump), 0);
EDGE_SUCC (bb, 0)->flags |= EDGE_CAN_FALLTHRU;
EDGE_SUCC (bb, 1)->flags |= EDGE_CAN_FALLTHRU;
}
@@ -1892,9 +1894,15 @@ fix_up_fall_thru_edges (void)
fall_thru_label = block_label (fall_thru->dest);
- if (old_jump && JUMP_P (old_jump) && fall_thru_label)
- invert_worked = invert_jump (old_jump,
- fall_thru_label,0);
+ if (old_jump && fall_thru_label)
+ {
+ rtx_jump_insn *old_jump_insn =
+ dyn_cast <rtx_jump_insn *> (old_jump);
+ if (old_jump_insn)
+ invert_worked = invert_jump (old_jump_insn,
+ fall_thru_label, 0);
+ }
+
if (invert_worked)
{
fall_thru->flags &= ~EDGE_FALLTHRU;
@@ -2009,10 +2017,9 @@ fix_crossing_conditional_branches (void)
edge succ2;
edge crossing_edge;
edge new_edge;
- rtx_insn *old_jump;
rtx set_src;
rtx old_label = NULL_RTX;
- rtx new_label;
+ rtx_code_label *new_label;
FOR_EACH_BB_FN (cur_bb, cfun)
{
@@ -2037,7 +2044,7 @@ fix_crossing_conditional_branches (void)
if (crossing_edge)
{
- old_jump = BB_END (cur_bb);
+ rtx_jump_insn *old_jump = as_a <rtx_jump_insn *> (BB_END (cur_bb));
/* Check to make sure the jump instruction is a
conditional jump. */
@@ -2076,7 +2083,8 @@ fix_crossing_conditional_branches (void)
else
{
basic_block last_bb;
- rtx_insn *new_jump;
+ rtx_code_label *old_jump_target;
+ rtx_jump_insn *new_jump;
/* Create new basic block to be dest for
conditional jump. */
@@ -2087,9 +2095,10 @@ fix_crossing_conditional_branches (void)
emit_label (new_label);
gcc_assert (GET_CODE (old_label) == LABEL_REF);
- old_label = JUMP_LABEL (old_jump);
- new_jump = emit_jump_insn (gen_jump (old_label));
- JUMP_LABEL (new_jump) = old_label;
+ old_jump_target = old_jump->jump_target ();
+ new_jump = as_a <rtx_jump_insn *>
+ (emit_jump_insn (gen_jump (old_jump_target)));
+ new_jump->set_jump_target (old_jump_target);
last_bb = EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb;
new_bb = create_basic_block (new_label, new_jump, last_bb);