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

2573 Commits

Author SHA1 Message Date
David Blaikie
3a329f9b6e More formatting...
llvm-svn: 207050
2014-04-23 23:38:39 +00:00
David Blaikie
0ea0080644 Remove intermediate accelerator table for names.
(similar changes coming for the other accelerator tables)

llvm-svn: 207049
2014-04-23 23:37:35 +00:00
David Blaikie
b5a0b53e34 DwarfAccelTable: Remove trivial dtor and simplify construction with an array.
llvm-svn: 207044
2014-04-23 23:03:45 +00:00
David Blaikie
f96fd788df Move the AddressPool from DwarfFile to DwarfDebug.
There's only ever one address pool, not one per DWARF output file, so
let's just have one.

(similar refactoring of the string pool to come soon)

llvm-svn: 207026
2014-04-23 21:20:10 +00:00
David Blaikie
ae2c262f6c clang-format for my previous commit (I keep forgetting... )
llvm-svn: 207025
2014-04-23 21:20:07 +00:00
David Blaikie
ef5afb8970 Separate out the DWARF address pool into its own type/files.
llvm-svn: 207022
2014-04-23 21:04:59 +00:00
David Blaikie
aa205a84ff clang-format r207010
llvm-svn: 207016
2014-04-23 19:44:08 +00:00
David Blaikie
24e0c7bf4c Split out DwarfFile from DwarfDebug into its own .h/.cpp files.
Some of these types (DwarfDebug in particular) are quite large to begin
with (and I keep forgetting whether DwarfFile is in DwarfDebug or
DwarfUnit... ) so having a few smaller files seems like goodness.

llvm-svn: 207010
2014-04-23 18:54:00 +00:00
Evgeniy Stepanov
c242bd4b23 Create MCTargetOptions.
For now it contains a single flag, SanitizeAddress, which enables
AddressSanitizer instrumentation of inline assembly.

Patch by Yuri Gorshenin.

llvm-svn: 206971
2014-04-23 11:16:03 +00:00
David Blaikie
4c499bd490 Requisite reformatting for previous commit.
llvm-svn: 206927
2014-04-22 23:09:36 +00:00
David Blaikie
4c1ce16ebc Push memory ownership of DwarfUnits into clients of DwarfFile.
This prompted me to push references through most of DwarfDebug. Sorry
for the churn.

Honestly it's a bit silly that we're passing around units all over the
place like that anyway and I think it's mostly due to the DIE attribute
adding utility functions being utilities in DwarfUnit. I should have
another go at moving them out of DwarfUnit...

llvm-svn: 206925
2014-04-22 22:39:41 +00:00
David Blaikie
ef0c701473 Use std::unique_ptr to handle ownership of DwarfUnits in DwarfFile.
So Chandler - how about those range algorithms? (would really love a
dereferencing range adapter for this sort of stuff)

llvm-svn: 206921
2014-04-22 21:27:37 +00:00
David Blaikie
9010d1345e Simplify address pool index assignment.
llvm-svn: 206905
2014-04-22 17:21:40 +00:00
David Blaikie
eb8b511a12 Revert "Use value semantics to manage DbgVariables rather than dynamic allocation/pointers."
This reverts commit r206780.

This commit was regressing gdb.opt/inline-locals.exp in the GDB 7.5 test
suite. Reverting until I can fix the issue.

llvm-svn: 206867
2014-04-22 05:41:06 +00:00
Chandler Carruth
2361db41db [Modules] Remove potential ODR violations by sinking the DEBUG_TYPE
define below all header includes in the lib/CodeGen/... tree. While the
current modules implementation doesn't check for this kind of ODR
violation yet, it is likely to grow support for it in the future. It
also removes one layer of macro pollution across all the included
headers.

Other sub-trees will follow.

llvm-svn: 206837
2014-04-22 02:02:50 +00:00
David Blaikie
ac6cce35ed Use value semantics to manage DbgVariables rather than dynamic allocation/pointers.
Requires switching some vectors to lists to maintain pointer validity.
These could be changed to forward_lists (singly linked) with a bit more
work - I've left comments to that effect.

