Hi.

This patch removes obsolete PREFERRED_RELOAD_CLASS macro from the ARM back end in the GCC and introduces equivalent TARGET_PREFERRED_RELOAD_CLASS target hook.

  Bootstrapped and regression tested on arm-unknown-linux-gnueabi.

  OK to install?

        * config/arm/arm.h (PREFERRED_RELOAD_CLASS): Remove.
        * config/arm/arm.c (TARGET_PREFERRED_RELOAD_CLASS): Define.
        (arm_preferred_reload_class): New function.


Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c        (revision 182743)
+++ gcc/config/arm/arm.c        (working copy)
@@ -82,6 +82,7 @@
 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);
@@ -573,6 +574,9 @@
 #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

@@ -6225,6 +6229,30 @@
     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: gcc/config/arm/arm.h
===================================================================
--- gcc/config/arm/arm.h        (revision 182743)
+++ gcc/config/arm/arm.h        (working copy)
@@ -1169,16 +1169,6 @@
 #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                          \



--
Anatoly.

Reply via email to