summaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2001-05-11 00:23:46 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2001-05-11 00:23:46 +0000
commit0f48207facfb59e819decab5bc50dfece083993d (patch)
tree9bf173c8776b5b1ef61f9b9b504a5ad7e05abb16 /gcc/cse.c
parentc037cba785c0ebb425f593565b282586907adbb8 (diff)
downloadgcc-0f48207facfb59e819decab5bc50dfece083993d.tar.gz
* cse.c (cse_insn): Mostly remove first hunk of code which collapsed
a computed jump into an unconditional jump. In second hunk of code for collapsing computed and conditional jumps into unconditional jumps, reemit the jump in additional cases. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41953 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 85716533792..f3978e4b257 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5518,31 +5518,17 @@ cse_insn (insn, libcall_insn)
check for this separately here. We will delete such an
insn below.
- Tablejump insns contain a USE of the table, so simply replacing
- the operand with the constant won't match. This is simply an
- unconditional branch, however, and is therefore valid. Just
- insert the substitution here and we will delete and re-emit
- the insn later. */
-
+ For other cases such as a table jump or conditional jump
+ where we know the ultimate target, go ahead and replace the
+ operand. While that may not make a valid insn, we will
+ reemit the jump below (and also insert any necessary
+ barriers). */
if (n_sets == 1 && dest == pc_rtx
&& (trial == pc_rtx
|| (GET_CODE (trial) == LABEL_REF
&& ! condjump_p (insn))))
{
- if (trial == pc_rtx)
- {
- SET_SRC (sets[i].rtl) = trial;
- cse_jumps_altered = 1;
- break;
- }
-
- PATTERN (insn) = gen_jump (XEXP (trial, 0));
- INSN_CODE (insn) = -1;
-
- if (NEXT_INSN (insn) != 0
- && GET_CODE (NEXT_INSN (insn)) != BARRIER)
- emit_barrier_after (insn);
-
+ SET_SRC (sets[i].rtl) = trial;
cse_jumps_altered = 1;
break;
}
@@ -5804,13 +5790,17 @@ cse_insn (insn, libcall_insn)
}
/* If this SET is now setting PC to a label, we know it used to
- be a conditional or computed branch. So we see if we can follow
- it. If it was a computed branch, delete it and re-emit. */
+ be a conditional or computed branch. */
else if (dest == pc_rtx && GET_CODE (src) == LABEL_REF)
{
- /* If this is not in the format for a simple branch and
- we are the only SET in it, re-emit it. */
- if (! simplejump_p (insn) && n_sets == 1)
+ /* We reemit the jump in as many cases as possible just in
+ case the form of an unconditional jump is significantly
+ different than a computed jump or conditional jump.
+
+ If this insn has multiple sets, then reemitting the
+ jump is nontrivial. So instead we just force rerecognition
+ and hope for the best. */
+ if (n_sets == 1)
{
rtx new = emit_jump_insn_before (gen_jump (XEXP (src, 0)), insn);
JUMP_LABEL (new) = XEXP (src, 0);
@@ -5818,11 +5808,6 @@ cse_insn (insn, libcall_insn)
insn = new;
}
else
- /* Otherwise, force rerecognition, since it probably had
- a different pattern before.
- This shouldn't really be necessary, since whatever
- changed the source value above should have done this.
- Until the right place is found, might as well do this here. */
INSN_CODE (insn) = -1;
never_reached_warning (insn);