From: Anatoly Sokolov Date: Mon, 4 Apr 2011 07:11:51 +0000 (+0400) Subject: sparc.h (PREFERRED_RELOAD_CLASS): Remove. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=112a861d6d6cbc78372888692043ebbb70c310d1;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b33bde63421..02bb52209b5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-04-04 Anatoly Sokolov + + * 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 PR debug/48404 diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 1e7ce535654..30c0d34174d 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -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" diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 96733bfe24b..87c29fcb84f 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -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.