1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

78 Commits

Author SHA1 Message Date
David Blaikie
a2d4a79272 DebugInfo: Introduce new DIValue, DIETypeSignature to encode references to type units via their signatures
This simplifies type unit and type unit reference creation as well as
setting the stage for inter-type hashing across type unit boundaries.

llvm-svn: 197539
2013-12-17 23:32:35 +00:00
Eric Christopher
d2217c5bea Constify the DIEs used for pubname and pubtype tables. Propagate
through findAttribute etc.

llvm-svn: 195290
2013-11-21 00:48:22 +00:00
Eric Christopher
08442ee86e Remove polymorphic destruction for DIE. DIEBlocks are owned elsewhere
and not polymorphically deleted and they are the only thing that derive
from DIE.

llvm-svn: 195183
2013-11-20 00:54:31 +00:00
David Blaikie
e40c1e850f DebugInfo: Partial implementation of DWARF type units.
Emit DW_TAG_type_units into the debug_info section using compile unit
headers. This is bogus/unusable by debuggers, but testable and provides
more isolated review.

Subsequent patches will include support for type unit headers and
emission into the debug_types section, as well as comdat grouping the
types based on their hash. Also the CompileUnit type will be renamed
'Unit' and relevant portions pulled out into respective CompileUnit and
TypeUnit types.

llvm-svn: 195166
2013-11-19 23:08:21 +00:00
Eric Christopher
03cbb881d9 Formatting and 80-col.
llvm-svn: 195122
2013-11-19 09:28:34 +00:00
Manman Ren
429e265cd8 Debug Info: remove duplication of DIEs when a DIE can be shared across CUs.
We add a map in DwarfDebug to map MDNodes that are shareable across CUs to the
corresponding DIEs: MDTypeNodeToDieMap. These DIEs can be shared across CUs,
that is why we keep the maps in DwarfDebug instead of CompileUnit.

We make the assumption that if a DIE is not added to an owner yet, we assume
it belongs to the current CU. Since DIEs for the type system are added to
their owners immediately after creation, and other DIEs belong to the current
CU, the assumption should be true.

A testing case is added to show that we only create a single DIE for a type
MDNode and we use ref_addr to refer to the type DIE.

We also add a testing case to show ref_addr relocations for non-darwin
platforms.

llvm-svn: 193779
2013-10-31 17:54:35 +00:00
Manman Ren
4c36c44e3f Debug Info: support for DW_FORM_ref_addr.
To support ref_addr, we calculate the section offset of a DIE (i.e. offset
of a DIE from beginning of the debug info section). The Offset field in DIE
is currently CU-relative. To calculate the section offset, we add a
DebugInfoOffset field in CompileUnit to store the offset of a CU from beginning
of the debug info section. We set the value in DwarfUnits::computeSizeAndOffset
for each CompileUnit.

A helper function DIE::getCompileUnit is added to return the CU DIE that
the input DIE belongs to. We also add a map CUDieMap in DwarfDebug to help
finding the CU for a given CU DIE.

For a cross-referenced DIE, we first find the CU DIE it belongs to with
getCompileUnit, then we use CUDieMap to get the corresponding CU for the CU DIE.
Adding the section offset of the CU with the CU-relative offset of a DIE gives
us the seciton offset of the DIE.

We correctly emit ref_addr with relocation using EmitLabelPlusOffset when
doesDwarfUseRelocationsAcrossSections is true.

This commit handles the emission of DW_FORM_ref_addr when we have an attribute
with FORM_ref_addr. A follow-on patch will start using ref_addr when adding a
DIEEntry. This commit will be tested and verified in the follow-on patch.

Reviewed off-list by Eric, Thanks.

llvm-svn: 193658
2013-10-29 22:57:10 +00:00
David Blaikie
576414d958 DIEHash: Refactor ref attribute hashing into smaller functions
llvm-svn: 193360
2013-10-24 17:51:43 +00:00
David Blaikie
6245d19f32 Remove unused debug-only member variable.
This may've been used at some point but the 'print' member function grew
an Indent parameter that entirely shadows this parameter.

