summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* DebugInfo: Gut DIVariable and DIGlobalVariableDuncan P. N. Exon Smith2015-04-141-9/+9
| | | | | | | | | | Gut all the non-pointer API from the variable wrappers, except an implicit conversion from `DIGlobalVariable` to `DIDescriptor`. Note that if you're updating out-of-tree code, `DIVariable` wraps `MDLocalVariable` (`MDVariable` is a common base class shared with `MDGlobalVariable`). llvm-svn: 234840
* DebugInfo: Inline DIVariable::isBlockByrefVariable() into its callersDuncan P. N. Exon Smith2015-04-141-2/+4
| | | | | | | I don't think this API is helping much. Change the callers to call `MDType::isBlockByrefStruct()` directly. llvm-svn: 234837
* DebugInfo: Gut DIObjCProperty and DIImportedEntityDuncan P. N. Exon Smith2015-04-141-1/+1
| | | | | | | Gut a couple more classes in the DIDescriptor hierarchy. Leave behind an implicit conversion to `DIDescriptor`, the old base class. llvm-svn: 234836
* DebugInfo: Gut DIExpressionDuncan P. N. Exon Smith2015-04-141-10/+10
| | | | | | | | | | | | | | | | Completely gut `DIExpression`, turning it into a simple wrapper around `MDExpression *`. There are two bits of magic left: - It's constructed from `const MDExpression*` but convertible to `MDExpression*`. - It's default-constructed to `nullptr`. Otherwise, it should behave quite like a raw pointer. Once I've done the same to the rest of the `DIDescriptor` subclasses, I'll come back to delete them entirely (and update call sites as necessary to deal with the missing magic). llvm-svn: 234832
* Reapply "Verifier: Check for incompatible bit piece expressions"Duncan P. N. Exon Smith2015-04-131-9/+1
| | | | | | | | | | | | | | | | | | | | | This reverts commit r234717, reapplying r234698 (in spirit). As described in r234717, the original `Verifier` check had a use-after-free. Instead of storing pointers to "interesting" debug info intrinsics whose bit piece expressions should be verified once we have typerefs, do a second traversal. I've added a testcase to catch the `llc` crasher. Original commit message: Verifier: Check for incompatible bit piece expressions Convert an assertion into a `Verifier` check. Bit piece expressions must fit inside the variable, and mustn't be the entire variable. Catching this in the verifier will help us find bugs sooner, and makes `DIVariable::getSizeInBits()` dead code. llvm-svn: 234776
* Revert "Verifier: Check for incompatible bit piece expressions"Duncan P. N. Exon Smith2015-04-131-1/+9
| | | | | | | | | | | | | This reverts commit r234698. This caused a use-after-free: `QueuedBitPieceExpressions` holds onto references to `DbgInfoIntrinsic`s and references them past where they're deleted (this is because the verifier is run as a function pass, and then `verifyTypeRefs()` is called during `doFinalization()`). I'll include a reduced crasher for `llc` when I recommit the check. llvm-svn: 234717
* Verifier: Check for incompatible bit piece expressionsDuncan P. N. Exon Smith2015-04-111-9/+1
| | | | | | | | | Convert an assertion into a `Verifier` check. Bit piece expressions must fit inside the variable, and mustn't be the entire variable. Catching this in the verifier will help us find bugs sooner, and makes `DIVariable::getSizeInBits()` dead code. llvm-svn: 234698
* DebugInfo: Remove DITypedArray<>, replace with typedefsDuncan P. N. Exon Smith2015-04-071-31/+15
| | | | | | | | | | | | | | | | | Replace all uses of `DITypedArray<>` with `MDTupleTypedArrayWrapper<>` and `MDTypeRefArray`. The APIs are completely different, but the provided functionality is the same: treat an `MDTuple` as if it's an array of a particular element type. To simplify this patch a bit, I've temporarily typedef'ed `DebugNodeArray` to `DIArray` and `MDTypeRefArray` to `DITypeArray`. I've also temporarily conditionalized the accessors to check for null -- eventually these should be changed to asserts and the callers should check for null themselves. There's a tiny accompanying patch to clang. llvm-svn: 234290
* DebugInfo: Remove special iterators from DIExpressionDuncan P. N. Exon Smith2015-04-071-1/+2
| | | | | | | | | | Remove special iterators from `DIExpression` in favour of same in `MDExpression`. There should be no functionality change here. Note that the APIs are slightly different: `getArg(unsigned)` counts from 0, not 1, in the `MDExpression` version of the iterator. llvm-svn: 234285
* CodeGen: Stop using DIDescriptor::is*() and auto-castingDuncan P. N. Exon Smith2015-04-061-35/+31
| | | | | | Same as r234255, but for lib/CodeGen and lib/Target. llvm-svn: 234258
* DebugInfo: Remove DIDescriptor::Verify()Duncan P. N. Exon Smith2015-04-061-4/+4
| | | | | | | | | | | | Remove `DIDescriptor::Verify()` and the `Verify()`s from subclasses. They had already been gutted, and just did an `isa<>` check. In a couple of cases I've temporarily dropped the check entirely, but subsequent commits are going to disallow conversions to the `DIDescriptor`s directly from `MDNode`, so the checks will come back in another form soon enough. llvm-svn: 234201
* CodeGen: Assert that inlined-at locations agreeDuncan P. N. Exon Smith2015-04-031-0/+2
| | | | | | | | | | | | | | | | | As a follow-up to r234021, assert that a debug info intrinsic variable's `MDLocalVariable::getInlinedAt()` always matches the `MDLocation::getInlinedAt()` of its `!dbg` attachment. The goal here is to get rid of `MDLocalVariable::getInlinedAt()` entirely (PR22778), but I'll let these assertions bake for a while first. If you have an out-of-tree backend that just broke, you're probably attaching the wrong `DebugLoc` to a `DBG_VALUE` instruction. The one you want is the location that was attached to the corresponding `@llvm.dbg.declare` or `@llvm.dbg.value` call that you started with. llvm-svn: 234038
* LexicalScopes: Use debug info hierarchy pervasivelyDuncan P. N. Exon Smith2015-03-301-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Pervasively use the types provided by the debug info hierarchy rather than `MDNode` in `LexicalScopes`. I noticed (again, I guess, based on comments in the implementation?) that `DILexicalBlockFile::getScope()` returns something different from `DILexicalBlockFile::getContext()`. I created a local helper for getting the same logic from `MDLexicalBlockFile` called `getScopeOfScope()`. I still don't really understand it, but I've added some FIXMEs and I'll come back to it (I suspect the way we encode these objects isn't really ideal). Note that my previous commit r233610 accidentally changed behaviour in `findLexicalScope()` -- it transitioned from a call to `DILexicalBlockFile::getScope()` to `MDLexicalBlockFile::getScope()` (sounds right, doesn't it?) -- so I've fixed that as a drive-by. No tests failed with my error, so it looks like we're missing some coverage here... when I come back to understand the logic, I'll see if I can add some. Other than the fix to `findLexicalScope()`, no functionality change. llvm-svn: 233640
* DwarfDebug: Avoid creating new DebugLocs in the backendDuncan P. N. Exon Smith2015-03-301-5/+3
| | | | | | | Don't use `DebugLoc::getFnDebugLoc()`, which creates new `MDLocation`s, in the backend. We just want to grab the subprogram here anyway. llvm-svn: 233601
* CodeGen: Use the new DebugLoc API, NFCDuncan P. N. Exon Smith2015-03-301-8/+6
| | | | | | Update lib/CodeGen (and lib/Target) to use the new `DebugLoc` API. llvm-svn: 233582
* Refactor how passes get a symbol at the end of a section.Rafael Espindola2015-03-231-9/+2
| | | | | | | | | | There is now a canonical symbol at the end of a section that different passes can request. This also allows us to assert that we don't switch back to a section whose end symbol has already been printed. llvm-svn: 233026
* Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used.Benjamin Kramer2015-03-231-0/+1
| | | | llvm-svn: 232998
* DwarfDebug: Check for null DebugLocsDuncan P. N. Exon Smith2015-03-201-13/+15
| | | | | | | | | | `DL` might be null, so check for that before using accessors. A WIP patch to make `DIDescriptors` more strict fails otherwise. As a bonus, I think the logic is easier to follow now (despite the extra nesting depth). llvm-svn: 232836
* Centralize the handling of unique ids for temporary labels.Rafael Espindola2015-03-171-9/+5
| | | | | | | | | | | | | | | | Before this patch code wanting to create temporary labels for a given entity (function, cu, exception range, etc) had to keep its own counter to have stable symbol names. createTempSymbol would still add a suffix to make sure a new symbol was always returned, but it kept a single counter. Because of that, if we were to use just createTempSymbol("cu_begin"), the label could change from cu_begin42 to cu_begin43 because some other code started using temporary labels. Simplify this by just keeping one counter per prefix and removing the various specialized counters. llvm-svn: 232535
* Convert the last 4 users of GetTempSymbol to createTempSymbol.Rafael Espindola2015-03-171-2/+2
| | | | | | Despite using the same name these are unrelated. llvm-svn: 232485
* Convert the easy cases of GetTempSymbol to createTempSymbol.Rafael Espindola2015-03-171-2/+2
| | | | | | | In these cases no code was depending on GetTempSymbol finding an existing symbol. llvm-svn: 232478
* Remove dead code. NFC.Rafael Espindola2015-03-171-24/+0
| | | | llvm-svn: 232472
* Use the cached subtarget off of the machine function.Eric Christopher2015-03-131-6/+6
| | | | llvm-svn: 232128
* Print section start labels when first switching to the section.Rafael Espindola2015-03-111-42/+5
| | | | | | | This is less brittle and avoids polluting the start of the file with every debug section. llvm-svn: 231898
* Create symbols marking the start of a section earlier.Rafael Espindola2015-03-101-23/+21
| | | | | | | | | This lets us pass the symbol to the constructor and avoid the mutable field. This also opens the way for outputting the symbol only when needed, instead of outputting them at the start of the file. llvm-svn: 231859
* Change the datatype of DwarfExpression::Emit(Un)Signed to (u)int64_tAdrian Prantl2015-03-101-2/+2
| | | | | | so it matches the one used by ByteStreamer::Emit(U|S)LEB128. llvm-svn: 231823
* Store an optional section start label in MCSection.Rafael Espindola2015-03-101-61/+46
| | | | | | | | | | | | This makes code that uses section relative expressions (debug info) simpler and less brittle. This is still a bit awkward as the symbol is created late and has to be stored in a mutable field. I will move the symbol creation earlier in the next patch. llvm-svn: 231802
* Remove effectively dead code.Rafael Espindola2015-03-101-16/+1
| | | | | | | Switching back and forth between sections does nothing (other than producing larger .s files). llvm-svn: 231790
* Use a MapVector instead of an extra sort.Rafael Espindola2015-03-091-23/+8
| | | | | | This also has the advantage of not depending on the brittle getLabelBeginName. llvm-svn: 231714
* Don't prime the section map.Rafael Espindola2015-03-091-3/+0
| | | | | | | This was just creating unused labels for .text when the module had no functions. llvm-svn: 231694
* Use the existing begin and end symbol for debug info.Rafael Espindola2015-03-051-17/+6
| | | | llvm-svn: 231338
* Turn off .debug_pubnames/pubtypes for PS4.Paul Robinson2015-03-051-2/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D8067 llvm-svn: 231322
* Support standard DWARF TLS opcode; Darwin and PS4 use it.Paul Robinson2015-03-041-0/+5
| | | | | | Differential Revision: http://reviews.llvm.org/D8018 llvm-svn: 231286
* Move emitDIE and emitAbbrevs to AsmPrinter. NFC.Frederic Riss2015-03-041-45/+2
| | | | | | | | | | | | | | (They are called emitDwarfDIE and emitDwarfAbbrevs in their new home) llvm-dsymutil wants to reuse that code, but it doesn't have a DwarfUnit or a DwarfDebug object to call those. It has access to an AsmPrinter though. Having emitDIE in the AsmPrinter also removes the DwarfFile dependency on DwarfDebug, and thus the patch drops that field. Differential Revision: http://reviews.llvm.org/D8024 llvm-svn: 231210
* Fix PR22750: non-determinism causes assertion failure in DWARF generationDario Domizioli2015-03-031-2/+5
| | | | | | | | | | | | | | | | | | | | | | | The cause of the issue is the interaction of two factors: 1) When generating a DW_TAG_imported_declaration DIE which imports another imported declaration, the code in AsmPrinter/DwarfCompileUnit.cpp asserts that the second imported declaration must already have a DIE. 2) There is a non-determinism in the order in which imported declarations within the same scope are processed. Because of the non-determinism (2), it is possible that an imported declaration is processed before another one it depends on, breaking the assumption in (1). The source of the non-determinism is that the imported declaration DIDescriptors are sorted by scope in DwarfDebug::beginModule(); however that sort is not a stable_sort, therefore the order of the declarations within the same scope is not preserved. The attached patch changes the std::sort to a std::stable_sort and it fixes the problem. Test omitted due to it being non-deterministic and depending on the implementation of std::sort. llvm-svn: 231100
* Refactor DebugLocDWARFExpression so it doesn't require access to theAdrian Prantl2015-03-021-49/+82
| | | | | | | | | | | | | | TargetRegisterInfo. DebugLocEntry now holds a buffer with the raw bytes of the pre-calculated DWARF expression. Ought to be NFC, but it does slightly alter the output format of the textual assembly. This reapplies 230930 without the assertion in DebugLocEntry::finalize() because not all Machine registers can be lowered into DWARF register numbers and floating point constants cannot be expressed. llvm-svn: 231023
* Use read{16,32,64}{le,be}() instead of ↵Rui Ueyama2015-03-021-1/+1
| | | | | | *reinterpret_cast<u{little,big}{16,32,64}_t>(). llvm-svn: 231016
* Revert "Refactor DebugLocDWARFExpression so it doesn't require access to the"Adrian Prantl2015-03-021-82/+49
| | | | | | This reverts commit 230975 to investigate buildbot breakage. llvm-svn: 231004
* Refactor DebugLocDWARFExpression so it doesn't require access to theAdrian Prantl2015-03-021-49/+82
| | | | | | | | | | | | | TargetRegisterInfo. DebugLocEntry now holds a buffer with the raw bytes of the pre-calculated DWARF expression. Ought to be NFC, but it does slightly alter the output format of the textual assembly. This reapplies 230930 with a relaxed assertion in DebugLocEntry::finalize() that allows for empty DWARF expressions for constant FP values. llvm-svn: 230975
* Revert r230930, it caused PR22747.Nico Weber2015-03-021-82/+49
| | | | llvm-svn: 230932
* Refactor DebugLocDWARFExpression so it doesn't require access to theAdrian Prantl2015-03-021-49/+82
| | | | | | | | | | TargetRegisterInfo. DebugLocEntry now holds a buffer with the raw bytes of the pre-calculated DWARF expression. Ought to be NFC, but it does slightly alter the output format of the textual assembly. llvm-svn: 230930
* Simplify arange output.Rafael Espindola2015-02-261-60/+43
| | | | | | | Move SectionMap to its only user (emitDebugARanges) and reorder to save a call to sort. llvm-svn: 230693
* Used the cached subtarget off of the MachineFunction.Eric Christopher2015-02-201-1/+1
| | | | llvm-svn: 230078
* AsmPrinter: Take range in DwarfExpression::AddExpression(), NFCDuncan P. N. Exon Smith2015-02-171-1/+1
| | | | | | | | | | Previously `DwarfExpression::AddExpression()` relied on default-constructing the end iterators for `DIExpression` -- once the operands are represented explicitly via `MDExpression` (instead of via the strange `StringRef` navigator in `DIHeaderIterator`) this won't work. Explicitly take an iterator for the end of the range. llvm-svn: 229572
* 80-column fixups.Eric Christopher2015-02-171-3/+4
| | | | llvm-svn: 229527
* AsmPrinter: Stop creating DebugLocsDuncan P. N. Exon Smith2015-02-171-5/+3
| | | | | | | | | | | | | | | | While looking at a heap profile of a clang LTO bootstrap with -g, I noticed that 2.2% of memory in an `llvm-lto` of clang is from calling `DebugLoc::get()` in `collectVariableInfo()` (accounting for ~40% of memory used for `MDLocation`s). I suspect this was introduced by r226736, whose goal was to prevent uniquing of `DebugLoc`s (goal achieved, if so). There's no reason we need a `DebugLoc` here at all -- it was just being used for (in)convenient API -- so the fix is to pass the scope and inlined-at directly to `LexicalScopes::findInlinedScope()`. llvm-svn: 229459
* Debug Info: Support variables that are described by more than one MMIAdrian Prantl2015-02-101-4/+3
| | | | | | | | | | table entry. This happens when SROA splits up an alloca and the resulting allocas cannot be lowered to SSA values because their address is passed to a function. Fixes PR22502. llvm-svn: 228764
* Debug info: Use DW_OP_bit_piece instead of DW_OP_piece in theAdrian Prantl2015-02-091-16/+15
| | | | | | | | | | | intermediate representation. This - increases consistency by using the same granularity everywhere - allows for pieces < 1 byte - DW_OP_piece didn't actually allow storing an offset. Part of PR22495. llvm-svn: 228631
* DebugInfo: Remove DW_TAG_constantDuncan P. N. Exon Smith2015-02-091-1/+0
| | | | | | | | Remove handling for DW_TAG_constant. We started producing it in r110656, but reverted that in r110876 without dropping the support. Finish the job. llvm-svn: 228623
* Move simple case earlier and use a continue.Rafael Espindola2015-02-021-24/+25
| | | | llvm-svn: 227841
OpenPOWER on IntegriCloud