Patchwork [MMIX] Hookize PRINT_OPERAND, PRINT_OPERAND_ADDRESS and PRINT_OPERAND_PUNCT_VALID_P

login
register
mail settings
Submitter Anatoly Sokolov
Date July 24, 2011, 8:35 p.m.
Message ID <455836624.20110725003507@post.ru>
Download mbox | patch
Permalink /patch/106572/
State New
Headers show

Comments

Anatoly Sokolov - July 24, 2011, 8:35 p.m.
Hi.

  This patch removes obsolete PRINT_OPERAND, PRINT_OPERAND_ADDRESS and 
PRINT_OPERAND_PUNCT_VALID_P macros from MMIX back end in the GCC and 
introduces equivalent TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS and
TARGET_PRINT_OPERAND_PUNCT_VALID_P target hooks.

  Regression tested on mmix-knuth-mmixware.

  OK to install?

        * config/mmix/mmix.h (PRINT_OPERAND, PRINT_OPERAND_ADDRESS,
        PRINT_OPERAND_PUNCT_VALID_P): Remove macro.
        * config/mmix/mmix-protos.h (mmix_print_operand_punct_valid_p,
        mmix_print_operand, mmix_print_operand_address): Remove.
        * config/mmix/mmix.c (mmix_print_operand_punct_valid_p): Make static.
        Change return type to bool. Change argument type to bool.
        (mmix_print_operand, mmix_print_operand_address): Make static.
        (mmix_intval, mmix_output_condition): Change 'x' argument type 
        to const_rtx.
        (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS,
        TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define.

        


Anatoly.
Hans-Peter Nilsson - July 24, 2011, 8:51 p.m.
On Mon, 25 Jul 2011, Anatoly Sokolov wrote:
> Hi.
>
>   This patch removes obsolete PRINT_OPERAND, PRINT_OPERAND_ADDRESS and
> PRINT_OPERAND_PUNCT_VALID_P macros from MMIX back end in the GCC and
> introduces equivalent TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS and
> TARGET_PRINT_OPERAND_PUNCT_VALID_P target hooks.
>
>   Regression tested on mmix-knuth-mmixware.
>
>   OK to install?
>
>         * config/mmix/mmix.h (PRINT_OPERAND, PRINT_OPERAND_ADDRESS,
>         PRINT_OPERAND_PUNCT_VALID_P): Remove macro.
>         * config/mmix/mmix-protos.h (mmix_print_operand_punct_valid_p,
>         mmix_print_operand, mmix_print_operand_address): Remove.
>         * config/mmix/mmix.c (mmix_print_operand_punct_valid_p): Make static.
>         Change return type to bool. Change argument type to bool.
>         (mmix_print_operand, mmix_print_operand_address): Make static.
>         (mmix_intval, mmix_output_condition): Change 'x' argument type
>         to const_rtx.
>         (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS,
>         TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define.

Ok, thanks!

brgds, H-P

Patch

Index: gcc/config/mmix/mmix.h
===================================================================
--- gcc/config/mmix/mmix.h      (revision 176649)
+++ gcc/config/mmix/mmix.h      (working copy)
@@ -793,15 +793,6 @@ 
  {{"sp", 254}, {":sp", 254}, {"rD", 256}, {"rE", 257},	\
   {"rH", 258}, {"rJ", MMIX_rJ_REGNUM}, {"rO", MMIX_rO_REGNUM}}
 
-#define PRINT_OPERAND(STREAM, X, CODE) \
- mmix_print_operand (STREAM, X, CODE)
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- mmix_print_operand_punct_valid_p (CODE)
-
-#define PRINT_OPERAND_ADDRESS(STREAM, X) \
- mmix_print_operand_address (STREAM, X)
-
 #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
  mmix_asm_output_reg_push (STREAM, REGNO)
 
Index: gcc/config/mmix/mmix-protos.h
===================================================================
--- gcc/config/mmix/mmix-protos.h       (revision 176649)
+++ gcc/config/mmix/mmix-protos.h       (working copy)
@@ -38,7 +38,6 @@ 
 extern void mmix_asm_weaken_label (FILE *, const char *);
 extern void mmix_asm_output_labelref (FILE *, const char *);
 extern void mmix_asm_output_def (FILE *, const char *, const char *);
-extern int mmix_print_operand_punct_valid_p (int);
 extern void mmix_asm_output_reg_push (FILE *, int);
 extern void mmix_asm_output_reg_pop (FILE *, int);
 extern void mmix_asm_output_skip (FILE *, int);
@@ -73,8 +72,6 @@ 
 extern rtx mmix_eh_return_stackadj_rtx (void);
 extern rtx mmix_eh_return_handler_rtx (void);
 extern int mmix_constant_address_p (rtx);
-extern void mmix_print_operand (FILE *, rtx, int);
-extern void mmix_print_operand_address (FILE *, rtx);
 extern void mmix_expand_prologue (void);
 extern void mmix_expand_epilogue (void);
 extern rtx mmix_get_hard_reg_initial_val (enum machine_mode, int);
Index: gcc/config/mmix/mmix.c
===================================================================
--- gcc/config/mmix/mmix.c      (revision 176649)
+++ gcc/config/mmix/mmix.c      (working copy)
@@ -118,8 +118,8 @@ 
 static void mmix_output_shiftvalue_op_from_str
   (FILE *, const char *, HOST_WIDEST_INT);
 static void mmix_output_shifted_value (FILE *, HOST_WIDEST_INT);
-static void mmix_output_condition (FILE *, rtx, int);
-static HOST_WIDEST_INT mmix_intval (rtx);
+static void mmix_output_condition (FILE *, const_rtx, int);
+static HOST_WIDEST_INT mmix_intval (const_rtx);
 static void mmix_output_octa (FILE *, HOST_WIDEST_INT, int);
 static bool mmix_assemble_integer (rtx, unsigned int, int);
 static struct machine_function *mmix_init_machine_status (void);
@@ -159,6 +159,9 @@ 
 static bool mmix_frame_pointer_required (void);
 static void mmix_asm_trampoline_template (FILE *);
 static void mmix_trampoline_init (rtx, tree, rtx);
+static void mmix_print_operand (FILE *, rtx, int);
+static void mmix_print_operand_address (FILE *, rtx);
+static bool mmix_print_operand_punct_valid_p (unsigned char);
 static void mmix_conditional_register_usage (void);
 
 /* Target structure macros.  Listed by node.  See `Using and Porting GCC'
@@ -186,6 +189,13 @@ 
 #undef TARGET_ASM_FUNCTION_EPILOGUE
 #define TARGET_ASM_FUNCTION_EPILOGUE mmix_target_asm_function_epilogue
 
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND mmix_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS mmix_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P mmix_print_operand_punct_valid_p
+
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO  mmix_encode_section_info
 #undef TARGET_STRIP_NAME_ENCODING
@@ -1552,9 +1562,9 @@ 
   fputc ('\n', stream);
 }
 
-/* PRINT_OPERAND.  */
+/* TARGET_PRINT_OPERAND.  */
 
-void
+static void
 mmix_print_operand (FILE *stream, rtx x, int code)
 {
   /* When we add support for different codes later, we can, when needed,
@@ -1779,10 +1789,10 @@ 
     }
 }
 
-/* PRINT_OPERAND_PUNCT_VALID_P.  */
+/* TARGET_PRINT_OPERAND_PUNCT_VALID_P.  */
 
-int
-mmix_print_operand_punct_valid_p (int code ATTRIBUTE_UNUSED)
+static bool
+mmix_print_operand_punct_valid_p (unsigned char code)
 {
   /* A '+' is used for branch prediction, similar to other ports.  */
   return code == '+'
@@ -1790,9 +1800,9 @@ 
     || code == '.';
 }
 
-/* PRINT_OPERAND_ADDRESS.  */
+/* TARGET_PRINT_OPERAND_ADDRESS.  */
 
-void
+static void
 mmix_print_operand_address (FILE *stream, rtx x)
 {
   if (REG_P (x))
@@ -2619,7 +2629,7 @@ 
    same as swapping the arguments).  */
 
 static void
-mmix_output_condition (FILE *stream, rtx x, int reversed)
+mmix_output_condition (FILE *stream, const_rtx x, int reversed)
 {
   struct cc_conv
   {
@@ -2724,7 +2734,7 @@ 
 /* Return the bit-value for a const_int or const_double.  */
 
 static HOST_WIDEST_INT
-mmix_intval (rtx x)
+mmix_intval (const_rtx x)
 {
   unsigned HOST_WIDEST_INT retval;