llvm-svn: 206780
2014-04-21 20:13:09 +00:00
Diego Novillo
45811c5ea3 Fix bug 19437 - Only add discriminators for DWARF 4 and above.
Summary:
This prevents the discriminator generation pass from triggering if
the DWARF version being used in the module is prior to 4.

Reviewers: echristo, dblaikie

CC: llvm-commits

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

llvm-svn: 206507
2014-04-17 22:33:50 +00:00
Jim Grosbach
63557754ee [c++11] Tidy up AsmPrinter.cpp.
Range'ify loops and tidy up some by-reference handling. No functional
change.

llvm-svn: 206422
2014-04-16 22:38:02 +00:00
David Blaikie
ff6e0d4bb1 Use unique_ptr for the result of Registry entries.
llvm-svn: 206248
2014-04-15 05:53:26 +00:00
David Blaikie
3d383785b6 Use unique_ptr to manage ownership of GCStrategy objects in GCMetadata
llvm-svn: 206246
2014-04-15 05:34:49 +00:00
David Blaikie
7495172545 Use std::unique_ptr for DIE children
Got bored, removed some manual memory management.

Pushed references (rather than pointers) through a few APIs rather than
replacing *x with x.get().

llvm-svn: 206222
2014-04-14 22:45:02 +00:00
Adrian Prantl
ee1b12d3e5 Re-apply r206096 after investigating the gdb buildbot failure.
Thanks to dblaikie for updating the testcase!

Debug info: (bugfix) C++ C/Dtors can be compiled to multiple functions,
therefore, their declaration cannot have one DW_AT_linkage_name.
The specific instances however can and should have that attribute.

This patch reorders the code in DwarfUnit::getOrCreateSubprogramDIE()
to emit linkage names for C/Dtors.

rdar://problem/16362674.

llvm-svn: 206210
2014-04-14 21:16:04 +00:00
David Blaikie
7c76f25336 PR13337: Omit DW_TAG_restrict_type when compiling for DWARF2
DWARF3 introduced DW_TAG_restrict_type, so avoid using it in prior
versions.

llvm-svn: 206105
2014-04-12 05:35:59 +00:00
Adrian Prantl
2d31ce322b Revert "Debug info: (bugfix) C++ C/Dtors can be compiled to multiple functions,"
This reverts commit 206096 while I investigate why this broke the gdb
buildbot.

llvm-svn: 206103
2014-04-12 04:25:02 +00:00
David Blaikie
1031309286 Use dwarf::Tag rather than unsigned for DIE::Tag to make debugging easier.
Nice to be able to just print out the Tag and have the debugger print
dwarf::DW_TAG_subprogram or whatever, rather than an int.

