public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: dwz@sourceware.org
Subject: [Bug default/25449] Factor out compilation units
Date: Wed, 01 Jan 2020 00:00:00 -0000	[thread overview]
Message-ID: <bug-25449-11298-3kOftOHmGq@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-25449-11298@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=25449

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> So, as a first step we could do a optimization in DWZ to look at all the
> items that are selected to be moved into a PU, and decide whether we can
> transform the PU into a CU and drop the imports.

One of the requirements probably has to be that the items are from a single
language.

> An #include directive appearing outside any other declarations is a good
> candidate to be represented using DW_TAG_compile_unit.
> 
> However, an #include appearing inside a C++ namespace declaration or a
> function, for example, is not a good candidate because the entities included
> are not necessarily file level entities.

The appendix suggests DIEs in a namespace are not good candidates, but I think
what that tries to say is that if we originally we have a DIE in a namespace:
...
DIE2: compilation unit B
  DIE3: namespace bla
    DIE1
...
and do some factoring out like so:
...
DIE0: factored-out unit A
  DIE1
DIE2: compilation unit B
  DIE3: namespace bla
    DIE4: import DIE0
...
the factored-out unit cannot use DW_TAG_compile_unit, because DIE1 is not a
globally visible entry.

However, dwz generates this type of partial unit:
...
DIE0: partial unit A
  DIE3: namespace bla
    DIE1
DIE2: compilation unit B
  DIE4: import DIE0
...
which basically works around this problem, and I don't see a reason here why
unit A can't be a compilation unit.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

      parent reply	other threads:[~2020-01-23 10:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-01  0:00 [Bug default/25449] New: " vries at gcc dot gnu.org
2020-01-01  0:00 ` [Bug default/25449] " vries at gcc dot gnu.org
2020-01-01  0:00 ` vries at gcc dot gnu.org
2020-01-01  0:00 ` vries at gcc dot gnu.org [this message]

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=bug-25449-11298-3kOftOHmGq@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=dwz@sourceware.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).