]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
target.def (output_addr_const_extra): New hook.
authorAnatoly Sokolov <aesok@post.ru>
Wed, 11 Aug 2010 19:52:46 +0000 (23:52 +0400)
committerAnatoly Sokolov <aesok@gcc.gnu.org>
Wed, 11 Aug 2010 19:52:46 +0000 (23:52 +0400)
* target.def (output_addr_const_extra): New hook.
* doc/tm.texi.in (TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA): Document.
* doc/tm.texi: Regenerate.
* targhooks.c (default_asm_output_addr_const_extra): New function.
* targhooks.h (default_asm_output_addr_const_extra): Declare.
* final.c: (output_addr_const): Use TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA
target hook.

* config/i386/i386.h (OUTPUT_ADDR_CONST_EXTRA): Remove.
* config/i386/i386-protos.h (output_addr_const_extra): Remove.
* config/i386/i386.h (output_addr_const_extra): Rename to...
(i386_asm_output_addr_const_extra): ...this. Make static.
(TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA): Define.

From-SVN: r163104

gcc/ChangeLog
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/final.c
gcc/target.def
gcc/targhooks.c
gcc/targhooks.h

index f9ce2f45701af958be4dc210a8337cffc26af966..c09d32c785b24ab16b4c6d2e40e9d743089e280f 100644 (file)
@@ -1,3 +1,19 @@
+2010-08-11  Anatoly Sokolov  <aesok@post.ru>
+
+       * target.def (output_addr_const_extra): New hook.
+       * doc/tm.texi.in (TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA): Document.
+       * doc/tm.texi: Regenerate.
+       * targhooks.c (default_asm_output_addr_const_extra): New function.
+       * targhooks.h (default_asm_output_addr_const_extra): Declare.
+       * final.c: (output_addr_const): Use TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA
+       target hook.
+
+       * config/i386/i386.h (OUTPUT_ADDR_CONST_EXTRA): Remove.
+       * config/i386/i386-protos.h (output_addr_const_extra): Remove.
+       * config/i386/i386.h (output_addr_const_extra): Rename to...
+       (i386_asm_output_addr_const_extra): ...this. Make static.
+       (TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA): Define.
+
 2010-08-11  Richard Henderson  <rth@redhat.com>
 
        * config/i386/i386.h (HARD_REGNO_CALL_PART_CLOBBERED): New.
index e41d8101851114e90e802d82212e7fe2cb9223b7..a72a432299a3d687d7a9ea09c2317eb2a63ad4a7 100644 (file)
@@ -62,7 +62,6 @@ extern int legitimate_pic_address_disp_p (rtx);
 
 extern void print_reg (rtx, int, FILE*);
 extern void ix86_print_operand (FILE *, rtx, int);
-extern bool output_addr_const_extra (FILE*, rtx);
 
 extern void split_di (rtx[], int, rtx[], rtx[]);
 extern void split_ti (rtx[], int, rtx[], rtx[]);
index 3f370664a5b88ea83c94c2b8f439ffa5eb4fbaf2..c3863acb81f0a29dd711086ce0292352b206cb8e 100644 (file)
@@ -13124,8 +13124,10 @@ ix86_print_operand_address (FILE *file, rtx addr)
     }
 }
 
