Commit Graph

2770 Commits

Author SHA1 Message Date
David Blaikie
9e4e3d057f Omit DW_TAG_subprograms for subprograms without inlined subroutines when producing -gmlt data
To reduce the size of -gmlt data, skip the subprograms without any
inlined subroutines. Since we've now got the ability to make these
determinations in the backend (funnily enough - we added the flag so we
wouldn't produce ranges under -gmlt, but with this change we use the
flag, but go back to producing ranges under -gmlt).

Instead, just produce CU ranges to inform the consumer which parts of
the code are described by this CU's line table. Tools could inspect the
line table directly to compute the range, but the CU ranges only seem to
be about 0.5% of object/executable size, so I'm not too worried about
teaching llvm-symbolizer that trick just yet - it's certainly a possible
piece of future work.

Update an llvm-symbolizer test just to demonstrate that this schema is
acceptable there (if it wasn't, the compiler-rt tests would catch this,
but good to have an in-llvm-tree test for llvm-symbolizer's behavior
here)

Building the clang binary with -gmlt with this patch reduces the total
size of object files by 5.1% (5.56% without ranges) without compression
and the executable by 4.37% (4.75% without ranges).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218129 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-19 17:03:16 +00:00
Frederic Riss
f5938eeeb3 Change DwarfCompileUnit::createGlobalVariable to getOrCreateGlobalVariable.
Summary:
This will allow to request the creation of a forward delacred variable
at is point of use (for imported declarations, this will be
DwarfDebug::constructImportedEntityDIE) rather than having to put the
forward decl in a retention list.

Note that getOrCreateGlobalVariable returns the actual definition DIE when the
routine creates a declaration and a definition DIE. If you agree this is the
right behavior, then I'll have a followup patch that registers the definition
in the DIE map instead of the declaration as it is today (this 'breaks' only
one test, where we test that the imported entity is the declaration). I'm
not sure what's best here, but it's easy enough for a consumer to follow the
DW_AT_specification link to get to the declaration, whereas it takes more
work to find the actual definition from a declaration DIE.

Reviewers: echristo, dblaikie, aprantl

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D5381

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218126 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-19 15:12:03 +00:00
David Blaikie
a562871c67 Omit DW_AT_frame_base under -gmlt for size
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218100 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-19 04:55:05 +00:00
David Blaikie
37132885ef Describe the -gmlt optimization committed in the previous revision.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218099 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-19 04:47:46 +00:00
David Blaikie
a5a4f87474 Omit all the extra static attributes on subprograms in -gmlt
This omission will be done in a fancier manner once we're dealing with
"put gmlt in the skeleton CUs under fission" - it'll have to be
conditional on the kind of CU we're emitting into (skeleton or gmlt).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218098 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-19 04:30:36 +00:00
Frederic Riss
7458ce3af9 Revert part of r218041.
The patch moved some logic around in an attempt to generate potentially more
DW_AT_declaration attributes. The patch was flawed though and it stopped
generating the attribute in some cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218060 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-18 16:41:04 +00:00
Frederic Riss
0a8f3afa4e Always emit DW_AT_declaration attribute when the variable isn't a definition.
Summary:
This doesn't show up today as we don't emit decalration only variables. This
will be tested when the followup patches implementing import of forward
declared entities lands in clang.

Reviewers: echristo, dblaikie, aprantl

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D5382

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218041 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-18 09:38:23 +00:00
Owen Anderson
374e06bbce Add back a fallback case for targets that do not or cannot implement getNoopForMachoTarget().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217899 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 20:28:00 +00:00
David Blaikie
1bdc6c4519 DebugInfo: Add comment describing the need to disable address pool usage in skeleton units.
Post commit review from Eric Christopher.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217842 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-15 22:41:25 +00:00
Rafael Espindola
3f0ce4fa18 Fix a lot of confusion around inserting nops on empty functions.
On MachO, and MachO only, we cannot have a truly empty function since that
breaks the linker logic for atomizing the section.

When we are emitting a frame pointer, the presence of an unreachable will
create a cfi instruction pointing past the last instruction. This is perfectly
fine. The FDE information encodes the pc range it applies to. If some tool
cannot handle this, we should explicitly say which bug we are working around
and only work around it when it is actually relevant (not for ELF for example).

Given the unreachable we could omit the .cfi_def_cfa_register, but then
again, we could also omit the entire function prologue if we wanted to.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217801 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-15 18:32:58 +00:00
David Blaikie
85d436d90a Remove the unused string section symbol parameter from DwarfFile::emitStrings
And since it /looked/ like the DwarfStrSectionSym was unused, I tried
removing it - but then it turned out that DwarfStringPool was
reconstructing the same label (and expecting it to have already been
emitted) and uses that.

So I kept it around, but wanted to pass it in to users - since it seemed
a bit silly for DwarfStringPool to have it passed in and returned but
itself have no use for it. The only two users don't handle strings in
both .dwo and .o files so they only ever need the one symbol - no need
to keep it (and have an unused symbol) in the DwarfStringPool used for
fission/.dwo.

