diff mbox

[visium] Turn a few macros into hooks

Message ID 3592919.YWOUbQlgx6@polaris
State New
Headers show

Commit Message

Eric Botcazou Nov. 9, 2015, 10:53 p.m. UTC
On the heels of Julian's patch, this turns the 3 PRINT_OPERAND_* macros into 
hooks for the Visium port.

Tested on visium-elf, applied on the mainline.


2015-11-09  Eric Botcazou  <ebotcazou@adacore.com>

	* config/visium/visium.h (PRINT_OPERAND): Delete.
	(PRINT_OPERAND_PUNCT_VALID_P): Likewise.
	(PRINT_OPERAND_ADDRESS): Likewise.
	* config/visium/visium.c (TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define
	to...
	(visium_print_operand_punct_valid_p): ...this.  New function.
	(TARGET_PRINT_OPERAND): Define to...
	(print_operand): Rename to...
	(visium_print_operand): ...this.
	(TARGET_PRINT_OPERAND_ADDRESS): Define to...
	(visium_output_address): Rename to...
	(visium_print_operand_address): ...this.
	(print_operand_address): Delete.
diff mbox

Patch

Index: config/visium/visium.c
===================================================================
--- config/visium/visium.c	(revision 230016)
+++ config/visium/visium.c	(working copy)
@@ -99,7 +99,6 @@  int visium_indent_opcode = 0;
    given how unlikely it is to have a long branch in a leaf function.  */
 static unsigned int long_branch_regnum = 31;
 
-static void visium_output_address (FILE *, enum machine_mode, rtx);
 static tree visium_handle_interrupt_attr (tree *, tree, tree, int, bool *);
 static inline bool current_function_saves_fp (void);
 static inline bool current_function_saves_lr (void);
@@ -157,6 +156,10 @@  static bool visium_legitimate_constant_p
 
 static bool visium_legitimate_address_p (enum machine_mode, rtx, bool);
 
+static bool visium_print_operand_punct_valid_p (unsigned char);
+static void visium_print_operand (FILE *, rtx, int);
+static void visium_print_operand_address (FILE *, machine_mode, rtx);
+
 static void visium_conditional_register_usage (void);
 
 static rtx visium_legitimize_address (rtx, rtx, enum machine_mode);
@@ -227,6 +230,13 @@  static unsigned int visium_reorg (void);
 #undef  TARGET_LEGITIMATE_ADDRESS_P
 #define TARGET_LEGITIMATE_ADDRESS_P visium_legitimate_address_p
 
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P visium_print_operand_punct_valid_p
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND visium_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS visium_print_operand_address
+
 #undef  TARGET_ATTRIBUTE_TABLE
 #define TARGET_ATTRIBUTE_TABLE visium_attribute_table
 
@@ -3038,12 +3048,19 @@  output_cbranch (rtx label, enum rtx_code
   return output_branch (label, cond, insn);
 }
 
-/* Helper function for PRINT_OPERAND (STREAM, X, CODE).  Output to stdio
-   stream FILE the assembler syntax for an instruction operand OP subject
-   to the modifier LETTER.  */
+/* Implement TARGET_PRINT_OPERAND_PUNCT_VALID_P.  */
 
-void
-print_operand (FILE *file, rtx op, int letter)
+static bool
+visium_print_operand_punct_valid_p (unsigned char code)
+{
+  return code == '#';
+}
+
+/* Implement TARGET_PRINT_OPERAND.  Output to stdio stream FILE the assembler
+   syntax for an instruction operand OP subject to the modifier LETTER.  */
+
+static void
+visium_print_operand (FILE *file, rtx op, int letter)
 {
   switch (letter)
     {
@@ -3104,7 +3121,7 @@  print_operand (FILE *file, rtx op, int l
       break;
 
     case MEM:
-      visium_output_address (file, GET_MODE (op), XEXP (op, 0));
+      visium_print_operand_address (file, GET_MODE (op), XEXP (op, 0));
       break;
 
     case CONST_INT:
@@ -3116,7 +3133,7 @@  print_operand (FILE *file, rtx op, int l
       break;
 
     case HIGH:
-      print_operand (file, XEXP (op, 1), letter);
+      visium_print_operand (file, XEXP (op, 1), letter);
       break;
 
     default:
@@ -3124,11 +3141,12 @@  print_operand (FILE *file, rtx op, int l
     }
 }
 
-/* Output to stdio stream FILE the assembler syntax for an instruction operand
-   that is a memory reference in MODE and whose address is ADDR.  */
+/* Implement TARGET_PRINT_OPERAND_ADDRESS.  Output to stdio stream FILE the
+   assembler syntax for an instruction operand that is a memory reference
+   whose address is ADDR.  */
 
 static void
-visium_output_address (FILE *file, enum machine_mode mode, rtx addr)
+visium_print_operand_address (FILE *file, enum machine_mode mode, rtx addr)
 {
   switch (GET_CODE (addr))
     {
@@ -3205,16 +3223,6 @@  visium_output_address (FILE *file, enum
     }
 }
 
-/* Helper function for PRINT_OPERAND_ADDRESS (STREAM, X).  Output to stdio
-   stream FILE the assembler syntax for an instruction operand that is a
-   memory reference whose address is ADDR.  */
-
-void
-print_operand_address (FILE *file, rtx addr)
-{
-  visium_output_address (file, QImode, addr);
-}
-
 /* The Visium stack frames look like:
 
               Before call                      After call
Index: config/visium/visium.h
===================================================================
--- config/visium/visium.h	(revision 230016)
+++ config/visium/visium.h	(working copy)
@@ -1477,49 +1477,6 @@  do									\
 #define ADDITIONAL_REGISTER_NAMES \
   {{"r22", HARD_FRAME_POINTER_REGNUM}, {"r23", STACK_POINTER_REGNUM}}
 
-/* `PRINT_OPERAND (STREAM, X, CODE)'
-
-   A C compound statement to output to stdio stream STREAM the
-   assembler syntax for an instruction operand X.  X is an RTL
-   expression.
-
-   CODE is a value that can be used to specify one of several ways of
-   printing the operand.  It is used when identical operands must be
-   printed differently depending on the context.  CODE comes from the
-   `%' specification that was used to request printing of the operand.
-   If the specification was just `%DIGIT' then CODE is 0; if the
-   specification was `%LTR DIGIT' then CODE is the ASCII code for LTR.
-
-   If X is a register, this macro should print the register's name.
-   The names can be found in an array `reg_names' whose type is `char
-   *[]'.  `reg_names' is initialized from `REGISTER_NAMES'.
-
-   When the machine description has a specification `%PUNCT' (a `%'
-   followed by a punctuation character), this macro is called with a
-   null pointer for X and the punctuation character for CODE. */
-#define PRINT_OPERAND(STREAM, X, CODE) print_operand (STREAM, X, CODE)
-
-/* `PRINT_OPERAND_PUNCT_VALID_P (CODE)'
-
-   A C expression which evaluates to true if CODE is a valid
-   punctuation character for use in the `PRINT_OPERAND' macro.  If
-   `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no
-   punctuation characters (except for the standard one, `%') are used */
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '#')
-
-/* `PRINT_OPERAND_ADDRESS (STREAM, X)'
-
-   A C compound statement to output to stdio stream STREAM the
-   assembler syntax for an instruction operand that is a memory
-   reference whose address is X.  X is an RTL expression.
-
-   On some machines, the syntax for a symbolic address depends on the
-   section that the address refers to.  On these machines, define the
-   macro `ENCODE_SECTION_INFO' to store the information into the
-   `symbol_ref', and then check for it here. */
-#define PRINT_OPERAND_ADDRESS(STREAM, ADDR) \
-  print_operand_address (STREAM, ADDR)
-
 /* `REGISTER_PREFIX'
    `LOCAL_LABEL_PREFIX'
    `USER_LABEL_PREFIX'