* target.h (struct asm_out):Add declare_constant_name field.

* target-def.h (TARGET_ASM_DECLARE_CONSTANT_NAME): Define.
	(TARGET_INITIALIZER): Use TARGET_ASM_DECLARE_CONSTANT_NAME.
	* output.h (default_asm_declare_constant_name): Declare.
	(assemble_label): Update prototype.
	* varasm.c (assemble_constant_contents): Use
	targetm.asm_out.declare_constant_name target hook.
	(assemble_label): Add 'file' argument.
	(default_asm_declare_constant_name): New function.
	* system.h (ASM_DECLARE_CONSTANT_NAME): Poison.
	* doc/tm.texi (ASM_DECLARE_CONSTANT_NAME): Remove.
	(TARGET_ASM_DECLARE_CONSTANT_NAME): Document it.

	* config/darwin-protos.h (darwin_asm_declare_constant_name): Declare.
	* config/darwin.c (darwin_asm_declare_constant_name): New function.
	(machopic_output_indirection): Update assemble_label argument list.
	* config/darwin.h (ASM_DECLARE_CONSTANT_NAME): Remove.
	(TARGET_ASM_DECLARE_CONSTANT_NAME): Define.

From-SVN: r160811
This commit is contained in:
Anatoly Sokolov 2010-06-16 01:01:57 +04:00 committed by Anatoly Sokolov
parent d1a115f895
commit e4f7c48321
10 changed files with 81 additions and 33 deletions

View File

@ -1,3 +1,24 @@
2010-06-15 Anatoly Sokolov <aesok@post.ru>
* target.h (struct asm_out):Add declare_constant_name field.
* target-def.h (TARGET_ASM_DECLARE_CONSTANT_NAME): Define.
(TARGET_INITIALIZER): Use TARGET_ASM_DECLARE_CONSTANT_NAME.
* output.h (default_asm_declare_constant_name): Declare.
(assemble_label): Update prototype.
* varasm.c (assemble_constant_contents): Use
targetm.asm_out.declare_constant_name target hook.
(assemble_label): Add 'file' argument.
(default_asm_declare_constant_name): New function.
* system.h (ASM_DECLARE_CONSTANT_NAME): Poison.
* doc/tm.texi (ASM_DECLARE_CONSTANT_NAME): Remove.
(TARGET_ASM_DECLARE_CONSTANT_NAME): Document it.
* config/darwin-protos.h (darwin_asm_declare_constant_name): Declare.
* config/darwin.c (darwin_asm_declare_constant_name): New function.
(machopic_output_indirection): Update assemble_label argument list.
* config/darwin.h (ASM_DECLARE_CONSTANT_NAME): Remove.
(TARGET_ASM_DECLARE_CONSTANT_NAME): Define.
2010-06-15 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/44391

View File

@ -87,6 +87,8 @@ extern void darwin_asm_output_dwarf_delta (FILE *, int, const char *,
const char *);
extern void darwin_asm_output_dwarf_offset (FILE *, int, const char *,
section *);
extern void darwin_asm_declare_constant_name (FILE *, const char *,
const_tree, HOST_WIDE_INT);
extern bool darwin_binds_local_p (const_tree);
extern void darwin_cpp_builtins (struct cpp_reader *);
extern void darwin_asm_output_anchor (rtx symbol);

View File

