aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2002-04-03 22:26:37 +0000
committerNeil Booth <neil@gcc.gnu.org>2002-04-03 22:26:37 +0000
commit599bba86dffe8bd03676f4bf50bca436d3112b90 (patch)
treea01f3b59f8231281416c086ab666faaa4b32176c /gcc/tree.c
parentcf7b8b0dc4258c4530a283000eea788c211029f9 (diff)
downloadgcc-599bba86dffe8bd03676f4bf50bca436d3112b90.zip
gcc-599bba86dffe8bd03676f4bf50bca436d3112b90.tar.gz
gcc-599bba86dffe8bd03676f4bf50bca436d3112b90.tar.bz2
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
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c49
1 files changed, 12 insertions, 37 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 4740891..f4aea26 100644
--- a/gcc/tree.c
+++ b/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