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> 2003-07-17 Eric Botcazou <ebotcazou@libertysurf.fr>
PR optimization/11536 PR optimization/11536

View File

@ -714,25 +714,20 @@ static void
merge_blocks_move_successor_nojumps (basic_block a, basic_block b) merge_blocks_move_successor_nojumps (basic_block a, basic_block b)
{ {
rtx barrier, real_b_end; rtx barrier, real_b_end;
rtx label, table;
real_b_end = b->end; real_b_end = b->end;
barrier = NEXT_INSN (b->end);
/* Recognize a jump table following block B. */ /* If there is a jump table following block B temporarily add the jump table
if (barrier to block B so that it will also be moved to the correct location. */
&& GET_CODE (barrier) == CODE_LABEL if (tablejump_p (b->end, &label, &table)
&& NEXT_INSN (barrier) && prev_active_insn (label) == b->end)
&& GET_CODE (NEXT_INSN (barrier)) == JUMP_INSN
&& (GET_CODE (PATTERN (NEXT_INSN (barrier))) == ADDR_VEC
|| GET_CODE (PATTERN (NEXT_INSN (barrier))) == ADDR_DIFF_VEC))
{ {
/* Temporarily add the table jump insn to b, so that it will also b->end = table;
be moved to the correct location. */
b->end = NEXT_INSN (barrier);
barrier = NEXT_INSN (b->end);
} }
/* There had better have been a barrier there. Delete it. */ /* There had better have been a barrier there. Delete it. */
barrier = NEXT_INSN (b->end);
if (barrier && GET_CODE (barrier) == BARRIER) if (barrier && GET_CODE (barrier) == BARRIER)
delete_insn (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); 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 /* If INSN is a tablejump return true and store the label (before jump table) to
INSN jumps to) to *LABEL and the tablejump insn to *TABLE. *LABELP and the jump table to *TABLEP. LABELP and TABLEP may be NULL. */
LABEL and TABLE may be NULL. */
bool 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) if (GET_CODE (insn) == JUMP_INSN
&& (l = JUMP_LABEL (insn)) != NULL_RTX && (label = JUMP_LABEL (insn)) != NULL_RTX
&& (t = NEXT_INSN (l)) != NULL_RTX && (table = next_active_insn (label)) != NULL_RTX
&& GET_CODE (t) == JUMP_INSN && GET_CODE (table) == JUMP_INSN
&& (GET_CODE (PATTERN (t)) == ADDR_VEC && (GET_CODE (PATTERN (table)) == ADDR_VEC
|| GET_CODE (PATTERN (t)) == ADDR_DIFF_VEC)) || GET_CODE (PATTERN (table)) == ADDR_DIFF_VEC))
{ {
if (label) if (labelp)
*label = l; *labelp = label;
if (table) if (tablep)
*table = t; *tablep = table;
return true; return true;
} }
return false; return false;