[PATCH/RFA] Updated patch to fix VAX casesi
Jason R Thorpe
thorpej@wasabisystems.com
Fri Jun 21 11:37:00 GMT 2002
This is an update of Richard's patch to fix casesi on VAX. The
change from the original is to check for NULL note in
force_nonfallthru_and_redirect() as was discussed in a follow-up
message.
This has been bootstrapped on vax-netbsdelf, and I'm bootstrapping it
on i386-netbsdelf right now as a sanity check.
OK to checkin if bootstrap succeeds?
2002-06-21 Richard Henderson <rth@redhat.com>
* bb-reorder.c (make_reorder_chain_1): Search harder for the
vax casesi fallthru edge.
* cfglayout.c (cleanup_unconditional_jumps): Use
redirect_edge_succ_nodup. Do not delete ADDR_VEC insns as dead.
* cfgrtl.c (force_nonfallthru_and_redirect): Place redirection
block after ADDR_VEC.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
-------------- next part --------------
Index: bb-reorder.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bb-reorder.c,v
retrieving revision 1.49
diff -c -r1.49 bb-reorder.c
*** bb-reorder.c 26 May 2002 15:01:11 -0000 1.49
--- bb-reorder.c 21 Jun 2002 18:20:13 -0000
***************
*** 209,224 ****
/* In the absence of a prediction, disturb things as little as possible
by selecting the old "next" block from the list of successors. If
there had been a fallthru edge, that will be the one. */
if (! next)
{
for (e = bb->succ; e ; e = e->succ_next)
! if (e->dest == bb->next_bb)
{
! if ((e->flags & EDGE_FALLTHRU)
! || (e->dest->succ
! && ! (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))))
! next = e->dest;
break;
}
}
--- 209,228 ----
/* In the absence of a prediction, disturb things as little as possible
by selecting the old "next" block from the list of successors. If
there had been a fallthru edge, that will be the one. */
+ /* Note the special exception of the VAX casesi fallthru, which may not
+ have been next, but should be selected, if possible. */
if (! next)
{
for (e = bb->succ; e ; e = e->succ_next)
! if (e->flags & EDGE_FALLTHRU)
{
! next = e->dest;
break;
+ }
+ else if (e->dest == bb->next_bb)
+ {
+ if (! (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH)))
+ next = e->dest;
}
}
Index: cfglayout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfglayout.c,v
retrieving revision 1.20
diff -c -r1.20 cfglayout.c
*** cfglayout.c 21 Jun 2002 02:09:10 -0000 1.20
--- cfglayout.c 21 Jun 2002 18:20:14 -0000
***************
*** 608,617 ****
}
/* Remove any unconditional jumps and forwarder block creating fallthru
! edges instead. During BB reordering fallthru edges are not required
to target next basic block in the linear CFG layout, so the unconditional
! jumps are not needed. If LOOPS is not null, also update loop structure &
! dominators. */
static void
cleanup_unconditional_jumps ()
--- 608,616 ----
}
/* Remove any unconditional jumps and forwarder block creating fallthru
! edges instead. During BB reordering, fallthru edges are not required
to target next basic block in the linear CFG layout, so the unconditional
! jumps are not needed. */
static void
cleanup_unconditional_jumps ()
***************
*** 636,642 ****
fprintf (rtl_dump_file, "Removing forwarder BB %i\n",
bb->index);
! redirect_edge_succ (bb->pred, bb->succ->dest);
flow_delete_block (bb);
bb = prev;
}
--- 635,641 ----
fprintf (rtl_dump_file, "Removing forwarder BB %i\n",
bb->index);
! redirect_edge_succ_nodup (bb->pred, bb->succ->dest);
flow_delete_block (bb);
bb = prev;
}
***************
*** 653,660 ****
else
continue;
- /* Cleanup barriers and delete ADDR_VECs in a way as they are belonging
- to removed tablejump anyway. */
insn = NEXT_INSN (bb->end);
while (insn
&& (GET_CODE (insn) != NOTE
--- 652,657 ----
***************
*** 664,675 ****
if (GET_CODE (insn) == BARRIER)
delete_barrier (insn);
- else if (GET_CODE (insn) == JUMP_INSN)
- delete_insn_chain (PREV_INSN (insn), insn);
- else if (GET_CODE (insn) == CODE_LABEL)
- ;
- else if (GET_CODE (insn) != NOTE)
- abort ();
insn = next;
}
--- 661,666 ----
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.57
diff -c -r1.57 cfgrtl.c
*** cfgrtl.c 11 Jun 2002 12:21:31 -0000 1.57
--- cfgrtl.c 21 Jun 2002 18:20:16 -0000
***************
*** 963,971 ****
if (e->src->succ->succ_next)
{
/* Create the new structures. */
note = last_loop_beg_note (e->src->end);
! jump_block
! = create_basic_block (NEXT_INSN (note), NULL, e->src);
jump_block->count = e->count;
jump_block->frequency = EDGE_FREQUENCY (e);
jump_block->loop_depth = target->loop_depth;
--- 963,983 ----
if (e->src->succ->succ_next)
{
/* Create the new structures. */
+
+ /* Position the new block correctly relative to loop notes. */
note = last_loop_beg_note (e->src->end);
! note = NEXT_INSN (note);
!
! /* ... and ADDR_VECs. */
! if (note != NULL
! && GET_CODE (note) == CODE_LABEL
! && NEXT_INSN (note)
! && GET_CODE (NEXT_INSN (note)) == JUMP_INSN
! && (GET_CODE (PATTERN (NEXT_INSN (note))) == ADDR_DIFF_VEC
! || GET_CODE (PATTERN (NEXT_INSN (note))) == ADDR_VEC))
! note = NEXT_INSN (NEXT_INSN (note));
!
! jump_block = create_basic_block (note, NULL, e->src);
jump_block->count = e->count;
jump_block->frequency = EDGE_FREQUENCY (e);
jump_block->loop_depth = target->loop_depth;
More information about the Gcc-patches
mailing list