OSDN Git Service

* config/sparc/sparc.h (PREFERRED_RELOAD_CLASS): Remove.
authoraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Apr 2011 07:11:51 +0000 (07:11 +0000)
committeraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Apr 2011 07:11:51 +0000 (07:11 +0000)
* config/sparc/sparc.c (TARGET_PREFERRED_RELOAD_CLASS): Define.
(sparc_preferred_reload_class): New function.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171925 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/sparc/sparc.c
gcc/config/sparc/sparc.h

index b33bde6..02bb522 100644 (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
index 1e7ce53..30c0d34 100644 (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);
 \f
 #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"
index 96733bf..87c29fc 100644 (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.