[MIPS] Hookize PREFERRED_RELOAD_CLASS

Anatoly Sokolov aesok@post.ru
Mon Mar 7 14:31:00 GMT 2011


  Hi.

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

  Bootstrapped and regression tested on mips64el-unknown-linux-gnu.

        * config/mips/mips.h (PREFERRED_RELOAD_CLASS): Remove macro.
        * config/mips/mips-protos.h (mips_preferred_reload_class): Remove.
        * config/mips/mips.c (mips_preferred_reload_class): Make static.
        Change 'rclass' argument and result type to reg_class_t.
        (TARGET_PREFERRED_RELOAD_CLASS): Define.

Index: gcc/config/mips/mips-protos.h
===================================================================
--- gcc/config/mips/mips-protos.h       (revision 170216)
+++ gcc/config/mips/mips-protos.h       (working copy)
@@ -283,7 +283,6 @@
                                           enum machine_mode, enum reg_class);
 extern bool mips_dangerous_for_la25_p (rtx);
 extern bool mips_modes_tieable_p (enum machine_mode, enum machine_mode);
-extern enum reg_class mips_preferred_reload_class (rtx, enum reg_class);
 extern enum reg_class mips_secondary_reload_class (enum reg_class,
                                                   enum machine_mode,
                                                   rtx, bool);
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c      (revision 170216)
+++ gcc/config/mips/mips.c      (working copy)
@@ -10804,10 +10804,10 @@
              && !mips_mode_ok_for_mov_fmt_p (mode2)));
 }
 
-/* Implement PREFERRED_RELOAD_CLASS.  */
+/* Implement TARGET_PREFERRED_RELOAD_CLASS.  */
 
-enum reg_class
-mips_preferred_reload_class (rtx x, enum reg_class rclass)
+static reg_class_t
+mips_preferred_reload_class (rtx x, reg_class_t rclass)
 {
   if (mips_dangerous_for_la25_p (x) && reg_class_subset_p (LEA_REGS, rclass))
     return LEA_REGS;
@@ -16487,6 +16487,9 @@
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG mips_reorg
 
+#undef  TARGET_PREFERRED_RELOAD_CLASS
+#define TARGET_PREFERRED_RELOAD_CLASS mips_preferred_reload_class
+
 #undef TARGET_ASM_FILE_START
 #define TARGET_ASM_FILE_START mips_file_start
 #undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
Index: gcc/config/mips/mips.h
===================================================================
--- gcc/config/mips/mips.h      (revision 170216)
+++ gcc/config/mips/mips.h      (working copy)
@@ -2028,9 +2028,6 @@
 #define SMALL_INT_UNSIGNED(X) SMALL_OPERAND_UNSIGNED (INTVAL (X))
 #define LUI_INT(X) LUI_OPERAND (INTVAL (X))
 
-#define PREFERRED_RELOAD_CLASS(X,CLASS)                                        \
-  mips_preferred_reload_class (X, CLASS)
-
 /* The HI and LO registers can only be reloaded via the general
    registers.  Condition code registers can only be loaded to the
    general registers, and from the floating point registers.  */


Anatoly.



More information about the Gcc-patches mailing list