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>
* Makefile.in (STRICT_WARN): Don't warn for ISO C constructs.
......
......@@ -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))
;
/* ??? Recognize a tablejump and do the right thing. */
else if ((tmp = JUMP_LABEL (insn)) != 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))
/* Recognize a tablejump and do the right thing. */
else if (tablejump_p (insn, NULL, &tmp))
{
rtvec vec;
int j;
......
......@@ -656,12 +656,7 @@ label_is_jump_target_p (label, jump_insn)
if (label == tmp)
return true;
if (tmp != NULL_RTX
&& (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))
if (tablejump_p (jump_insn, NULL, &tmp))
{
rtvec vec = XVEC (tmp, GET_CODE (tmp) == ADDR_DIFF_VEC);
int i, veclen = GET_NUM_ELEM (vec);
......
......@@ -760,7 +760,6 @@ bool
cfg_layout_can_duplicate_bb_p (bb)
basic_block bb;
{
rtx next;
edge s;
if (bb == EXIT_BLOCK_PTR || bb == ENTRY_BLOCK_PTR)
......@@ -775,11 +774,7 @@ cfg_layout_can_duplicate_bb_p (bb)
/* Do not attempt to duplicate tablejumps, as we need to unshare
the dispatch table. This is difficult to do, as the instructions
computing jump destination may be hoisted outside the basic block. */
if (GET_CODE (bb->end) == JUMP_INSN && JUMP_LABEL (bb->end)
&& (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))
if (tablejump_p (bb->end, NULL, NULL))
return false;
/* Do not duplicate blocks containing insns that can't be copied. */
......
......@@ -383,12 +383,7 @@ flow_delete_block_noexpunge (b)
/* Include any jump table following the basic block. */
end = b->end;
if (GET_CODE (end) == JUMP_INSN
&& (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))
if (tablejump_p (end, NULL, &tmp))
end = tmp;
/* Include any barrier that may follow the basic block. */
......@@ -674,7 +669,7 @@ try_redirect_by_replacing_jump (e, target)
basic_block src = e->src;
rtx insn = src->end, kill_from;
edge tmp;
rtx set, table;
rtx set;
int fallthru = 0;
/* Verify that all targets will be TARGET. */
......@@ -684,11 +679,7 @@ try_redirect_by_replacing_jump (e, target)
if (tmp || !onlyjump_p (insn))
return false;
if (flow2_completed && JUMP_LABEL (insn)
&& (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))
if ((!optimize || flow2_completed) && tablejump_p (insn, NULL, NULL))
return false;
/* Avoid removing branch with side effects. */
......@@ -739,7 +730,7 @@ try_redirect_by_replacing_jump (e, target)
else
{
rtx target_label = block_label (target);
rtx barrier, tmp;
rtx barrier, label, table;
emit_jump_insn_after (gen_jump (target_label), insn);
JUMP_LABEL (src->end) = target_label;
......@@ -754,14 +745,8 @@ try_redirect_by_replacing_jump (e, target)
/* Recognize a tablejump that we are converting to a
simple jump and remove its associated CODE_LABEL
and ADDR_VEC or ADDR_DIFF_VEC. */
if ((tmp = JUMP_LABEL (insn)) != 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))
{
delete_insn_chain (JUMP_LABEL (insn), tmp);
}
if (tablejump_p (insn, &label, &table))
delete_insn_chain (label, table);
barrier = next_nonnote_insn (src->end);
if (!barrier || GET_CODE (barrier) != BARRIER)
......@@ -854,11 +839,7 @@ redirect_edge_and_branch (e, target)
return false;
/* Recognize a tablejump and adjust all matching cases. */
if ((tmp = JUMP_LABEL (insn)) != 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))
if (tablejump_p (insn, NULL, &tmp))
{
rtvec vec;
int j;
......
......@@ -3352,17 +3352,11 @@ fold_rtx (x, insn)
/* 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
lets us fold switch statements on the VAX. */
if (insn && GET_CODE (insn) == JUMP_INSN)
{
rtx next = next_nonnote_insn (insn);
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);
}
{
rtx next;
if (tablejump_p (insn, &next, NULL))
return gen_rtx_LABEL_REF (Pmode, next);
}
break;
case SUBREG:
......
......@@ -1757,10 +1757,7 @@ delete_related_insns (insn)
next = NEXT_INSN (next);
return next;
}
else if ((lab_next = next_nonnote_insn (lab)) != NULL
&& GET_CODE (lab_next) == JUMP_INSN
&& (GET_CODE (PATTERN (lab_next)) == ADDR_VEC
|| GET_CODE (PATTERN (lab_next)) == ADDR_DIFF_VEC))
else if (tablejump_p (insn, NULL, &lab_next))
{
/* If we're deleting the tablejump, delete the dispatch table.
We may not be able to kill the label immediately preceding
......
......@@ -466,13 +466,7 @@ get_jump_table_offset (insn, earliest)
rtx old_y;
int i;
if (GET_CODE (insn) != JUMP_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)))
if (!tablejump_p (insn, &label, &table) || !(set = single_set (insn)))
return NULL_RTX;
x = SET_SRC (set);
......
......@@ -948,12 +948,7 @@ ssa_ccp_df_delete_unreachable_insns ()
/* Include any jump table following the basic block. */
end = b->end;
if (GET_CODE (end) == JUMP_INSN
&& (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))
if (tablejump_p (end, NULL, &tmp))
end = tmp;
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