summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DIBuilder.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* DIBuilder: Remove duplicated comments, NFCDuncan P. N. Exon Smith2014-10-011-77/+1
| | | | | | | These comments already appear in the header, and some of them are out-of-date anyway. llvm-svn: 218829
* Revert "DIBuilder: Remove dead code"Duncan P. N. Exon Smith2014-10-011-0/+6
| | | | | | | | | This reverts commit r218820. It turns out that Adrian has an outstanding SROA patch that uses this. I've updated it to forward to `createExpression()`. llvm-svn: 218828
* DIBuilder: Remove dead codeDuncan P. N. Exon Smith2014-10-011-14/+0
| | | | | | | | | | | | I neglected to update `DIBuilder::createPieceExpression()` in r218797, which I noticed while rebasing a patch for PR17891. On closer inspection, it looks like dead code. If there are any downstream users of this, you should transition to the more general `createExpression()`. Or, we can add this back, but then it should just forward to `createExpression()`. llvm-svn: 218820
* DIBuilder: Encapsulate DIExpression's element typeDuncan P. N. Exon Smith2014-10-011-2/+6
| | | | | | | | `DIExpression`'s elements are 64-bit integers that are stored as `ConstantInt`. The accessors already encapsulate the storage. This commit updates the `DIBuilder` API to also encapsulate that. llvm-svn: 218797
* Move the complex address expression out of DIVariable and into an extraAdrian Prantl2014-10-011-45/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | argument of the llvm.dbg.declare/llvm.dbg.value intrinsics. Previously, DIVariable was a variable-length field that has an optional reference to a Metadata array consisting of a variable number of complex address expressions. In the case of OpPiece expressions this is wasting a lot of storage in IR, because when an aggregate type is, e.g., SROA'd into all of its n individual members, the IR will contain n copies of the DIVariable, all alike, only differing in the complex address reference at the end. By making the complex address into an extra argument of the dbg.value/dbg.declare intrinsics, all of the pieces can reference the same variable and the complex address expressions can be uniqued across the CU, too. Down the road, this will allow us to move other flags, such as "indirection" out of the DIVariable, too. The new intrinsics look like this: declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr) declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr) This patch adds a new LLVM-local tag to DIExpressions, so we can detect and pretty-print DIExpression metadata nodes. What this patch doesn't do: This patch does not touch the "Indirect" field in DIVariable; but moving that into the expression would be a natural next step. http://reviews.llvm.org/D4919 rdar://problem/17994491 Thanks to dblaikie and dexonsmith for reviewing this patch! Note: I accidentally committed a bogus older version of this patch previously. llvm-svn: 218787
* Revert r218778 while investigating buldbot breakage.Adrian Prantl2014-10-011-27/+45
| | | | | | "Move the complex address expression out of DIVariable and into an extra" llvm-svn: 218782
* Move the complex address expression out of DIVariable and into an extraAdrian Prantl2014-10-011-45/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | argument of the llvm.dbg.declare/llvm.dbg.value intrinsics. Previously, DIVariable was a variable-length field that has an optional reference to a Metadata array consisting of a variable number of complex address expressions. In the case of OpPiece expressions this is wasting a lot of storage in IR, because when an aggregate type is, e.g., SROA'd into all of its n individual members, the IR will contain n copies of the DIVariable, all alike, only differing in the complex address reference at the end. By making the complex address into an extra argument of the dbg.value/dbg.declare intrinsics, all of the pieces can reference the same variable and the complex address expressions can be uniqued across the CU, too. Down the road, this will allow us to move other flags, such as "indirection" out of the DIVariable, too. The new intrinsics look like this: declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr) declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr) This patch adds a new LLVM-local tag to DIExpressions, so we can detect and pretty-print DIExpression metadata nodes. What this patch doesn't do: This patch does not touch the "Indirect" field in DIVariable; but moving that into the expression would be a natural next step. http://reviews.llvm.org/D4919 rdar://problem/17994491 Thanks to dblaikie and dexonsmith for reviewing this patch! llvm-svn: 218778
* Remove dead code from DIBuilderJyoti Allur2014-09-291-43/+7
| | | | llvm-svn: 218593
* DIBuilder: Delete dead code, NFCDuncan P. N. Exon Smith2014-09-191-28/+0
| | | | | | | There are two versions of `DIBuilder::createObjCIVar()`. Delete the one that's apparently dead. llvm-svn: 218167
* Add DIBuilder functions to build RAUWable DIVariables and DIFunctions.Frederic Riss2014-09-171-26/+92
| | | | | | | | | | | | Summary: These will be used to implement support for useful forward declarartions. Reviewers: echristo, dblaikie, aprantl Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5328 llvm-svn: 217949
* Fix comments of createReplaceableForwardDecl() and createForwardDecl().Frederic Riss2014-09-101-4/+3
| | | | | | | | | | | | | Noticed while trying to understand how the merge of forward decalred types and defintions work. Reviewers: echristo, dblaikie, aprantl Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5291 llvm-svn: 217514
* Use DILexicalBlockFile, rather than DILexicalBlock, to track discriminator ↵David Blaikie2014-08-211-5/+5
| | | | | | | | | | | | | | | 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. llvm-svn: 216239
* Debug info: Infrastructure to support debug locations for fragmentedAdrian Prantl2014-08-011-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | variables (for example, by-value struct arguments passed in registers, or large integer values split across several smaller registers). On the IR level, this adds a new type of complex address operation OpPiece to DIVariable that describes size and offset of a variable fragment. On the DWARF emitter level, all pieces describing the same variable are collected, sorted and emitted as DWARF expressions using the DW_OP_piece and DW_OP_bit_piece operators. http://reviews.llvm.org/D3373 rdar://problem/15928306 What this patch doesn't do / Future work: - This patch only adds the backend machinery to make this work, patches that change SROA and SelectionDAG's type legalizer to actually create such debug info will follow. (http://reviews.llvm.org/D2680) - Making the DIVariable complex expressions into an argument of dbg.value will reduce the memory footprint of the debug metadata. - The sorting/uniquing of pieces should be moved into DebugLocEntry, to facilitate the merging of multi-piece entries. llvm-svn: 214576
* Feedback on r214189, no functionality change.Manman Ren2014-07-291-1/+1
| | | | llvm-svn: 214240
* [Debug Info] remove DITrivialType and use null to represent unspecified param.Manman Ren2014-07-291-5/+2
| | | | | | | | | | | | Per feedback on r214111, we are going to use null to represent unspecified parameter. If the type array is {null}, it means a function that returns void; If the type array is {null, null}, it means a variadic function that returns void. In summary if we have more than one element in the type array and the last element is null, it is a variadic function. rdar://17628609 llvm-svn: 214189
* [Debug Info] add DISubroutineType and its creation takes DITypeArray. Manman Ren2014-07-281-4/+4
| | | | | | | | | | | DITypeArray is an array of DITypeRef, at its creation, we will create DITypeRef (i.e use the identifier if the type node has an identifier). This is the last patch to unique the type array of a subroutine type. rdar://17628609 llvm-svn: 214132
* [Debug Info] add a template class DITypedArray.Manman Ren2014-07-281-0/+12
| | | | | | | | | | | | Typedef DIArray to DITypedArray<DIDescriptor>. Also typedef DITypeArray as DITypedArray<DITypeRef>. This is the third of a series of patches to handle type uniqueing of the type array for a subroutine type. This commit should have no functionality change. llvm-svn: 214115
* [Debug Info] replace DIUnspecifiedParameter with DITrivialType.Manman Ren2014-07-281-2/+2
| | | | | | | | | | | | | This is the first of a series of patches to handle type uniqueing of the type array for a subroutine type. This commit makes sure unspecified_parameter is a DIType to enable converting the type array for a subroutine type to an array of DITypes. This commit should have no functionality change. With this commit, we may change unspecified type to be a DITrivialType instead of a DIType. llvm-svn: 214111
* Debug info: split out complex DIVariable address expressions into aAdrian Prantl2014-06-301-12/+13
| | | | | | | | | | | separate MDNode so they can be uniqued via folding set magic. To conserve space, DIVariable nodes are still variable-length, with the last two fields being optional. No functional change. http://reviews.llvm.org/D3526 llvm-svn: 212050
* Add new debug kind LocTrackingOnly.Diego Novillo2014-06-241-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This new debug emission kind supports emitting line location information in all instructions, but stops code generation from emitting debug info to the final output. This mode is useful when the backend wants to track source locations during code generation, but it does not want to produce debug info. This is currently used by optimization remarks (-pass-remarks, -pass-remarks-missed and -pass-remarks-analysis). To prevent debug info emission, DIBuilder never inserts the annotation 'llvm.dbg.cu' when LocTrackingOnly is enabled. Reviewers: echristo, dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D4234 llvm-svn: 211609
* DebugInfo: Add FIXME regarding DILexicalBlock uniquing fields.David Blaikie2014-05-151-0/+7
| | | | llvm-svn: 208909
* PR19562: DebugInfo temporary MDNode leak: Don't include a temporary node to ↵David Blaikie2014-05-071-2/+1
| | | | | | | | | | replace with a variable list for methods, since they're always declarations and thus never include variables This field is used for a list of variables to ensure they are not lost during optimization (they're only included when optimizations are enabled). llvm-svn: 208159
* PR19598: Provide the ability to RAUW a declaration with itself, creating a ↵David Blaikie2014-05-061-0/+34
| | | | | | | | | | | | | non-temporary copy and using that to RAUW. Also, provide the ability to create temporary and non-temporary declarations, as not all declarations may be replaced by definitions later on. This provides the necessary infrastructure for Clang to fix PR19598, leaking temporary MDNodes in Clang's debug info generation. llvm-svn: 208054
* PR19623: Implement typedefs of void.David Blaikie2014-05-011-1/+0
| | | | | | | | This the LLVM portion that will allow Clang and other frontends to emit typedefs of void by providing a null type for the typedef's underlying type. llvm-svn: 207777
* Modify the assertion in DIBuilder.cpp to cover the DWARF 5 languagesPeter Collingbourne2014-04-281-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D3523 llvm-svn: 207428
* [C++11] More 'nullptr' conversion or in some cases just using a boolean ↵Craig Topper2014-04-091-52/+58
| | | | | | check instead of comparing to nullptr. llvm-svn: 205831
* DebugInfo: Support namespace aliases as DW_TAG_imported_declaration instead ↵David Blaikie2014-04-061-24/+23
| | | | | | | | | | | | | | | | of DW_TAG_imported_module I really should read the spec more often (and test GCC more often too). I just assumed that namespace aliases would be the same as using directives, except with a name. But apparently that's not how the DWARF standards suggests they be implemented. DWARF4 provides an example and other non-normative text suggesting that namespace aliases be implemented by named imported declarations intsead of named imported modules. So be it. llvm-svn: 205685
* LTO type uniquing: store the Decl field of a DIImportedEntity as a DIRef.Adrian Prantl2014-04-011-2/+2
| | | | | | | | | | 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
* Switch the type field in DIVariable and DIGlobalVariable over to DITypeRefs.Adrian Prantl2014-03-181-7/+8
| | | | | | | | | 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
* [Layering] Move DebugInfo.h into the IR library where its implementationChandler Carruth2014-03-061-1/+1
| | | | | | already lives. llvm-svn: 203046
* [Layering] Move DIBuilder.h into the IR library where its implementationChandler Carruth2014-03-061-1/+1
| | | | | | already lives. llvm-svn: 203038
* Add DWARF discriminator support to DILexicalBlocks.Diego Novillo2014-03-031-1/+3
| | | | | | This adds support for emitting discriminators from DILexicalBlocks. llvm-svn: 202736
* Fix >> to be > > for non-c++11.Eric Christopher2014-02-281-1/+1
| | | | llvm-svn: 202545
* 80-col.Eric Christopher2014-02-281-1/+2
| | | | llvm-svn: 202541
* Fix a crasher where when we're attempting to replace a typeEric Christopher2014-02-281-4/+7
| | | | | | | | | | during the finalization for CGDebugInfo in clang we would RAUW a type and it would result in a corrupted MDNode for an imported declaration. Testcase pending as reducing has been difficult. llvm-svn: 202540
* Add a debug info code generation level to the compile unit metadataEric Christopher2014-02-271-2/+5
| | | | | | | | | | and update everything accordingly. This can be used to conditionalize the amount of output in the backend based on the amount of debug requested/metadata emission scheme by a front end (e.g. clang). Paired with a commit to clang. llvm-svn: 202332
* DIBuilder: simplify array generation to produce true zero-length arraysDavid Blaikie2014-02-031-4/+0
| | | | | | | | | | | | For some anachronistic reason we were producing {i32 0} for zero-length debug info arrays. (this change is paired with a Clang change and may cause temporary buildbot noise) Let's not. llvm-svn: 200721
* Debug info: Implement (rvalue) reference qualifiers for C++11 non-staticAdrian Prantl2013-12-181-2/+3
| | | | | | | | member functions. Paired commit with CFE. rdar://problem/15356637 llvm-svn: 197613
* DebugInfo: Simplify a few more explicit constructions, underconstrained ↵David Blaikie2013-11-181-4/+4
| | | | | | types, and make DIType(MDNode*) explicit like all the other DI* node ctors. llvm-svn: 195055
* Add an assert that we have a scope that matters for methodsEric Christopher2013-10-151-1/+4
| | | | | | | and remove a call to getNonCompileUnitScope as a method shouldn't be in the compile unit scope. llvm-svn: 192748
* Clean up, formatting, comments. No functional change.Eric Christopher2013-10-151-100/+88
| | | | llvm-svn: 192747
* Debug Info: In DIBuilder, the context field of subprogram is updated to useManman Ren2013-10-101-2/+24
| | | | | | | | DIScopeRef. A paired commit at clang is required due to changes to DIBuilder. llvm-svn: 192378
* Debug Info: In DIBuilder, the context and type fields of template_type andManman Ren2013-10-091-4/+4
| | | | | | | | template_value are updated to use DIRef. A paired commit at clang is required due to changes to DIBuilder. llvm-svn: 192320
* Debug Info: In DIBuilder, the context field of a forward decl is updatedManman Ren2013-10-091-1/+1
| | | | | | to use DIScopeRef. llvm-svn: 192309
* Debug Info: In DIBuilder, the context field of a DICompositeType is updatedManman Ren2013-10-091-4/+4
| | | | | | | | to use DIScopeRef. A paired commit at clang is required due to changes to DIBuilder. llvm-svn: 192256
* Debug Info: In DIBuilder, the context fields of a static member and aManman Ren2013-10-081-2/+2
| | | | | | typedef are updated to use DIScopeRef. llvm-svn: 192254
* Debug Info: In DIBuilder, the derived-from field of DICompositeTypeManman Ren2013-10-081-5/+5
| | | | | | | | is updated to use DITypeRef. A paired commit at clang is required due to changes to DIBuilder. llvm-svn: 192251
* Debug Info: In DIBuilder, the derived-from field of DIDerivedTypeManman Ren2013-10-081-8/+8
| | | | | | | | is updated to use DITypeRef. A paired commit at clang is required due to changes to DIBuilder. llvm-svn: 192246
* Debug Info: In DIBuilder, the derived-from field of a DW_TAG_pointer_typeManman Ren2013-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | is updated to use DITypeRef. Move isUnsignedDIType and getOriginalTypeSize from DebugInfo.h to be static helper functions in DwarfCompileUnit. We already have a static helper function "isTypeSigned" in DwarfCompileUnit, and a pointer to DwarfDebug is added to resolve the derived-from field. All three functions need to go across link for derived-from fields, so we need to get hold of a type identifier map. A pointer to DwarfDebug is also added to DbgVariable in order to resolve the derived-from field. Debug info verifier is updated to check a derived-from field is a TypeRef. Verifier will not go across link for derived-from fields, in debug info finder, we go across the link to add derived-from fields to types. Function getDICompositeType is only used by dragonegg and since dragonegg does not generate identifier for types, we use an empty map to resolve the derived-from field. When printing a derived-from field, we use DITypeRef::getName to either return the type identifier or getName of the DIType. A paired commit at clang is required due to changes to DIBuilder. llvm-svn: 192018
* Temporarily revert r191792 as it is causing some LTO debug failuresEric Christopher2013-10-041-1/+1
| | | | | | | on platforms with relocations in debug info and also temporarily revert r191800 due to conflicts with the revert of r191792. llvm-svn: 191967
OpenPOWER on IntegriCloud