cfgcleanup.c (merge_blocks_move_successor_nojumps): Use tablejump_p.

* cfgcleanup.c (merge_blocks_move_successor_nojumps): Use tablejump_p.
	* rtlanal.c (tablejump_p): Use next_active_insn for finding the jump
	table.

From-SVN: r69637
This commit is contained in:
Josef Zlomek 2003-07-21 19:18:00 +02:00 committed by Josef Zlomek
parent f345c6b522
commit ee735eefd8
3 changed files with 27 additions and 27 deletions

View File

@ -1,3 +1,9 @@
2003-07-21 Josef Zlomek <zlomekj@suse.cz>
* cfgcleanup.c (merge_blocks_move_successor_nojumps): Use tablejump_p.
* rtlanal.c (tablejump_p): Use next_active_insn for finding the jump
table.
2003-07-17 Eric Botcazou <ebotcazou@libertysurf.fr>
PR optimization/11536

View File

@ -714,25 +714,20 @@ static void
merge_blocks_move_successor_nojumps (basic_block a, basic_block b)
{
rtx barrier, real_b_end;
rtx label, table;
real_b_end = b->end;
barrier = NEXT_INSN (b->end);
/* Recognize a jump table following block B. */
if (barrier
&& GET_CODE (barrier) == CODE_LABEL
&& NEXT_INSN (barrier)
&& GET_CODE (NEXT_INSN (barrier)) == JUMP_INSN
&& (GET_CODE (PATTERN (NEXT_INSN (barrier))) == ADDR_VEC
|| GET_CODE (PATTERN (NEXT_INSN (barrier))) == ADDR_DIFF_VEC))
/* If there is a jump table following block B temporarily add the jump table
to block B so that it will also be moved to the correct location. */
if (tablejump_p (b->end, &label, &table)
&& prev_active_insn (label) == b->end)
{
/* Temporarily add the table jump insn to b, so that it will also
be moved to the correct location. */
b->end = NEXT_INSN (barrier);
barrier = NEXT_INSN (b->end);
b->end = table;
}
/* There had better have been a barrier there. Delete it. */
barrier = NEXT_INSN (b->end);
if (barrier && GET_CODE (barrier) == BARRIER)
delete_insn (barrier);

View File

@ -2795,26 +2795,25 @@ rtx_referenced_p (rtx x, rtx body)
return for_each_rtx (&body, rtx_referenced_p_1, x);
}
/* If INSN is a jump to jumptable insn rturn true and store the label (which
INSN jumps to) to *LABEL and the tablejump insn to *TABLE.
LABEL and TABLE may be NULL. */
/* If INSN is a tablejump return true and store the label (before jump table) to
*LABELP and the jump table to *TABLEP. LABELP and TABLEP may be NULL. */
bool
tablejump_p (rtx insn, rtx *label, rtx *table)
tablejump_p (rtx insn, rtx *labelp, rtx *tablep)
{
rtx l, t;
rtx label, table;
if (onlyjump_p (insn)
&& (l = JUMP_LABEL (insn)) != NULL_RTX
&& (t = NEXT_INSN (l)) != NULL_RTX
&& GET_CODE (t) == JUMP_INSN
&& (GET_CODE (PATTERN (t)) == ADDR_VEC
|| GET_CODE (PATTERN (t)) == ADDR_DIFF_VEC))
if (GET_CODE (insn) == JUMP_INSN
&& (label = JUMP_LABEL (insn)) != NULL_RTX
&& (table = next_active_insn (label)) != NULL_RTX
&& GET_CODE (table) == JUMP_INSN
&& (GET_CODE (PATTERN (table)) == ADDR_VEC
|| GET_CODE (PATTERN (table)) == ADDR_DIFF_VEC))
{
if (label)
*label = l;
if (table)
*table = t;
if (labelp)
*labelp = label;
if (tablep)
*tablep = table;
return true;
}
return false;