Patchwork [M32C] Hookize PREFERRED_RELOAD_CLASS and PREFERRED_OUTPUT_RELOAD_CLASS

login
register
mail settings
Submitter Anatoly Sokolov
Date Aug. 14, 2011, 3:31 p.m.
Message ID <10910441793.20110814193129@post.ru>
Download mbox | patch
Permalink /patch/109959/
State New
Headers show

Comments

Anatoly Sokolov - Aug. 14, 2011, 3:31 p.m.
Hi.

  This patch removes obsolete PREFERRED_RELOAD_CLASS and 
PREFERRED_OUTPUT_RELOAD_CLASS macros from M32C back end in the GCC and 
introduces equivalent TARGET_PREFERRED_RELOAD_CLASS and
TARGET_PREFERRED_OUTPUT_RELOAD_CLASS target hooks.

  Regression tested on m32c-unknown-elf.

  OK to install?

        * config/m32c/m32c.h (PREFERRED_RELOAD_CLASS,
        PREFERRED_OUTPUT_RELOAD_CLASS): Remove macro.
        * config/m32c/m32c-protos.h (m32c_preferred_reload_class,
        m32c_preferred_output_reload_class): Remove.
        * config/m32c/m32c.c (m32c_preferred_reload_class): Make static.
        Change rclass argument and return types to reg_class_t. Use
        reg_class_subset_p instead of class_sizes.
        (m32c_preferred_output_reload_class): Make static. Change rclass
        argument and return types to reg_class_t.
        (TARGET_PREFERRED_RELOAD_CLASS,
        TARGET_PREFERRED_OUTPUT_RELOAD_CLASS): Define.



Anatoly.
DJ Delorie - Aug. 14, 2011, 7:20 p.m.
Ok.

Patch

Index: gcc/config/m32c/m32c.c
===================================================================
--- gcc/config/m32c/m32c.c      (revision 177745)
+++ gcc/config/m32c/m32c.c      (working copy)
@@ -729,12 +729,16 @@ 
 
 #define DEBUG_RELOAD 0
 
-/* Implements PREFERRED_RELOAD_CLASS.  In general, prefer general
+/* Implements TARGET_PREFERRED_RELOAD_CLASS.  In general, prefer general
    registers of the appropriate size.  */
-int
-m32c_preferred_reload_class (rtx x, int rclass)
+
+#undef TARGET_PREFERRED_RELOAD_CLASS
+#define TARGET_PREFERRED_RELOAD_CLASS m32c_preferred_reload_class
+
+static reg_class_t
+m32c_preferred_reload_class (rtx x, reg_class_t rclass)
 {
-  int newclass = rclass;
+  reg_class_t newclass = rclass;
 
 #if DEBUG_RELOAD
   fprintf (stderr, "\npreferred_reload_class for %s is ",
@@ -759,7 +763,7 @@ 
   else if (newclass == QI_REGS && GET_MODE_SIZE (GET_MODE (x)) > 2)
     newclass = SI_REGS;
   else if (GET_MODE_SIZE (GET_MODE (x)) > 4
-          && ~class_contents[rclass][0] & 0x000f)
+          && ! reg_class_subset_p (R03_REGS, rclass))
     newclass = DI_REGS;
 
   rclass = reduce_class (rclass, newclass, rclass);
@@ -779,9 +783,13 @@ 
   return rclass;
 }
 
-/* Implements PREFERRED_OUTPUT_RELOAD_CLASS.  */
-int
-m32c_preferred_output_reload_class (rtx x, int rclass)
+/* Implements TARGET_PREFERRED_OUTPUT_RELOAD_CLASS.  */
+
+#undef TARGET_PREFERRED_OUTPUT_RELOAD_CLASS
+#define TARGET_PREFERRED_OUTPUT_RELOAD_CLASS m32c_preferred_output_reload_class
+
+static reg_class_t
+m32c_preferred_output_reload_class (rtx x, reg_class_t rclass)
 {
   return m32c_preferred_reload_class (x, rclass);
 }
Index: gcc/config/m32c/m32c.h
===================================================================
--- gcc/config/m32c/m32c.h      (revision 177745)
+++ gcc/config/m32c/m32c.h      (working copy)
@@ -417,8 +417,6 @@ 
 #define REGNO_OK_FOR_BASE_P(NUM) m32c_regno_ok_for_base_p (NUM)
 #define REGNO_OK_FOR_INDEX_P(NUM) 0
 
-#define PREFERRED_RELOAD_CLASS(X,CLASS) m32c_preferred_reload_class (X, CLASS)
-#define PREFERRED_OUTPUT_RELOAD_CLASS(X,CLASS) m32c_preferred_output_reload_class (X, CLASS)
 #define LIMIT_RELOAD_CLASS(MODE,CLASS) \
   (enum reg_class) m32c_limit_reload_class (MODE, CLASS)
 
Index: gcc/config/m32c/m32c-protos.h
===================================================================
--- gcc/config/m32c/m32c-protos.h       (revision 177745)
+++ gcc/config/m32c/m32c-protos.h       (working copy)
@@ -66,8 +66,6 @@ 
 int  m32c_modes_tieable_p (enum machine_mode, enum machine_mode);
 bool m32c_mov_ok (rtx *, enum machine_mode);
 char * m32c_output_compare (rtx, rtx *);
-int  m32c_preferred_output_reload_class (rtx, int);
-int  m32c_preferred_reload_class (rtx, int);
 int  m32c_prepare_move (rtx *, enum machine_mode);
 int  m32c_prepare_shift (rtx *, int, int);
 int  m32c_reg_ok_for_base_p (rtx, int);