diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1993-11-05 00:00:08 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1993-11-05 00:00:08 +0000 |
commit | f57d22b8d06a650a32453c7a12b0af498596bfb1 (patch) | |
tree | b76b24b22594b9bd8e9c2faab2fe3c3045ee7e7d /gcc/reload.c | |
parent | bc834e064cb63450108fdf30e6eb7305cae4f4a2 (diff) | |
download | gcc-f57d22b8d06a650a32453c7a12b0af498596bfb1.tar.gz |
(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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@6000 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reload.c')
-rw-r--r-- | gcc/reload.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/gcc/reload.c b/gcc/reload.c index ca2ed814e81..af4ff981e26 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) |