Commit Graph

2110 Commits

Author SHA1 Message Date
David Blaikie 9208b5ed8e DIEHash: Move header include to be first in the implementation file to flush out header inclusion ordering issues
llvm-svn: 194588
2013-11-13 18:07:27 +00:00
Eric Christopher aeb105f9fe Unify the adding of enumerators with the construction of the enumeration.
llvm-svn: 194401
2013-11-11 18:52:39 +00:00
Eric Christopher 98b7f17c72 Formatting.
llvm-svn: 194400
2013-11-11 18:52:36 +00:00
Eric Christopher e6c6c4d36b 80-col.
llvm-svn: 194399
2013-11-11 18:52:33 +00:00
Eric Christopher df9955dd89 Just pass the DIComposite type by value instead of by pointer.
llvm-svn: 194398
2013-11-11 18:52:31 +00:00
Matt Arsenault c900303e2f Use type form of getIntPtrType.
This should be inconsequential and is work
towards removing the default address space
arguments.

llvm-svn: 194347
2013-11-10 04:46:57 +00:00
Eric Christopher fedfa44922 Comment some and reformat for clarity beginFunction.
llvm-svn: 193894
2013-11-01 23:14:17 +00:00
Rafael Espindola 716e7405d3 Remove linkonce_odr_auto_hide.
linkonce_odr_auto_hide was in incomplete attempt to implement a way
for the linker to hide symbols that are known to be available in every
TU and whose addresses are not relevant for a particular DSO.

It was redundant in that it all its uses are equivalent to
linkonce_odr+unnamed_addr. Unlike those, it has never been connected
to clang or llvm's optimizers, so it was effectively dead.

Given that nothing produces it, this patch just nukes it
(other than the llvm-c enum value).

llvm-svn: 193865
2013-11-01 17:09:14 +00:00
David Blaikie 71d34a2eef DebugInfo: Emit member variable locations as data instead of expressions in blocks
Drive by space optimization. Also makes the DIEs more regular which
might speed up DWARF parsing.

llvm-svn: 193835
2013-11-01 00:25:45 +00:00
Manman Ren 4dbdc9021d 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
Rafael Espindola 6f1b2852fc Produce .weak_def_can_be_hidden for some linkonce_odr values
With this patch llvm produces a weak_def_can_be_hidden for linkonce_odr
if they are also unnamed_addr or don't have their address taken.

There is not a lot of documentation about .weak_def_can_be_hidden, but
from the old discussion about linkonce_odr_auto_hide and the name of
the directive this looks correct: these symbols can be hidden.

Testing this with the ld64 in Xcode 5 linking clang reduces the number of
exported symbols from 21053 to 19049.

llvm-svn: 193718
2013-10-30 22:08:11 +00:00
David Blaikie 6b288cfa7a DebugInfo: Push header handling down into CompileUnit
This is a preliminary step to handling type units by abstracting over
all (type or compile) units.

llvm-svn: 193714
2013-10-30 20:42:41 +00:00
David Blaikie 2d4e11228b DwarfDebug: Change Abbreviations member from pointer to reference
llvm-svn: 193699
2013-10-30 17:14:24 +00:00
Manman Ren 251a1bd215 Debug Info: code clean up.
Use EmitLabelOffsetDifference for handling on darwin platform when
non-darwin platforms use EmitLabelPlusOffset.

Also fix a bug in EmitLabelOffsetDifference where the size is hard-coded
to 4 even though Size is passed in as an argument.

llvm-svn: 193660
2013-10-29 23:14:15 +00:00
Manman Ren ce20d460e2 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
Manman Ren f4c339e04a Debug Info: instead of calling addToContextOwner which constructs the context
after the DIE creation, we construct the context first.

Ensure that we create the context before we create a type so that we can add
the newly created type to the parent. Remove last use of addToContextOwner
now that it's not needed.

We use createAndAddDIE to wrap around "new DIE(". Now all shareable DIEs
should be added to their parents right after the creation.

Reviewed off-list by Eric, Thanks.

llvm-svn: 193657
2013-10-29 22:49:29 +00:00
Rafael Espindola e133ed88b5 Move getSymbol to TargetLoweringObjectFile.
This allows constructing a Mangler with just a TargetMachine.