It's a bit finicky (for example DIDescriptor::getTag still returns
unsigned) because some places still handle real dwarf tags + our fake
tags (one day we'll remove the fake tags, hopefully).

llvm-svn: 206098
2014-04-12 02:24:04 +00:00
Adrian Prantl
86edc5e96b Debug info: (bugfix) C++ C/Dtors can be compiled to multiple functions,
therefore, their declaration cannot have one DW_AT_linkage_name.
The specific instances however can and should have that attribute.

This patch reorders the code in DwarfUnit::getOrCreateSubprogramDIE()
to emit linkage names for C/Dtors.

rdar://problem/16362674.

llvm-svn: 206096
2014-04-12 01:44:42 +00:00
Adrian Prantl
208fc516be Debug info: Store the DIVariable in DebugLocEntry also for constants,
so DwarfDebug::emitDebugLocEntry can emit them with the correct signedness.

rdar://problem/15928306

llvm-svn: 206042
2014-04-11 17:49:47 +00:00
Adrian Prantl
52b43b7eb6 Debug info: Factor the retrieving of the DIVariable from a MachineInstr
into a function.

llvm-svn: 205973
2014-04-10 17:39:48 +00:00
David Blaikie
a8caf93b53 DebugInfo: Use a 64 bit type for the subrange
While we were encoding 64 bit values (data8) in the subrange itself,
using a 32 bit type for the subrange was still confusing the gdb. Oh,
and make it unsigned too.

As the comment points out, this could be pushed into the frontend so
that it would be 32 or 64 bit as appropriate, etc.

llvm-svn: 205512
2014-04-03 06:28:20 +00:00
Oliver Stannard
e941b27161 ARM: Add support for segmented stacks
Patch by Alex Crichton, ILyoan, Luqman Aden and Svetoslav.

llvm-svn: 205430
2014-04-02 16:10:33 +00:00
Adrian Prantl
34fbf7eb58 clarify comment
llvm-svn: 205429
2014-04-02 15:49:45 +00:00
David Blaikie
f8c0762846 Adjust comments regarding non-relocated abbrev offset in debug_info.dwo
I'm not sure the comment in the implementation really adds a lot of
value (it's clear that we emit zero when no symbol is provided, but it
doesn't explain why we would do that). Happy to iterate.

llvm-svn: 205386
2014-04-02 02:04:51 +00:00
David Blaikie
e62bc9ddaa Split debug_loc and debug_loc.dwo emission into two separate functions
Based on code review feedback from Eric Christopher on r204697

llvm-svn: 205385
2014-04-02 01:50:20 +00:00
David Blaikie
f410cc8df5 DebugInfo: Introduce DebugLocList to encapsulate a list of DebugLocEntries and an MC Label to refer to them
This removes the magic-number-esque code creating/retrieving the same
label for a debug_loc entry from two places and removes the last small
piece of reusable logic from emitDebugLoc so that there will be less
duplication when refactoring it into two functions (one for debug_loc,
the other for debug_loc.dwo).

llvm-svn: 205382
2014-04-02 01:43:18 +00:00
Adrian Prantl
cf2248c0ba Add a doxygen comment to DebugLocEntry::Merge.
llvm-svn: 205374
2014-04-01 23:34:45 +00:00
David Blaikie
034f61d1e5 DebugLocEntry: Actually merge the loc entry when returning true.
Seems we didn't have any test coverage for merging... awesome. So I
added some - but hit an llvm-objdump bug while I was there. I'm choosing
not to shave that yak right now.

Code review feedback/bug catch by Adrian Prantl in r205360.

llvm-svn: 205373
2014-04-01 23:19:23 +00:00
David Blaikie
10e2013985 Fix accidental fallthrough in DebugLocEntry::hasSameValueOrLocation
No test case (this would invoke UB by examining uninitialized members,
etc, at best - and this code is apparently untested anyway - I'm about
to fix that)

Code review feedback from Adrian Prantl on r205360.

llvm-svn: 205367
2014-04-01 22:25:09 +00:00
David Blaikie
0bcd815436 Remove unused function DebugLocEntry::isEmpty
llvm-svn: 205365
2014-04-01 22:06:18 +00:00
David Blaikie
d3e34a8e49 Refactor out the comparison of the location/value in a DebugLocEntry
llvm-svn: 205364
2014-04-01 22:04:07 +00:00
David Blaikie
8ffd5df5fe DebugInfo: Split DebugLocEntry into its own file.
It seems big enough that it deserves its own file - but it is header
only, so there's no need for another cpp file, etc.

llvm-svn: 205360
2014-04-01 21:49:04 +00:00
Adrian Prantl
65a4c6a66e DwarfDebug: Prevent DebugLocEntry merging from coalescing two different
constants into only the first one.

rdar://14874886.

llvm-svn: 205357
2014-04-01 21:04:18 +00:00
David Blaikie
7ed071eec0 DebugInfo: Factor out common functionality for rendering debug_loc and debug_loc.dwo location list entries
In preparation for refactoring this function into two, one for
debug_loc, one for debug_loc.dwo.

llvm-svn: 205324
2014-04-01 16:17:41 +00:00
David Blaikie
6b5255c1db Cleanup remaining use of removed variable to fix the build
llvm-svn: 205323
2014-04-01 16:13:29 +00:00
David Blaikie
260a196cb8 Simplify debug_loc.dwo handling slightly.
llvm-svn: 205322
2014-04-01 16:09:49 +00:00
David Blaikie
99bdb2e6c3 DebugInfo: Avoid creating unnecessary/empty line tables and remove the special case of '0' in DwarfCompileUnit::initStmtList by just always using a label difference
This moves one case of raw text checking down into the MCStreamer
interfaces in the form of a virtual function, even if we ultimately end
up consolidating on the one-or-many line tables issue one day, this is
nicer in the interim. This just generally streamlines a bunch of use
cases into a common code path.

llvm-svn: 205287
2014-04-01 08:07:52 +00:00
Adrian Prantl
860533bd61 LTO type uniquing: store the Decl field of a DIImportedEntity as a DIRef.
No other functionality changes, DIBuilder testcase is included in a paired
CFE commit.

This relaxes the assertion in isScopeRef to also accept subclasses of
DIScope.

llvm-svn: 205279
2014-04-01 03:41:04 +00:00
Saleem Abdulrasool
d42d60171a Canonicalise Windows target triple spellings
Construct a uniform Windows target triple nomenclature which is congruent to the
Linux counterpart.  The old triples are normalised to the new canonical form.
This cleans up the long-standing issue of odd naming for various Windows
environments.

There are four different environments on Windows:

MSVC: The MS ABI, MSVCRT environment as defined by Microsoft
GNU: The MinGW32/MinGW32-W64 environment which uses MSVCRT and auxiliary libraries
Itanium: The MSVCRT environment + libc++ built with Itanium ABI
Cygnus: The Cygwin environment which uses custom libraries for everything

The following spellings are now written as:

i686-pc-win32 => i686-pc-windows-msvc
i686-pc-mingw32 => i686-pc-windows-gnu
i686-pc-cygwin => i686-pc-windows-cygnus

This should be sufficiently flexible to allow us to target other windows
environments in the future as necessary.

llvm-svn: 204977
2014-03-27 22:50:05 +00:00
Timur Iskhodzhanov
464e932215 Follow-up to r204790: don't try to emit line tables if there are no functions with DI in the TU
llvm-svn: 204795
2014-03-26 11:24:36 +00:00
Timur Iskhodzhanov
c72b9dd73a Fix PR19239 - Add support for generating debug info for functions without lexical scopes and/or debug info at all
llvm-svn: 204790
2014-03-26 09:50:36 +00:00
David Blaikie
5563f7c61c DebugInfo: Add GNU_addr_base and GNU_ranges_base only when there are addresses or ranges
Based on code review feedback from Eric in r204672.

llvm-svn: 204702
2014-03-25 05:34:24 +00:00
David Blaikie
c5322af8c2 DebugInfo: Support debug_loc under fission
Implement debug_loc.dwo, as well as llvm-dwarfdump support for dumping
this section.

Outlined in the DWARF5 spec and http://gcc.gnu.org/wiki/DebugFission the
debug_loc.dwo section has more variation than the standard debug_loc,
allowing 3 different forms of entry (plus the end of list entry). GCC
seems to, and Clang certainly, only use one form, so I've just
implemented dumping support for that for now.

It wasn't immediately obvious that there was a good refactoring to share
the implementation of dumping support between debug_loc and
debug_loc.dwo, so they're separate for now - ideas welcome or I may come
back to it at some point.

As per a comment in the code, we could choose different forms that may
reduce the number of debug_addr entries we emit, but that will require
further study.

llvm-svn: 204697
2014-03-25 01:44:02 +00:00
David Blaikie
0f5095ddfc DebugInfo: Remove unnecessary zero-size check
This seems excessive - switching section isn't expensive (or if it is
we're already being wasteful, since we emitted the debug_loc section
symbol earlier anyway) and otherwise there's no work that happens in
this function when the list is empty.

llvm-svn: 204696
2014-03-25 01:43:56 +00:00
David Blaikie
155b9ac89b DebugInfo: Simplify debug loc list handling by keeping separate lists
Rather than using a flat list with "empty" entries (ala the actual
on-disk format), keep separate lists for each variable.

llvm-svn: 204680
2014-03-24 22:38:38 +00:00
David Blaikie
6c35a2d755 DwarfDebug: Simplify debug_loc merging
No functional change intended.

Merging up-front rather than delaying this task until later. This just
seems simpler and more efficient (avoiding growing the debug loc list
only to have to skip over those post-merged entries, etc).

llvm-svn: 204679
2014-03-24 22:27:06 +00:00
Adrian Prantl
f42452e60a Get rid of an unnecessary use of the * and & operators.
llvm-svn: 204673
2014-03-24 21:33:01 +00:00
David Blaikie
a69e0d8494 DebugInfo: Add DW_AT_GNU_ranges_base to skeleton CUs
This is used to avoid relocations in the dwo file by allowing
DW_AT_ranges specified in debug_info.dwo to be relative to this base
address. (r204667 implements the base-relative DW_AT_ranges side of
this)

llvm-svn: 204672
2014-03-24 21:31:35 +00:00
David Blaikie
982d05712f DebugInfo: Implement relative addressing for DW_AT_ranges under fission
This removes the debug_ranges relocations from debug_info.dwo (but
doesn't implement the DW_AT_GNU_ranges_base which is also necessary for
correct functioning)

llvm-svn: 204668
2014-03-24 21:07:27 +00:00
David Blaikie
4dbc173911 DebugInfo: Don't emit relocations to abbreviations in debug_info.dwo
llvm-svn: 204667
2014-03-24 20:53:02 +00:00
David Blaikie
2f7fbac157 DwarfDebug: Remove an unused parameter
llvm-svn: 204665
2014-03-24 20:31:01 +00:00
David Blaikie
65a7d20254 Remove unused parameter
llvm-svn: 204663
2014-03-24 20:28:10 +00:00
Adrian Prantl
f5fc7c7dab Delete stale comment. Thanks, Eric!
llvm-svn: 204530
2014-03-21 22:58:25 +00:00
Adrian Prantl
1afdb657fe Dwarf Debug: Remove some cargo-cult type uniquing. Scopes do not have
an ID, so this is a noop.
Thanks Manman for catching this!

llvm-svn: 204528
2014-03-21 22:16:32 +00:00
David Blaikie
612322e43d DebugInfo: Omit DW_AT_addr_base from skeletal type units.
Type units have no addresses, so there's no need for DW_AT_addr_base.
This removes another relocation from every skeletal type unit and brings
LLVM's skeletal type units in line with GCC's (containing only
GNU_dwo_name (strp), comp_dir (strp), and GNU_pubnames (flag_present)).

Cary's got some ideas about using str_index in the .o file to reduce
those last two relocations (well, replace two relocations with one
relocation (pointing to the string index) and two indicies)

llvm-svn: 204506
2014-03-21 20:27:21 +00:00
Eric Christopher
fdbc553506 Typo.
llvm-svn: 204378
2014-03-20 19:16:20 +00:00
Eric Christopher
17584b9ad3 Reapply DW_AT_low/high_pc patch:
Use the range machinery for DW_AT_ranges and DW_AT_high/lo_pc.

    This commit moves us from a single range per subprogram to extending
    ranges if we are:

    a) In the same section, and
    b) In the same enclosing CU.

    This means we have more fine grained ranges for compile units, and fewer
    ranges overall when we have multiple functions in the same CU
    adjacent to each other in the object file.

    Also remove all of the earlier hacks around this functionality for
    function sections etc. Also update all of the testcases to take into
    account the merging functionality.

