summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* [Modules] Remove potential ODR violations by sinking the DEBUG_TYPEChandler Carruth2014-04-221-1/+2
| | | | | | | | | | | | 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
* ARM: Add support for segmented stacksOliver Stannard2014-04-021-0/+3
| | | | | | Patch by Alex Crichton, ILyoan, Luqman Aden and Svetoslav. llvm-svn: 205430
* Two part patch:Eric Christopher2014-03-071-44/+34
| | | | | | | | | | | | | | | First: refactor out the emission of entries into the .debug_loc section into its own routine. Second: add a new class ByteStreamer that can be used to either emit using an AsmPrinter or hash using DIEHash the series of bytes that would be emitted. Use this in all of the location emission routines for the .debug_loc section. No functional change intended outside of a few additional comments in verbose assembly. llvm-svn: 203304
* Fix up formatting.Eric Christopher2014-03-071-9/+8
| | | | llvm-svn: 203286
* Move some dwarf emission routines to AsmPrinterDwarf.cpp.Eric Christopher2014-03-071-0/+157
| | | | llvm-svn: 203191
* Add back r201608, r201622, r201624 and r201625Rafael Espindola2014-02-191-1/+1
| | | | | | | | | | | | | | r201608 made llvm corretly handle private globals with MachO. r201622 fixed a bug in it and r201624 and r201625 were changes for using private linkage, assuming that llvm would do the right thing. They all got reverted because r201608 introduced a crash in LTO. This patch includes a fix for that. The issue was that TargetLoweringObjectFile now has to be initialized before we can mangle names of private globals. This is trivially true during the normal codegen pipeline (the asm printer does it), but LTO has to do it manually. llvm-svn: 201700
* Revert r201622 and r201608.Daniel Jasper2014-02-191-1/+1
| | | | | | | This causes the LLVMgold plugin to segfault. More information on the replies to r201608. llvm-svn: 201669
* Fix PR18743.Rafael Espindola2014-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The IR @foo = private constant i32 42 is valid, but before this patch we would produce an invalid MachO from it. It was invalid because it would use an L label in a section where the liker needs the labels in order to atomize it. One way of fixing it would be to just reject this IR in the backend, but that would not be very front end friendly. What this patch does is use an 'l' prefix in sections that we know the linker requires symbols for atomizing them. This allows frontends to just use private and not worry about which sections they go to or how the linker handles them. One small issue with this strategy is that now a symbol name depends on the section, which is not available before codegen. This is not a problem in practice. The reason is that it only happens with private linkage, which will be ignored by the non codegen users (llvm-nm and llvm-ar). llvm-svn: 201608
* Use a consistent argument order in TargetLoweringObjectFile.Rafael Espindola2014-02-091-1/+1
| | | | | | | | | These methods normally call each other and it is really annoying if the arguments are in different order. The more common rule was that the arguments specific to call are first (GV, Encoding, Suffix) and the auxiliary objects (Mang, TM) come after. This patch changes the exceptions. llvm-svn: 201044
* Pass the Mangler by reference.Rafael Espindola2014-02-081-1/+1
| | | | | | | It is never null and it is not used in casts, so there is no reason to use a pointer. This matches how we pass TM. llvm-svn: 201025
* Simplify check.Eric Christopher2013-12-041-1/+1
| | | | llvm-svn: 196422
* Reformat slightly.Eric Christopher2013-12-041-27/+45
| | | | llvm-svn: 196421
* [Sparc] Implements exception handling in SPARC with DwarfCFI.Venkatraman Govindaraju2013-09-261-0/+3
| | | | llvm-svn: 191432
* Implements parsing and emitting of .cfi_window_save in MC.Venkatraman Govindaraju2013-09-261-0/+3
| | | | llvm-svn: 191431
* DebugInfo: PR14404: Avoid truncating 64 bit values into 32 bits for ↵David Blaikie2013-06-231-2/+2
| | | | | | ULEB128/SLEB128 generation llvm-svn: 184669
* Remove the MachineMove class.Rafael Espindola2013-05-131-23/+16
| | | | | | | | | | | | It was just a less powerful and more confusing version of MCCFIInstruction. A side effect is that, since MCCFIInstruction uses dwarf register numbers, calls to getDwarfRegNum are pushed out, which should allow further simplifications. I left the MachineModuleInfo::addFrameMove interface unchanged since this patch was already fairly big. llvm-svn: 181680
* Remove unused DwarfSectionOffsetDirective stringMatt Arsenault2013-04-221-1/+1
| | | | | | | The value isn't actually used, and setting it emits a COFF specific directive. llvm-svn: 180064
OpenPOWER on IntegriCloud