arm.h (PREFERRED_RELOAD_CLASS): Remove.
authorAnatoly Sokolov <aesok@post.ru>
Mon, 2 Apr 2012 18:45:13 +0000 (22:45 +0400)
committerAnatoly Sokolov <aesok@gcc.gnu.org>
Mon, 2 Apr 2012 18:45:13 +0000 (22:45 +0400)
* config/arm/arm.h (PREFERRED_RELOAD_CLASS): Remove.
* config/arm/arm.c (TARGET_PREFERRED_RELOAD_CLASS): Define.
(arm_preferred_reload_class): New function.

From-SVN: r186092

gcc/ChangeLog
gcc/config/arm/arm.c
gcc/config/arm/arm.h

index 2d4fb1d49d41e1e55483be1fd666752ff6324396..8a341dd06ed76cdd71d8db9c25032bf2f38eb5c0 100644 (file)
@@ -1,3 +1,9 @@
+2012-04-02  Anatoly Sokolov  <aesok@post.ru>
+
+       * config/arm/arm.h (PREFERRED_RELOAD_CLASS): Remove.
+       * config/arm/arm.c (TARGET_PREFERRED_RELOAD_CLASS): Define.
+       (arm_preferred_reload_class): New function.
+
 2012-04-02  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/52756
index 9af66dd8ace6c952428bc5f604f60a6444b49be8..5522fc12172d245ebc9a81a9a07004b14ccc1c4c 100644 (file)
@@ -82,6 +82,7 @@ static int arm_legitimate_index_p (enum machine_mode, rtx, RTX_CODE, int);
 static int thumb2_legitimate_index_p (enum machine_mode, rtx, int);
 static int thumb1_base_register_rtx_p (rtx, enum machine_mode, int);
 static rtx arm_legitimize_address (rtx, rtx, enum machine_mode);
+static reg_class_t arm_preferred_reload_class (rtx, reg_class_t);
 static rtx thumb_legitimize_address (rtx, rtx, enum machine_mode);
 inline static int thumb1_index_register_rtx_p (rtx, int);
 static bool arm_legitimate_address_p (enum machine_mode, rtx, bool);
@@ -576,6 +577,9 @@ static const struct attribute_spec arm_attribute_table[] =
 #undef TARGET_LEGITIMATE_ADDRESS_P
 #define TARGET_LEGITIMATE_ADDRESS_P    arm_legitimate_address_p
 
+#undef TARGET_PREFERRED_RELOAD_CLASS
+#define TARGET_PREFERRED_RELOAD_CLASS arm_preferred_reload_class
+
 #undef TARGET_INVALID_PARAMETER_TYPE
 #define TARGET_INVALID_PARAMETER_TYPE arm_invalid_parameter_type
 
@@ -6226,6 +6230,30 @@ arm_legitimate_address_p (enum machine_mode mode, rtx x, bool strict_p)
     return thumb1_legitimate_address_p (mode, x, strict_p);
 }
 
+/* Worker function for TARGET_PREFERRED_RELOAD_CLASS.
+
+   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 for the Thumb core registers and
+   immediate constants we prefer a LO_REGS class or a subset.  */
+
+static reg_class_t
+arm_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, reg_class_t rclass)
+{
+  if (TARGET_32BIT)
+    return rclass;
+  else
+    {
+      if (rclass == GENERAL_REGS
+         || rclass == HI_REGS
+         || rclass == NO_REGS
+         || rclass == STACK_REG)
+       return LO_REGS;
+      else
+       return rclass;
+    }
+}
+
 /* Build the SYMBOL_REF for __tls_get_addr.  */
 
 static GTY(()) rtx tls_get_addr_libfunc;
index 443d2ed168dc4e9bf19a977acbfe4b4d614a4fc3..c6b4cc09a46b6ce3da325cdf4c15a7fd405fd4ef 100644 (file)
@@ -1151,16 +1151,6 @@ enum reg_class
 #define TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P \
   arm_small_register_classes_for_mode_p 
 
-/* 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 for the Thumb core registers and
-   immediate constants we prefer a LO_REGS class or a subset.  */
-#define PREFERRED_RELOAD_CLASS(X, CLASS)               \
-  (TARGET_32BIT ? (CLASS) :                            \
-   ((CLASS) == GENERAL_REGS || (CLASS) == HI_REGS      \
-    || (CLASS) == NO_REGS || (CLASS) == STACK_REG      \
-   ? LO_REGS : (CLASS)))
-
 /* Must leave BASE_REGS reloads alone */
 #define THUMB_SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X)             \
   ((CLASS) != LO_REGS && (CLASS) != BASE_REGS                          \