[PATCH] DECL_ASSEMBLER_NAME and friends
authorNathan Sidwell <nathan@gcc.gnu.org>
Wed, 11 Oct 2017 15:33:51 +0000 (15:33 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 11 Oct 2017 15:33:51 +0000 (15:33 +0000)
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00582.html
* tree.h (DECL_ASSEMBLER_NAME_RAW): New.
(SET_DECL_ASSEMBLER_NAME): Use it.
(DECL_ASSEMBLER_NAME_SET_P): Likewise.
(COPY_DECL_ASSEMBLER_NAME): Likewise.
* tree.c (decl_assembler_name): Use DECL_ASSEMBLER_NAME_RAW.

lto/
* lto.c (mentions_vars_p_decl_with_vis): Use
DECL_ASSEMBLER_NAME_RAW.
(lto_fixup_prevailing_decls): Likewise.

cp
* decl2.c (struct mangled_decl_hash): Use DECL_ASSEMBLER_NAME_RAW.
(record_mangling): Likewise.

From-SVN: r253647

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/lto/ChangeLog
gcc/lto/lto.c
gcc/tree.c
gcc/tree.h

index 8d09e1038012cee1365133363b8444ae8a3f5db0..273f561fd8720f8c499de4d93fb29895015a0f6f 100644 (file)
@@ -1,3 +1,11 @@
+2017-10-11  Nathan Sidwell  <nathan@acm.org>
+
+       * tree.h (DECL_ASSEMBLER_NAME_RAW): New.
+       (SET_DECL_ASSEMBLER_NAME): Use it.
+       (DECL_ASSEMBLER_NAME_SET_P): Likewise.
+       (COPY_DECL_ASSEMBLER_NAME): Likewise.
+       * tree.c (decl_assembler_name): Use DECL_ASSEMBLER_NAME_RAW.
+
 2017-10-11  Jan Hubicka  <hubicka@ucw.cz>
 
        * config.gcc (i386, x86_64): Add extra objects.
 
 2017-10-10  Jan Hubicka  <hubicka@ucw.cz>
 
-       * x86-tune.def (X86_TUNE_AVOID_FALSE_DEP_FOR_BMI, X86_TUNE_ADJUST_UNROLL,
-       X86_TUNE_ONE_IF_CONV_INSN): Move to right spot in the file.
+       * x86-tune.def (X86_TUNE_AVOID_FALSE_DEP_FOR_BMI,
+       X86_TUNE_ADJUST_UNROLL, X86_TUNE_ONE_IF_CONV_INSN): Move to right
+       spot in the file.
 
 2017-10-10  Richard Sandiford  <richard.sandiford@linaro.org>
 
index c0ca1f896cce969cd3d11ae857547d77c33db33f..611742da83bab644c287fdcd20b8b0a805b103b2 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-11  Nathan Sidwell  <nathan@acm.org>
+
+       * decl2.c (struct mangled_decl_hash): Use DECL_ASSEMBLER_NAME_RAW.
+       (record_mangling): Likewise.
+
 2017-10-10  Nathan Sidwell  <nathan@acm.org>
 
        * name-lookup.c (extern_c_fns): Rename to ...
index 3c93d5c7cf5ea1c07fa6ea6ca5bc4d408882175f..bc509623b36508317567449b60a0b68d79585391 100644 (file)
@@ -103,7 +103,7 @@ static GTY(()) vec<tree, va_gc> *no_linkage_decls;
 static GTY(()) vec<tree, va_gc> *mangling_aliases;
 
 /* hash traits for declarations.  Hashes single decls via
-   DECL_ASSEMBLER_NAME.  */
+   DECL_ASSEMBLER_NAME_RAW.  */
 
 struct mangled_decl_hash : ggc_remove <tree>
 {
@@ -112,11 +112,11 @@ struct mangled_decl_hash : ggc_remove <tree>
 
   static hashval_t hash (const value_type decl)
   {
-    return IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME (decl));
+    return IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME_RAW (decl));
   }
   static bool equal (const value_type existing, compare_type candidate)
   {
-    tree name = DECL_ASSEMBLER_NAME (existing);
+    tree name = DECL_ASSEMBLER_NAME_RAW (existing);
     return candidate == name;
   }
 
@@ -4399,7 +4399,7 @@ record_mangling (tree decl, bool need_warning)
     mangled_decls = hash_table<mangled_decl_hash>::create_ggc (499);
 
   gcc_checking_assert (DECL_ASSEMBLER_NAME_SET_P (decl));
-  tree id = DECL_ASSEMBLER_NAME (decl);
+  tree id = DECL_ASSEMBLER_NAME_RAW (decl);
   tree *slot
     = mangled_decls->find_slot_with_hash (id, IDENTIFIER_HASH_VALUE (id),
                                          INSERT);