llvm-svn: 193358
2013-10-24 17:10:13 +00:00
David Blaikie
e9f0bff07e DebugInfo: Put each kind of constant (form, attribute, tag, etc) into its own enum for ease of use.
This allows various variables to be more self-documenting and easier to
debug by being of specific types without overlapping enum values.

Precommit review by Eric Christopher.

llvm-svn: 193091
2013-10-21 17:28:37 +00:00
David Blaikie
220fa86ab8 Remove some dead code.
llvm-svn: 192000
2013-10-04 23:37:30 +00:00
Eric Christopher
dd034c0291 Temporarily revert r176882 as it needs to be implemented in a different
way for all platforms.

llvm-svn: 191975
2013-10-04 19:40:33 +00:00
Eric Christopher
88a8082ea0 Temporarily revert r191792 as it is causing some LTO debug failures
on platforms with relocations in debug info and also temporarily
revert r191800 due to conflicts with the revert of r191792.

llvm-svn: 191967
2013-10-04 17:08:38 +00:00
David Blaikie
957eba35f2 DebugInfo: Avoid redundantly adding child DIEs to parents.
DIE::addChild had a shortcircuit that silently no-op'd when a child was
readded to the same parent. This hid some quirky/redundant code in
DwarfDebug/CompileUnit. By removing that functionality and replacing it
with an assert I was able to find and cleanup those cases, mostly
centering around adding members to types in various circumstances.

1) The original oddity I noticed while working on type units (which
actually was helping me in the short term, by accident) was the
addToContextOwner call in constructTypeDIE. This call was completely
bogus (why was it only done for non-virtual types? what relevance does
that have at all) and redundant with the more uniform addToContextOwner
made in getOrCreateTypeDIE.

2) If a member function definition was visited (createSubprogramDIE), it
would attempt to build the member function declaration. The declaration
DIE would then be added to its context, but in building the context (the
type for which this function is a member) the members of the type would
be added to the type automatically, so by the time the context was
constructed, the member function was already associated with it.

3) The same as (2) but without the member function being constructed
first. Whenever a type was constructed, the members would be created and
member functions would be created by getOrCreateSubprogramDIE - this
would lead to the subprogram being added to the (incomplete) type
already, then the general member-construction code would add it again.

llvm-svn: 191928
2013-10-03 20:07:20 +00:00
Manman Ren
ba5cd65c4c Debug Info: remove duplication of DIEs when a DIE is part of the type system
and it is shared across CUs.

We add a few maps in DwarfDebug to map MDNodes for the type system to the
corresponding DIEs: MDTypeNodeToDieMap, MDSPNodeToDieMap, and
MDStaticMemberNodeToDieMap. These DIEs can be shared across CUs, that is why we
keep the maps in DwarfDebug instead of CompileUnit.

Sometimes, when we try to add an attribute to a DIE, the DIE is not yet added
to its owner yet, so we don't know whether we should use ref_addr or ref4.
We create a worklist that will be processed during finalization to add
attributes with the correct form (ref_addr or ref4).

We add addDIEEntry to DwarfDebug to be a wrapper around DIE->addValue. It checks
whether we know the correct form, if not, we update the worklist
(DIEEntryWorklist).

A testing case is added to show that we only create a single DIE for a type
MDNode and we use ref_addr to refer to the type DIE.

llvm-svn: 191792
2013-10-01 19:52:23 +00:00
Benjamin Kramer
23f676e21d Revert "Give internal classes hidden visibility."
It works with clang, but GCC has different rules so we can't make all of those
hidden. This reverts commit r190534.

llvm-svn: 190536
2013-09-11 18:05:11 +00:00
Benjamin Kramer
386bd314a1 Give internal classes hidden visibility.
Worth 100k on a linux/x86_64 Release+Asserts clang.

