aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/config/i386/i386-protos.h1
-rw-r--r--gcc/config/i386/i386.c8
-rw-r--r--gcc/config/i386/i386.h6
-rw-r--r--gcc/doc/tm.texi12
-rw-r--r--gcc/doc/tm.texi.in12
-rw-r--r--gcc/final.c7
-rw-r--r--gcc/target.def6
-rw-r--r--gcc/targhooks.c15
-rw-r--r--gcc/targhooks.h1
10 files changed, 70 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f9ce2f4..c09d32c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index e41d810..a72a432 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -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[]);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 3f37066..c3863ac 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 7fd874b..57c2244 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2123,12 +2123,6 @@ do { \
"call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n" \
TEXT_SECTION_ASM_OP);
-#define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL) \
-do { \
- if (! output_addr_const_extra (FILE, (X))) \
- goto FAIL; \
-} while (0);
-
/* 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. */
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index d59c55f..3e38618 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -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
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 1b00ebc..6358916 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -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
diff --git a/gcc/final.c b/gcc/final.c
index f1cff34..73c6069 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -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");
}
}
diff --git a/gcc/target.def b/gcc/target.def
index 10013e6..46e3ef7 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -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. */
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 553d0bc..9898225 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -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.
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 198bcc7..bc43bc2 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -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);