* config/sparc/sparc.h (PREFERRED_RELOAD_CLASS): Remove.
* config/sparc/sparc.c (TARGET_PREFERRED_RELOAD_CLASS): Define.
(sparc_preferred_reload_class): New function.
From-SVN: r171925
+2011-04-04 Anatoly Sokolov <aesok@post.ru>
+
+ * config/sparc/sparc.h (PREFERRED_RELOAD_CLASS): Remove.
+ * config/sparc/sparc.c (TARGET_PREFERRED_RELOAD_CLASS): Define.
+ (sparc_preferred_reload_class): New function.
+
2011-04-04 Jakub Jelinek <jakub@redhat.com>
PR debug/48404
#endif
static void sparc_trampoline_init (rtx, tree, rtx);
static enum machine_mode sparc_preferred_simd_mode (enum machine_mode);
+static reg_class_t sparc_preferred_reload_class (rtx x, reg_class_t rclass);
\f
#ifdef SUBTARGET_ATTRIBUTE_TABLE
/* Table of valid machine attributes. */
#undef TARGET_CAN_ELIMINATE
#define TARGET_CAN_ELIMINATE sparc_can_eliminate
+#undef TARGET_PREFERRED_RELOAD_CLASS
+#define TARGET_PREFERRED_RELOAD_CLASS sparc_preferred_reload_class
#undef TARGET_CONDITIONAL_REGISTER_USAGE
#define TARGET_CONDITIONAL_REGISTER_USAGE sparc_conditional_register_usage
fixed_regs[4] = 0;
}
+/* Implement TARGET_PREFERRED_RELOAD_CLASS
+
+ - We can't load constants into FP registers.
+ - We can't load FP constants into integer registers when soft-float,
+ because there is no soft-float pattern with a r/F constraint.
+ - We can't load FP constants into integer registers for TFmode unless
+ it is 0.0L, because there is no movtf pattern with a r/F constraint.
+ - Try and reload integer constants (symbolic or otherwise) back into
+ registers directly, rather than having them dumped to memory. */
+
+static reg_class_t
+sparc_preferred_reload_class (rtx x, reg_class_t rclass)
+{
+ if (CONSTANT_P (x))
+ {
+ if (FP_REG_CLASS_P (rclass)
+ || rclass == GENERAL_OR_FP_REGS
+ || rclass == GENERAL_OR_EXTRA_FP_REGS
+ || (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT && ! TARGET_FPU)
+ || (GET_MODE (x) == TFmode && ! const_zero_operand (x, TFmode)))
+ return NO_REGS;
+
+ if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
+ return GENERAL_REGS;
+ }
+
+ return rclass;
+}
+
#include "gt-sparc.h"
#define SPARC_SETHI32_P(X) \
(SPARC_SETHI_P ((unsigned HOST_WIDE_INT) (X) & GET_MODE_MASK (SImode)))
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-/* - We can't load constants into FP registers.
- - We can't load FP constants into integer registers when soft-float,
- because there is no soft-float pattern with a r/F constraint.
- - We can't load FP constants into integer registers for TFmode unless
- it is 0.0L, because there is no movtf pattern with a r/F constraint.
- - Try and reload integer constants (symbolic or otherwise) back into
- registers directly, rather than having them dumped to memory. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- (CONSTANT_P (X) \
- ? ((FP_REG_CLASS_P (CLASS) \
- || (CLASS) == GENERAL_OR_FP_REGS \
- || (CLASS) == GENERAL_OR_EXTRA_FP_REGS \
- || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
- && ! TARGET_FPU) \
- || (GET_MODE (X) == TFmode \
- && ! const_zero_operand (X, TFmode))) \
- ? NO_REGS \
- : (!FP_REG_CLASS_P (CLASS) \
- && GET_MODE_CLASS (GET_MODE (X)) == MODE_INT) \
- ? GENERAL_REGS \
- : (CLASS)) \
- : (CLASS))
-
/* Return the register class of a scratch register needed to load IN into
a register of class CLASS in MODE.