aboutsummaryrefslogtreecommitdiff
path: root/gcc/reload.c
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@redhat.com>2003-11-02 09:34:54 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2003-11-02 09:34:54 +0000
commit0938c9e8fb1cdb88de2c3ff465835d18e049e813 (patch)
tree417cb41087b6a363102c51ebf7a4358bd360b492 /gcc/reload.c
parente69cdc1237a4be0650026452ee57b886f1b1dbbe (diff)
downloadgcc-0938c9e8fb1cdb88de2c3ff465835d18e049e813.zip
gcc-0938c9e8fb1cdb88de2c3ff465835d18e049e813.tar.gz
gcc-0938c9e8fb1cdb88de2c3ff465835d18e049e813.tar.bz2
Makefile.in (targhooks.o, reload.o): Update dependencies.
* Makefile.in (targhooks.o, reload.o): Update dependencies. (GTFILES): Add targhooks.c. (gt-targhooks.h): New rule; depend on s-gtype. * target.h (direct_pool_load_p): New hook. * target-def.h (TARGET_DIRECT_POOL_LOAD_P): New macro. (TARGET_INITIALIZER): Include it. * targhooks.h (default_direct_pool_load_p): Declare. (hook_bool_machine_mode_true): Declare. * targhooks.c: Include insn-config.h, recog.h, ggc.h and gt-targhooks.h. (pool_symbol): New variable. (default_direct_pool_load_p): New function. (hook_bool_machine_mode_true): New function. * reload.c: Include target.h. (find_reloads): If an alternative will force a constant into memory, count an extra reload if constant pool symbols are not valid addresses. If an alternative uses memory to move values between registers, count the move as two reloads rather than one. * config/s390/s390.c (TARGET_DIRECT_POOL_LOAD_P): Define. * doc/tm.texi (TARGET_DIRECT_POOL_LOAD_P): Document. From-SVN: r73196
Diffstat (limited to 'gcc/reload.c')
-rw-r--r--gcc/reload.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/reload.c b/gcc/reload.c
index 8bd68c5..13dd25e 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -104,6 +104,7 @@ a register with any other reload. */
#include "output.h"
#include "function.h"
#include "toplev.h"
+#include "target.h"
#ifndef REGNO_MODE_OK_FOR_BASE_P
#define REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) REGNO_OK_FOR_BASE_P (REGNO)
@@ -3369,6 +3370,11 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
const_to_mem = 1;
if (this_alternative[i] != (int) NO_REGS)
losers++;
+
+ /* If constant pool symbols are not valid addresses,
+ count an extra reload for the address. */
+ if (!targetm.direct_pool_load_p (operand_mode[i]))
+ losers++;
}
/* If we can't reload this value at all, reject this
@@ -3394,6 +3400,21 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
&& ! const_to_mem)
bad = 1;
+#ifdef SECONDARY_MEMORY_NEEDED
+ /* If this alternative would use memory to move a value
+ between registers, it would need two reloads, one for
+ the load and one for the store. Account for the extra
+ reload here. */
+ if (GET_CODE (operand) == REG
+ && REGNO (operand) < FIRST_PSEUDO_REGISTER
+ && this_alternative[i] != NO_REGS
+ && (SECONDARY_MEMORY_NEEDED
+ (this_alternative[i],
+ REGNO_REG_CLASS (REGNO (operand)),
+ GET_MODE (operand))))
+ losers++;
+#endif
+
/* 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