[mips] hookize PRINT_OPERAND &co.

Nathan Froyd froydnj@codesourcery.com
Tue Jun 8 00:23:00 GMT 2010


On Mon, Jun 07, 2010 at 10:23:51PM +0100, Richard Sandiford wrote:
> Nathan Froyd <froydnj@codesourcery.com> writes:
> > @@ -7619,7 +7628,7 @@ mips_print_operand (FILE *file, rtx op, int letter)
> >  
> >  /* Output address operand X to FILE.  */
> >  
> > -void
> > +static void
> >  mips_print_operand_address (FILE *file, rtx x)
> >  {
> >    struct mips_address_info addr;
> 
> ...please change the comment to "Implement TARGET_PRINT_OPERAND_ADDRESS.",
> for consistency with the others.

Thanks for the quick review.  I committed the following, with
config/mips/$FILE in the ChangeLog entry and "Implement $HOOK." comments
for TARGET_PRINT_OPERAND{,_PUNCT_VALID_P}.

-Nathan

        * config/mips/mips-protos.h (mips_print_operand): Delete.
	(mips_print_operand_address): Delete.
	* config/mips/mips.h (mips_print_operand_punct): Delete.
	(PRINT_OPERAND): Delete.
	(PRINT_OPERAND_PUNCT_VALID_P): Delete.
	(PRINT_OPERAND_ADDRESS): Delete.
	* config/mips/mips.c (mips_print_operand_punct): Make static.
	(mips_print_operand_address): Make static.
	(mips_print_operand): Make static.  Call
	mips_print_operand_punct_valid_p.
	(mips_print_operand_punct_valid_p): New function.
	(TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define.
	(TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define.

Index: config/mips/mips-protos.h
===================================================================
--- config/mips/mips-protos.h	(revision 160411)
+++ config/mips/mips-protos.h	(working copy)
@@ -260,8 +260,6 @@ extern HOST_WIDE_INT mips_debugger_offse
 
 extern void mips_push_asm_switch (struct mips_asm_switch *);
 extern void mips_pop_asm_switch (struct mips_asm_switch *);
-extern void mips_print_operand (FILE *, rtx, int);
-extern void mips_print_operand_address (FILE *, rtx);
 extern void mips_output_external (FILE *, tree, const char *);
 extern void mips_output_filename (FILE *, const char *);
 extern void mips_output_ascii (FILE *, const char *, size_t);
Index: config/mips/mips.c
===================================================================
--- config/mips/mips.c	(revision 160411)
+++ config/mips/mips.c	(working copy)
@@ -548,7 +548,7 @@ bool mips_hard_regno_mode_ok[(int) MAX_M
 
 /* Index C is true if character C is a valid PRINT_OPERAND punctation
    character.  */
-bool mips_print_operand_punct[256];
+static bool mips_print_operand_punct[256];
 
 static GTY (()) int mips_output_filename_first_time = 1;
 
@@ -7446,7 +7446,15 @@ mips_print_float_branch_condition (FILE 
     }
 }
 
-/* Implement the PRINT_OPERAND macro.  The MIPS-specific operand codes are:
+/* Implement TARGET_PRINT_OPERAND_PUNCT_VALID_P.  */
+
+static bool
+mips_print_operand_punct_valid_p (unsigned char code)
+{
+  return mips_print_operand_punct[code];
+}
+
+/* Implement TARGET_PRINT_OPERAND.  The MIPS-specific operand codes are:
 
    'X'	Print CONST_INT OP in hexadecimal format.
    'x'	Print the low 16 bits of CONST_INT OP in hexadecimal format.
@@ -7470,12 +7478,12 @@ mips_print_float_branch_condition (FILE 
    'M'	Print high-order register in a double-word register operand.
    'z'	Print $0 if OP is zero, otherwise print OP normally.  */
 
-void
+static void
 mips_print_operand (FILE *file, rtx op, int letter)
 {
   enum rtx_code code;
 
-  if (PRINT_OPERAND_PUNCT_VALID_P (letter))
+  if (mips_print_operand_punct_valid_p (letter))
     {
       mips_print_operand_punctuation (file, letter);
       return;
@@ -7617,9 +7625,9 @@ mips_print_operand (FILE *file, rtx op, 
     }
 }
 
-/* Output address operand X to FILE.  */
+/* Implement TARGET_PRINT_OPERAND_ADDRESS.  */
 
-void
+static void
 mips_print_operand_address (FILE *file, rtx x)
 {
   struct mips_address_info addr;
@@ -16377,6 +16385,13 @@ void mips_function_profiler (FILE *file)
 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
 #define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
 
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND mips_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS mips_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P mips_print_operand_punct_valid_p
+
 #undef TARGET_SETUP_INCOMING_VARARGS
 #define TARGET_SETUP_INCOMING_VARARGS mips_setup_incoming_varargs
 #undef TARGET_STRICT_ARGUMENT_NAMING
Index: config/mips/mips.h
===================================================================
--- config/mips/mips.h	(revision 160411)
+++ config/mips/mips.h	(working copy)
@@ -2704,10 +2704,6 @@ typedef struct mips_args {
 
 #define ALL_COP_ADDITIONAL_REGISTER_NAMES
 
-#define PRINT_OPERAND mips_print_operand
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) mips_print_operand_punct[CODE]
-#define PRINT_OPERAND_ADDRESS mips_print_operand_address
-
 #define DBR_OUTPUT_SEQEND(STREAM)					\
 do									\
   {									\
@@ -3060,7 +3056,6 @@ struct mips_asm_switch {
 
 extern const enum reg_class mips_regno_to_class[];
 extern bool mips_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];
-extern bool mips_print_operand_punct[256];
 extern const char *current_function_file; /* filename current function is in */
 extern int num_source_filenames;	/* current .file # */
 extern struct mips_asm_switch mips_noreorder;



More information about the Gcc-patches mailing list