with a fix for location entries in the debug_loc section:

Make sure that debug loc entries are relative to the low_pc
of the compile unit. This means that when we only have a single
range that the offset should be just relative to the low_pc
of the unit, for multiple ranges for a CU this means that we'll be
relative to 0 which we emit along with DW_AT_ranges.

This mostly shows up with linked binaries, so add a testcase with
multiple CUs so that our location is going to be offset of a CU
with a non-zero low_pc.

llvm-svn: 204377
2014-03-20 19:16:16 +00:00
David Blaikie
997f231203 Add comments from Eric's review of r204094.
llvm-svn: 204358
2014-03-20 17:05:45 +00:00
Eric Christopher
c3d06012dc Revert "Use the range machinery for DW_AT_ranges and DW_AT_high/lo_pc."
This appears to trigger failures with optimization and function arguments somehow.

This reverts commit r204277.

llvm-svn: 204286
2014-03-20 00:12:06 +00:00
Eric Christopher
3b9d5414df Use the range machinery for DW_AT_ranges and DW_AT_high/lo_pc.
This commit moves us from a single range per subprogram to extending
ranges if we are:

a) In the same section, and
b) In the same enclosing CU.

This means we have more fine grained ranges for compile units, and fewer
ranges overall when we have multiple functions in the same CU
adjacent to each other in the object file.

