[debug-early] remove deferred_asm_name
diff mbox

Message ID 54AC3746.2070504@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez Jan. 6, 2015, 7:28 p.m. UTC
As discussed in previous threads, we need to get rid of 
deferred_asm_name (and limbo nodes, etc) as part of the debug-early work.

The original patch for deferred_asm_name came in Alex's patch here:

https://gcc.gnu.org/ml/gcc-patches/2009-06/msg00030.html

One alternative to avoid this mechanism would be to to provide a non 
destructive decl_assembler_name() variant that would just return the 
mangled name, but without setting the .assembler_name field and 
triggering the template instantiation Alex speaks of.  I had a patch for 
this, but Jason was skeptical that the instantiation was still 
happening.  At Jason's request, I have removed deferred_asm_name 
altogether, and tested it by a full bootstrap on _mainline_.

Unless someone can come up with a testcase for the instantiation 
problem, I am going to commit this to the branch within a day or two.

Jason/Richi: Does this patch look reasonable?

Thanks.
Aldy
commit 4c3da3f77a9a996179ee2b9f05b89d02fa103c95
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Tue Jan 6 11:14:07 2015 -0800

    	* dwarf2out.c: Remove deferred_asm_name.
    	(add_linkage_name): Same.
    	(dwarf2out_finish): Same.
    	(dwarf2out_c_finalize): Same.
    	(move_linkage_attr): Remove.

Comments

Jason Merrill Jan. 6, 2015, 10:07 p.m. UTC | #1
Let's also run the testsuite with the environment variable 
GCC_COMPARE_DEBUG=1.

Jason

Patch
diff mbox

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 9d60d88..e3ccda2 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -2785,10 +2785,6 @@  static GTY(()) comdat_type_node *comdat_type_list;
 /* A list of DIEs with a NULL parent waiting to be relocated.  */
 static GTY(()) limbo_die_node *limbo_die_list;
 
-/* A list of DIEs for which we may have to generate
-   DW_AT_{,MIPS_}linkage_name once their DECL_ASSEMBLER_NAMEs are set.  */
-static GTY(()) limbo_die_node *deferred_asm_name;
-
 struct dwarf_file_hasher : ggc_hasher<dwarf_file_data *>
 {
   typedef const char *compare_type;
@@ -17007,22 +17003,9 @@  add_linkage_name (dw_die_ref die, tree decl)
       && (TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL)
       && TREE_PUBLIC (decl)
       && !(TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
-      && die->die_tag != DW_TAG_member)
-    {
-      /* Defer until we have an assembler name set.  */
-      if (!DECL_ASSEMBLER_NAME_SET_P (decl))
-	{
-	  limbo_die_node *asm_name;
-
-	  asm_name = ggc_cleared_alloc<limbo_die_node> ();
-	  asm_name->die = die;
-	  asm_name->created_for = decl;
-	  asm_name->next = deferred_asm_name;
-	  deferred_asm_name = asm_name;
-	}
-      else if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
-	add_linkage_attr (die, decl);
-    }
+      && die->die_tag != DW_TAG_member
+      && DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
+    add_linkage_attr (die, decl);
 }
 
 /* Add a DW_AT_name attribute and source coordinate attribute for the
@@ -23597,37 +23580,6 @@  comdat_type_hasher::equal (const value_type *type_node_1,
                     DWARF_TYPE_SIGNATURE_SIZE));
 }
 
-/* Move a DW_AT_{,MIPS_}linkage_name attribute just added to dw_die_ref
-   to the location it would have been added, should we know its
-   DECL_ASSEMBLER_NAME when we added other attributes.  This will
-   probably improve compactness of debug info, removing equivalent
-   abbrevs, and hide any differences caused by deferring the
-   computation of the assembler name, triggered by e.g. PCH.  */
-
-static inline void
-move_linkage_attr (dw_die_ref die)
-{
-  unsigned ix = vec_safe_length (die->die_attr);
-  dw_attr_node linkage = (*die->die_attr)[ix - 1];
-
-  gcc_assert (linkage.dw_attr == DW_AT_linkage_name
-	      || linkage.dw_attr == DW_AT_MIPS_linkage_name);
-
-  while (--ix > 0)
-    {
-      dw_attr_node *prev = &(*die->die_attr)[ix - 1];
-
-      if (prev->dw_attr == DW_AT_decl_line || prev->dw_attr == DW_AT_name)
-	break;
-    }
-
-  if (ix != vec_safe_length (die->die_attr) - 1)
-    {
-      die->die_attr->pop ();
-      die->die_attr->quick_insert (ix, linkage);
-    }
-}
-
 /* Helper function for resolve_addr, mark DW_TAG_base_type nodes
    referenced from typed stack ops and count how often they are used.  */
 
@@ -24873,23 +24825,6 @@  dwarf2out_finish (const char *filename)
   resolve_addr (comp_unit_die ());
   move_marked_base_types ();
 
-  for (node = deferred_asm_name; node; node = node->next)
-    {
-      tree decl = node->created_for;
-      /* When generating LTO bytecode we can not generate new assembler
-         names at this point and all important decls got theirs via
-	 free-lang-data.  */
-      if (((!flag_generate_lto && !flag_generate_offload)
-	   || DECL_ASSEMBLER_NAME_SET_P (decl))
-	  && DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
-	{
-	  add_linkage_attr (node->die, decl);
-	  move_linkage_attr (node->die);
-	}
-    }
-
-  deferred_asm_name = NULL;
-
   /* Walk through the list of incomplete types again, trying once more to
      emit full debugging info for them.  */
   retry_incomplete_types ();
@@ -25231,7 +25166,6 @@  dwarf2out_c_finalize (void)
   single_comp_unit_die = NULL;
   comdat_type_list = NULL;
   limbo_die_list = NULL;
-  deferred_asm_name = NULL;
   file_table = NULL;
   decl_die_table = NULL;
   common_block_die_table = NULL;