Patchwork [XTENSA] Hookize OUTPUT_ADDR_CONST_EXTRA

login
register
mail settings
Submitter Anatoly Sokolov
Date Jan. 6, 2011, 4:49 p.m.
Message ID <485819437.20110106194948@post.ru>
Download mbox | patch
Permalink /patch/77736/
State New
Headers show

Comments

Anatoly Sokolov - Jan. 6, 2011, 4:49 p.m.
Hello.

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

  Not tested.

  OK to install?

        * config/xtensa/xtensa.h (OUTPUT_ADDR_CONST_EXTRA): Remove.
        * config/xtensa/xtensa-protos.h (xtensa_output_addr_const_extra): Remove.
        * config/xtensa/xtensa.c (xtensa_output_addr_const_extra): Make static.
        (TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA): Define.



Anatoly.
Sterling Augustine - Jan. 6, 2011, 4:59 p.m.
This follows your patches for other architectures fairly closely, so 
approved. Please apply, and thanks.

Sterling

On 01/06/2011 08:49 AM, Anatoly Sokolov wrote:
> Hello.
>
>    This patch removes obsolete OUTPUT_ADDR_CONST_EXTRA macro from XTENSA back
> end in the GCC and introduces equivalent TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA
> target hook.
>
>    Not tested.
>
>    OK to install?
>
>          * config/xtensa/xtensa.h (OUTPUT_ADDR_CONST_EXTRA): Remove.
>          * config/xtensa/xtensa-protos.h (xtensa_output_addr_const_extra): Remove.
>          * config/xtensa/xtensa.c (xtensa_output_addr_const_extra): Make static.
>          (TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA): Define.
>
> Index: gcc/config/xtensa/xtensa.c
> ===================================================================
> --- gcc/config/xtensa/xtensa.c  (revision 168543)
> +++ gcc/config/xtensa/xtensa.c  (working copy)
> @@ -157,6 +157,7 @@
>   static rtx xtensa_static_chain (const_tree, bool);
>   static void xtensa_asm_trampoline_template (FILE *);
>   static void xtensa_trampoline_init (rtx, tree, rtx);
> +static bool xtensa_output_addr_const_extra (FILE *, rtx);
>
>   static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
>     REG_ALLOC_ORDER;
> @@ -274,6 +275,9 @@
>   #undef TARGET_OPTION_OPTIMIZATION_TABLE
>   #define TARGET_OPTION_OPTIMIZATION_TABLE xtensa_option_optimization_table
>
> +#undef TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA
> +#define TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA xtensa_output_addr_const_extra
> +
>   struct gcc_target targetm = TARGET_INITIALIZER;
>
>   
> @@ -2438,7 +2442,7 @@
>   }
>
>
> -bool
> +static bool
>   xtensa_output_addr_const_extra (FILE *fp, rtx x)
>   {
>     if (GET_CODE (x) == UNSPEC&&  XVECLEN (x, 0) == 1)
> Index: gcc/config/xtensa/xtensa.h
> ===================================================================
> --- gcc/config/xtensa/xtensa.h  (revision 168543)
> +++ gcc/config/xtensa/xtensa.h  (working copy)
> @@ -816,14 +816,6 @@
>   #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
>   #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
>
> -/* Recognize machine-specific patterns that may appear within
> -   constants.  Used for PIC-specific UNSPECs.  */
> -#define OUTPUT_ADDR_CONST_EXTRA(STREAM, X, FAIL)                       \
> -  do {                                                                 \
> -    if (xtensa_output_addr_const_extra (STREAM, X) == FALSE)           \
> -      goto FAIL;                                                       \
> -  } while (0)
> -
>   /* Globalizing directive for a label.  */
>   #define GLOBAL_ASM_OP "\t.global\t"
>
> Index: gcc/config/xtensa/xtensa-protos.h
> ===================================================================
> --- gcc/config/xtensa/xtensa-protos.h   (revision 168543)
> +++ gcc/config/xtensa/xtensa-protos.h   (working copy)
> @@ -62,7 +62,6 @@
>
>   extern void print_operand (FILE *, rtx, int);
>   extern void print_operand_address (FILE *, rtx);
> -extern bool xtensa_output_addr_const_extra (FILE *, rtx);
>   extern void xtensa_output_literal (FILE *, rtx, enum machine_mode, int);
>   extern rtx xtensa_return_addr (int, rtx);
>   extern enum reg_class xtensa_preferred_reload_class (rtx, enum reg_class, int);
>
>
> Anatoly.
>

Patch

Index: gcc/config/xtensa/xtensa.c
===================================================================
--- gcc/config/xtensa/xtensa.c  (revision 168543)
+++ gcc/config/xtensa/xtensa.c  (working copy)
@@ -157,6 +157,7 @@ 
 static rtx xtensa_static_chain (const_tree, bool);
 static void xtensa_asm_trampoline_template (FILE *);
 static void xtensa_trampoline_init (rtx, tree, rtx);
+static bool xtensa_output_addr_const_extra (FILE *, rtx);
 
 static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
   REG_ALLOC_ORDER;
@@ -274,6 +275,9 @@ 
 #undef TARGET_OPTION_OPTIMIZATION_TABLE
 #define TARGET_OPTION_OPTIMIZATION_TABLE xtensa_option_optimization_table
 
+#undef TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA
+#define TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA xtensa_output_addr_const_extra
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 
@@ -2438,7 +2442,7 @@ 
 }
 
 
-bool
+static bool
 xtensa_output_addr_const_extra (FILE *fp, rtx x)
 {
   if (GET_CODE (x) == UNSPEC && XVECLEN (x, 0) == 1)
Index: gcc/config/xtensa/xtensa.h
===================================================================
--- gcc/config/xtensa/xtensa.h  (revision 168543)
+++ gcc/config/xtensa/xtensa.h  (working copy)
@@ -816,14 +816,6 @@ 
 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
 
-/* Recognize machine-specific patterns that may appear within
-   constants.  Used for PIC-specific UNSPECs.  */
-#define OUTPUT_ADDR_CONST_EXTRA(STREAM, X, FAIL)                       \
-  do {                                                                 \
-    if (xtensa_output_addr_const_extra (STREAM, X) == FALSE)           \
-      goto FAIL;                                                       \
-  } while (0)
-
 /* Globalizing directive for a label.  */
 #define GLOBAL_ASM_OP "\t.global\t"
 
Index: gcc/config/xtensa/xtensa-protos.h
===================================================================
--- gcc/config/xtensa/xtensa-protos.h   (revision 168543)
+++ gcc/config/xtensa/xtensa-protos.h   (working copy)
@@ -62,7 +62,6 @@ 
 
 extern void print_operand (FILE *, rtx, int);
 extern void print_operand_address (FILE *, rtx);
-extern bool xtensa_output_addr_const_extra (FILE *, rtx);
 extern void xtensa_output_literal (FILE *, rtx, enum machine_mode, int);
 extern rtx xtensa_return_addr (int, rtx);
 extern enum reg_class xtensa_preferred_reload_class (rtx, enum reg_class, int);