summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move the Mangler from the AsmPrinter down to TLOF and clean up theEric Christopher2016-09-161-2/+1
| | | | | | TLOF API accordingly. llvm-svn: 281708
* CodeGen: Do not require a MachineFunction just to create a DIEDwarfExpression.Peter Collingbourne2016-05-201-3/+3
| | | | | | | | | We are about to start using DIEDwarfExpression to create global variable DIEs, which happens before we generate code for functions. Differential Revision: http://reviews.llvm.org/D20412 llvm-svn: 270257
* Generalize ownership/passing semantics to allow dsymutil to own ↵David Blaikie2015-11-181-12/+5
| | | | | | | | | | | | | abbreviations via unique_ptr While still allowing CodeGen/AsmPrinter in llvm to own them using a bump ptr allocator. (might be nice to replace the pointers there with something that at least automatically calls their dtors, if that's necessary/useful, rather than having it done explicitly (I think a typed BumpPtrAllocator already does this, or maybe a unique_ptr with a custom deleter, etc)) llvm-svn: 253409
* [X86] Generate .cfi_adjust_cfa_offset correctly when pushing argumentsMichael Kuperstein2015-11-031-0/+3
| | | | | | | | | | | | | | | When push instructions are being used to pass function arguments on the stack, and either EH or debugging are enabled, we need to generate .cfi_adjust_cfa_offset directives appropriately. For (synch) EH, it is enough for the CFA offset to be correct at every call site, while for debugging we want to be correct after every push. Darwin does not support this well, so don't use pushes whenever it would be required. Differential Revision: http://reviews.llvm.org/D13767 llvm-svn: 251904
* [AsmPrinter] Prune dead code. NFC.Benjamin Kramer2015-10-151-12/+0
| | | | | | I left all (dead) print and dump methods in place. llvm-svn: 250433
* [X86] Emit .cfi_escape GNU_ARGS_SIZE when adjusting the stack before callsMichael Kuperstein2015-10-071-0/+6
| | | | | | | | | | | | When outgoing function arguments are passed using push instructions, and EH is enabled, we may need to indicate to the stack unwinder that the stack pointer was adjusted before the call. This should fix the exception handling issues in PR24792. Differential Revision: http://reviews.llvm.org/D13132 llvm-svn: 249522
* Test commit. Fix comment. NFC.Maksim Panchenko2015-09-191-1/+1
| | | | llvm-svn: 248082
* Fix typos.Bruce Mitchener2015-09-121-2/+2
| | | | | | | | | | Summary: This fixes a variety of typos in docs, code and headers. Subscribers: jholewinski, sanjoy, arsenm, llvm-commits Differential Revision: http://reviews.llvm.org/D12626 llvm-svn: 247495
* Move most user of TargetMachine::getDataLayout to the Module oneMehdi Amini2015-07-161-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: This change is part of a series of commits dedicated to have a single DataLayout during compilation by using always the one owned by the module. This patch is quite boring overall, except for some uglyness in ASMPrinter which has a getDataLayout function but has some clients that use it without a Module (llmv-dsymutil, llvm-dwarfdump), so some methods are taking a DataLayout as parameter. Reviewers: echristo Subscribers: yaron.keren, rafael, llvm-commits, jholewinski Differential Revision: http://reviews.llvm.org/D11090 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 242386
* AsmPrinter: Use an intrusively linked list for DIE::ChildrenDuncan P. N. Exon Smith2015-06-251-1/+1
| | | | | | | | | | | | | | Replace the `std::vector<>` for `DIE::Children` with an intrusively linked list. This is a strict memory improvement: it requires no auxiliary storage, and reduces `sizeof(DIE)` by one pointer. It also factors out the DIE-related malloc traffic. This drops llc memory usage from 735 MB down to 718 MB, or ~2.3%. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 240736
* AsmPrinter: Cleanup DIEValue::EmitValue() API, NFCDuncan P. N. Exon Smith2015-06-241-3/+2
| | | | | | | | | Stop taking a `dwarf::Form` in `DIEValue::EmitValue()` and `DIEValue::SizeOf()`, since they're always passed `DIEValue::getForm()` anyway. This is just left over from when `DIEValue` didn't know its own form. llvm-svn: 240566
* Rename and improve emitSectionOffset.Rafael Espindola2015-06-161-18/+14
| | | | | | | | | | | | | | | | | | | | | | | Different object formats represent references from dwarf in different ways. ELF uses a relocation to the referenced point (except for .dwo) and COFF/MachO use the offset of the referenced point inside its section. This patch renames emitSectionOffset because * It doesn't produce an offset on ELF. * It changes behavior depending on how DWARF is represented, so adding dwarf to its name is probably a good thing. The patch also adds an option to force the use of offsets.That avoids funny looking code like if (!UseOffsets) Asm->emitSectionOffset.... It was correct, but read as if the ! was inverted. llvm-svn: 239866
* AsmPrinter: Stop exposing underlying DIE children list, NFCDuncan P. N. Exon Smith2015-05-281-1/+1
| | | | | | | Update `DIE` API to hide the implementation of `DIE::Children` so we can swap it out. llvm-svn: 238468
* AsmPrinter: Stop exposing underlying DIEValue list, NFCDuncan P. N. Exon Smith2015-05-271-7/+5
| | | | | | | Change the `DIE` API to hide the implementation of the list of `DIEValue`s. llvm-svn: 238369
* AsmPrinter: Store abbreviation data directly in DIE and DIEValueDuncan P. N. Exon Smith2015-05-271-12/+8
| | | | | | | | | | | | | | | | Stop storing a `DIEAbbrev` in `DIE`, since the data fits neatly inside the `DIEValue` list. Besides being a cleaner data structure (avoiding the parallel arrays), this gives us more freedom to rearrange the `DIEValue` list. This fixes the temporary memory regression from 845 MB up to 879 MB, and drops it further to 829 MB for a net memory decrease of around 1.9% (incremental decrease around 5.7%). (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 238364
* Reapply "AsmPrinter: Change DIEValue to be stored by value"Duncan P. N. Exon Smith2015-05-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit r238350, effectively reapplying r238349 after fixing (all?) the problems, all somehow related to how I was using `AlignedArrayCharUnion<>` inside `DIEValue`: - MSVC can only handle `sizeof()` on types, not values. Change the assert. - GCC doesn't know the `is_trivially_copyable` type trait. Instead of asserting it, add destructors. - Call placement new even when constructing POD (i.e., the pointers). - Instead of copying the char buffer, copy the casted classes. I've left in a couple of `static_assert`s that I think both MSVC and GCC know how to handle. If the bots disagree with me, I'll remove them. - Check that the constructed type is either standard layout or a pointer. This protects against a programming error: we really want the "small" `DIEValue`s to be small and simple, so don't accidentally change them not to be. - Similarly, check that the size of the buffer is no bigger than a `uint64_t` or a pointer. (I thought checking against `sizeof(uint64_t)` would be good enough, but Chandler suggested that pointers might sometimes be bigger than that in the context of sanitizers.) I've also committed r238359 in the meantime, which introduces a DIEValue.def to simplify dispatching between the various types (thanks to a review comment by David Blaikie). Without that, this commit would be almost unintelligible. Here's the original commit message: -- Change `DIEValue` to be stored/passed/etc. by value, instead of reference. It's now a discriminated union, with a `Val` field storing the actual type. The classes that used to inherit from `DIEValue` no longer do. There are two categories of these: - Small values fit in a single pointer and are stored by value. - Large values require auxiliary storage, and are stored by reference. The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp. It was relying on `DIEInteger`s being passed around by reference, so I replaced that assumption with a `PatchLocation` type that stores a safe reference to where the `DIEInteger` lives instead. This commit causes a temporary regression in memory usage, since I've left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit. I measured an increase from 845 MB to 879 MB, around 3.9%. The follow-up drops it lower than the starting point, and I've only recently brought the memory this low anyway, so I'm committing these changes separately to keep them incremental. (I also considered swapping the commits, but the other one first would cause a lot more code churn.) (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) -- llvm-svn: 238362
* Revert "AsmPrinter: Change DIEValue to be stored by value"Duncan P. N. Exon Smith2015-05-271-4/+4
| | | | | | | | | This reverts commit r238349, since it caused some errors on bots: - std::is_trivially_copyable isn't available until GCC 5.0. - It was complaining about strict aliasing with my use of ArrayCharUnion. llvm-svn: 238350
* AsmPrinter: Change DIEValue to be stored by valueDuncan P. N. Exon Smith2015-05-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change `DIEValue` to be stored/passed/etc. by value, instead of reference. It's now a discriminated union, with a `Val` field storing the actual type. The classes that used to inherit from `DIEValue` no longer do. There are two categories of these: - Small values fit in a single pointer and are stored by value. - Large values require auxiliary storage, and are stored by reference. The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp. It was relying on `DIEInteger`s being passed around by reference, so I replaced that assumption with a `PatchLocation` type that stores a safe reference to where the `DIEInteger` lives instead. This commit causes a temporary regression in memory usage, since I've left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit. I measured an increase from 845 MB to 879 MB, around 3.9%. The follow-up drops it lower than the starting point, and I've only recently brought the memory this low anyway, so I'm committing these changes separately to keep them incremental. (I also considered swapping the commits, but the other one first would cause a lot more code churn.) (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 238349
* AsmPrinter: Avoid EmitLabelDifference() in DwarfAccelTableDuncan P. N. Exon Smith2015-05-241-0/+10
| | | | | | | | | | | | | | | | | | Mint a new function, `AsmPrinter::emitDwarfStringOffset()`, which takes a `DwarfStringPoolEntryRef`. When DWARF is relocatable across sections, this defers to `emitSectionOffset()` and emits the `MCSymbol`; otherwise, just emit the offset directly, without using any intermediate symbols. `EmitLabelDifference()` is already optimized to emit absolute label differences cheaply when possible, so there aren't any major memory savings here (853 MB down to 851 MB, or 0.2%). However, it prepares for making the `MCSymbol`s in the `DwarfStringPool` optional. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 238119
* Revert "Add bool to DebugLocDwarfExpression to control emitting comments."Pete Cooper2015-05-201-2/+1
| | | | | | | | This reverts commit 0037b6bcbc874aa1b93d7ce3ad8dba3753ee2d9d (r237827). David Blaikie suggested some alternatives to this which are better. Reverting to apply a better solution later. llvm-svn: 237849
* Add bool to DebugLocDwarfExpression to control emitting comments.Pete Cooper2015-05-201-1/+2
| | | | | | | | | | | DebugLocDwarfExpression::EmitOp was creating temporary strings by concatenating Twine's. When emitting to object files, these comments are thrown away. This commit adds a boolean to the constructor of the DwarfExpression to control whether it will actually emit any comments. This prevents it from even generating the temporary comments which would have been thrown away anyway. llvm-svn: 237827
* [AsmPrinter] Make AsmPrinter's OutStreamer member a unique_ptr.Lang Hames2015-04-241-31/+32
| | | | | | | AsmPrinter owns the OutStreamer, so an owning pointer makes sense here. Using a reference for this is crufty. llvm-svn: 235752
* Store an optional section start label in MCSection.Rafael Espindola2015-03-101-9/+2
| | | | | | | | | | | | 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
* Move variable into assert to fix -Asserts builds.Rafael Espindola2015-03-101-4/+2
| | | | llvm-svn: 231753
* Remove incredibly confusing isBaseAddressKnownZero.Rafael Espindola2015-03-101-3/+2
| | | | | | | | | | | | | | | When referring to a symbol in a dwarf section on ELF we should use .long foo instead of .long foo - .debug_something because ELF is unaware of the content of the sections and therefore needs relocations. This has nothing to do with optimizing a -0. llvm-svn: 231751
* Move emitDIE and emitAbbrevs to AsmPrinter. NFC.Frederic Riss2015-03-041-0/+58
| | | | | | | | | | | | | | (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
* Revert "Revert "For the dwarf expression code get the subtarget off of the ↵Adrian Prantl2015-03-021-1/+2
| | | | | | | | current"" This reapplies r230990 without modifications. llvm-svn: 231024
* Refactor DebugLocDWARFExpression so it doesn't require access to theAdrian Prantl2015-03-021-40/+4
| | | | | | | | | | | | | | 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
* Revert "Refactor DebugLocDWARFExpression so it doesn't require access to the"Adrian Prantl2015-03-021-4/+40
| | | | | | This reverts commit 230975 to investigate buildbot breakage. llvm-svn: 231004
* Revert "For the dwarf expression code get the subtarget off of the current"Adrian Prantl2015-03-021-2/+1
| | | | | | This reverts commit 230990 because also reverting 230975. llvm-svn: 231003
* For the dwarf expression code get the subtarget off of the currentEric Christopher2015-03-021-1/+2
| | | | | | MachineFunction. llvm-svn: 230990
* Refactor DebugLocDWARFExpression so it doesn't require access to theAdrian Prantl2015-03-021-40/+4
| | | | | | | | | | | | | 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-4/+40
| | | | llvm-svn: 230932
* Refactor DebugLocDWARFExpression so it doesn't require access to theAdrian Prantl2015-03-021-40/+4
| | | | | | | | | | 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
* Migrate away a use of the subtarget (and TargetMachine) fromEric Christopher2015-02-191-5/+4
| | | | | | | AsmPrinterDwarf since the information is on the MCRegisterInfo via the MCContext and MMI that we already have on the AsmPrinter. llvm-svn: 229928
* Move DataLayout back to the TargetMachine from TargetSubtargetInfoEric Christopher2015-01-261-1/+1
| | | | | | | | | | | | | | | | | | | derived classes. Since global data alignment, layout, and mangling is often based on the DataLayout, move it to the TargetMachine. This ensures that global data is going to be layed out and mangled consistently if the subtarget changes on a per function basis. Prior to this all targets(*) have had subtarget dependent code moved out and onto the TargetMachine. *One target hasn't been migrated as part of this change: R600. The R600 port has, as a subtarget feature, the size of pointers and this affects global data layout. I've currently hacked in a FIXME to enable progress, but the port needs to be updated to either pass the 64-bitness to the TargetMachine, or fix the DataLayout to avoid subtarget dependent features. llvm-svn: 227113
* Remove support for DIVariable's FlagIndirectVariable and expectAdrian Prantl2015-01-191-6/+3
| | | | | | | | | | | | | | | frontends to use a DIExpression with a DW_OP_deref instead. This is not only a much more natural place for this informationl; there is also a technical reason: The FlagIndirectVariable is used to mark a variable that is turned into a reference by virtue of the calling convention; this happens for example to aggregate return values. The inliner, for example, may actually need to undo this indirection to correctly represent the value in its new context. This is impossible to implement because the DIVariable can't be safely modified. We can however safely construct a new DIExpression on the fly. llvm-svn: 226476
* [cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth2015-01-141-1/+1
| | | | | | | | | | | utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
* Debug Info: Emitting a register in DwarfExpression may fail. Report theAdrian Prantl2015-01-141-1/+4
| | | | | | | | status in a bool and let the users deal with the error. NFC. llvm-svn: 225899
* Debug Info: Turn DIExpression::getFrameRegister() into an isFrameRegister()Adrian Prantl2015-01-131-2/+3
| | | | | | | | function. NFC. llvm-svn: 225846
* Debug Info: Move support for constants into DwarfExpression.Adrian Prantl2015-01-131-14/+6
| | | | | | | | | Move the declaration of DebugLocDwarfExpression into DwarfExpression.h because it needs to be accessed from AsmPrinterDwarf.cpp and DwarfDebug.cpp NFC. llvm-svn: 225734
* Make DwarfExpression store the AsmPrinter instead of the TargetMachine.Adrian Prantl2015-01-121-5/+5
| | | | | | NFC. llvm-svn: 225731
* Run clang-format on the parts of AsmPrinterDwarf where it improves theAdrian Prantl2015-01-121-12/+10
| | | | | | readability. llvm-svn: 225726
* Untwine this expression. Thanks to David for noticing!Adrian Prantl2015-01-121-1/+1
| | | | llvm-svn: 225720
* Debug Info: Implement DwarfUnit::addRegisterOffset using DwarfExpression.Adrian Prantl2015-01-121-0/+3
| | | | | | No functional change. llvm-svn: 225707
* Debug info: Factor out the creation of DWARF expressions from AsmPrinterAdrian Prantl2015-01-121-136/+42
| | | | | | | | | | | | | | into a new class DwarfExpression that can be shared between AsmPrinter and DwarfUnit. This is the first step towards unifying the two entirely redundant implementations of dwarf expression emission in DwarfUnit and AsmPrinter. Almost no functional change — Testcases were updated because asm comments that used to be on two lines now appear on the same line, which is actually preferable. llvm-svn: 225706
* Remove the TargetMachine forwards for TargetSubtargetInfo basedEric Christopher2014-08-041-3/+4
| | | | | | information and update all callers. No functional change. llvm-svn: 214781
* Debug info: Infrastructure to support debug locations for fragmentedAdrian Prantl2014-08-011-15/+12
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Clarify the doxygen comment for AsmPrinter::EmitDwarfRegOpPiece and addAdrian Prantl2014-04-271-6/+6
| | | | | | | | default arguments to the function. No functional change. llvm-svn: 207372
* Debug info: Refactor EmitDwarfRegOpPiece to be a member function ofAdrian Prantl2014-04-271-18/+45
| | | | | | | | | | AsmPrinter. No functional change. http://reviews.llvm.org/D3373 rdar://problem/15928306 llvm-svn: 207369
OpenPOWER on IntegriCloud