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]

[MN10300] Hookize OUTPUT_ADDR_CONST_EXTRA


Hello.

  This patch removes obsolete OUTPUT_ADDR_CONST_EXTRA macro from MN10300 back 
end in the GCC and introduces equivalent TARGET_OUTPUT_ADDR_CONST_EXTRA 
target hook.

  Regression tested on mn10300-unknown-elf.

  OK to install?

        * config/mn10300/mn10300.h (OUTPUT_ADDR_CONST_EXTRA): Remove.
        * config/mn10300/mn10300.c (mn10300_asm_output_addr_const_extra): New
        functions.
        (TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA): Define.

Index: gcc/config/mn10300/mn10300.c
===================================================================
--- gcc/config/mn10300/mn10300.c        (revision 166814)
+++ gcc/config/mn10300/mn10300.c        (working copy)
@@ -523,6 +523,52 @@
     }
 }
 
+/* Implement TARGET__ASM_OUTPUT_ADDR_CONST_EXTRA.
+
+   Used for PIC-specific UNSPECs.  */
+
+static bool
+mn10300_asm_output_addr_const_extra (FILE *file, rtx x)
+{
+  if (GET_CODE (x) == UNSPEC)
+    {
+      switch (XINT (x, 1))
+       {
+       case UNSPEC_INT_LABEL:
+         asm_fprintf (file, ".%LLIL" HOST_WIDE_INT_PRINT_DEC,
+                      INTVAL (XVECEXP (x, 0, 0)));
+         break;
+       case UNSPEC_PIC:
+         /* GLOBAL_OFFSET_TABLE or local symbols, no suffix.  */
+         output_addr_const (file, XVECEXP (x, 0, 0));
+         break;
+       case UNSPEC_GOT:
+         output_addr_const (file, XVECEXP (x, 0, 0));
+         fputs ("@GOT", file);
+         break;
+       case UNSPEC_GOTOFF:
+         output_addr_const (file, XVECEXP (x, 0, 0));
+         fputs ("@GOTOFF", file);
+         break;
+       case UNSPEC_PLT:
+         output_addr_const (file, XVECEXP (x, 0, 0));
+         fputs ("@PLT", file);
+         break;
+       case UNSPEC_GOTSYM_OFF:
+         assemble_name (file, GOT_SYMBOL_NAME);
+         fputs ("-(", file);
+         output_addr_const (file, XVECEXP (x, 0, 0));
+         fputs ("-.)", file);
+         break;
+       default:
+         return false;
+       }
+      return true;
+    }
+  else
+    return false;
+}
+
 /* Count the number of FP registers that have to be saved.  */
 static int
 fp_regs_to_save (void)
@@ -2451,6 +2497,9 @@
 #undef  TARGET_ASM_FILE_START_FILE_DIRECTIVE
 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
+#undef TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA
+#define TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA mn10300_asm_output_addr_const_extra
+
 #undef  TARGET_DEFAULT_TARGET_FLAGS
 #define TARGET_DEFAULT_TARGET_FLAGS MASK_MULT_BUG | MASK_PTR_A0D0
 #undef  TARGET_HANDLE_OPTION
Index: gcc/config/mn10300/mn10300.h
===================================================================
--- gcc/config/mn10300/mn10300.h        (revision 166814)
+++ gcc/config/mn10300/mn10300.h        (working copy)
@@ -599,49 +599,6 @@
 
 /* Non-global SYMBOL_REFs have SYMBOL_REF_FLAG enabled.  */
 #define MN10300_GLOBAL_P(X) (! SYMBOL_REF_FLAG (X))
-
-/* Recognize machine-specific patterns that may appear within
-   constants.  Used for PIC-specific UNSPECs.  */
-#define OUTPUT_ADDR_CONST_EXTRA(STREAM, X, FAIL) \
-  do                                                                   \
-    if (GET_CODE (X) == UNSPEC)                                                \
-      {                                                                        \
-       switch (XINT ((X), 1))                                          \
-         {                                                             \
-         case UNSPEC_INT_LABEL:                                        \
-           asm_fprintf ((STREAM), ".%LLIL" HOST_WIDE_INT_PRINT_DEC,    \
-                        INTVAL (XVECEXP ((X), 0, 0)));                 \
-           break;                                                      \
-         case UNSPEC_PIC:                                              \
-           /* GLOBAL_OFFSET_TABLE or local symbols, no suffix.  */     \
-           output_addr_const ((STREAM), XVECEXP ((X), 0, 0));          \
-           break;                                                      \
-         case UNSPEC_GOT:                                              \
-           output_addr_const ((STREAM), XVECEXP ((X), 0, 0));          \
-           fputs ("@GOT", (STREAM));                                   \
-           break;                                                      \
-         case UNSPEC_GOTOFF:                                           \
-           output_addr_const ((STREAM), XVECEXP ((X), 0, 0));          \
-           fputs ("@GOTOFF", (STREAM));                                \
-           break;                                                      \
-         case UNSPEC_PLT:                                              \
-           output_addr_const ((STREAM), XVECEXP ((X), 0, 0));          \
-           fputs ("@PLT", (STREAM));                                   \
-           break;                                                      \
-         case UNSPEC_GOTSYM_OFF:                                       \
-           assemble_name (STREAM, GOT_SYMBOL_NAME);                    \
-           fputs ("-(", STREAM);                                       \
-           output_addr_const (STREAM, XVECEXP (X, 0, 0));              \
-           fputs ("-.)", STREAM);                                      \
-           break;                                                      \
-         default:                                                      \
-           goto FAIL;                                                  \
-         }                                                             \
-       break;                                                          \
-      }                                                                        \
-    else                                                               \
-      goto FAIL;                                                       \
-  while (0)
 
 #define SELECT_CC_MODE(OP, X, Y)  mn10300_select_cc_mode (X)
 #define REVERSIBLE_CC_MODE(MODE)  0


Anatoly.


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