Also remove all of the earlier hacks around this functionality for
function sections etc. Also update all of the testcases to take into
account the merging functionality.

llvm-svn: 204277
2014-03-19 22:42:36 +00:00
David Blaikie
37f715972a DebugInfo: Use the comp_dir of the referencing type units when building debug_line.dwo
This isn't a complete fix - it falls back to non-comp_dir when multiple
compile units are in play. Adding a map of comp_dir to table is part of
the more general solution, but I gave up (in the short term) when I
realized I'd also have to calculate the size of each type unit so as to
produce correct DW_AT_stmt_list attributes.

llvm-svn: 204202
2014-03-19 00:11:28 +00:00
Jim Grosbach
d25aed4de9 MachO: Emit a version-min load command when possible.
When deployment target version information is available, emit it to the
target streamer for inclusion in the object file.

rdar://11337778

llvm-svn: 204191
2014-03-18 22:09:08 +00:00
Eric Christopher
40adcd40e2 More header and forward declaration cleanup.
llvm-svn: 204183
2014-03-18 21:44:12 +00:00
Eric Christopher
fd9bb8e5aa Add back the headers we're getting via (likely) transitive includes.
We really do use these things in the header.

llvm-svn: 204180
2014-03-18 20:58:35 +00:00
Eric Christopher
7269e6876d Fix for coding style.
llvm-svn: 204177
2014-03-18 20:39:54 +00:00
Eric Christopher
de6cbc6841 Remove a bunch of unnecessary includes and forward declarations.
llvm-svn: 204176
2014-03-18 20:37:10 +00:00
Adrian Prantl
09abeac799 Debug info: Remove OdrMemberMap from DwarfDebug, it's not necessary.
Follow-up to r203982.

