Commit Graph

2155 Commits

Author SHA1 Message Date
Timur Iskhodzhanov
45ab4750de Rename DwarfException methods so the new names are consistent with DwarfDebug and the style guide
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195763 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-26 13:34:55 +00:00
David Blaikie
2fdf433e51 DebugInfo: Remove CompileUnit::constructTypeDIEImpl now that it's just a simple wrapper again.
r195698 moved the type unit checking up into getOrCreateTypeDIE so
remove the redundant check and fold the functions back together again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195700 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-26 00:35:04 +00:00
David Blaikie
999cf05d6a DebugInfo: Avoid emitting pubtype entries for type DIEs that just indirect to a type unit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195698 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-26 00:22:37 +00:00
David Blaikie
0487c74613 DebugInfo: Pubtypes: Coelesce pubtype registration with accelerator type registration.
It might be possible to eventually use one data structure, but I haven't
looked at the exact criteria used for accelerator tables and pubtypes to
see if there's good reason for the differences between the two or not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195696 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-26 00:15:27 +00:00
David Blaikie
a3507d4883 DwarfDebug: Move ownership of CompileUnits into DwarfUnits
This avoids the need for an extra list of SkeletonCUs and associated
cleanup while staging things to be cleaner for further type unit
improvements.

Also hopefully fixes a memory leak introduced in r195166.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195536 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-23 01:17:34 +00:00
Eric Christopher
43d67d01e2 Refactor DW_AT_ranges handling to use labels for ranges rather than
a non-relocatable number offset.

One fixme to make the ranges as discrete data structures and
have range lists explicitly represented rather than as a list of symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195523 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-23 00:05:29 +00:00
Eric Christopher
c918db1076 Reformat const for readability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195522 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-23 00:05:06 +00:00
Eric Christopher
2d5d104c5b In Dwarf 3 (and Dwarf 2) attributes whose value are offsets into a
section use the form DW_FORM_data4 whilst in Dwarf 4 and later they
use the form DW_FORM_sec_offset.

This patch updates the places where such attributes are generated to
use the appropriate form depending on the Dwarf version. The DIE entries
affected have the following tags:
DW_AT_stmt_list, DW_AT_ranges, DW_AT_location, DW_AT_GNU_pubnames,
DW_AT_GNU_pubtypes, DW_AT_GNU_addr_base, DW_AT_GNU_ranges_base

It also adds a hidden command line option "--dwarf-version=<uint>"
to llc which allows the version of Dwarf to be generated to override
what is specified in the metadata; this makes it possible to update
existing tests to check the debugging information generated for both
Dwarf 4 (the default) and Dwarf 3 using the same metadata.

Patch (slightly modified) by Keith Walker!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195391 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-21 23:46:41 +00:00
Eric Christopher
cd5978a7f5 Move member variable up to where the rest of non-DWARF5 variables reside.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195380 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-21 22:56:11 +00:00
Eric Christopher
7b98dd33fd Move DebugInfoOffset member near the other data member it helps describe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195299 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-21 01:29:16 +00:00
Eric Christopher
b553c81cf6 Reflow some documentation and remove whitespace comments. Move
DebugInfoOffset data member up with the rest of the data members.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195298 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-21 01:29:13 +00:00
Eric Christopher
1531e711ac Add more documenation for the lookup tables data members.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195297 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-21 01:16:31 +00:00
Eric Christopher
bd355a033e Reorder language in the CompileUnit description and add a comment.
Language may only be a temporary addition.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195296 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-21 01:14:00 +00:00
Eric Christopher
76ef8af358 Update comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195293 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-21 01:01:30 +00:00
Eric Christopher
ba5ab8289c Constify the DIEs used for pubname and pubtype tables. Propagate
through findAttribute etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195290 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-21 00:48:22 +00:00
David Blaikie
ba883cebd6 DwarfCompileUnit: Initialize DebugInfoOffset.
While not strictly necessary (the class has an invariant that
"setDebugInfoOffset" is called before "getDebugInfoOffset" - anyone
client that actually gets the default zero offset is buggy/broken) this
is consistent with the code as originally written and the removal of the
initialization was an accident in r195166.

