aboutsummaryrefslogtreecommitdiff
path: root/gcc/reload.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1993-11-04 19:00:08 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1993-11-04 19:00:08 -0500
commit3a322c50e1f6cd93718cf2281b24d2b77c48735a (patch)
treeb76b24b22594b9bd8e9c2faab2fe3c3045ee7e7d /gcc/reload.c
parentfd28789a7a600be9db838f62e81bf8c86b4d5f34 (diff)
downloadgcc-3a322c50e1f6cd93718cf2281b24d2b77c48735a.zip
gcc-3a322c50e1f6cd93718cf2281b24d2b77c48735a.tar.gz
gcc-3a322c50e1f6cd93718cf2281b24d2b77c48735a.tar.bz2
(find_reloads, case 'o'): A pseudo is not always an offsettable memref.
(find_reloads): If we reload a constant into a register via memory, count it as two reloads. From-SVN: r6000
Diffstat (limited to 'gcc/reload.c')
-rw-r--r--gcc/reload.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/gcc/reload.c b/gcc/reload.c
index ca2ed81..af4ff98 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -2822,7 +2822,14 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
|| reg_equiv_address[REGNO (XEXP (operand, 0))] != 0))
|| (GET_CODE (operand) == REG
&& REGNO (operand) >= FIRST_PSEUDO_REGISTER
- && reg_renumber[REGNO (operand)] < 0))
+ && reg_renumber[REGNO (operand)] < 0
+ /* If reg_equiv_address is nonzero, we will be
+ loading it into a register; hence it will be
+ offsettable, but we cannot say that reg_equiv_mem
+ is offsettable without checking. */
+ && ((reg_equiv_mem[REGNO (operand)] != 0
+ && offsettable_memref_p (reg_equiv_mem[REGNO (operand)]))
+ || (reg_equiv_address[REGNO (operand)] != 0))))
win = 1;
if (CONSTANT_P (operand) || GET_CODE (operand) == MEM)
badop = 0;
@@ -2979,6 +2986,22 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
else if (modified[i] != RELOAD_WRITE && no_input_reloads)
bad = 1;
+ /* If this is a constant that is reloaded into the desired
+ class by copying it to memory first, count that as another
+ reload. This is consistent with other code and is
+ required to avoid chosing another alternative when
+ the constant is moved into memory by this function on
+ an early reload pass. Note that the test here is
+ precisely the same as in the code below that calls
+ force_const_mem. */
+ if (CONSTANT_P (operand)
+ && (PREFERRED_RELOAD_CLASS (operand,
+ (enum reg_class) this_alternative[i])
+ == NO_REGS)
+ && this_alternative[i] != (int) NO_REGS
+ && operand_mode[i] != VOIDmode)
+ losers++;
+
/* We prefer to reload pseudos over reloading other things,
since such reloads may be able to be eliminated later.
If we are reloading a SCRATCH, we won't be generating any
@@ -3323,7 +3346,11 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
;
/* Handle an operand with a nonoffsettable address
appearing where an offsettable address will do
- by reloading the address into a base register. */
+ by reloading the address into a base register.
+
+ ??? We can also do this when the operand is a register and
+ reg_equiv_mem is not offsettable, but this is a bit tricky,
+ so we don't bother with it. It may not be worth doing. */
else if (goal_alternative_matched[i] == -1
&& goal_alternative_offmemok[i]
&& GET_CODE (recog_operand[i]) == MEM)