This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[rs6000] hookize PRINT_OPERAND &co.


The patch below converts the rs6000 port to TARGET_PRINT_OPERAND &co.  I am
planning to commit this at the end of the week if there are no comments.

Tested on powerpc-eabispe.

-Nathan

	* rs6000-protos.h (print_operand): Delete.
	(print_operand_address): Delete.
	* rs6000.h (PRINT_OPERAND): Delete.
	(PRINT_OPERAND_PUNCT_VALID_P): Delete.
	(PRINT_OPERAND_ADDRESS): Delete.
	* rs6000.c (rs6000_print_operand_punct): Make static.
	(rs6000_print_operand_address): Make static.
	(rs6000_print_operand): Make static.  Call rs6000_print_operand
	and rs6000_print_operand_address.
	(rs6000_print_operand_punct_valid_p): New function.
	(TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define.
	(TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define.

--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -85,8 +85,6 @@ extern int ccr_bit (rtx, int);
 extern int extract_MB (rtx);
 extern int extract_ME (rtx);
 extern void rs6000_output_function_entry (FILE *, const char *);
-extern void print_operand (FILE *, rtx, int);
-extern void print_operand_address (FILE *, rtx);
 extern bool rs6000_output_addr_const_extra (FILE *, rtx);
 extern enum rtx_code rs6000_reverse_condition (enum machine_mode,
 					       enum rtx_code);
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -946,6 +946,9 @@ static bool constant_pool_expr_p (rtx);
 static bool legitimate_small_data_p (enum machine_mode, rtx);
 static bool legitimate_lo_sum_address_p (enum machine_mode, rtx, int);
 static struct machine_function * rs6000_init_machine_status (void);
+static void rs6000_print_operand (FILE *, rtx, int);
+static void rs6000_print_operand_address (FILE *, rtx);
+static bool rs6000_print_operand_punct_valid_p (unsigned char code);
 static bool rs6000_assemble_integer (rtx, unsigned int, int);
 static bool no_global_regs_above (int, bool);
 #ifdef HAVE_GAS_HIDDEN
@@ -1367,6 +1370,13 @@ static const struct attribute_spec rs6000_attribute_table[] =
 #endif
 #endif
 
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND rs6000_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS rs6000_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P rs6000_print_operand_punct_valid_p
+
 /* This hook deals with fixups for relocatable code and DI-mode objects
    in 64-bit code.  */
 #undef TARGET_ASM_INTEGER
@@ -14619,8 +14629,8 @@ rs6000_output_function_entry (FILE *file, const char *fname)
 #define SMALL_DATA_REG 0
 #endif
 
-void
-print_operand (FILE *file, rtx x, int code)
+static void
+rs6000_print_operand (FILE *file, rtx x, int code)
 {
   int i;
   HOST_WIDE_INT val;
@@ -14653,7 +14663,7 @@ print_operand (FILE *file, rtx x, int code)
       if (INT_P (x))
 	fprintf (file, HOST_WIDE_INT_PRINT_DEC, INT_LOWPART (x) & 0xffff);
       else
-	print_operand (file, x, 0);
+	rs6000_print_operand (file, x, 0);
       return;
 
     case 'B':
@@ -14727,7 +14737,7 @@ print_operand (FILE *file, rtx x, int code)
       if (INT_P (x))
 	fprintf (file, HOST_WIDE_INT_PRINT_DEC, INT_LOWPART (x) & 31);
       else
-	print_operand (file, x, 0);
+	rs6000_print_operand (file, x, 0);
       return;
 
     case 'H':
@@ -14736,7 +14746,7 @@ print_operand (FILE *file, rtx x, int code)
       if (INT_P (x))
 	fprintf (file, HOST_WIDE_INT_PRINT_DEC, INT_LOWPART (x) & 63);
       else
-	print_operand (file, x, 0);
+	rs6000_print_operand (file, x, 0);
       return;
 
     case 'I':
@@ -14780,7 +14790,7 @@ print_operand (FILE *file, rtx x, int code)
 	 bits of the MEM.  */
       if (GET_CODE (x) != CONST)
 	{
-	  print_operand_address (file, x);
+	  rs6000_print_operand_address (file, x);
 	  fputs ("@l", file);
 	}
       else
@@ -14790,14 +14800,14 @@ print_operand (FILE *file, rtx x, int code)
 		  && GET_CODE (XEXP (XEXP (x, 0), 0)) != LABEL_REF)
 	      || GET_CODE (XEXP (XEXP (x, 0), 1)) != CONST_INT)
 	    output_operand_lossage ("invalid %%K value");
-	  print_operand_address (file, XEXP (XEXP (x, 0), 0));
+	  rs6000_print_operand_address (file, XEXP (XEXP (x, 0), 0));
 	  fputs ("@l", file);
 	  /* For GNU as, there must be a non-alphanumeric character
 	     between 'l' and the number.  The '-' is added by
 	     print_operand() already.  */
 	  if (INTVAL (XEXP (XEXP (x, 0), 1)) >= 0)
 	    fputs ("+", file);
-	  print_operand (file, XEXP (XEXP (x, 0), 1), 0);
+	  rs6000_print_operand (file, XEXP (XEXP (x, 0), 1), 0);
 	}
       return;
 
@@ -15070,7 +15080,7 @@ print_operand (FILE *file, rtx x, int code)
 	fprintf (file, HOST_WIDE_INT_PRINT_DEC,
 		 ((INT_LOWPART (x) & 0xffff) ^ 0x8000) - 0x8000);
       else
-	print_operand (file, x, 0);
+	rs6000_print_operand (file, x, 0);
       return;
 
     case 'W':
@@ -15300,8 +15310,8 @@ print_operand (FILE *file, rtx x, int code)
 
 /* Print the address of an operand.  */
 
-void
-print_operand_address (FILE *file, rtx x)
+static void
+rs6000_print_operand_address (FILE *file, rtx x)
 {
   if (GET_CODE (x) == REG)
     fprintf (file, "0(%s)", reg_names[ REGNO (x) ]);
@@ -15354,6 +15364,14 @@ print_operand_address (FILE *file, rtx x)
     gcc_unreachable ();
 }
 
+/* Implement TARGET_PRINT_OPERAND_PUNCT_VALID_P.  */
+
+static bool
+rs6000_print_operand_punct_valid_p (unsigned char code)
+{
+  return (code == '.' || code == '&');
+}
+
 /* Implement OUTPUT_ADDR_CONST_EXTRA for address X.  */
 
 bool
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -2429,21 +2429,6 @@ extern char rs6000_reg_names[][8];	/* register names (0 vs. %r0).  */
 #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 3 : INVALID_REGNUM)
 #define EH_RETURN_STACKADJ_RTX  gen_rtx_REG (Pmode, 10)
 
-/* Print operand X (an rtx) in assembler syntax to file FILE.
-   CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
-   For `%' followed by punctuation, CODE is the punctuation and X is null.  */
-
-#define PRINT_OPERAND(FILE, X, CODE)  print_operand (FILE, X, CODE)
-
-/* Define which CODE values are valid.  */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE)  \
-  ((CODE) == '.' || (CODE) == '&')
-
-/* Print a memory address as an operand to reference that memory location.  */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
-
 #define OUTPUT_ADDR_CONST_EXTRA(STREAM, X, FAIL)		\
   do								\
     if (!rs6000_output_addr_const_extra (STREAM, X))		\


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]