Suggested by Manman Ren.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195263 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-20 18:52:39 +00:00
David Blaikie
89cadbe6b0 CR feedback for r195166: Add comments regarding type unit mapping and type units disabling cross-CU sharing.
Changes suggested by Manman Ren.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195262 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-20 18:40:16 +00:00
Eric Christopher
9259787e4f Remove polymorphic destruction for DIE. DIEBlocks are owned elsewhere
and not polymorphically deleted and they are the only thing that derive
from DIE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195183 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-20 00:54:31 +00:00
David Blaikie
6fe6dc19f8 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195166 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 23:08:21 +00:00
David Blaikie
d4010998b0 DebugInfo: Constify accelerator table handling, and separate type accelarator insertion in preparation for a second use of this code from type units.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195164 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 22:51:04 +00:00
Eric Christopher
4d06b6d28f Formatting and 80-col.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195122 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 09:28:34 +00:00
Eric Christopher
5efc006438 Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195121 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 09:11:26 +00:00
Eric Christopher
d2b3a0243c Refactor the section emission code to remove duplicates now that
we can emit various sections in any order.
No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195120 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 09:04:50 +00:00
Eric Christopher
eee5230373 Reformat file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195119 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 09:04:36 +00:00
David Blaikie
8da7540802 DwarfDebug: Move trailing else to the same line as prior closing brace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195060 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-18 23:59:04 +00:00
David Blaikie
d6dffb40cb DwarfDebug: Remove some more redundant explicit constructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195059 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-18 23:57:26 +00:00
David Blaikie
4adba52570 DebugInfo: Simplify a few more explicit constructions, underconstrained types, and make DIType(MDNode*) explicit like all the other DI* node ctors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195055 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-18 23:33:32 +00:00
David Blaikie
17a88a7e8b Remove unnecessary temporary construction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194981 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-17 21:59:31 +00:00
David Blaikie
fbf70b383d Remove redundant explicit default initialization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194980 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-17 21:57:33 +00:00
David Blaikie
08e51e1d97 DwarfCompileUnit: Add type safety to createGlobalVariableDIE
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194979 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-17 21:55:13 +00:00
David Blaikie
1dc2723996 DwarfCompileUnit: Push type safety of DIDescriptor through CompileUnit::createAndAddDIE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194902 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-16 00:29:01 +00:00
David Blaikie
21c9708c09 DwarfCompileUnit: Remove unnecessary OwningPtr<T>::get() call
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194901 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-16 00:28:15 +00:00
Eric Christopher
87fd14d9b5 For dwarf4 use the correct form for referencing debug_loc locations,
and update test cases accordingly.

This doesn't affect the output dumped using llvm-dwarfdump, but
readelf does now dump the debug_loc section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194898 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-16 00:18:40 +00:00
David Blaikie
7b86771094 DwarfCompileUnit: Add type safety to CompileUnit::getNode by returning DICompileUnit instead of a raw MDNode*.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194895 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 23:54:45 +00:00
David Blaikie
942431fa71 DwarfCompileUnit: Add type safety by using DICompileUnit rather than raw MDNode* for the CU metadata node
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194893 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 23:52:02 +00:00
David Blaikie
aedaa723c2 DwarfCompileUnit: Simplify getLanguage() calls to use existing member function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194892 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 23:50:53 +00:00
Adrian Prantl
6bc810a499 Replace the dangling context hotfix with an assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194883 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 23:21:39 +00:00
David Blaikie
14f41e7e18 DwarfDebug: Push DISubprogram through updateSubprogramScopeDIE
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194879 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 23:13:08 +00:00
David Blaikie
cbc85a270d DwarfCompileUnit: Push DIDescriptors through a getDIE/insertDIE
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194875 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 23:09:13 +00:00
David Blaikie
86a3348737 DwarfCompileUnit: Push DIDescriptor usage out from isShareableAcrossCUs
This is the first of a few similar patches. We'll see how far it
goes/makes sense.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194871 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 22:59:36 +00:00
Adrian Prantl
0cbdb81de7 Reimplement r194843 in a slightly less broken way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194848 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 21:05:09 +00:00
Adrian Prantl
7d5f2bd5f9 Restore the behaviour from before r194728.
If getDIE() fails, getOrCreateContextDIE() should also return the CUDie.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194843 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 19:53:23 +00:00
Eric Christopher
7b64181529 Use a reference rather than a pointer as we don't expect a NULL
DbgVariable.

No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194761 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 01:43:19 +00:00
David Blaikie
41e1a18885 DebugInfo: Simplify/narrow null-check for getOrCreateType
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194737 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-14 22:25:02 +00:00
David Blaikie
8c0fecc39f DwarfCompileUnit::getOrCreateContext: Return the compile unit DIE rather than null.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194728 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-14 21:24:34 +00:00
David Blaikie
f4837be7c1 Remove unnecessary 'else' after return.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194724 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-14 19:37:56 +00:00
Rafael Espindola
3d47402f2e Error if we see an alias to a declaration.
In ELF and COFF an alias is just another offset in a section. There is no way
to represent an alias to something in another file.

In MachO, the spec has the N_INDR type which should allow for exactly that, but
is not currently implemented. Given that it is specified but not implemented,
we error in codegen to avoid miscompiling but don't reject aliases to
declarations in the verifier to leave the option open of implementing it.

In the past we have used alias to declarations as a way of implementing
weakref, which is why it exists in some old tests which this patch updates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194705 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-14 13:58:06 +00:00
David Blaikie
a9a8f0f432 DIEHash: Move header include to be first in the implementation file to flush out header inclusion ordering issues
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194588 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-13 18:07:27 +00:00
Eric Christopher
953398916c Unify the adding of enumerators with the construction of the enumeration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194401 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-11 18:52:39 +00:00
Eric Christopher
6129002232 Formatting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194400 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-11 18:52:36 +00:00