-bool
-output_addr_const_extra (FILE *file, rtx x)
+/* Implementation of TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA.  */
+
+static bool
+i386_asm_output_addr_const_extra (FILE *file, rtx x)
 {
   rtx op;
 
@@ -31539,6 +31541,8 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
 #define TARGET_PRINT_OPERAND_ADDRESS ix86_print_operand_address
 #undef TARGET_PRINT_OPERAND_PUNCT_VALID_P
 #define TARGET_PRINT_OPERAND_PUNCT_VALID_P ix86_print_operand_punct_valid_p
+#undef TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA
+#define TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA i386_asm_output_addr_const_extra 
 
 #undef TARGET_SCHED_ADJUST_COST
 #define TARGET_SCHED_ADJUST_COST ix86_adjust_cost
index 7fd874b93f8b9cd4e2206a9ce447d30af2ac9e4c..57c224420f65610612045db883893c868c9bbbc9 100644 (file)
@@ -2123,12 +2123,6 @@ do {                                                                     \
        "call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n"     \
        TEXT_SECTION_ASM_OP);
 \f
-#define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL) \
-do {                                           \
-  if (! output_addr_const_extra (FILE, (X)))   \
-    goto FAIL;                                 \
-} while (0);
-\f
 /* Which processor to schedule for. The cpu attribute defines a list that
    mirrors this list, so changes to i386.md must be made at the same time.  */
 
index d59c55f054cf822841ee5cea088dd2e4fba7ea9b..3e38618e79c92bf7166a7ca6883effb7a46578da 100644 (file)
@@ -7410,6 +7410,18 @@ The default implementation of this hook will use the
 when the relevant string is @code{NULL}.
 @end deftypefn
 
+@deftypefn {Target Hook} bool TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA (FILE *@var{file}, rtx @var{x})
+A target hook to recognize @var{rtx} patterns that @code{output_addr_const}
+can't deal with, and output assembly code to @var{file} corresponding to
+the pattern @var{x}.  This may be used to allow machine-dependent
+@code{UNSPEC}s to appear within constants.
+
+If target hook fails to recognize a pattern, it must return @code{false},
+so that a standard error message is printed.  If it prints an error message
+itself, by calling, for example, @code{output_operand_lossage}, it may just
+return @code{true}.
+@end deftypefn
+
 @defmac OUTPUT_ADDR_CONST_EXTRA (@var{stream}, @var{x}, @var{fail})
 A C statement to recognize @var{rtx} patterns that
 @code{output_addr_const} can't deal with, and output assembly code to
index 1b00ebcda7b3dcef7fa5e80907c8112f9e10e3a9..63589168f8d0426c9966fb9290c44b3bc1a78756 100644 (file)
@@ -7401,6 +7401,18 @@ The default implementation of this hook will use the
 when the relevant string is @code{NULL}.
 @end deftypefn
 
+@hook TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA
+A target hook to recognize @var{rtx} patterns that @code{output_addr_const}
+can't deal with, and output assembly code to @var{file} corresponding to
+the pattern @var{x}.  This may be used to allow machine-dependent
+@code{UNSPEC}s to appear within constants.
+
+If target hook fails to recognize a pattern, it must return @code{false},
+so that a standard error message is printed.  If it prints an error message
+itself, by calling, for example, @code{output_operand_lossage}, it may just
+return @code{true}.
+@end deftypefn
+
 @defmac OUTPUT_ADDR_CONST_EXTRA (@var{stream}, @var{x}, @var{fail})
 A C statement to recognize @var{rtx} patterns that
 @code{output_addr_const} can't deal with, and output assembly code to
index f1cff3409ade3c62e97253d8340f11d4fff53f0b..73c60691d276063db47cf4e6d9f8856ed5ac0a63 100644 (file)
@@ -3620,12 +3620,9 @@ output_addr_const (FILE *file, rtx x)
       break;
 
     default:
-#ifdef OUTPUT_ADDR_CONST_EXTRA
-      OUTPUT_ADDR_CONST_EXTRA (file, x, fail);
-      break;
+      if (targetm.asm_out.output_addr_const_extra (file, x))
+       break;
 
-    fail:
-#endif
       output_operand_lossage ("invalid expression as operand");
     }
 }
index 10013e643d32fcf2081e592ae9e3a442d464e3c2..46e3ef761964419df722003a1c5f5a010cd4209d 100644 (file)
@@ -415,6 +415,12 @@ DEFHOOK
  void ,(FILE *file, const char *name),
  default_asm_output_source_filename)
 
+DEFHOOK
+(output_addr_const_extra,
+ "",
+ bool, (FILE *file, rtx x),
+ default_asm_output_addr_const_extra)
+
 /* ??? The TARGET_PRINT_OPERAND* hooks are part of the asm_out struct,
    even though that is not reflected in the macro name to override their
    initializers.  */
index 553d0bc9aef64920d5ecf96fe908036dfc417427..9898225f2d199f879e6fdc33664e5a6773ef7c38 100644 (file)
@@ -356,6 +356,21 @@ default_print_operand_punct_valid_p (unsigned char code ATTRIBUTE_UNUSED)
 #endif
 }
 
+/* The default implementation of TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA.  */
+
+bool
+default_asm_output_addr_const_extra (FILE *file ATTRIBUTE_UNUSED,
+                                    rtx x ATTRIBUTE_UNUSED)
+{
+#ifdef OUTPUT_ADDR_CONST_EXTRA
+  OUTPUT_ADDR_CONST_EXTRA (file, x, fail);
+  return true;
+
+fail:
+#endif
+  return false;
+}
+
 /* True if MODE is valid for the target.  By "valid", we mean able to
    be manipulated in non-trivial ways.  In particular, this means all
    the arithmetic is supported.
index 198bcc79eafff5f8f8f5f95e335f8e0fa09e8261..bc43bc2595a6f008a64d200ac33085449626cf3d 100644 (file)
@@ -65,6 +65,7 @@ extern bool hook_callee_copies_named
 extern void default_print_operand (FILE *, rtx, int);
 extern void default_print_operand_address (FILE *, rtx);
 extern bool default_print_operand_punct_valid_p (unsigned char);
+extern bool default_asm_output_addr_const_extra (FILE *, rtx);
 
 extern bool default_scalar_mode_supported_p (enum machine_mode);
 extern bool default_decimal_float_supported_p (void);