llvm-svn: 190534
2013-09-11 17:42:27 +00:00
Eric Christopher
c16b1aaf3f Be more rigorous about the sizes of forms and attributes.
llvm-svn: 187953
2013-08-08 01:41:00 +00:00
Eric Christopher
8aac1919bd Add a way to grab a particular attribute out of a DIE.
Use it when we're looking for a string in particular. Update comments
as well.

llvm-svn: 187844
2013-08-07 01:18:33 +00:00
Eric Christopher
04dc3562f6 Add preliminary support for hashing DIEs and breaking them into
type units.

Initially this support is used in the computation of an ODR checker
for C++. For now we're attaching it to the DIE, but in the future
it will be attached to the type unit.

This also starts breaking out types into the separation for type
units, but without actually splitting the DIEs.

In preparation for hashing the DIEs this adds a DIEString type
that contains a StringRef with the string contained at the label.

llvm-svn: 187213
2013-07-26 17:02:41 +00:00
Manman Ren
4245062b12 Debug Info: use module flag to set up Dwarf version.
Correctly handles ref_addr depending on the Dwarf version. Emit Dwarf with
version from module flag.

TODO: turn on/off features depending on the Dwarf version.
llvm-svn: 185484
2013-07-02 23:40:10 +00:00
Ulrich Weigand
c2c7d0c173 [DebugInfo] Introduce DIEExpr variant of DIEValue to hold MCExpr values
This partially reverts r185202 and restores DIELabel to hold plain
MCSymbol references.  Instead, we add a new subclass DIEExpr of
DIEValue that can hold generic MCExpr references.

This is in preparation for supporting debug info for TLS variables
on PowerPC, where we need to describe the variable location using
a more complex expression than just MCSymbolRefExpr.

llvm-svn: 185458
2013-07-02 18:46:26 +00:00
David Blaikie
3648e54a41 DebugInfo: Pass MCSymbolRefExprs for labels instead of MCSymbols
This is a precursor to adding debug info support for TLS which requires
non-default relocations applied to TLS symbols.

llvm-svn: 185202
2013-06-28 20:05:04 +00:00
Eric Christopher
227290eb88 Formatting.
llvm-svn: 183807
2013-06-11 23:41:38 +00:00
Eric Christopher
2cbc09bd1e Fix up comment.
llvm-svn: 183703
2013-06-10 22:24:07 +00:00
Eric Christopher
dc7873061b Remove unused function.
llvm-svn: 183698
2013-06-10 21:59:28 +00:00
Eric Christopher
727e746fda IndentCount is only used within NDEBUG code.
llvm-svn: 183695
2013-06-10 20:58:53 +00:00
Eric Christopher
fd692fbd15 Const-ify some printing and dumping code for DIEValues.
llvm-svn: 183057
2013-05-31 22:50:40 +00:00
Eric Christopher
429115c97a Make getCompileUnit non-const and return the current DIE if it
happens to be a compile unit. Noticed on inspection and tested
via calling on a newly created compile unit. No functional change.

llvm-svn: 181835
2013-05-14 21:33:10 +00:00
David Blaikie
353440a9d7 Assert that DIEEntries are constructed with non-null DIEs
This just brings a crash a little further forward from DWARF emission to
DIE construction to make errors easier to diagnose.

llvm-svn: 181748
2013-05-14 00:35:19 +00:00
Eric Christopher
c179ac43fa Remove unnecessary instance variable and rework logic accordingly.
llvm-svn: 181227
2013-05-06 17:50:50 +00:00
Manman Ren
d4f1e1e1df Debug Info: revert 178722 for now.
There is a difference for FORM_ref_addr between DWARF 2 and DWARF 3+.
Since Eric is against guarding DWARF 2 ref_addr with DarwinGDBCompat, we are
still in discussion on how to handle this.

The correct solution is to update our header to say version 4 instead of version
2 and update tool chains as well.

rdar://problem/13559431

