* target.def (output_addr_const_extra): New hook.
authoraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Aug 2010 19:52:46 +0000 (19:52 +0000)
committeraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Aug 2010 19:52:46 +0000 (19:52 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163104 138bc75d-0d04-0410-961f-82ee72b054a4

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 f9ce2f4..c09d32c 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 e41d810..a72a432 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 3f37066..c3863ac 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 7fd874b..57c2244 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 d59c55f..3e38618 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 1b00ebc..6358916 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 f1cff34..73c6069 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 10013e6..46e3ef7 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 553d0bc..9898225 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 198bcc7..bc43bc2 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);