aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/cp-lang.c2
-rw-r--r--gcc/cp/tree.c1
-rw-r--r--gcc/langhooks-def.h3
-rw-r--r--gcc/langhooks.c27
-rw-r--r--gcc/langhooks.h7
-rw-r--r--gcc/tree.c49
-rw-r--r--gcc/tree.h14
9 files changed, 73 insertions, 50 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 72e1f0c..a5b6c3c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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()
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7c03c0d..a7ffd32 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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:
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index f4d3cb0..b7d129a 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -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
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index d66d3d8..c96f0e2 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -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),
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index c922e22..5e90a95 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -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, \
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index 9287711..4cdb8ab 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -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
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index 804e811..299efcd 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -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;
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
diff --git a/gcc/tree.h b/gcc/tree.h
index 74eefe7..ad24904 100644
--- a/gcc/tree.h
+++ b/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 */