index fef0f9cc96dcfb907011d54d2182086cea339365..3e6b00bc487091bdeaf0f196382faebfcb1b06c0 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-11  Nathan Sidwell  <nathan@acm.org>
+
+       * lto.c (mentions_vars_p_decl_with_vis): Use
+       DECL_ASSEMBLER_NAME_RAW.
+       (lto_fixup_prevailing_decls): Likewise.
+
 2017-10-10  Richard Sandiford  <richard.sandiford@linaro.org>
 
        * lto.c (compare_tree_sccs_1): Use wi::to_wide when
index cc36851b8b679fbb70f7545d79e48b0ad57ee32e..63ba73c0dbf2fce9798c99d360ecabb5b614a8f6 100644 (file)
@@ -591,7 +591,7 @@ mentions_vars_p_decl_with_vis (tree t)
     return true;
 
   /* Accessor macro has side-effects, use field-name here. */
-  CHECK_NO_VAR (t->decl_with_vis.assembler_name);
+  CHECK_NO_VAR (DECL_ASSEMBLER_NAME_RAW (t));
   return false;
 }
 
@@ -2557,7 +2557,7 @@ lto_fixup_prevailing_decls (tree t)
        }
       if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
        {
-         LTO_NO_PREVAIL (t->decl_with_vis.assembler_name);
+         LTO_NO_PREVAIL (DECL_ASSEMBLER_NAME_RAW (t));
        }
       if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
        {
index a43177b6a39b7896ede886208e891b6e2b413f93..8acbdf70f4e21caefd508d3ff7601b73b1da931a 100644 (file)
@@ -671,7 +671,7 @@ decl_assembler_name (tree decl)
 {
   if (!DECL_ASSEMBLER_NAME_SET_P (decl))
     lang_hooks.set_decl_assembler_name (decl);
-  return DECL_WITH_VIS_CHECK (decl)->decl_with_vis.assembler_name;
+  return DECL_ASSEMBLER_NAME_RAW (decl);
 }
 
 /* When the target supports COMDAT groups, this indicates which group the
index 9507c3bef51b103c8e3be5785acbcb31ab6261b0..b542f5181f5d3c798705bc403dbd081dacb9f1f0 100644 (file)
@@ -2721,6 +2721,10 @@ extern void decl_value_expr_insert (tree, tree);
    LTO compilation and C++.  */
 #define DECL_ASSEMBLER_NAME(NODE) decl_assembler_name (NODE)
 
+/* Raw accessor for DECL_ASSEMBLE_NAME.  */
+#define DECL_ASSEMBLER_NAME_RAW(NODE) \
+  (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.assembler_name)
+
 /* Return true if NODE is a NODE that can contain a DECL_ASSEMBLER_NAME.
    This is true of all DECL nodes except FIELD_DECL.  */
 #define HAS_DECL_ASSEMBLER_NAME_P(NODE) \
@@ -2731,11 +2735,11 @@ extern void decl_value_expr_insert (tree, tree);
    yet.  */
 #define DECL_ASSEMBLER_NAME_SET_P(NODE) \
   (HAS_DECL_ASSEMBLER_NAME_P (NODE) \
-   && DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.assembler_name != NULL_TREE)
+   && DECL_ASSEMBLER_NAME_RAW (NODE) != NULL_TREE)
 
 /* Set the DECL_ASSEMBLER_NAME for NODE to NAME.  */
 #define SET_DECL_ASSEMBLER_NAME(NODE, NAME) \
-  (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.assembler_name = (NAME))
+  (DECL_ASSEMBLER_NAME_RAW (NODE) = (NAME))
 
 /* Copy the DECL_ASSEMBLER_NAME from DECL1 to DECL2.  Note that if DECL1's
    DECL_ASSEMBLER_NAME has not yet been set, using this macro will not cause
@@ -2747,10 +2751,7 @@ extern void decl_value_expr_insert (tree, tree);
    which will try to set the DECL_ASSEMBLER_NAME for DECL1.  */
 
 #define COPY_DECL_ASSEMBLER_NAME(DECL1, DECL2)                         \
-  (DECL_ASSEMBLER_NAME_SET_P (DECL1)                                   \
-   ? (void) SET_DECL_ASSEMBLER_NAME (DECL2,                            \
-                                    DECL_ASSEMBLER_NAME (DECL1))       \
-   : (void) 0)
+  SET_DECL_ASSEMBLER_NAME (DECL2, DECL_ASSEMBLER_NAME_RAW (DECL1))
 
 /* Records the section name in a section attribute.  Used to pass
    the name from decl_attributes to make_function_rtl and make_decl_rtl.  */