llvm-svn: 193630
2013-10-29 17:28:26 +00:00
Rafael Espindola 79858aa3df Add a helper getSymbol to AsmPrinter.
llvm-svn: 193627
2013-10-29 17:07:16 +00:00
Manman Ren f6b936bc06 Debug Info: instead of calling addToContextOwner which constructs the context
after the DIE creation, we construct the context first.

This touches creation of namespaces and global variables. The purpose is to
handle all DIE creations similarly: constructs the context first, then creates
the DIE and immediately adds the DIE to its parent.

We use createAndAddDIE to wrap around "new DIE(".

llvm-svn: 193589
2013-10-29 05:49:41 +00:00
Manman Ren 4a841a86bd Debug Info: use createAndAddDIE to wrap around "new DIE" in DwarfDebug.
This commit ensures DIEs are constructed within a compile unit and
immediately added to their parents.

Reviewed off-list by Eric.

llvm-svn: 193568
2013-10-29 01:03:01 +00:00
Manman Ren 73d697c641 Debug Info: use createAndAddDIE for newly-created Subprogram DIEs.
More patches will be submitted to convert "new DIE(" to use createAddAndDIE in
DwarfCompileUnit.cpp. This will simplify implementation of addDIEEntry where
we have to decide between ref4 and ref_addr, because DIEs that can be shared
across CU will be added to a CU already.

Reviewed off-list by Eric.

llvm-svn: 193567
2013-10-29 00:58:04 +00:00
Manman Ren b987e517f2 Debug Info: add a helper function createAndAddDIE.
It wraps around "new DIE(" and handles the bookkeeping part of the newly-created
DIE. It adds the DIE to its parent, and calls insertDIE if necessary. It makes
sure that bookkeeping is done at the earliest time and we should not see
parentless DIEs if all constructions of DIEs go through this helper function.

Later on, we can use an allocator for DIE allocation, and will only need to
change createAndAddDIE instead of modifying all the "new DIE(".

Reviewed off-list by Eric.

llvm-svn: 193566
2013-10-29 00:53:03 +00:00
David Blaikie 8bc7db777d DIEHash: Summary hashing of member functions
llvm-svn: 193432
2013-10-25 20:04:25 +00:00
David Blaikie 65cc969f50 DIEHash: Summary hashing of nested types
llvm-svn: 193427
2013-10-25 18:38:43 +00:00
David Blaikie d8c5b4e8ef MCStreamer: Reimplement the virtual EmitRawText as a protected member, EmitRawTextImpl, to avoid string literal ambiguities
Also improve the implementation of EmitRawText(Twine) so it doesn't
bother using the SmallString buffer if the Twine is a simple StringRef
anyway.

llvm-svn: 193378
2013-10-24 22:43:10 +00:00
David Blaikie 68642d3118 DWARF emission: Remove unnecessary/redundant DIE reference code
The default case at the end of the switch handles this just fine.

llvm-svn: 193374
2013-10-24 22:00:44 +00:00
Eric Christopher e34116750f Fix name of variable in comment.
llvm-svn: 193373
2013-10-24 21:54:58 +00:00
Eric Christopher 670ee0e941 Grammar.
llvm-svn: 193372
2013-10-24 21:20:23 +00:00
Eric Christopher b088d2d0bc Update misleading comment.
llvm-svn: 193371
2013-10-24 21:05:08 +00:00
David Blaikie 2aee7be871 DIEHash: Const correct and use references where non-null/non-rebound.
llvm-svn: 193363
2013-10-24 18:29:03 +00:00
David Blaikie 32744412d2 DIEHash: Do not use shallow type hashing for unnamed types
llvm-svn: 193361
2013-10-24 17:53:58 +00:00
David Blaikie afcb9656c3 DIEHash: Refactor ref attribute hashing into smaller functions
llvm-svn: 193360
2013-10-24 17:51:43 +00:00
David Blaikie e568225fc3 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
Manman Ren ffc9a71866 Debug Info: code clean up.
Since we never insert DIE for DITemplateTypeParameter to a map, there is no need
to call getDIE in getOrCreateTemplateTypeParameterDIE. It is also renamed to
constructTemplateTypeParameterDIE to match with other construct functions
in CompileUnit.

