Hi.

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

  Compiled. Untested.

  OK to install?

        * config/bfin/bfin.h (PREFERRED_RELOAD_CLASS): Remove.
        * config/bfin/bfin.c (TARGET_PREFERRED_RELOAD_CLASS): Define.
        (bfin_preferred_reload_class): New function.


Index: gcc/config/bfin/bfin.c
===================================================================
--- gcc/config/bfin/bfin.c      (revision 182912)
+++ gcc/config/bfin/bfin.c      (working copy)
@@ -2648,6 +2648,19 @@ split_load_immediate (rtx operands[])
   return 0;
 }
 
+/* Worker function for TARGET_PREFERRED_RELOAD_CLASS.  */
+
+static reg_class_t
+bfin_preferred_reload_class (rtx x, reg_class_t rclass)
+{
+  if (GET_CODE (x) == POST_INC
+      || GET_CODE (x) == POST_DEC
+      || GET_CODE (x) == PRE_DEC)
+    return PREGS;
+
+  return rclass;
+}
+
 /* Return true if the legitimate memory address for a memory operand of mode
    MODE.  Return false if not.  */

@@ -5771,6 +5784,9 @@ bfin_conditional_register_usage (void)
 #undef TARGET_RETURN_IN_MEMORY
 #define TARGET_RETURN_IN_MEMORY bfin_return_in_memory

+#undef  TARGET_PREFERRED_RELOAD_CLASS
+#define TARGET_PREFERRED_RELOAD_CLASS bfin_preferred_reload_class
+
 #undef TARGET_LEGITIMATE_ADDRESS_P
 #define TARGET_LEGITIMATE_ADDRESS_P    bfin_legitimate_address_p

Index: gcc/config/bfin/bfin.h
===================================================================
--- gcc/config/bfin/bfin.h      (revision 182912)
+++ gcc/config/bfin/bfin.h      (working copy)
@@ -707,16 +707,6 @@ enum reg_class
       && GET_MODE_SIZE (MODE1) <= UNITS_PER_WORD    \
       && GET_MODE_SIZE (MODE2) <= UNITS_PER_WORD))

-/* `PREFERRED_RELOAD_CLASS (X, CLASS)'
-   A C expression that places additional restrictions on the register
-   class to use when it is necessary to copy value X into a register
-   in class CLASS.  The value is a register class; perhaps CLASS, or
-   perhaps another, smaller class.  */
-#define PREFERRED_RELOAD_CLASS(X, CLASS)               \
-  (GET_CODE (X) == POST_INC                            \
-   || GET_CODE (X) == POST_DEC                         \
-   || GET_CODE (X) == PRE_DEC ? PREGS : (CLASS))
-
 /* Function Calling Conventions. */

 /* The type of the current function; normal functions are of type


--
Anatoly.

Reply via email to