llvm-svn: 204162
2014-03-18 17:41:15 +00:00
Adrian Prantl
2858669a6f DwarfDebug: Only unique retained types instead of all types.
This is a follow-up to r203983 based on feedback from dblaikie and mren (Thanks!)
No functionality change.

llvm-svn: 204107
2014-03-18 02:35:03 +00:00
Adrian Prantl
c28a560ab2 Switch the type field in DIVariable and DIGlobalVariable over to DITypeRefs.
This allows us to catch more opportunities for ODR-based type uniquing
during LTO.
Paired commit with CFE which updates some testcases to verify the new
DIBuilder behavior.

llvm-svn: 204106
2014-03-18 02:34:58 +00:00
Adrian Prantl
ca108f3f54 Replace unnecessary #include directive with forward declarations.
llvm-svn: 204104
2014-03-18 02:34:52 +00:00
Eric Christopher
4614b6ba2a Add explanatory comment.
llvm-svn: 204103
2014-03-18 02:18:27 +00:00
Eric Christopher
81af357a6f Shorten DotDebugLocEntry to just DebugLocEntry and reformat.
No functional change.

llvm-svn: 204102
2014-03-18 02:18:24 +00:00
David Blaikie
1bdbb37386 DebugInfo: Avoid emitting standard opcode lengths in debug_line.dwo headers where opcodes are never used anyway
Introduce a slightly tighter wrapper around the header structure that
handles this use case. (MCDwarfDwoLineTable)

llvm-svn: 204101
2014-03-18 02:13:23 +00:00
David Blaikie
9b1e3d2728 DebugInfo: Implement debug_line.dwo for file names used in type units during -gsplit-dwarf
This removes an attribute (and more importantly, a relocation) from
skeleton type units and removes some unnecessary file names from the
debug_line section that remains in the .o (and linked executable) file.

