langhooks-def.h (lhd_set_decl_assembler_name, [...]): New.
* langhooks-def.h (lhd_set_decl_assembler_name, LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): New. (LANG_HOOKS_INITIALIZER): Update. * langhooks.c (lhd_set_decl_assembler_name): New, from tree.c * langhooks.h (struct lang_hooks): New hook. * tree.c (set_decl_assembler_name): Move to langhooks.c. (lang_set_decl_assembler_name): Remove. (init_obstacks): Don't set hook. (decl_assembler_name): New function. * tree.h (DECL_ASSEMBLER_NAME): Turn into a function call. (decl_assembler_name): New. (lang_set_decl_assembler_name): Remove. cp: * cp-lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): Redefine. * tree.c (init_tree): Don't set hook. From-SVN: r51817
This commit is contained in:
parent
cf7b8b0dc4
commit
599bba86df
|
@ -1,3 +1,18 @@
|
|||
2002-04-03 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||
|
||||
* langhooks-def.h (lhd_set_decl_assembler_name,
|
||||
LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): New.
|
||||
(LANG_HOOKS_INITIALIZER): Update.
|
||||
* langhooks.c (lhd_set_decl_assembler_name): New, from tree.c
|
||||
* langhooks.h (struct lang_hooks): New hook.
|
||||
* tree.c (set_decl_assembler_name): Move to langhooks.c.
|
||||
(lang_set_decl_assembler_name): Remove.
|
||||
(init_obstacks): Don't set hook.
|
||||
(decl_assembler_name): New function.
|
||||
* tree.h (DECL_ASSEMBLER_NAME): Turn into a function call.
|
||||
(decl_assembler_name): New.
|
||||
(lang_set_decl_assembler_name): Remove.
|
||||
|
||||
2002-04-03 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* configure.in (HAVE_SPARC_UA_PCREL_HIDDEN): Test whether %r_disp32()
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2002-04-03 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||
|
||||
* cp-lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): Redefine.
|
||||
* tree.c (init_tree): Don't set hook.
|
||||
|
||||
2002-04-03 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
PR c++/5998:
|
||||
|
|
|
@ -67,6 +67,8 @@ static bool ok_to_generate_alias_set_for_type PARAMS ((tree));
|
|||
#define LANG_HOOKS_MARK_TREE cxx_mark_tree
|
||||
#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
|
||||
#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
|
||||
#undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
|
||||
#define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME mangle_decl
|
||||
#undef LANG_HOOKS_MARK_ADDRESSABLE
|
||||
#define LANG_HOOKS_MARK_ADDRESSABLE cxx_mark_addressable
|
||||
#undef LANG_HOOKS_PRINT_STATISTICS
|
||||
|
|
|
@ -2295,7 +2295,6 @@ void
|
|||
init_tree ()
|
||||
{
|
||||
lang_statement_code_p = cp_statement_code_p;
|
||||
lang_set_decl_assembler_name = mangle_decl;
|
||||
list_hash_table = htab_create (31, list_hash, list_hash_eq, NULL);
|
||||
ggc_add_root (&list_hash_table, 1,
|
||||
sizeof (list_hash_table),
|
||||
|
|
|
@ -55,6 +55,7 @@ extern void lhd_set_yydebug PARAMS ((int));
|
|||
extern rtx lhd_expand_expr PARAMS ((tree, rtx, enum machine_mode, int));
|
||||
extern void lhd_print_error_function PARAMS ((struct diagnostic_context *,
|
||||
const char *));
|
||||
extern void lhd_set_decl_assembler_name PARAMS ((tree));
|
||||
|
||||
/* Declarations of default tree inlining hooks. */
|
||||
tree lhd_tree_inlining_walk_subtrees PARAMS ((tree *, int *,
|
||||
|
@ -94,6 +95,7 @@ tree lhd_tree_inlining_convert_parm_for_inlining PARAMS ((tree, tree, tree));
|
|||
#define LANG_HOOKS_UNSAVE_EXPR_NOW lhd_unsave_expr_now
|
||||
#define LANG_HOOKS_MAYBE_BUILD_CLEANUP lhd_return_null_tree
|
||||
#define LANG_HOOKS_MARK_TREE lhd_do_nothing_t
|
||||
#define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lhd_set_decl_assembler_name
|
||||
#define LANG_HOOKS_HONOR_READONLY false
|
||||
#define LANG_HOOKS_PRINT_STATISTICS lhd_do_nothing
|
||||
#define LANG_HOOKS_PRINT_XNODE lhd_print_tree_nothing
|
||||
|
@ -209,6 +211,7 @@ int lhd_tree_dump_type_quals PARAMS ((tree));
|
|||
LANG_HOOKS_UNSAVE_EXPR_NOW, \
|
||||
LANG_HOOKS_MAYBE_BUILD_CLEANUP, \
|
||||
LANG_HOOKS_MARK_TREE, \
|
||||
LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, \
|
||||
LANG_HOOKS_HONOR_READONLY, \
|
||||
LANG_HOOKS_PRINT_STATISTICS, \
|
||||
LANG_HOOKS_PRINT_XNODE, \
|
||||
|
|
|
@ -123,6 +123,33 @@ lhd_set_yydebug (value)
|
|||
fprintf (stderr, "warning: no yacc/bison-generated output to debug!\n");
|
||||
}
|
||||
|
||||
/* Set the DECL_ASSEMBLER_NAME for DECL. */
|
||||
void
|
||||
lhd_set_decl_assembler_name (decl)
|
||||
tree decl;
|
||||
{
|
||||
/* The language-independent code should never use the
|
||||
DECL_ASSEMBLER_NAME for lots of DECLs. Only FUNCTION_DECLs and
|
||||
VAR_DECLs for variables with static storage duration need a real
|
||||
DECL_ASSEMBLER_NAME. */
|
||||
if (TREE_CODE (decl) == FUNCTION_DECL
|
||||
|| (TREE_CODE (decl) == VAR_DECL
|
||||
&& (TREE_STATIC (decl)
|
||||
|| DECL_EXTERNAL (decl)
|
||||
|| TREE_PUBLIC (decl))))
|
||||
/* By default, assume the name to use in assembly code is the
|
||||
same as that used in the source language. (That's correct
|
||||
for C, and GCC used to set DECL_ASSEMBLER_NAME to the same
|
||||
value as DECL_NAME in build_decl, so this choice provides
|
||||
backwards compatibility with existing front-ends. */
|
||||
SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl));
|
||||
else
|
||||
/* Nobody should ever be asking for the DECL_ASSEMBLER_NAME of
|
||||
these DECLs -- unless they're in language-dependent code, in
|
||||
which case set_decl_assembler_name hook should handle things. */
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* Provide a default routine to clear the binding stack. This is used
|
||||
by languages that don't need to do anything special. */
|
||||
void
|
||||
|
|
|
@ -242,6 +242,13 @@ struct lang_hooks
|
|||
/* Mark nodes held through the lang_specific hooks in the tree. */
|
||||
void (*mark_tree) PARAMS ((tree));
|
||||
|
||||
/* Set the DECL_ASSEMBLER_NAME for a node. If it is the sort of
|
||||
thing that the assembler should talk about, set
|
||||
DECL_ASSEMBLER_NAME to an appropriate IDENTIFIER_NODE.
|
||||
Otherwise, set it to the ERROR_MARK_NODE to ensure that the
|
||||
assembler does not talk about it. */
|
||||
void (*set_decl_assembler_name) PARAMS ((tree));
|
||||
|
||||
/* Nonzero if TYPE_READONLY and TREE_READONLY should always be honored. */
|
||||
bool honor_readonly;
|
||||
|
||||
|
|
49
gcc/tree.c
49
gcc/tree.c
|
@ -133,43 +133,9 @@ static int type_hash_marked_p PARAMS ((const void *));
|
|||
static void type_hash_mark PARAMS ((const void *));
|
||||
static int mark_tree_hashtable_entry PARAMS((void **, void *));
|
||||
|
||||
/* Set the DECL_ASSEMBLER_NAME for a node. If it is the sort of thing
|
||||
that the assembler should talk about, set DECL_ASSEMBLER_NAME to an
|
||||
appropriate IDENTIFIER_NODE. Otherwise, set it to the
|
||||
ERROR_MARK_NODE to ensure that the assembler does not talk about
|
||||
it. */
|
||||
void (*lang_set_decl_assembler_name) PARAMS ((tree));
|
||||
|
||||
tree global_trees[TI_MAX];
|
||||
tree integer_types[itk_none];
|
||||
|
||||
/* Set the DECL_ASSEMBLER_NAME for DECL. */
|
||||
void
|
||||
set_decl_assembler_name (decl)
|
||||
tree decl;
|
||||
{
|
||||
/* The language-independent code should never use the
|
||||
DECL_ASSEMBLER_NAME for lots of DECLs. Only FUNCTION_DECLs and
|
||||
VAR_DECLs for variables with static storage duration need a real
|
||||
DECL_ASSEMBLER_NAME. */
|
||||
if (TREE_CODE (decl) == FUNCTION_DECL
|
||||
|| (TREE_CODE (decl) == VAR_DECL
|
||||
&& (TREE_STATIC (decl)
|
||||
|| DECL_EXTERNAL (decl)
|
||||
|| TREE_PUBLIC (decl))))
|
||||
/* By default, assume the name to use in assembly code is the
|
||||
same as that used in the source language. (That's correct
|
||||
for C, and GCC used to set DECL_ASSEMBLER_NAME to the same
|
||||
value as DECL_NAME in build_decl, so this choice provides
|
||||
backwards compatibility with existing front-ends. */
|
||||
SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl));
|
||||
else
|
||||
/* Nobody should ever be asking for the DECL_ASSEMBLER_NAME of
|
||||
these DECLs -- unless they're in language-dependent code, in
|
||||
which case lang_set_decl_assembler_name should handle things. */
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* Init the principal obstacks. */
|
||||
|
||||
void
|
||||
|
@ -184,9 +150,6 @@ init_obstacks ()
|
|||
type_hash_mark);
|
||||
ggc_add_tree_root (global_trees, TI_MAX);
|
||||
ggc_add_tree_root (integer_types, itk_none);
|
||||
|
||||
/* Set lang_set_decl_set_assembler_name to a default value. */
|
||||
lang_set_decl_assembler_name = set_decl_assembler_name;
|
||||
}
|
||||
|
||||
|
||||
|
@ -214,6 +177,18 @@ perm_calloc (nelem, size)
|
|||
return rval;
|
||||
}
|
||||
|
||||
/* The name of the object as the assembler will see it (but before any
|
||||
translations made by ASM_OUTPUT_LABELREF). Often this is the same
|
||||
as DECL_NAME. It is an IDENTIFIER_NODE. */
|
||||
tree
|
||||
decl_assembler_name (decl)
|
||||
tree decl;
|
||||
{
|
||||
if (!DECL_ASSEMBLER_NAME_SET_P (decl))
|
||||
(*lang_hooks.set_decl_assembler_name) (decl);
|
||||
return DECL_CHECK (decl)->decl.assembler_name;
|
||||
}
|
||||
|
||||
/* Compute the number of bytes occupied by 'node'. This routine only
|
||||
looks at TREE_CODE and, if the code is TREE_VEC, TREE_VEC_LENGTH. */
|
||||
size_t
|
||||
|
|
14
gcc/tree.h
14
gcc/tree.h
|
@ -1352,11 +1352,7 @@ struct tree_type
|
|||
/* The name of the object as the assembler will see it (but before any
|
||||
translations made by ASM_OUTPUT_LABELREF). Often this is the same
|
||||
as DECL_NAME. It is an IDENTIFIER_NODE. */
|
||||
#define DECL_ASSEMBLER_NAME(NODE) \
|
||||
((DECL_ASSEMBLER_NAME_SET_P (NODE) \
|
||||
? (void) 0 \
|
||||
: (*lang_set_decl_assembler_name) (NODE)), \
|
||||
DECL_CHECK (NODE)->decl.assembler_name)
|
||||
#define DECL_ASSEMBLER_NAME(NODE) decl_assembler_name (NODE)
|
||||
|
||||
/* Returns non-zero if the DECL_ASSEMBLER_NAME for NODE has been set. If zero,
|
||||
the NODE might still have a DECL_ASSEMBLER_NAME -- it just hasn't been set
|
||||
|
@ -2057,6 +2053,7 @@ extern double approx_sqrt PARAMS ((double));
|
|||
|
||||
extern char *permalloc PARAMS ((int));
|
||||
extern char *expralloc PARAMS ((int));
|
||||
extern tree decl_assembler_name PARAMS ((tree));
|
||||
|
||||
/* Compute the number of bytes occupied by 'node'. This routine only
|
||||
looks at TREE_CODE and, if the code is TREE_VEC, TREE_VEC_LENGTH. */
|
||||
|
@ -2811,13 +2808,6 @@ extern int alias_sets_conflict_p PARAMS ((HOST_WIDE_INT,
|
|||
extern int readonly_fields_p PARAMS ((tree));
|
||||
extern int objects_must_conflict_p PARAMS ((tree, tree));
|
||||
|
||||
/* Set the DECL_ASSEMBLER_NAME for a node. If it is the sort of thing
|
||||
that the assembler should talk about, set DECL_ASSEMBLER_NAME to an
|
||||
appropriate IDENTIFIER_NODE. Otherwise, set it to the
|
||||
ERROR_MARK_NODE to ensure that the assembler does not talk about
|
||||
it. */
|
||||
extern void (*lang_set_decl_assembler_name) PARAMS ((tree));
|
||||
|
||||
struct obstack;
|
||||
|
||||
/* In tree.c */
|
||||
|
|
Loading…
Reference in New Issue