llvm-svn: 178806
2013-04-04 23:13:11 +00:00
Manman Ren
2dafd4d1df Debug Info: according to DWARF 2, FORM_ref_addr the same size as an address on
the target system.

It was hard-coded to 4 bytes before. I can't get llvm to generate a
ref_addr on a reasonably sized testing case.

rdar://problem/13559431

llvm-svn: 178722
2013-04-04 00:22:54 +00:00
Eric Christopher
d5d6d72d50 Fix grammar.
llvm-svn: 178624
2013-04-03 05:29:58 +00:00
Eric Christopher
05df599ea8 Use SmallVectorImpl instead of SmallVector at the uses.
llvm-svn: 178386
2013-03-29 23:34:06 +00:00
Eric Christopher
cd1e668cce Use 12 as the magic number for our abbreviation data and our
die values. A lot of DIEs have 10 attributes in C++ code (example
clang), none had more than 12. Seems like a good default.

llvm-svn: 178366
2013-03-29 20:23:06 +00:00
Hans Wennborg
edb8448b25 Fix integer comparison in DIEInteger::BestForm.
The always-true "(int)Int == (signed)Int" comparison was found
while experimenting with a potential new Clang warning.

llvm-svn: 177290
2013-03-18 17:03:05 +00:00
Manman Ren
d88019ac47 Debug Info: use DW_FORM_ref_addr instead of DW_FORM_ref4 if the referenced DIE
belongs to a different compile unit.

DW_FORM_ref_addr should be used for cross compile-unit reference.

When compiling a large application, we got a dwarfdump verification error where
abstract_origin points to nowhere.

This error can't be reproduced on any testing case in MultiSource.
We may have other cases where we use DW_FORM_ref4 unconditionally.

rdar://problem/13370501

llvm-svn: 176882
2013-03-12 18:27:15 +00:00
Eric Christopher
b2abc44cbd Whitespace and 80-col.
llvm-svn: 171803
2013-01-07 22:40:45 +00:00
Bill Wendling
56d9c4b832 Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
llvm-svn: 170502
2012-12-19 07:18:57 +00:00
Sean Silva
2174f713f4 Remove unnecessary classof()'s
isa<> et al. automatically infer when the cast is an upcast (including a
self-cast), so these are no longer necessary.

llvm-svn: 165767
2012-10-11 23:30:49 +00:00
Benjamin Kramer
06164017c0 Bit pack DIE structures better.
16 bits are sufficient to store attributes, tags and forms.

llvm-svn: 148799
2012-01-24 12:08:28 +00:00
Eric Christopher
afc99847bf Remove generation of DW_AT_sibling. Nothing as far as I can tell uses it.
Saves about 1.5% on debug info size.

rdar://10278198

llvm-svn: 148794
2012-01-24 09:43:28 +00:00
David Blaikie
576aba04f1 Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
llvm-svn: 146960
2011-12-20 02:50:00 +00:00
Nick Lewycky
5758d6af22 Always use the string pool, even when it makes the .o larger. This may help
tools that read the debug info in the .o files by making the DIE sizes more
consistent.

llvm-svn: 143186
2011-10-28 05:29:47 +00:00
Nick Lewycky
4f22c1e786 Remove dead enum value. There is no DIESectionOffset.
llvm-svn: 142912
2011-10-25 07:05:26 +00:00
Nick Lewycky
0de6ef455c Fix some typo/formatting issues. No functionality change.
llvm-svn: 142435
2011-10-18 22:39:43 +00:00
Benjamin Kramer
782cb6d68d Remove unused virtual dtor.
llvm-svn: 127331
2011-03-09 14:20:28 +00:00
Cameron Zwarich
974208a607 Roll out r126425 and r126450 to see if it fixes the failures on the buildbots.
llvm-svn: 126488
2011-02-25 16:30:32 +00:00
Devang Patel
f2b2417c2c Enable DebugInfo support for COFF object files.
Patch by Nathan Jeffords!

llvm-svn: 126425
2011-02-24 21:04:00 +00:00