]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
langhooks-def.h (lhd_set_decl_assembler_name, [...]): New.
authorNeil Booth <neil@daikokuya.demon.co.uk>
Wed, 3 Apr 2002 22:26:37 +0000 (22:26 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Wed, 3 Apr 2002 22:26:37 +0000 (22:26 +0000)
* 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

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/cp-lang.c
gcc/cp/tree.c
gcc/langhooks-def.h
gcc/langhooks.c
gcc/langhooks.h
gcc/tree.c
gcc/tree.h

index 72e1f0c82dc335c64e51d9c22ae2ad5c52f00ba5..a5b6c3c73ee2a96ccfb05403113b1a59fec1ee86 100644 (file)
@@ -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()
index 7c03c0d9494345f002e8e31368630f68666443a8..a7ffd32d62138935cee79147bdd73ae32b6838eb 100644 (file)
@@ -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:
index f4d3cb0268257b394423c06d6a745a8b758803bd..b7d129a7c216c742e1ac43987b8483d5696a9c66 100644 (file)
@@ -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
index d66d3d8b8628843e052018301927bd96b2cb217c..c96f0e24d775811db2a82dba6a5759c425c64d2d 100644 (file)
@@ -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),
index c922e22a127668ba29f04456c1436c5ff46d1140..5e90a9544ee69e3c07bdf2dcd03e8c4b45eca71b 100644 (file)
@@ -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, \
index 92877117e5db8ca6b49d95c3a91c832f100344a7..4cdb8abee7864d1c290ff13293dd1b1628f02a8d 100644 (file)
@@ -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
index 804e811d4b57596b857ad4be9cd646e64afb93e1..299efcd8a929b00e6a7cfbfc6d61e6679992a421 100644 (file)
@@ -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;
 
index 47408914f3209455754e05f93077b333da53405e..f4aea2602c33d35cf5a9850a86b9a646e59b8812 100644 (file)
@@ -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));
-\f
 tree global_trees[TI_MAX];
 tree integer_types[itk_none];
 \f
-/* 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 ();
-}
-\f
 /* 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;
 }
 
 \f
@@ -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
index 74eefe72ea7b775cc148bb6e214e0d62923b8c06..ad24904f1d61d4171f523a577b163568bfa1dcd9 100644 (file)
@@ -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 */