sparc.h (PREFERRED_RELOAD_CLASS): Remove.

* 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
This commit is contained in:
Anatoly Sokolov 2011-04-04 11:11:51 +04:00 committed by Anatoly Sokolov
parent e8c6bb7473
commit 112a861d6d
3 changed files with 38 additions and 28 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -465,6 +465,7 @@ static const char *sparc_mangle_type (const_tree);
#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);
#ifdef SUBTARGET_ATTRIBUTE_TABLE
/* Table of valid machine attributes. */
@ -641,6 +642,8 @@ static const struct default_options sparc_option_optimization_table[] =
#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
@ -9699,4 +9702,33 @@ sparc_conditional_register_usage (void)
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"

View File

@ -1104,34 +1104,6 @@ extern char leaf_reg_remap[];
#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.