There's still a few places we could shave off some more space here:

* use compilation dir of the underlying compilation unit (since all the
  type units share that compilation dir - though this would be more
  complicated in LTO cases where they don't (keep a map of compilation
  dir->line table header?))

* Remove some of the unnecessary header fields from the line table since
  they're not needed in this situation (about 12 bytes per table).

llvm-svn: 204099
2014-03-18 01:17:26 +00:00
David Blaikie
cb0b38be9c DebugInfo: Do not rely on the compilation dir (index 0) for files in line tables shared between compilation units
When emitting assembly there's no support for emitting separate line
tables for each compilation unit - so LLVM emits .loc directives
producing a single line table.

Line tables have an implicit directory (index 0) equal to the
compilation directory (DW_AT_comp_dir) of the compilation unit that
references them.

If multiple compilation units (with possibly disparate compilation
directories) reference the same line table, we must avoid relying on
this ambiguous directory.

Achieve this my simply not setting the compilation directory on the line
table when we're in this situation (multiple units while emitting
assembly).

llvm-svn: 204094
2014-03-18 00:11:48 +00:00
David Blaikie
1e7fb56e8e DebugInfo: Move getOrCreateSourceID from DwarfDebug to DwarfCompileUnit
We still do a few lookups into the line table mapping in MCContext that
could be factored out into a single lookup (rather than looking it up
once for the table label, once to set the compilation unit, once for
each time we need a file ID, etc... ) but assembly output complicates
that somewhat as we still need a virtual dispatch back to the
MCAsmStreamer in that case.

llvm-svn: 204092
2014-03-17 23:53:25 +00:00
David Blaikie
dea7f464ea DebugInfo: Move line table zero-directory-index (compilation dir) handling into MCDwarf
Our handling of compilation directory in DwarfDebug was broken
(incorrectly using the 'last' compilation directory (that of the last
CU in the metadata list) for all function emission in any CU). By moving
this handling down into MCDwarf the issue is fixed as the compilation
dir is tracked correctly per line table.

llvm-svn: 204089
2014-03-17 23:29:40 +00:00
David Blaikie
d61679d719 DebugInfo: Use MC line table file entry uniquing for non-asm input as well.
See r204027 for the precursor to this that applied to asm debug info.

