public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [debug-early] avoid unnecessary dwarf passes
Date: Tue, 24 Mar 2015 17:27:00 -0000	[thread overview]
Message-ID: <55119E77.3040605@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]

I've been trying to squash DIEs that get generated too late, and here 
are some minor fixes.

First, I'm now caching CONST_DECL DIEs.  No sense recreating them in 
late debug.

Second, I've limited gen_generic_params_dies() to early dwarf.  I don't 
think we get any additional location info or anything later.

Last, and similarly as above, imported modules shouldn't need to be 
generated in late debug at all.  I don't think they were, but no sense 
going through them as part of process_scope_var in late debug.

Committed to branch.

Aldy

[-- Attachment #2: curr --]
[-- Type: text/plain, Size: 1736 bytes --]

commit ae58778141d336360ea4a7cb7238896eebbe797f
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Tue Mar 24 10:17:38 2015 -0700

    Cache CONST_DECL dies.
    
    Avoid unnecessary dwarf passes.

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 044869d..48e2eed 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -19080,7 +19080,8 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
       /* XXX */
       if (!lookup_decl_die (decl))
 	equate_decl_number_to_die (decl, subr_die);
-      gen_generic_params_dies (decl);
+      if (early_dwarf_dumping)
+	gen_generic_params_dies (decl);
     }
 
   /* Now output descriptions of the arguments for this function. This gets
@@ -19713,7 +19714,12 @@ gen_const_die (tree decl, dw_die_ref context_die)
   dw_die_ref const_die;
   tree type = TREE_TYPE (decl);
 
+  const_die = lookup_decl_die (decl);
+  if (const_die)
+    return;
+
   const_die = new_die (DW_TAG_constant, context_die, decl);
+  equate_decl_number_to_die (decl, const_die);
   add_name_and_src_coords_attributes (const_die, decl);
   add_type_attribute (const_die, type, TYPE_QUAL_CONST, context_die);
   if (TREE_PUBLIC (decl))
@@ -21018,8 +21024,11 @@ process_scope_var (tree stmt, tree decl, tree origin, dw_die_ref context_die)
   if (die != NULL && die->die_parent == NULL)
     add_child_die (context_die, die);
   else if (TREE_CODE (decl_or_origin) == IMPORTED_DECL)
-    dwarf2out_imported_module_or_decl_1 (decl_or_origin, DECL_NAME (decl_or_origin),
-					 stmt, context_die);
+    {
+      if (early_dwarf_dumping)
+	dwarf2out_imported_module_or_decl_1 (decl_or_origin, DECL_NAME (decl_or_origin),
+					     stmt, context_die);
+    }
   else
     gen_decl_die (decl, origin, context_die);
 }

                 reply	other threads:[~2015-03-24 17:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55119E77.3040605@redhat.com \
    --to=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).