Same applies to getOrCreateTemplateValueParameterDIE.

llvm-svn: 193287
2013-10-23 23:05:28 +00:00
Manman Ren 230ec864af Debug Info: code clean up.
Rename createMemberDIE to constructMemberDIE to match other construct functions
in CompileUnit.

llvm-svn: 193286
2013-10-23 23:00:44 +00:00
Manman Ren 57e6ff7e72 Debug Info: code clean up.
Remove the unneeded return values from createMemberDIE, constructEnumTypeDIE,
getOrCreateTemplateTypeParameterDIE, and getOrCreateTemplateValueParameterDIE.

llvm-svn: 193285
2013-10-23 22:57:12 +00:00
Manman Ren 0cfd20b99e Debug Info: code clean up.
Unifying the argument ordering of private construct functions in CompileUnit to
follow constructTypeDIE(DIE &, DIBasicType),
constructTypeDIE(DIE &, DIDerivedType), constructTypeDIE(DIE &, DICompositeType),
constructSubrangeDIE and constructArrayTypeDIE.

llvm-svn: 193284
2013-10-23 22:52:22 +00:00
Manman Ren b9512a7c57 Remove {} from one-line block.
llvm-svn: 193276
2013-10-23 22:12:26 +00:00
Rafael Espindola b02877416e Reduce casting and use a fully covered switch.
llvm-svn: 193272
2013-10-23 21:24:34 +00:00
Manman Ren 642a0acce2 Debug Info: code clean up.
Remove unnecessary creation of LexicalScope in collectDeadVariables.
The created LexicialScope was only used to get isAbstractScope, which
should be false from the creation:
"new LexicalScope(NULL, DIDescriptor(SP), NULL, false);".

We can also remove a DenseMap that holds the created LexicalScopes.

llvm-svn: 193196
2013-10-22 20:59:19 +00:00
David Blaikie 5ebc54d9ea DIEHashing: Provide an assert for unreachable functionality regarding friends.
Since (as of r190716) Clang no longer emits debug info for C++ friend
declarations (and it seems GCC never has/does, which was the motivation
for the Clang change), there's no actual reachable case for implementing
the part of DWARF 4, Section 7.27 part 5 that pertains to friends.

Leave an assert here so that if/when we do have a client producing
friends and using type units, we can fill in the gap and add appropriate
(unit and feature) tests.

llvm-svn: 193193
2013-10-22 20:28:55 +00:00
David Blaikie d70a055394 DWARF type hashing: pointers to members
Includes a test case/FIXME demonstrating a bug/limitation in pointer to
member hashing. To be honest I'm not sure why we don't just always use
summary hashing for referenced types... but perhaps I'm missing
something.

llvm-svn: 193175
2013-10-22 18:14:41 +00:00
Eric Christopher c798d8ad0a Formatting/whitespace.
llvm-svn: 193135
2013-10-22 00:22:39 +00:00
David Blaikie fe3233a568 DWARF Type Hashing: Include reference and rvalue reference type in the declarable summary hashing path
More support for 7.25 Part 5.

llvm-svn: 193129
2013-10-21 23:06:19 +00:00
David Blaikie 6cf58c8980 DWARF type hashing: begin implementing Step 5, summary hashing in declarable contexts
There are several other tag types that need similar handling but to
ensure test coverage they'll be coming incrementally.

llvm-svn: 193126
2013-10-21 22:36:50 +00:00
Matt Arsenault b768912db8 Fix CodeGen for different size address space GEPs
llvm-svn: 193111
2013-10-21 20:03:54 +00:00
Reid Kleckner ad65f10d75 Fix the build in DIE.cpp with MSVC 2010
llvm-svn: 193106
2013-10-21 19:18:31 +00:00
David Blaikie 980d4994b2 DWARF type hashing: Handle multiple (including recursive) references to the same type
This uses a map, keeping the type DIE numbering separate from the DIEs
themselves - alternatively we could do things the way GCC does if we
want to add an integer to the DIE type to record the numbering there.

llvm-svn: 193105
2013-10-21 18:59:40 +00:00
Eric Christopher 691281be2f Fix up some old review feedback.
llvm-svn: 193095
2013-10-21 17:48:51 +00:00
David Blaikie f244319cac 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