Refactor a bunch of accelerator table usage to remove duplication so I
didn't have to touch 4-5 callers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217628 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-11 21:12:48 +00:00
Adrian Prantl
c9547570c2 Cleanup: Use the appropriate API for accessing the DIVariable of a
DBG_VALUE intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217533 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-10 18:52:29 +00:00
Yuri Gorshenin
ca31084292 [asan-assembly-instrumentation] Added CFI directives to the generated instrumentation code.
Summary: [asan-assembly-instrumentation] Added CFI directives to the generated instrumentation code.

Reviewers: eugenis

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D5189

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217482 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-10 09:45:49 +00:00
David Blaikie
01c14f6de0 Sink PrevCU updating into DwarfUnit::addRange to ensure consistency
So that the two operations in DwarfDebug couldn't get separated (because
I accidentally separated them in some work in progress), put them
together. While we're here, move DwarfUnit::addRange to
DwarfCompileUnit, since it's not relevant to type units.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217468 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-09 23:13:01 +00:00
David Blaikie
9e0dae166f Remove DwarfDebug::PrevSection, PrevCU is sufficient for handling address range holes.
PrevSection/PrevCU are used to detect holes in the address range of a CU
to ensure the DW_AT_ranges does not include those holes. When we see a
function with no debug info, though it may be in the same range as the
prior and subsequent functions, there should be a gap in the CU's
ranges. By setting PrevCU to null in that case, the range would not be
extended to cover the gap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217466 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-09 22:56:36 +00:00
David Blaikie
22f8dcb2b5 DebugInfo: Do not use DW_FORM_GNU_addr_index in skeleton CUs, GDB 7.8 errors on this.
It's probably not a huge deal to not do this - if we could, maybe the
address could be reused by a subprogram low_pc and avoid an extra
relocation, but it's just one per CU at best.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217338 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-07 17:31:42 +00:00
Saleem Abdulrasool
901a3419d1 CodeGen: indicate Windows unwind data format
The structures for Windows unwinding are shared across multiple platforms.
Indicate the encoding to be used for the particular target.  Use this to switch
the unwind emitter instantiated by the AsmPrinter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216895 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-01 23:48:39 +00:00
Saleem Abdulrasool
05c3ddfa4e CodeGen: split out the Win64Exception emitter
Move the Windows unwind information emitter into a separate header.  This is not
related to DWARF based emission.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216894 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-01 23:48:34 +00:00
David Blaikie
e2cf6dc5c9 DebugInfo: Elide lexical scopes which only contain other (inline or lexical) scopes.
DW_TAG_lexical_scopes inform debuggers about the instruction range for
which a given variable (or imported declaration/module/etc) is valid. If
the scope doesn't itself contain any such entities, it's a waste of
space and should be omitted.

We were correctly doing this for entirely empty leaves, but not for
intermediate nodes.

Reduces total (not just debug sections) .o file size for a bootstrap
-gmlt LLVM by 22% and bootstrap -gmlt clang executable by 13%. The wins
for a full -g build will be less as a % (and in absolute terms), but
should still be substantial - with some of that win being fewer
relocations, thus more substantiall reducing link times than fewer bytes
alone would have.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216861 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-31 21:26:22 +00:00
David Blaikie
363d0d2738 DebugInfo: Move argument creation up into the caller that's unambiguously handling the subprogram scope (replacing a conditional with an assertion in the process)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216845 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-31 18:04:28 +00:00
David Blaikie
4b538d396f Delay adding imported entity DIEs to the lexical scope, streamlining the check for "this scope has nothing in it"
This makes the emptiness of the scope with regards to variables and
nested scopes is the same as with regards to imported entities. Just
check if we had nothing at all before we build the node.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216840 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-31 05:46:17 +00:00
David Blaikie
677ae42511 Modify DwarfDebug::constructImportedEntityDIE to return rather than insert into the scope
Another step towards improving lexical_scope handling

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216839 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-31 05:41:15 +00:00
David Blaikie
ba466e6909 Refactor constructImportedEntityDIE(DwarfUnit, DIImportedEntity) to return a DIE rather than inserting it into a specified context.
First of many steps to improve lexical scope construction (to omit
trivial lexical scopes - those without any direct variables). To that
end it's easier not to create imported entities directly into the
lexical scope node, but to build them, then add them if necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216838 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-31 05:32:06 +00:00
David Blaikie
b8ee7c2bf6 Simplify expression using container's front() rather than begin()->
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216833 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-31 02:14:26 +00:00
Craig Topper
24ae56d4c9 Fix some cases where StringRef was being passed by const reference. Remove const from some other StringRefs since its implicitly const already.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216820 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-30 16:48:02 +00:00
Adrian Prantl
4b9f3c1665 Debug info: Add a new explicit DIDescriptor flag for the "public" access
specifier and change the default behavior to only emit the
DW_AT_accessibility(public) attribute when the isPublic() is explicitly
set.

rdar://problem/18154959

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216799 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 22:44:07 +00:00
David Blaikie
3f4b69db4d Revert accidentally committed patches r216787-r216789
Rushed when I realized I hadn't committed the FreeDeleter for a clang
change I'd committed, and didn't check that I had things lying around in
my client.

Apologies for the noise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216792 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 22:10:52 +00:00
David Blaikie
a2fa271b36 Omit DW_AT_artificial, DW_AT_external, and similar attributes under -gmlt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216789 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 22:05:29 +00:00
David Blaikie
0f155c19a5 Omit dwarf::DW_AT_frame_base under -gmlt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216788 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 22:05:27 +00:00
David Blaikie
a66ce7afdd Stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 22:05:26 +00:00
Robin Morisset
217b38e19a Fix typos in comments, NFC
Summary: Just fixing comments, no functional change.

Test Plan: N/A

Reviewers: jfb

Subscribers: mcrosier, llvm-commits

Differential Revision: http://reviews.llvm.org/D5130

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216784 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 21:53:01 +00:00
Frederic Riss
622de3b2eb Use DwarfDebug::attachLowHighPC for the compilation unit DIE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216719 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 09:00:26 +00:00
Frederic Riss
8317095e97 Constify MCSymbol* parameters to DwarfDebug::attachLowHighPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216681 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-28 19:09:29 +00:00
Rafael Espindola
1a7f705fba Return a std::unique_ptr when creating a new MemoryBuffer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216583 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 20:03:13 +00:00
Craig Topper
16edb0e930 Fix some cases were ArrayRefs were being passed by reference. Also remove 'const' from some other ArrayRef uses since its implicitly const already.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216524 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 05:25:00 +00:00
David Blaikie
ad2a271781 Remove type unit skeletons. GDB no longer needs them & this saves a heap of space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216521 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 05:04:14 +00:00
David Blaikie
c7260209a8 Use DILexicalBlockFile, rather than DILexicalBlock, to track discriminator changes to ensure discriminator changes don't introduce new DWARF DW_TAG_lexical_blocks.
Somewhat unnoticed in the original implementation of discriminators, but
it could cause instructions to end up in new, small,
DW_TAG_lexical_blocks due to the use of DILexicalBlock to track
discriminator changes.

Instead, use DILexicalBlockFile which we already use to track file
changes without introducing new scopes, so it works well to track
discriminator changes in the same way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216239 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21 22:45:21 +00:00
David Blaikie
95ca0fb247 Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using std::unique_ptr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216223 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21 20:44:56 +00:00
Craig Topper
431bdfc4c1 Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216158 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21 05:55:13 +00:00
Craig Topper
db77b82ed5 Revert "Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size."
Getting a weird buildbot failure that I need to investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215870 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-18 00:24:38 +00:00
Craig Topper
f06c7072c2 Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215868 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-17 23:47:00 +00:00
Rafael Espindola
607e03b0d4 Delete dead code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215720 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-15 14:58:22 +00:00
Benjamin Kramer
00e08fcaa0 Canonicalize header guards into a common format.
Add header guards to files that were missing guards. Remove #endif comments
as they don't seem common in LLVM (we can easily add them back if we decide
they're useful)

Changes made by clang-tidy with minor tweaks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215558 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 16:26:38 +00:00
Adrian Prantl
ee8b879822 Remove a condition that can never be true, as wittnessed by the assert
above.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215477 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12 21:55:58 +00:00
Adrian Prantl
a6bd9bd30e DebugLocEntry: Restore the comparison predicate from before the
refactoring in 215384. This way it can unique multiple entries describing
the same piece even if they don't have the exact same location.
(The same piece may get merged in and be added from OpenRanges).
There ought to be a more elegant solution for this, though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215418 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12 01:07:53 +00:00
David Blaikie
524cd2eb7b Revert "Partially revert r214761 that asserted that all concrete debug info variables had DIEs, due to a failure on Darwin."
I believe this was addressed by r215157 and r215227, so let's have
another go at the bots, etc.

This reverts commit r214880.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215412 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12 00:00:31 +00:00
Adrian Prantl
79fb67b835 Add a couple of convenience accessors to DebugLocEntry::Value to further
simplify common usage patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215407 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-11 23:22:59 +00:00
Adrian Prantl
74f89fe1f0 Make these DebugLocEntry::Value comparison operators friend functions
as suggested by dblaikie in a comment on r215384.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215403 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-11 22:52:56 +00:00
Adrian Prantl
7189d07d62 Debug info: Remove an obsolete constructor from DebugLocEntry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215387 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-11 21:06:03 +00:00
Adrian Prantl
db72188598 Debug info: Modify DebugLocEntry::addValue to take multiple values so it
only has to sort/unique values once per batch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215386 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-11 21:06:00 +00:00