This required some non-obvious API changes to handle the case of asm
output (we never go asm->asm so this didn't come up in r204027): the
modification of the file/directory name by MCDwarfLineTableHeader needed
to be reflected in the MCAsmStreamer caller so it could print the
appropriate .file directive, so those StringRef parameters are now
non-const ref (in/out) parameters rather than just const.

llvm-svn: 204069
2014-03-17 18:13:58 +00:00
Adrian Prantl
5f3f22111a Debug info: Unique types before emitting them to DWARF, where applicable.
llvm-svn: 203983
2014-03-14 23:08:29 +00:00
Adrian Prantl
3409fa5a11 Debug Info: Fix LTO type uniquing for C++ member declarations
based on the ODR.

This adds an OdrMemberMap to DwarfDebug which is used to unique C++
member function declarations based on the unique identifier of their
containing class and their mangled name.
We can't use the usual DIRef mechanism here because DIScopes are indexed
using their entire MDNode, including decl_file and decl_line, which need
not be unique (see testcase).

Prior to this change multiple redundant member function declarations would
end up in the same uniqued DW_TAG_class_type.

llvm-svn: 203982
2014-03-14 23:08:25 +00:00
Adrian Prantl
a1e0ffdea8 typo
llvm-svn: 203980
2014-03-14 23:08:17 +00:00
Eric Christopher
f15e1e16b6 Remove command line option for CU hashing. This is on by default now.
Fix up testcases and use of flag.

llvm-svn: 203973
2014-03-14 21:20:07 +00:00
Eric Christopher
58fb190db8 If we see that we're emitting code for a function that doesn't have
any lexical scopes then go ahead and turn on DW_AT_ranges for the
compile unit since we would be claiming to describe in the CU
a range for which we don't have information in the CU otherwise.

llvm-svn: 203969
2014-03-14 20:53:49 +00:00
Eric Christopher
bc1f951268 Remove the -generate-dwarf-cu-ranges flag.
Rewrite a couple of testcases to cover areas that would be normally
by turning it on into testcases that will follow the logic.

llvm-svn: 203968
2014-03-14 20:53:43 +00:00
David Blaikie
cee98394ad DwarfDebug: Remove some needless recursion.
llvm-svn: 203946
2014-03-14 16:33:32 +00:00
Eric Christopher
fc22ad9058 Use DW_AT_linkage_name when we're emitting DWARF4 or above.
llvm-svn: 203867
2014-03-13 23:26:25 +00:00
Rafael Espindola
d15cd32b9f Remove the linker_private and linker_private_weak linkages.
These linkages were introduced some time ago, but it was never very
clear what exactly their semantics were or what they should be used
for. Some investigation found these uses:

* utf-16 strings in clang.
* non-unnamed_addr strings produced by the sanitizers.

It turns out they were just working around a more fundamental problem.
For some sections a MachO linker needs a symbol in order to split the
section into atoms, and llvm had no idea that was the case. I fixed
that in r201700 and it is now safe to use the private linkage. When
the object ends up in a section that requires symbols, llvm will use a
'l' prefix instead of a 'L' prefix and things just work.

With that, these linkages were already dead, but there was a potential
future user in the objc metadata information. I am still looking at
CGObjcMac.cpp, but at this point I am convinced that linker_private
and linker_private_weak are not what they need.

The objc uses are currently split in

* Regular symbols (no '\01' prefix). LLVM already directly provides
whatever semantics they need.
* Uses of a private name (start with "\01L" or "\01l") and private
linkage. We can drop the "\01L" and "\01l" prefixes as soon as llvm
agrees with clang on L being ok or not for a given section. I have two
patches in code review for this.
* Uses of private name and weak linkage.

The last case is the one that one could think would fit one of these
linkages. That is not the case. The semantics are

* the linker will merge these symbol by *name*.
* the linker will hide them in the final DSO.

Given that the merging is done by name, any of the private (or
internal) linkages would be a bad match. They allow llvm to rename the
symbols, and that is really not what we want. From the llvm point of
view, these objects should really be (linkonce|weak)(_odr)?.

For now, just keeping the "\01l" prefix is probably the best for these
symbols. If we one day want to have a more direct support in llvm,
IMHO what we should add is not a linkage, it is just a hidden_symbol
attribute. It would be applicable to multiple linkages. For example,
on weak it would produce the current behavior we have for objc
metadata. On internal, it would be equivalent to private (and we
should then remove private).

llvm-svn: 203866
2014-03-13 23:18:37 +00:00
Rafael Espindola
d866898775 Reject alias to undefined symbols in the verifier.
On ELF and COFF an alias is just another name for a position in the file.
There is no way to refer to a position in another file, so an alias to
undefined is meaningless.

MachO currently doesn't support aliases. The spec has a N_INDR, which when
implemented will have a different set of restrictions. Adding support for
it shouldn't be harder than any other IR extension.

For now, having the IR represent what is actually possible with current
tools makes it easier to fix the design of GlobalAlias.

llvm-svn: 203705
2014-03-12 20:15:49 +00:00
Eric Christopher
b4e3999ddf When computing the size of a base type be conservative if the type
is a declaration and return the size of the type.

llvm-svn: 203690
2014-03-12 18:18:05 +00:00
Eric Christopher
ed4e3bf8aa Use values we've already computed, update comment.
No functional change.

llvm-svn: 203681
2014-03-12 17:14:46 +00:00
Eric Christopher
4729f8d18e Turn on hashing by default for split dwarf compile units.
llvm-svn: 203680
2014-03-12 17:14:43 +00:00
David Blaikie
2365974d09 DebugInfo: Use common line/file attribute construction code
llvm-svn: 203676
2014-03-12 16:51:06 +00:00