public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, alpha]: Add TARGET_PRINT_OPERAND and friends
@ 2015-11-11 16:20 Uros Bizjak
  0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2015-11-11 16:20 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 798 bytes --]

2015-11-11  Uros Bizjak  <ubizjak@gmail.com>

    * config/alpha/alpha-protos.h (print_operand): Remove.
    (print_operand_address): Remove.
    * config/alpha/alpha.h (PRINT_OPERAND): Remove.
    (PRINT_OPERAND_ADDRESS): Remove.
    (PRINT_OPERAND_PUNCT_VALID_P): Remove.
    * config/alpha/alpha.c (TARGET_PRINT_OPERAND): New hook define.
    (TARGET_PRINT_OPERAND_ADDRESS): New hook define.
    (TARGET_PRINT_OPERAND_PUNCT_VALID_P): New hook define.
    (print_operand_address): Rename to...
    (alpha_print_operand_address): ...this and make static.
    (print_operand): Rename to...
    (alpha_print_operand): ...this and make static.
    (alpha_print_operand_punct_valid_p): New static function.

Bootstrapped and regression tested on alphaev68-linux-gnu, committed
to mainline SVN.

Uros.

[-- Attachment #2: a.diff.txt --]
[-- Type: text/plain, Size: 4714 bytes --]

Index: config/alpha/alpha-protos.h
===================================================================
--- config/alpha/alpha-protos.h	(revision 230178)
+++ config/alpha/alpha-protos.h	(working copy)
@@ -65,8 +65,6 @@ extern void alpha_expand_builtin_revert_vms_condit
 
 extern rtx alpha_return_addr (int, rtx);
 extern rtx alpha_gp_save_rtx (void);
-extern void print_operand (FILE *, rtx, int);
-extern void print_operand_address (FILE *, rtx);
 extern void alpha_initialize_trampoline (rtx, rtx, rtx, int, int, int);
 
 extern rtx alpha_va_arg (tree, tree);
Index: config/alpha/alpha.c
===================================================================
--- config/alpha/alpha.c	(revision 230178)
+++ config/alpha/alpha.c	(working copy)
@@ -5041,11 +5041,21 @@ get_round_mode_suffix (void)
   gcc_unreachable ();
 }
 
-/* Print an operand.  Recognize special options, documented below.  */
+/* Implement TARGET_PRINT_OPERAND_PUNCT_VALID_P.  */
 
-void
-print_operand (FILE *file, rtx x, int code)
+static bool
+alpha_print_operand_punct_valid_p (unsigned char code)
 {
+  return (code == '/' || code == ',' || code == '-' || code == '~'
+	  || code == '#' || code == '*' || code == '&');
+}
+
+/* Implement TARGET_PRINT_OPERAND.  The alpha-specific
+   operand codes are documented below.  */
+
+static void
+alpha_print_operand (FILE *file, rtx x, int code)
+{
   int i;
 
   switch (code)
@@ -5064,6 +5074,8 @@ get_round_mode_suffix (void)
       break;
 
     case '/':
+      /* Generates the instruction suffix.  The TRAP_SUFFIX and ROUND_SUFFIX
+	 attributes are examined to determine what is appropriate.  */
       {
 	const char *trap = get_trap_mode_suffix ();
 	const char *round = get_round_mode_suffix ();
@@ -5074,12 +5086,14 @@ get_round_mode_suffix (void)
       }
 
     case ',':
-      /* Generates single precision instruction suffix.  */
+      /* Generates single precision suffix for floating point
+	 instructions (s for IEEE, f for VAX).  */
       fputc ((TARGET_FLOAT_VAX ? 'f' : 's'), file);
       break;
 
     case '-':
-      /* Generates double precision instruction suffix.  */
+      /* Generates double precision suffix for floating point
+	 instructions (t for IEEE, g for VAX).  */
       fputc ((TARGET_FLOAT_VAX ? 'g' : 't'), file);
       break;
 
@@ -5350,8 +5364,10 @@ get_round_mode_suffix (void)
     }
 }
 
-void
-print_operand_address (FILE *file, rtx addr)
+/* Implement TARGET_PRINT_OPERAND_ADDRESS.  */
+
+static void
+alpha_print_operand_address (FILE *file, machine_mode /*mode*/, rtx addr)
 {
   int basereg = 31;
   HOST_WIDE_INT offset = 0;
@@ -9877,6 +9893,13 @@ alpha_atomic_assign_expand_fenv (tree *hold, tree
 #define TARGET_STDARG_OPTIMIZE_HOOK alpha_stdarg_optimize_hook
 #endif
 
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND alpha_print_operand
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS alpha_print_operand_address
+#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
+#define TARGET_PRINT_OPERAND_PUNCT_VALID_P alpha_print_operand_punct_valid_p
+
 /* Use 16-bits anchor.  */
 #undef TARGET_MIN_ANCHOR_OFFSET
 #define TARGET_MIN_ANCHOR_OFFSET -0x7fff - 1
Index: config/alpha/alpha.h
===================================================================
--- config/alpha/alpha.h	(revision 230178)
+++ config/alpha/alpha.h	(working copy)
@@ -1005,37 +1005,6 @@ do {						\
 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
   fprintf (FILE, "\t.gprel32 $L%d\n", (VALUE))
 \f
-
-/* 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)
-
-/* Determine which codes are valid without a following integer.  These must
-   not be alphabetic.
-
-   ~    Generates the name of the current function.
-
-   /	Generates the instruction suffix.  The TRAP_SUFFIX and ROUND_SUFFIX
-	attributes are examined to determine what is appropriate.
-
-   ,    Generates single precision suffix for floating point
-	instructions (s for IEEE, f for VAX)
-
-   -	Generates double precision suffix for floating point
-	instructions (t for IEEE, g for VAX)
-   */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
-  ((CODE) == '/' || (CODE) == ',' || (CODE) == '-' || (CODE) == '~' \
-   || (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))
-\f
 /* If we use NM, pass -g to it so it only lists globals.  */
 #define NM_FLAGS "-pg"
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-11 16:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-11 16:20 [PATCH, alpha]: Add TARGET_PRINT_OPERAND and friends Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).