Commit e1233a7d by Richard Henderson Committed by Richard Henderson

cfgbuild.c (make_edges): Use tablejump_p.

        * cfgbuild.c (make_edges): Use tablejump_p.
        * cfgcleanup.c (label_is_jump_target_p): Likewise.
        * cfglayout.c (cfg_layout_can_duplicate_bb_p): Likewise.
        * cfgrtl.c (flow_delete_block_noexpunge): Likewise.
        (try_redirect_by_replacing_jump): Likewise.
        (redirect_edge_and_branch): Likewise.
        * cse.c (fold_rtx): Likewise.
        * jump.c (delete_related_insns): Likewise.
        * rtlanal.c (get_jump_table_offset): Likewise.
        * ssa-ccp.c (ssa_ccp_df_delete_unreachable_insns): Likewise.

From-SVN: r65054
parent 9b703090
2003-03-30 Richard Henderson <rth@redhat.com>
* cfgbuild.c (make_edges): Use tablejump_p.
* cfgcleanup.c (label_is_jump_target_p): Likewise.
* cfglayout.c (cfg_layout_can_duplicate_bb_p): Likewise.
* cfgrtl.c (flow_delete_block_noexpunge): Likewise.
(try_redirect_by_replacing_jump): Likewise.
(redirect_edge_and_branch): Likewise.
* cse.c (fold_rtx): Likewise.
* jump.c (delete_related_insns): Likewise.
* rtlanal.c (get_jump_table_offset): Likewise.
* ssa-ccp.c (ssa_ccp_df_delete_unreachable_insns): Likewise.
2003-03-30 Gabriel Dos Reis <gdr@integrable-solutions.net> 2003-03-30 Gabriel Dos Reis <gdr@integrable-solutions.net>
* Makefile.in (STRICT_WARN): Don't warn for ISO C constructs. * Makefile.in (STRICT_WARN): Don't warn for ISO C constructs.
......
...@@ -343,12 +343,8 @@ make_edges (label_value_list, min, max, update_p) ...@@ -343,12 +343,8 @@ make_edges (label_value_list, min, max, update_p)
else if (find_reg_note (insn, REG_NON_LOCAL_GOTO, NULL_RTX)) else if (find_reg_note (insn, REG_NON_LOCAL_GOTO, NULL_RTX))
; ;
/* ??? Recognize a tablejump and do the right thing. */ /* Recognize a tablejump and do the right thing. */
else if ((tmp = JUMP_LABEL (insn)) != NULL_RTX else if (tablejump_p (insn, NULL, &tmp))
&& (tmp = NEXT_INSN (tmp)) != NULL_RTX
&& GET_CODE (tmp) == JUMP_INSN
&& (GET_CODE (PATTERN (tmp)) == ADDR_VEC
|| GET_CODE (PATTERN (tmp)) == ADDR_DIFF_VEC))
{ {
rtvec vec; rtvec vec;
int j; int j;
......
...@@ -656,12 +656,7 @@ label_is_jump_target_p (label, jump_insn) ...@@ -656,12 +656,7 @@ label_is_jump_target_p (label, jump_insn)
if (label == tmp) if (label == tmp)
return true; return true;
if (tmp != NULL_RTX if (tablejump_p (jump_insn, NULL, &tmp))
&& (tmp = NEXT_INSN (tmp)) != NULL_RTX
&& GET_CODE (tmp) == JUMP_INSN
&& (tmp = PATTERN (tmp),
GET_CODE (tmp) == ADDR_VEC
|| GET_CODE (tmp) == ADDR_DIFF_VEC))
{ {
rtvec vec = XVEC (tmp, GET_CODE (tmp) == ADDR_DIFF_VEC); rtvec vec = XVEC (tmp, GET_CODE (tmp) == ADDR_DIFF_VEC);
int i, veclen = GET_NUM_ELEM (vec); int i, veclen = GET_NUM_ELEM (vec);
......
...@@ -760,7 +760,6 @@ bool ...@@ -760,7 +760,6 @@ bool
cfg_layout_can_duplicate_bb_p (bb) cfg_layout_can_duplicate_bb_p (bb)
basic_block bb; basic_block bb;
{ {
rtx next;
edge s; edge s;
if (bb == EXIT_BLOCK_PTR || bb == ENTRY_BLOCK_PTR) if (bb == EXIT_BLOCK_PTR || bb == ENTRY_BLOCK_PTR)
...@@ -775,11 +774,7 @@ cfg_layout_can_duplicate_bb_p (bb) ...@@ -775,11 +774,7 @@ cfg_layout_can_duplicate_bb_p (bb)
/* Do not attempt to duplicate tablejumps, as we need to unshare /* Do not attempt to duplicate tablejumps, as we need to unshare
the dispatch table. This is difficult to do, as the instructions the dispatch table. This is difficult to do, as the instructions
computing jump destination may be hoisted outside the basic block. */ computing jump destination may be hoisted outside the basic block. */
if (GET_CODE (bb->end) == JUMP_INSN && JUMP_LABEL (bb->end) if (tablejump_p (bb->end, NULL, NULL))
&& (next = next_nonnote_insn (JUMP_LABEL (bb->end)))
&& GET_CODE (next) == JUMP_INSN
&& (GET_CODE (PATTERN (next)) == ADDR_VEC
|| GET_CODE (PATTERN (next)) == ADDR_DIFF_VEC))
return false; return false;
/* Do not duplicate blocks containing insns that can't be copied. */ /* Do not duplicate blocks containing insns that can't be copied. */
......
...@@ -383,12 +383,7 @@ flow_delete_block_noexpunge (b) ...@@ -383,12 +383,7 @@ flow_delete_block_noexpunge (b)
/* Include any jump table following the basic block. */ /* Include any jump table following the basic block. */
end = b->end; end = b->end;
if (GET_CODE (end) == JUMP_INSN if (tablejump_p (end, NULL, &tmp))
&& (tmp = JUMP_LABEL (end)) != NULL_RTX
&& (tmp = NEXT_INSN (tmp)) != NULL_RTX
&& GET_CODE (tmp) == JUMP_INSN
&& (GET_CODE (PATTERN (tmp)) == ADDR_VEC
|| GET_CODE (PATTERN (tmp)) == ADDR_DIFF_VEC))
end = tmp; end = tmp;
/* Include any barrier that may follow the basic block. */ /* Include any barrier that may follow the basic block. */
...@@ -674,7 +669,7 @@ try_redirect_by_replacing_jump (e, target) ...@@ -674,7 +669,7 @@ try_redirect_by_replacing_jump (e, target)
basic_block src = e->src; basic_block src = e->src;
rtx insn = src->end, kill_from; rtx insn = src->end, kill_from;
edge tmp; edge tmp;
rtx set, table; rtx set;
int fallthru = 0; int fallthru = 0;
/* Verify that all targets will be TARGET. */ /* Verify that all targets will be TARGET. */
...@@ -684,11 +679,7 @@ try_redirect_by_replacing_jump (e, target) ...@@ -684,11 +679,7 @@ try_redirect_by_replacing_jump (e, target)
if (tmp || !onlyjump_p (insn)) if (tmp || !onlyjump_p (insn))
return false; return false;
if (flow2_completed && JUMP_LABEL (insn) if ((!optimize || flow2_completed) && tablejump_p (insn, NULL, NULL))
&& (table = NEXT_INSN (JUMP_LABEL (insn))) != NULL_RTX
&& GET_CODE (table) == JUMP_INSN
&& (GET_CODE (PATTERN (table)) == ADDR_VEC
|| GET_CODE (PATTERN (table)) == ADDR_DIFF_VEC))
return false; return false;
/* Avoid removing branch with side effects. */ /* Avoid removing branch with side effects. */
...@@ -739,7 +730,7 @@ try_redirect_by_replacing_jump (e, target) ...@@ -739,7 +730,7 @@ try_redirect_by_replacing_jump (e, target)
else else
{ {
rtx target_label = block_label (target); rtx target_label = block_label (target);
rtx barrier, tmp; rtx barrier, label, table;
emit_jump_insn_after (gen_jump (target_label), insn); emit_jump_insn_after (gen_jump (target_label), insn);
JUMP_LABEL (src->end) = target_label; JUMP_LABEL (src->end) = target_label;
...@@ -754,14 +745,8 @@ try_redirect_by_replacing_jump (e, target) ...@@ -754,14 +745,8 @@ try_redirect_by_replacing_jump (e, target)
/* Recognize a tablejump that we are converting to a /* Recognize a tablejump that we are converting to a
simple jump and remove its associated CODE_LABEL simple jump and remove its associated CODE_LABEL
and ADDR_VEC or ADDR_DIFF_VEC. */ and ADDR_VEC or ADDR_DIFF_VEC. */
if ((tmp = JUMP_LABEL (insn)) != NULL_RTX if (tablejump_p (insn, &label, &table))
&& (tmp = NEXT_INSN (tmp)) != NULL_RTX delete_insn_chain (label, table);
&& GET_CODE (tmp) == JUMP_INSN
&& (GET_CODE (PATTERN (tmp)) == ADDR_VEC
|| GET_CODE (PATTERN (tmp)) == ADDR_DIFF_VEC))
{
delete_insn_chain (JUMP_LABEL (insn), tmp);
}
barrier = next_nonnote_insn (src->end); barrier = next_nonnote_insn (src->end);
if (!barrier || GET_CODE (barrier) != BARRIER) if (!barrier || GET_CODE (barrier) != BARRIER)
...@@ -854,11 +839,7 @@ redirect_edge_and_branch (e, target) ...@@ -854,11 +839,7 @@ redirect_edge_and_branch (e, target)
return false; return false;
/* Recognize a tablejump and adjust all matching cases. */ /* Recognize a tablejump and adjust all matching cases. */
if ((tmp = JUMP_LABEL (insn)) != NULL_RTX if (tablejump_p (insn, NULL, &tmp))
&& (tmp = NEXT_INSN (tmp)) != NULL_RTX
&& GET_CODE (tmp) == JUMP_INSN
&& (GET_CODE (PATTERN (tmp)) == ADDR_VEC
|| GET_CODE (PATTERN (tmp)) == ADDR_DIFF_VEC))
{ {
rtvec vec; rtvec vec;
int j; int j;
......
...@@ -3352,17 +3352,11 @@ fold_rtx (x, insn) ...@@ -3352,17 +3352,11 @@ fold_rtx (x, insn)
/* If the next insn is a CODE_LABEL followed by a jump table, /* If the next insn is a CODE_LABEL followed by a jump table,
PC's value is a LABEL_REF pointing to that label. That PC's value is a LABEL_REF pointing to that label. That
lets us fold switch statements on the VAX. */ lets us fold switch statements on the VAX. */
if (insn && GET_CODE (insn) == JUMP_INSN) {
{ rtx next;
rtx next = next_nonnote_insn (insn); if (tablejump_p (insn, &next, NULL))
return gen_rtx_LABEL_REF (Pmode, next);
if (next && GET_CODE (next) == CODE_LABEL }
&& NEXT_INSN (next) != 0
&& GET_CODE (NEXT_INSN (next)) == JUMP_INSN
&& (GET_CODE (PATTERN (NEXT_INSN (next))) == ADDR_VEC
|| GET_CODE (PATTERN (NEXT_INSN (next))) == ADDR_DIFF_VEC))
return gen_rtx_LABEL_REF (Pmode, next);
}
break; break;
case SUBREG: case SUBREG:
......
...@@ -1757,10 +1757,7 @@ delete_related_insns (insn) ...@@ -1757,10 +1757,7 @@ delete_related_insns (insn)
next = NEXT_INSN (next); next = NEXT_INSN (next);
return next; return next;
} }
else if ((lab_next = next_nonnote_insn (lab)) != NULL else if (tablejump_p (insn, NULL, &lab_next))
&& GET_CODE (lab_next) == JUMP_INSN
&& (GET_CODE (PATTERN (lab_next)) == ADDR_VEC
|| GET_CODE (PATTERN (lab_next)) == ADDR_DIFF_VEC))
{ {
/* If we're deleting the tablejump, delete the dispatch table. /* If we're deleting the tablejump, delete the dispatch table.
We may not be able to kill the label immediately preceding We may not be able to kill the label immediately preceding
......
...@@ -466,13 +466,7 @@ get_jump_table_offset (insn, earliest) ...@@ -466,13 +466,7 @@ get_jump_table_offset (insn, earliest)
rtx old_y; rtx old_y;
int i; int i;
if (GET_CODE (insn) != JUMP_INSN if (!tablejump_p (insn, &label, &table) || !(set = single_set (insn)))
|| ! (label = JUMP_LABEL (insn))
|| ! (table = NEXT_INSN (label))
|| GET_CODE (table) != JUMP_INSN
|| (GET_CODE (PATTERN (table)) != ADDR_VEC
&& GET_CODE (PATTERN (table)) != ADDR_DIFF_VEC)
|| ! (set = single_set (insn)))
return NULL_RTX; return NULL_RTX;
x = SET_SRC (set); x = SET_SRC (set);
......
...@@ -948,12 +948,7 @@ ssa_ccp_df_delete_unreachable_insns () ...@@ -948,12 +948,7 @@ ssa_ccp_df_delete_unreachable_insns ()
/* Include any jump table following the basic block. */ /* Include any jump table following the basic block. */
end = b->end; end = b->end;
if (GET_CODE (end) == JUMP_INSN if (tablejump_p (end, NULL, &tmp))
&& (tmp = JUMP_LABEL (end)) != NULL_RTX
&& (tmp = NEXT_INSN (tmp)) != NULL_RTX
&& GET_CODE (tmp) == JUMP_INSN
&& (GET_CODE (PATTERN (tmp)) == ADDR_VEC
|| GET_CODE (PATTERN (tmp)) == ADDR_DIFF_VEC))
end = tmp; end = tmp;
while (1) while (1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment