Patchwork [MMIX] Hookize PREFERRED_RELOAD_CLASS and PREFERRED_OUTPUT_RELOAD_CLASS

login
register
mail settings
Submitter Anatoly Sokolov
Date Aug. 1, 2011, 5:08 p.m.
Message ID <16210455590.20110801210848@post.ru>
Download mbox | patch
Permalink /patch/107785/
State New
Headers show

Comments

Anatoly Sokolov - Aug. 1, 2011, 5:08 p.m.
Hi.

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

  Regression tested on mmix-knuth-mmixware.

  OK to install?

        * config/mmix/mmix.h (PREFERRED_RELOAD_CLASS,
        PREFERRED_OUTPUT_RELOAD_CLASS): Remove macro.
        * config/mmix/mmix-protos.h (mmix_preferred_reload_class,
        mmix_preferred_output_reload_class): Remove.
        * config/mmix/mmix.c (mmix_preferred_reload_class,
        mmix_preferred_output_reload_class): Make static. Change rclass
        argument and return type to reg_class_t.
        (TARGET_PREFERRED_RELOAD_CLASS,
        TARGET_PREFERRED_OUTPUT_RELOAD_CLASS): Define.


Anatoly.
Richard Henderson - Aug. 1, 2011, 5:59 p.m.
On 08/01/2011 10:08 AM, Anatoly Sokolov wrote:
>         * config/mmix/mmix.h (PREFERRED_RELOAD_CLASS,
>         PREFERRED_OUTPUT_RELOAD_CLASS): Remove macro.
>         * config/mmix/mmix-protos.h (mmix_preferred_reload_class,
>         mmix_preferred_output_reload_class): Remove.
>         * config/mmix/mmix.c (mmix_preferred_reload_class,
>         mmix_preferred_output_reload_class): Make static. Change rclass
>         argument and return type to reg_class_t.
>         (TARGET_PREFERRED_RELOAD_CLASS,
>         TARGET_PREFERRED_OUTPUT_RELOAD_CLASS): Define.


Ok.


r~

Patch

Index: gcc/config/mmix/mmix.h
===================================================================
--- gcc/config/mmix/mmix.h      (revision 176858)
+++ gcc/config/mmix/mmix.h      (working copy)
@@ -452,12 +452,6 @@ 
 
 #define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P (REGNO)
 
-#define PREFERRED_RELOAD_CLASS(X, CLASS) \
- mmix_preferred_reload_class (X, CLASS)
-
-#define PREFERRED_OUTPUT_RELOAD_CLASS(X, CLASS) \
- mmix_preferred_output_reload_class (X, CLASS)
-
 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
  mmix_secondary_reload_class (CLASS, MODE, X, 1)
 
Index: gcc/config/mmix/mmix-protos.h
===================================================================
--- gcc/config/mmix/mmix-protos.h       (revision 176858)
+++ gcc/config/mmix/mmix-protos.h       (working copy)
@@ -59,9 +59,6 @@ 
   (FILE *, tree, int, const char *);
 extern void mmix_asm_output_addr_diff_elt (FILE *, rtx, int, int);
 extern void mmix_asm_output_addr_vec_elt (FILE *, int);
-extern enum reg_class mmix_preferred_reload_class (rtx, enum reg_class);
-extern enum reg_class mmix_preferred_output_reload_class
-  (rtx, enum reg_class);
 extern enum reg_class mmix_secondary_reload_class
   (enum reg_class, enum machine_mode, rtx, int);
 extern int mmix_const_ok_for_letter_p (HOST_WIDE_INT, int);
Index: gcc/config/mmix/mmix.c
===================================================================
--- gcc/config/mmix/mmix.c      (revision 176858)
+++ gcc/config/mmix/mmix.c      (working copy)
@@ -129,6 +129,8 @@ 
 static void mmix_target_asm_function_prologue (FILE *, HOST_WIDE_INT);
 static void mmix_target_asm_function_end_prologue (FILE *);
 static void mmix_target_asm_function_epilogue (FILE *, HOST_WIDE_INT);
+static reg_class_t mmix_preferred_reload_class (rtx, reg_class_t);
+static reg_class_t mmix_preferred_output_reload_class (rtx, reg_class_t);
 static bool mmix_legitimate_address_p (enum machine_mode, rtx, bool);
 static bool mmix_legitimate_constant_p (enum machine_mode, rtx);
 static void mmix_reorg (void);
@@ -250,6 +252,11 @@ 
 #undef TARGET_CALLEE_COPIES
 #define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true
 
+#undef TARGET_PREFERRED_RELOAD_CLASS
+#define TARGET_PREFERRED_RELOAD_CLASS mmix_preferred_reload_class
+#undef TARGET_PREFERRED_OUTPUT_RELOAD_CLASS
+#define TARGET_PREFERRED_OUTPUT_RELOAD_CLASS mmix_preferred_reload_class
+
 #undef TARGET_LEGITIMATE_ADDRESS_P
 #define TARGET_LEGITIMATE_ADDRESS_P    mmix_legitimate_address_p
 #undef TARGET_LEGITIMATE_CONSTANT_P
@@ -409,23 +416,22 @@ 
   return regno <= MMIX_LAST_STACK_REGISTER_REGNUM && !call_used_regs[regno];
 }
 
-/* PREFERRED_RELOAD_CLASS.
+/* TARGET_PREFERRED_RELOAD_CLASS.
    We need to extend the reload class of REMAINDER_REG and HIMULT_REG.  */
 
-enum reg_class
-mmix_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, enum reg_class rclass)
+static reg_class_t
+mmix_preferred_reload_class (rtx x, reg_class_t rclass)
 {
   /* FIXME: Revisit.  */
   return GET_CODE (x) == MOD && GET_MODE (x) == DImode
     ? REMAINDER_REG : rclass;
 }
 
-/* PREFERRED_OUTPUT_RELOAD_CLASS.
+/* TARGET_PREFERRED_OUTPUT_RELOAD_CLASS.
    We need to extend the reload class of REMAINDER_REG and HIMULT_REG.  */
 
-enum reg_class
-mmix_preferred_output_reload_class (rtx x ATTRIBUTE_UNUSED,
-                                   enum reg_class rclass)
+static reg_class_t
+mmix_preferred_output_reload_class (rtx x, reg_class_t rclass)
 {
   /* FIXME: Revisit.  */
   return GET_CODE (x) == MOD && GET_MODE (x) == DImode