aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-03-30 12:46:57 -0800
committerRichard Henderson <rth@gcc.gnu.org>2003-03-30 12:46:57 -0800
commite1233a7dc0b2ab2e7d9cb5f0138a9de8f65125e5 (patch)
tree1f8da9ec73c4ebabe1b0846460e0317b29ff02a4
parent9b703090abb0b72c28ddfe1804d93bc6af5ec6a0 (diff)
downloadgcc-e1233a7dc0b2ab2e7d9cb5f0138a9de8f65125e5.zip
gcc-e1233a7dc0b2ab2e7d9cb5f0138a9de8f65125e5.tar.gz
gcc-e1233a7dc0b2ab2e7d9cb5f0138a9de8f65125e5.tar.bz2
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
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/cfgbuild.c8
-rw-r--r--gcc/cfgcleanup.c7
-rw-r--r--gcc/cfglayout.c7
-rw-r--r--gcc/cfgrtl.c33
-rw-r--r--gcc/cse.c16
-rw-r--r--gcc/jump.c5
-rw-r--r--gcc/rtlanal.c8
-rw-r--r--gcc/ssa-ccp.c7
9 files changed, 32 insertions, 72 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4599a07..3b02fd1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,16 @@
+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.
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index d698f3b..889ae9d 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -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;
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 23436d5..8ca6c41 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -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);
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index c95ac38..b5be7ca 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -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. */
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 5e47236..c7194b5 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -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;
diff --git a/gcc/cse.c b/gcc/cse.c
index 9f6b96d..94eb8d0 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -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:
diff --git a/gcc/jump.c b/gcc/jump.c
index 15c9d36..6e04790 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -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
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index dc87e45..f7923c2 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -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);
diff --git a/gcc/ssa-ccp.c b/gcc/ssa-ccp.c
index 085f18f..abd557e 100644
--- a/gcc/ssa-ccp.c
+++ b/gcc/ssa-ccp.c
@@ -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)