aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ"orn Rennecke <amylaar@cygnus.co.uk>1998-05-14 21:36:53 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>1998-05-14 22:36:53 +0100
commitaa6498c297e5363a57e274c92d142f17701e4e30 (patch)
treef2ad3c92665db1dcbac1c35e41ab86ff894d0999
parent0238952c7937dc3bac9901eb92af5da10f21f31d (diff)
downloadgcc-aa6498c297e5363a57e274c92d142f17701e4e30.zip
gcc-aa6498c297e5363a57e274c92d142f17701e4e30.tar.gz
gcc-aa6498c297e5363a57e274c92d142f17701e4e30.tar.bz2
reload1.c (delete_output_reload): Ignore single USE that was emitted for the pseudo use of this INSN.
* reload1.c (delete_output_reload): Ignore single USE that was emitted for the pseudo use of this INSN. If the no reference to REG between OUTPUT_RELOAD_INSN and INSN remains, we can always delete OUTPUT_RELOAD_INSN. From-SVN: r19762
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/reload1.c51
2 files changed, 45 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bbbbc8f..fce1cc5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+Fri May 15 05:35:37 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * reload1.c (delete_output_reload): Ignore single USE that
+ was emitted for the pseudo use of this INSN.
+ If the no reference to REG between OUTPUT_RELOAD_INSN and INSN
+ remains, we can always delete OUTPUT_RELOAD_INSN.
+
Thu May 14 18:38:50 1998 Jim Wilson <wilson@cygnus.com>
* reload.c (find_reloads): Don't penalize SCRATCH output reload.
diff --git a/gcc/reload1.c b/gcc/reload1.c
index f6d9a0f..1b4e8e4 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -7401,20 +7401,40 @@ delete_output_reload (insn, j, output_reload_insn)
return;
if ((GET_CODE (i1) == INSN || GET_CODE (i1) == CALL_INSN)
&& reg_mentioned_p (reg, PATTERN (i1)))
- return;
+ {
+ /* If this is just a single USE with an REG_EQUAL note in front
+ of INSN, this is no problem, because this mentions just the
+ address that we are using here.
+ But if there is more than one such USE, the insn might use
+ the operand directly, or another reload might do that.
+ This is analogous to the count_occurences check in the callers. */
+ int num_occurences = 0;
+
+ while (GET_CODE (i1) == INSN && GET_CODE (PATTERN (i1)) == USE
+ && find_reg_note (i1, REG_EQUAL, NULL_RTX))
+ {
+ num_occurences += rtx_equal_p (reg, XEXP (PATTERN (i1), 0)) != 0;
+ i1 = NEXT_INSN (i1);
+ }
+ if (num_occurences == 1 && i1 == insn)
+ break;
+ return;
+ }
}
- /* If this insn will store in the pseudo again,
- the previous store can be removed. */
- if (reload_out[j] == reload_in[j])
- delete_insn (output_reload_insn);
-
- /* See if the pseudo reg has been completely replaced
+ /* The caller has already checked that REG dies or is set in INSN.
+ It has also checked that we are optimizing, and thus some inaccurancies
+ in the debugging information are acceptable.
+ So we could just delete output_reload_insn.
+ But in some cases we can improve the debugging information without
+ sacrificing optimization - maybe even improving the code:
+ See if the pseudo reg has been completely replaced
with reload regs. If so, delete the store insn
and forget we had a stack slot for the pseudo. */
- else if (REG_N_DEATHS (REGNO (reg)) == 1
- && REG_BASIC_BLOCK (REGNO (reg)) >= 0
- && find_regno_note (insn, REG_DEAD, REGNO (reg)))
+ if (reload_out[j] != reload_in[j]
+ && REG_N_DEATHS (REGNO (reg)) == 1
+ && REG_BASIC_BLOCK (REGNO (reg)) >= 0
+ && find_regno_note (insn, REG_DEAD, REGNO (reg)))
{
rtx i2;
@@ -7436,9 +7456,12 @@ delete_output_reload (insn, j, output_reload_insn)
break;
if ((GET_CODE (i2) == INSN || GET_CODE (i2) == CALL_INSN)
&& reg_mentioned_p (reg, PATTERN (i2)))
- /* Some other ref remains;
- we can't do anything. */
- return;
+ {
+ /* Some other ref remains; just delete the output reload we
+ know to be dead. */
+ delete_insn (output_reload_insn);
+ return;
+ }
}
/* Delete the now-dead stores into this pseudo. */
@@ -7464,6 +7487,8 @@ delete_output_reload (insn, j, output_reload_insn)
reg_renumber[REGNO (reg)] = REGNO (reload_reg_rtx[j]);
alter_reg (REGNO (reg), -1);
}
+ delete_insn (output_reload_insn);
+
}
/* Output reload-insns to reload VALUE into RELOADREG.