aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/pa
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-09-15 12:56:34 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-09-15 12:56:34 +0000
commit0d803030650a6c671b295d3e7d5161e64b59b2f6 (patch)
tree854fba2d2be98f794a0e01b4efb9f6621aab2d03 /gcc/config/pa
parentfa0cdfb651f59951d10331b782c422baad93d3e4 (diff)
downloadgcc-0d803030650a6c671b295d3e7d5161e64b59b2f6.zip
gcc-0d803030650a6c671b295d3e7d5161e64b59b2f6.tar.gz
gcc-0d803030650a6c671b295d3e7d5161e64b59b2f6.tar.bz2
Turn CANNOT_CHANGE_MODE_CLASS into a hook
This also seemed like a good opportunity to reverse the sense of the hook to "can", to avoid the awkward double negative in !CANNOT. 2017-09-15 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayard <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * target.def (can_change_mode_class): New hook. (mode_rep_extended): Refer to it instead of CANNOT_CHANGE_MODE_CLASS. (hard_regno_nregs): Likewise. * hooks.h (hook_bool_mode_mode_reg_class_t_true): Declare. * hooks.c (hook_bool_mode_mode_reg_class_t_true): New function. * doc/tm.texi.in (CANNOT_CHANGE_MODE_CLASS): Replace with... (TARGET_CAN_CHANGE_MODE_CLASS): ...this. (LOAD_EXTEND_OP): Update accordingly. * doc/tm.texi: Regenerate. * doc/rtl.texi: Refer to TARGET_CAN_CHANGE_MODE_CLASS instead of CANNOT_CHANGE_MODE_CLASS. * hard-reg-set.h (REG_CANNOT_CHANGE_MODE_P): Replace with... (REG_CAN_CHANGE_MODE_P): ...this new macro. * combine.c (simplify_set): Update accordingly. * emit-rtl.c (validate_subreg): Likewise. * recog.c (general_operand): Likewise. * regcprop.c (mode_change_ok): Likewise. * reload1.c (choose_reload_regs): Likewise. (inherit_piecemeal_p): Likewise. * rtlanal.c (simplify_subreg_regno): Likewise. * postreload.c (reload_cse_simplify_set): Use REG_CAN_CHANGE_MODE_P instead of CANNOT_CHANGE_MODE_CLASS. (reload_cse_simplify_operands): Likewise. * reload.c (push_reload): Use targetm.can_change_mode_class instead of CANNOT_CHANGE_MODE_CLASS. (push_reload): Likewise. Also use REG_CAN_CHANGE_MODE_P instead of REG_CANNOT_CHANGE_MODE_P. * config/alpha/alpha.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/alpha/alpha.c (alpha_can_change_mode_class): New function. (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. * config/arm/arm.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/arm/arm.c (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. (arm_can_change_mode_class): New function. * config/arm/neon.md: Refer to TARGET_CAN_CHANGE_MODE_CLASS rather than CANNOT_CHANGE_MODE_CLASS in comments. * config/i386/i386.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/i386/i386-protos.h (ix86_cannot_change_mode_class): Delete. * config/i386/i386.c (ix86_cannot_change_mode_class): Replace with... (ix86_can_change_mode_class): ...this new function, inverting the sense of the return value. (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. * config/ia64/ia64.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/ia64/ia64.c (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. (ia64_can_change_mode_class): New function. * config/m32c/m32c.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/m32c/m32c-protos.h (m32c_cannot_change_mode_class): Delete. * config/m32c/m32c.c (m32c_cannot_change_mode_class): Replace with... (m32c_can_change_mode_class): ...this new function, inverting the sense of the return value. (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. * config/mips/mips.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/mips/mips-protos.h (mips_cannot_change_mode_class): Delete. * config/mips/mips.c (mips_cannot_change_mode_class): Replace with... (mips_can_change_mode_class): ...this new function, inverting the sense of the return value. (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. * config/msp430/msp430.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/msp430/msp430.c (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. (msp430_can_change_mode_class): New function. * config/nvptx/nvptx.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/nvptx/nvptx.c (nvptx_can_change_mode_class): New function. (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. * config/pa/pa32-regs.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/pa/pa64-regs.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/pa/pa-protos.h (pa_cannot_change_mode_class): Delete. * config/pa/pa.c (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. (pa_cannot_change_mode_class): Replace with... (pa_can_change_mode_class): ...this new function, inverting the sense of the return value. (pa_modes_tieable_p): Refer to TARGET_CAN_CHANGE_MODE_CLASS rather than CANNOT_CHANGE_MODE_CLASS in comments. * config/pdp11/pdp11.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/pdp11/pdp11-protos.h (pdp11_cannot_change_mode_class): Delete. * config/pdp11/pdp11.c (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. (pdp11_cannot_change_mode_class): Replace with... (pdp11_can_change_mode_class): ...this new function, inverting the sense of the return value. * config/powerpcspe/powerpcspe.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/powerpcspe/powerpcspe-protos.h (rs6000_cannot_change_mode_class_ptr): Delete. * config/powerpcspe/powerpcspe.c (rs6000_cannot_change_mode_class_ptr): Delete. (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. (rs6000_option_override_internal): Assign to targetm.can_change_mode_class instead of rs6000_cannot_change_mode_class_ptr. (rs6000_cannot_change_mode_class): Replace with... (rs6000_can_change_mode_class): ...this new function, inverting the sense of the return value. (rs6000_debug_cannot_change_mode_class): Replace with... (rs6000_debug_can_change_mode_class): ...this new function. * config/riscv/riscv.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/riscv/riscv.c (riscv_can_change_mode_class): New function. (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. * config/rs6000/rs6000.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/rs6000/rs6000-protos.h (rs6000_cannot_change_mode_class_ptr): Delete. * config/rs6000/rs6000.c (rs6000_cannot_change_mode_class_ptr): Delete. (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. (rs6000_option_override_internal): Assign to targetm.can_change_mode_class instead of rs6000_cannot_change_mode_class_ptr. (rs6000_cannot_change_mode_class): Replace with... (rs6000_can_change_mode_class): ...this new function, inverting the sense of the return value. (rs6000_debug_cannot_change_mode_class): Replace with... (rs6000_debug_can_change_mode_class): ...this new function. * config/s390/s390.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/s390/s390-protos.h (s390_cannot_change_mode_class): Delete. * config/s390/s390.c (s390_cannot_change_mode_class): Replace with... (s390_can_change_mode_class): ...this new function, inverting the sense of the return value. (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. * config/sh/sh.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/sh/sh-protos.h (sh_cannot_change_mode_class): Delete. * config/sh/sh.c (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. (sh_cannot_change_mode_class): Replace with... (sh_can_change_mode_class): ...this new function, inverting the sense of the return value. * config/sparc/sparc.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/sparc/sparc.c (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. (sparc_can_change_mode_class): New function. * config/spu/spu.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/spu/spu.c (spu_can_change_mode_class): New function. (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. * config/visium/visium.h (CANNOT_CHANGE_MODE_CLASS): Delete. * config/visium/visium.c (TARGET_CAN_CHANGE_MODE_CLASS): Redefine. (visium_can_change_mode_class): New function. * system.h (CANNOT_CHANGE_MODE_CLASS): Poison. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r252816
Diffstat (limited to 'gcc/config/pa')
-rw-r--r--gcc/config/pa/pa-protos.h2
-rw-r--r--gcc/config/pa/pa.c29
-rw-r--r--gcc/config/pa/pa32-regs.h5
-rw-r--r--gcc/config/pa/pa64-regs.h5
4 files changed, 16 insertions, 25 deletions
diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h
index ba496f9..cbf25af 100644
--- a/gcc/config/pa/pa-protos.h
+++ b/gcc/config/pa/pa-protos.h
@@ -106,8 +106,6 @@ extern void pa_asm_output_aligned_local (FILE *, const char *,
unsigned HOST_WIDE_INT,
unsigned int);
extern void pa_hpux_asm_output_external (FILE *, tree, const char *);
-extern bool pa_cannot_change_mode_class (machine_mode, machine_mode,
- enum reg_class);
extern HOST_WIDE_INT pa_initial_elimination_offset (int, int);
extern const int pa_magic_milli[];
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index f39b672..651ae59 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -204,6 +204,7 @@ static bool pa_callee_copies (cumulative_args_t, machine_mode,
static unsigned int pa_hard_regno_nregs (unsigned int, machine_mode);
static bool pa_hard_regno_mode_ok (unsigned int, machine_mode);
static bool pa_modes_tieable_p (machine_mode, machine_mode);
+static bool pa_can_change_mode_class (machine_mode, machine_mode, reg_class_t);
/* The following extra sections are only used for SOM. */
static GTY(()) section *som_readonly_data_section;
@@ -421,6 +422,9 @@ static size_t n_deferred_plabels = 0;
#undef TARGET_MODES_TIEABLE_P
#define TARGET_MODES_TIEABLE_P pa_modes_tieable_p
+#undef TARGET_CAN_CHANGE_MODE_CLASS
+#define TARGET_CAN_CHANGE_MODE_CLASS pa_can_change_mode_class
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Parse the -mfixed-range= option string. */
@@ -10001,27 +10005,26 @@ pa_hpux_file_end (void)
}
#endif
-/* Return true if a change from mode FROM to mode TO for a register
- in register class RCLASS is invalid. */
+/* Implement TARGET_CAN_CHANGE_MODE_CLASS. */
-bool
-pa_cannot_change_mode_class (machine_mode from, machine_mode to,
- enum reg_class rclass)
+static bool
+pa_can_change_mode_class (machine_mode from, machine_mode to,
+ reg_class_t rclass)
{
if (from == to)
- return false;
+ return true;
if (GET_MODE_SIZE (from) == GET_MODE_SIZE (to))
- return false;
+ return true;
/* Reject changes to/from modes with zero size. */
if (!GET_MODE_SIZE (from) || !GET_MODE_SIZE (to))
- return true;
+ return false;
/* Reject changes to/from complex and vector modes. */
if (COMPLEX_MODE_P (from) || VECTOR_MODE_P (from)
|| COMPLEX_MODE_P (to) || VECTOR_MODE_P (to))
- return true;
+ return false;
/* There is no way to load QImode or HImode values directly from memory
to a FP register. SImode loads to the FP registers are not zero
@@ -10029,16 +10032,16 @@ pa_cannot_change_mode_class (machine_mode from, machine_mode to,
of LOAD_EXTEND_OP. Thus, we can't allow changing between modes with
different sizes in the floating-point registers. */
if (MAYBE_FP_REG_CLASS_P (rclass))
- return true;
+ return false;
/* TARGET_HARD_REGNO_MODE_OK places modes with sizes larger than a word
in specific sets of registers. Thus, we cannot allow changing
to a larger mode when it's larger than a word. */
if (GET_MODE_SIZE (to) > UNITS_PER_WORD
&& GET_MODE_SIZE (to) > GET_MODE_SIZE (from))
- return true;
+ return false;
- return false;
+ return true;
}
/* Implement TARGET_MODES_TIEABLE_P.
@@ -10047,7 +10050,7 @@ pa_cannot_change_mode_class (machine_mode from, machine_mode to,
are not ok in the floating-point registers. However, this prevents
tieing these modes to SImode and DImode in the general registers.
So, this isn't a good idea. We rely on TARGET_HARD_REGNO_MODE_OK and
- CANNOT_CHANGE_MODE_CLASS to prevent these modes from being used
+ TARGET_CAN_CHANGE_MODE_CLASS to prevent these modes from being used
in the floating-point registers. */
static bool
diff --git a/gcc/config/pa/pa32-regs.h b/gcc/config/pa/pa32-regs.h
index f168ecf..d479b1a 100644
--- a/gcc/config/pa/pa32-regs.h
+++ b/gcc/config/pa/pa32-regs.h
@@ -294,11 +294,6 @@ enum reg_class { NO_REGS, R1_REGS, GENERAL_REGS, FPUPPER_REGS, FP_REGS,
{0x00000000, 0x00000000, 0x01000000}, /* SHIFT_REGS */ \
{0xfffffffe, 0xffffffff, 0x03ffffff}} /* ALL_REGS */
-/* Defines invalid mode changes. */
-
-#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
- pa_cannot_change_mode_class (FROM, TO, CLASS)
-
/* Return the class number of the smallest class containing
reg number REGNO. This could be a conditional expression
or could index an array. */
diff --git a/gcc/config/pa/pa64-regs.h b/gcc/config/pa/pa64-regs.h
index 15b8808..d9c8dd4 100644
--- a/gcc/config/pa/pa64-regs.h
+++ b/gcc/config/pa/pa64-regs.h
@@ -230,11 +230,6 @@ enum reg_class { NO_REGS, R1_REGS, GENERAL_REGS, FPUPPER_REGS, FP_REGS,
{0x00000000, 0x10000000}, /* SHIFT_REGS */ \
{0xfffffffe, 0x3fffffff}} /* ALL_REGS */
-/* Defines invalid mode changes. */
-
-#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
- pa_cannot_change_mode_class (FROM, TO, CLASS)
-
/* Return the class number of the smallest class containing
reg number REGNO. This could be a conditional expression
or could index an array. */