@ -966,7 +966,7 @@ machopic_output_indirection (void **slot, void *data)
{
switch_to_section (data_section);
assemble_align (GET_MODE_ALIGNMENT (Pmode));
assemble_label (ptr_name);
assemble_label (asm_out_file, ptr_name);
assemble_integer (gen_rtx_SYMBOL_REF (Pmode, sym_name),
GET_MODE_SIZE (Pmode),
GET_MODE_ALIGNMENT (Pmode), 1);
@ -1617,6 +1617,20 @@ darwin_non_lazy_pcrel (FILE *file, rtx addr)
fputs ("-.", file);
}
/* The implementation of ASM_DECLARE_CONSTANT_NAME. */
void
darwin_asm_declare_constant_name (FILE *file, const char *name,
const_tree exp ATTRIBUTE_UNUSED,
HOST_WIDE_INT size)
{
assemble_label (file, name);
/* Darwin doesn't support zero-size objects, so give them a byte. */
if ((size) == 0)
assemble_zeros (1);
}
/* Emit an assembler directive to set visibility for a symbol. The
only supported visibilities are VISIBILITY_DEFAULT and
VISIBILITY_HIDDEN; the latter corresponds to Darwin's "private

View File

@ -652,14 +652,8 @@ extern GTY(()) int darwin_ms_struct;
ASM_OUTPUT_LABEL (FILE, xname); \
} while (0)
#define ASM_DECLARE_CONSTANT_NAME(FILE, NAME, EXP, SIZE) \
do { \
ASM_OUTPUT_LABEL (FILE, NAME); \
/* Darwin doesn't support zero-size objects, so give them a \
byte. */ \
if ((SIZE) == 0) \
assemble_zeros (1); \
} while (0)
#undef TARGET_ASM_DECLARE_CONSTANT_NAME
#define TARGET_ASM_DECLARE_CONSTANT_NAME darwin_asm_declare_constant_name
/* Wrap new method names in quotes so the assembler doesn't gag.
Make Objective-C internal symbols local and in doing this, we need

View File

@ -7787,21 +7787,19 @@ You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} and/or
@code{ASM_OUTPUT_SIZE_DIRECTIVE} in the definition of this macro.
@end defmac
@defmac ASM_DECLARE_CONSTANT_NAME (@var{stream}, @var{name}, @var{exp}, @var{size})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} any text necessary for declaring the name @var{name} of a
constant which is being defined. This macro is responsible for
outputting the label definition (perhaps using
@code{ASM_OUTPUT_LABEL}). The argument @var{exp} is the
value of the constant, and @var{size} is the size of the constant
in bytes. @var{name} will be an internal label.
@deftypefn {Target Hook} void TARGET_ASM_DECLARE_CONSTANT_NAME (FILE * @var{file}, const char * @var{name}, const_tree @var{expr}, HOST_WIDE_INT @var{size})
A target hook to output to the stdio stream @var{file} any text necessary
for declaring the name @var{name} of a constant which is being defined. This
target hook is responsible for outputting the label definition (perhaps using
@code{assemble_label}). The argument @var{exp} is the value of the constant,
and @var{size} is the size of the constant in bytes. The @var{name}
will be an internal label.
If this macro is not defined, then the @var{name} is defined in the
usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
The default version of this target hook, define the @var{name} in the
usual manner as a label (by means of @code{assemble_label}).
You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in the definition
of this macro.
@end defmac
You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in this target hook.
@end deftypefn
@defmac ASM_DECLARE_REGISTER_GLOBAL (@var{stream}, @var{decl}, @var{regno}, @var{name})
A C statement (sans semicolon) to output to the stdio stream

View File

@ -1,7 +1,8 @@
/* Declarations for insn-output.c. These functions are defined in recog.c,
final.c, and varasm.c.
Copyright (C) 1987, 1991, 1994, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@ -230,7 +231,7 @@ extern void assemble_string (const char *, int);
extern void assemble_external_libcall (rtx);
/* Assemble a label named NAME. */
extern void assemble_label (const char *);
extern void assemble_label (FILE *, const char *);
/* Output to FILE (an assembly file) a reference to NAME. If NAME
starts with a *, the rest of NAME is output verbatim. Otherwise
@ -630,6 +631,8 @@ extern void default_globalize_decl_name (FILE *, tree);
extern void default_emit_unwind_label (FILE *, tree, int, int);
extern void default_emit_except_table_label (FILE *);
extern void default_internal_label (FILE *, const char *, unsigned long);
extern void default_asm_declare_constant_name (FILE *, const char *,
const_tree, HOST_WIDE_INT);
extern void default_file_start (void);
extern void file_end_indicate_exec_stack (void);

View File

@ -768,7 +768,8 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
SMALL_ARG_MAX ASM_OUTPUT_SHARED_BSS ASM_OUTPUT_SHARED_COMMON \
ASM_OUTPUT_SHARED_LOCAL ASM_MAKE_LABEL_LINKONCE \
STACK_CHECK_PROBE_INTERVAL STACK_CHECK_PROBE_LOAD \
ORDER_REGS_FOR_LOCAL_ALLOC FUNCTION_OUTGOING_VALUE
ORDER_REGS_FOR_LOCAL_ALLOC FUNCTION_OUTGOING_VALUE \
ASM_DECLARE_CONSTANT_NAME
/* Hooks that are no longer used. */
#pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \

View File

@ -84,6 +84,10 @@
#define TARGET_ASM_INTERNAL_LABEL default_internal_label
#endif
#ifndef TARGET_ASM_DECLARE_CONSTANT_NAME
#define TARGET_ASM_DECLARE_CONSTANT_NAME default_asm_declare_constant_name
#endif
#ifndef TARGET_ASM_TTYPE
#define TARGET_ASM_TTYPE hook_bool_rtx_false
#endif
@ -297,6 +301,7 @@
TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL, \
TARGET_UNWIND_EMIT, \
TARGET_ASM_INTERNAL_LABEL, \
TARGET_ASM_DECLARE_CONSTANT_NAME, \
TARGET_ASM_TTYPE, \
TARGET_ASM_ASSEMBLE_VISIBILITY, \
TARGET_ASM_FUNCTION_PROLOGUE, \

View File

@ -171,6 +171,10 @@ struct gcc_target
/* Output an internal label. */
void (* internal_label) (FILE *, const char *, unsigned long);
/* Output label for the constant. */
void (* declare_constant_name) (FILE *, const char *, const_tree,
HOST_WIDE_INT);
/* Emit a ttype table reference to a typeinfo object. */
bool (* ttype) (rtx);

View File

@ -2461,9 +2461,9 @@ assemble_external_libcall (rtx fun)
/* Assemble a label named NAME. */
void
assemble_label (const char *name)
assemble_label (FILE *file, const char *name)
{
ASM_OUTPUT_LABEL (asm_out_file, name);
ASM_OUTPUT_LABEL (file, name);
}
/* Set the symbol_referenced flag for ID. */
@ -3475,12 +3475,7 @@ assemble_constant_contents (tree exp, const char *label, unsigned int align)
size = get_constant_size (exp);
/* Do any machine/system dependent processing of the constant. */
#ifdef ASM_DECLARE_CONSTANT_NAME
ASM_DECLARE_CONSTANT_NAME (asm_out_file, label, exp, size);
#else
/* Standard thing is just output label for the constant. */
ASM_OUTPUT_LABEL (asm_out_file, label);
#endif /* ASM_DECLARE_CONSTANT_NAME */
targetm.asm_out.declare_constant_name (asm_out_file, label, exp, size);
/* Output the value of EXP. */
output_constant (exp, size, align);
@ -6894,6 +6889,17 @@ default_internal_label (FILE *stream, const char *prefix,
ASM_OUTPUT_INTERNAL_LABEL (stream, buf);
}
/* The default implementation of ASM_DECLARE_CONSTANT_NAME. */
void
default_asm_declare_constant_name (FILE *file, const char *name,
const_tree exp ATTRIBUTE_UNUSED,
HOST_WIDE_INT size ATTRIBUTE_UNUSED)
{
assemble_label (file, name);
}
/* This is the default behavior at the beginning of a file. It's
controlled by two other target-hook toggles. */
void