aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/powerpcspe
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-09-13 17:05:16 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-09-13 17:05:16 +0000
commitf15643d4ea7103ad1bd9ef893f4c211624e1614d (patch)
tree794d8c949f2b13fdb15f7c1b2d4cacb4b7a6f2e8 /gcc/config/powerpcspe
parent94e23f53d700769c453d31881c089d06cde823dd (diff)
downloadgcc-f15643d4ea7103ad1bd9ef893f4c211624e1614d.zip
gcc-f15643d4ea7103ad1bd9ef893f4c211624e1614d.tar.gz
gcc-f15643d4ea7103ad1bd9ef893f4c211624e1614d.tar.bz2
Turn SECONDARY_MEMORY_NEEDED into a hook
Since the patch is going through all the definitions anyway, it seemed like a good opportunity to put the mode argument first, to match the order for register_move_cost. 2017-09-13 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * target.def (secondary_memory_needed): New hook. (secondary_reload): Refer to TARGET_SECONDARY_MEMORY_NEEDED instead of SECONDARY_MEMORY_NEEDED. (secondary_memory_needed_mode): Likewise. * hooks.h (hook_bool_mode_reg_class_t_reg_class_t_false): Declare. * hooks.c (hook_bool_mode_reg_class_t_reg_class_t_false): New function. * doc/tm.texi.in (SECONDARY_MEMORY_NEEDED): Replace with... (TARGET_SECONDARY_MEMORY_NEEDED): ...this. (SECONDARY_MEMORY_NEEDED_RTX): Update reference accordingly. * doc/tm.texi: Regenerate. * config/alpha/alpha.h (SECONDARY_MEMORY_NEEDED): Delete. * config/alpha/alpha.c (alpha_secondary_memory_needed): New function. (TARGET_SECONDARY_MEMORY_NEEDED): Redefine. * config/i386/i386.h (SECONDARY_MEMORY_NEEDED): Delete. * config/i386/i386-protos.h (ix86_secondary_memory_needed): Delete. * config/i386/i386.c (inline_secondary_memory_needed): Put the mode argument first and change the reg_class arguments to reg_class_t. (ix86_secondary_memory_needed): Likewise. Remove the strict parameter. Make static. Update the call to inline_secondary_memory_needed. (ix86_register_move_cost): Update the call to inline_secondary_memory_needed. (TARGET_SECONDARY_MEMORY_NEEDED): Redefine. * config/ia64/ia64.h (SECONDARY_MEMORY_NEEDED): Delete commented-out definition. * config/ia64/ia64.c (spill_xfmode_rfmode_operand): Refer to TARGET_SECONDARY_MEMORY_NEEDED rather than SECONDARY_MEMORY_NEEDED in comment. * config/mips/mips.h (SECONDARY_MEMORY_NEEDED): Delete. * config/mips/mips-protos.h (mips_secondary_memory_needed): Delete. * config/mips/mips.c (mips_secondary_memory_needed): Make static and match hook interface. Add comment from mips.h. (TARGET_SECONDARY_MEMORY_NEEDED): Redefine. * config/mmix/mmix.md (truncdfsf2): Refer to TARGET_SECONDARY_MEMORY_NEEDED rather than SECONDARY_MEMORY_NEEDED in comment. * config/pa/pa-64.h (SECONDARY_MEMORY_NEEDED): Rename to... (PA_SECONDARY_MEMORY_NEEDED): ...this, and put the mode argument first. * config/pa/pa.c (TARGET_SECONDARY_MEMORY_NEEDED): Redefine. (pa_secondary_memory_needed): New function. * config/pdp11/pdp11.h (SECONDARY_MEMORY_NEEDED): Delete. * config/pdp11/pdp11-protos.h (pdp11_secondary_memory_needed): Delete. * config/pdp11/pdp11.c (TARGET_SECONDARY_MEMORY_NEEDED): Redefine. (pdp11_secondary_memory_needed): Make static and match hook interface. * config/powerpcspe/powerpcspe.h (SECONDARY_MEMORY_NEEDED): Delete. * config/powerpcspe/powerpcspe-protos.h (rs6000_secondary_memory_needed_ptr): Delete. * config/powerpcspe/powerpcspe.c (rs6000_secondary_memory_needed_ptr): Delete. (TARGET_SECONDARY_MEMORY_NEEDED): Redefine. (rs6000_option_override_internal): Assign to targetm.secondary_memory_needed rather than rs6000_secondary_memory_needed_ptr. (rs6000_secondary_memory_needed): Match hook interface. (rs6000_debug_secondary_memory_needed): Likewise. * config/riscv/riscv.h (SECONDARY_MEMORY_NEEDED): Delete. * config/riscv/riscv.c (riscv_secondary_memory_needed): New function. (riscv_register_move_cost): Use it instead of SECONDARY_MEMORY_NEEDED. (TARGET_SECONDARY_MEMORY_NEEDED): Redefine. * config/rs6000/rs6000.h (SECONDARY_MEMORY_NEEDED): Delete. * config/rs6000/rs6000-protos.h (rs6000_secondary_memory_needed_ptr): Delete. * config/rs6000/rs6000.c (rs6000_secondary_memory_needed_ptr): Delete. (TARGET_SECONDARY_MEMORY_NEEDED): Redefine. (rs6000_option_override_internal): Assign to targetm.secondary_memory_needed rather than rs6000_secondary_memory_needed_ptr. (rs6000_secondary_memory_needed): Match hook interface. (rs6000_debug_secondary_memory_needed): Likewise. * config/s390/s390.h (SECONDARY_MEMORY_NEEDED): Delete. * config/s390/s390.c (s390_secondary_memory_needed): New function. (TARGET_SECONDARY_MEMORY_NEEDED): Redefine. * config/sparc/sparc.h (SECONDARY_MEMORY_NEEDED): Delete. * config/sparc/sparc.c (TARGET_SECONDARY_MEMORY_NEEDED): Redefine. (sparc_secondary_memory_needed): New function. * lra-constraints.c (check_and_process_move): Refer to TARGET_SECONDARY_MEMORY_NEEDED rather than SECONDARY_MEMORY_NEEDED in comment. (curr_insn_transform): Likewise. (process_alt_operands): Use targetm.secondary_memory_needed instead of TARGET_SECONDARY_MEMORY_NEEDED. (check_secondary_memory_needed_p): Likewise. (choose_split_class): Likewise. * reload.c: Unconditionally include code that was previously conditional on SECONDARY_MEMORY_NEEDED. (push_secondary_reload): Use targetm.secondary_memory_needed instead of TARGET_SECONDARY_MEMORY_NEEDED. (push_reload): Likewise. * reload1.c: Unconditionally include code that was previously conditional on SECONDARY_MEMORY_NEEDED. (choose_reload_regs): Use targetm.secondary_memory_needed instead of TARGET_SECONDARY_MEMORY_NEEDED. (gen_reload): Likewise. * system.h (SECONDARY_MEMORY_NEEDED): Poison. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r252461
Diffstat (limited to 'gcc/config/powerpcspe')
-rw-r--r--gcc/config/powerpcspe/powerpcspe-protos.h3
-rw-r--r--gcc/config/powerpcspe/powerpcspe.c30
-rw-r--r--gcc/config/powerpcspe/powerpcspe.h8
3 files changed, 13 insertions, 28 deletions
diff --git a/gcc/config/powerpcspe/powerpcspe-protos.h b/gcc/config/powerpcspe/powerpcspe-protos.h
index f3aa41b..c87a6a0 100644
--- a/gcc/config/powerpcspe/powerpcspe-protos.h
+++ b/gcc/config/powerpcspe/powerpcspe-protos.h
@@ -109,9 +109,6 @@ extern enum reg_class (*rs6000_preferred_reload_class_ptr) (rtx,
extern enum reg_class (*rs6000_secondary_reload_class_ptr) (enum reg_class,
machine_mode,
rtx);
-extern bool (*rs6000_secondary_memory_needed_ptr) (enum reg_class,
- enum reg_class,
- machine_mode);
extern bool (*rs6000_cannot_change_mode_class_ptr) (machine_mode,
machine_mode,
enum reg_class);
diff --git a/gcc/config/powerpcspe/powerpcspe.c b/gcc/config/powerpcspe/powerpcspe.c
index 9b8d68b..499dc1d 100644
--- a/gcc/config/powerpcspe/powerpcspe.c
+++ b/gcc/config/powerpcspe/powerpcspe.c
@@ -1384,11 +1384,9 @@ static enum reg_class rs6000_debug_secondary_reload_class (enum reg_class,
static enum reg_class rs6000_preferred_reload_class (rtx, enum reg_class);
static enum reg_class rs6000_debug_preferred_reload_class (rtx,
enum reg_class);
-static bool rs6000_secondary_memory_needed (enum reg_class, enum reg_class,
- machine_mode);
-static bool rs6000_debug_secondary_memory_needed (enum reg_class,
- enum reg_class,
- machine_mode);
+static bool rs6000_debug_secondary_memory_needed (machine_mode,
+ reg_class_t,
+ reg_class_t);
static bool rs6000_cannot_change_mode_class (machine_mode,
machine_mode,
enum reg_class);
@@ -1412,10 +1410,6 @@ enum reg_class (*rs6000_secondary_reload_class_ptr) (enum reg_class,
enum reg_class (*rs6000_preferred_reload_class_ptr) (rtx, enum reg_class)
= rs6000_preferred_reload_class;
-bool (*rs6000_secondary_memory_needed_ptr) (enum reg_class, enum reg_class,
- machine_mode)
- = rs6000_secondary_memory_needed;
-
bool (*rs6000_cannot_change_mode_class_ptr) (machine_mode,
machine_mode,
enum reg_class)
@@ -1897,6 +1891,8 @@ static const struct attribute_spec rs6000_attribute_table[] =
#undef TARGET_SECONDARY_RELOAD
#define TARGET_SECONDARY_RELOAD rs6000_secondary_reload
+#undef TARGET_SECONDARY_MEMORY_NEEDED
+#define TARGET_SECONDARY_MEMORY_NEEDED rs6000_secondary_memory_needed
#undef TARGET_SECONDARY_MEMORY_NEEDED_MODE
#define TARGET_SECONDARY_MEMORY_NEEDED_MODE rs6000_secondary_memory_needed_mode
@@ -5098,7 +5094,7 @@ rs6000_option_override_internal (bool global_init_p)
targetm.legitimize_address = rs6000_debug_legitimize_address;
rs6000_secondary_reload_class_ptr
= rs6000_debug_secondary_reload_class;
- rs6000_secondary_memory_needed_ptr
+ targetm.secondary_memory_needed
= rs6000_debug_secondary_memory_needed;
rs6000_cannot_change_mode_class_ptr
= rs6000_debug_cannot_change_mode_class;
@@ -23149,9 +23145,9 @@ rs6000_debug_preferred_reload_class (rtx x, enum reg_class rclass)
set and vice versa. */
static bool
-rs6000_secondary_memory_needed (enum reg_class from_class,
- enum reg_class to_class,
- machine_mode mode)
+rs6000_secondary_memory_needed (machine_mode mode,
+ reg_class_t from_class,
+ reg_class_t to_class)
{
enum rs6000_reg_type from_type, to_type;
bool altivec_p = ((from_class == ALTIVEC_REGS)
@@ -23175,11 +23171,11 @@ rs6000_secondary_memory_needed (enum reg_class from_class,
/* Debug version of rs6000_secondary_memory_needed. */
static bool
-rs6000_debug_secondary_memory_needed (enum reg_class from_class,
- enum reg_class to_class,
- machine_mode mode)
+rs6000_debug_secondary_memory_needed (machine_mode mode,
+ reg_class_t from_class,
+ reg_class_t to_class)
{
- bool ret = rs6000_secondary_memory_needed (from_class, to_class, mode);
+ bool ret = rs6000_secondary_memory_needed (mode, from_class, to_class);
fprintf (stderr,
"rs6000_secondary_memory_needed, return: %s, from_class = %s, "
diff --git a/gcc/config/powerpcspe/powerpcspe.h b/gcc/config/powerpcspe/powerpcspe.h
index 5d1a138..be3d0e8 100644
--- a/gcc/config/powerpcspe/powerpcspe.h
+++ b/gcc/config/powerpcspe/powerpcspe.h
@@ -1596,14 +1596,6 @@ extern enum reg_class rs6000_constraints[RS6000_CONSTRAINT_MAX];
#define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
rs6000_secondary_reload_class_ptr (CLASS, MODE, IN)
-/* If we are copying between FP or AltiVec registers and anything
- else, we need a memory location. The exception is when we are
- targeting ppc64 and the move to/from fpr to gpr instructions
- are available.*/
-
-#define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
- rs6000_secondary_memory_needed_ptr (CLASS1, CLASS2, MODE)
-
/* For cpus that cannot load/store SDmode values from the 64-bit
FP registers without using a full 64-bit load/store, we need
to allocate a full 64-bit stack slot for them. */