summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DIE.h
Commit message (Collapse)AuthorAgeFilesLines
* Make DIE.h a public CodeGen header.Frederic Riss2015-01-051-587/+0
| | | | | | | | | | | | | | dsymutil would like to use all the AsmPrinter/MCStreamer infrastructure to stream out the DWARF. In order to do so, it will reuse the DIE object and so this header needs to be public. The interface exposed here has some corners that cannot be used without a DwarfDebug object, but clients that want to stream Dwarf can just avoid these. Differential Revision: http://reviews.llvm.org/D6695 llvm-svn: 225208
* Fix some cases where StringRef was being passed by const reference. Remove ↵Craig Topper2014-08-301-2/+2
| | | | | | const from some other StringRefs since its implicitly const already. llvm-svn: 216820
* Canonicalize header guards into a common format.Benjamin Kramer2014-08-131-2/+2
| | | | | | | | | | Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. llvm-svn: 215558
* DIE: Document some learnings about why the world isn't perfect.David Blaikie2014-04-281-0/+6
| | | | llvm-svn: 207458
* DIE: Pass ownership of children via std::unique_ptr rather than raw pointer.David Blaikie2014-04-251-2/+2
| | | | | | | | | | | This should reduce the chance of memory leaks like those fixed in r207240. There's still some unclear ownership of DIEs happening in DwarfDebug. Pushing unique_ptr and references through more APIs should help expose the cases where ownership is a bit fuzzy. llvm-svn: 207263
* DIEEntry: Refer to the specified DIE via reference rather than pointer.David Blaikie2014-04-251-4/+3
| | | | | | | Makes some more cases (the unit tests, specifically), lexically compatible with a change to unique_ptr. llvm-svn: 207261
* [C++] Use 'nullptr'.Craig Topper2014-04-241-2/+2
| | | | llvm-svn: 207083
* Use std::unique_ptr for DIE childrenDavid Blaikie2014-04-141-4/+5
| | | | | | | | | Got bored, removed some manual memory management. Pushed references (rather than pointers) through a few APIs rather than replacing *x with x.get(). llvm-svn: 206222
* Use dwarf::Tag rather than unsigned for DIE::Tag to make debugging easier.David Blaikie2014-04-121-3/+8
| | | | | | | | | | | Nice to be able to just print out the Tag and have the debugger print dwarf::DW_TAG_subprogram or whatever, rather than an int. It's a bit finicky (for example DIDescriptor::getTag still returns unsigned) because some places still handle real dwarf tags + our fake tags (one day we'll remove the fake tags, hopefully). llvm-svn: 206098
* More header and forward declaration cleanup.Eric Christopher2014-03-181-3/+1
| | | | llvm-svn: 204183
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-081-30/+30
| | | | | | class. llvm-svn: 203339
* Add a DIELocList class to handle pointers into the location list.Eric Christopher2014-03-051-1/+33
| | | | | | | | This enables us to figure out where in the debug_loc section our locations are so that we can eventually hash them. It also helps remove some special case code in emission. No functional change. llvm-svn: 203018
* Make the DIEValue constructor even more explicit.Eric Christopher2014-03-051-6/+6
| | | | llvm-svn: 202926
* Use a bool for whether or not an abbreviation has children rather thanEric Christopher2014-03-051-9/+11
| | | | | | | using a full uint16_t with the flag value... which happens to be 0 or 1. Update the class for bool values and rename functions slightly. llvm-svn: 202921
* Use dwarf::Attribute instead of a bare uint16_t.Eric Christopher2014-03-051-1/+1
| | | | llvm-svn: 202920
* Expand slightly on comment.Eric Christopher2014-03-051-1/+2
| | | | llvm-svn: 202919
* Unindent namespace.Eric Christopher2014-03-051-414/+436
| | | | llvm-svn: 202918
* Revert r201751 and solve the const problem a different way - byEric Christopher2014-02-271-10/+2
| | | | | | making the cache mutable. llvm-svn: 202417
* Make DIELoc/DIEBlock's ComputeSize method const. Add a setSizeEric Christopher2014-02-201-2/+10
| | | | | | | method to actually set it in the class to avoid computing it multiple times. llvm-svn: 201751
* Add a DIELoc class to cover the DW_FORM_exprloc set of expressionsEric Christopher2014-02-161-8/+47
| | | | | | | | | | | | | alongside DIEBlock and replace uses accordingly. Use DW_FORM_exprloc in DWARF4 and later code. Update testcases. Adding a DIELoc instead of using extra forms inside DIEBlock so that we can keep location expressions separate from other uses. No direct use at the moment, however, it's not a lot of code and using a separately named class keeps it somewhat more obvious what's going on in various locations. llvm-svn: 201481
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-071-1/+1
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. llvm-svn: 198685
* DebugInfo: Introduce new DIValue, DIETypeSignature to encode references to ↵David Blaikie2013-12-171-0/+29
| | | | | | | | | type units via their signatures This simplifies type unit and type unit reference creation as well as setting the stage for inter-type hashing across type unit boundaries. llvm-svn: 197539
* Constify the DIEs used for pubname and pubtype tables. PropagateEric Christopher2013-11-211-1/+1
| | | | | | through findAttribute etc. llvm-svn: 195290
* Remove polymorphic destruction for DIE. DIEBlocks are owned elsewhereEric Christopher2013-11-201-1/+1
| | | | | | | and not polymorphically deleted and they are the only thing that derive from DIE. llvm-svn: 195183
* DebugInfo: Partial implementation of DWARF type units.David Blaikie2013-11-191-5/+5
| | | | | | | | | | | | | | Emit DW_TAG_type_units into the debug_info section using compile unit headers. This is bogus/unusable by debuggers, but testable and provides more isolated review. Subsequent patches will include support for type unit headers and emission into the debug_types section, as well as comdat grouping the types based on their hash. Also the CompileUnit type will be renamed 'Unit' and relevant portions pulled out into respective CompileUnit and TypeUnit types. llvm-svn: 195166
* Formatting and 80-col.Eric Christopher2013-11-191-2/+2
| | | | llvm-svn: 195122
* Debug Info: remove duplication of DIEs when a DIE can be shared across CUs.Manman Ren2013-10-311-0/+3
| | | | | | | | | | | | | | | | | | | 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
* Debug Info: support for DW_FORM_ref_addr.Manman Ren2013-10-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* DIEHash: Refactor ref attribute hashing into smaller functionsDavid Blaikie2013-10-241-0/+1
| | | | llvm-svn: 193360
* Remove unused debug-only member variable.David Blaikie2013-10-241-4/+0
| | | | | | | 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
* DebugInfo: Put each kind of constant (form, attribute, tag, etc) into its ↵David Blaikie2013-10-211-33/+33
| | | | | | | | | | | 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
* Remove some dead code.David Blaikie2013-10-041-2/+0
| | | | llvm-svn: 192000
* Temporarily revert r176882 as it needs to be implemented in a differentEric Christopher2013-10-041-3/+0
| | | | | | way for all platforms. llvm-svn: 191975
* Temporarily revert r191792 as it is causing some LTO debug failuresEric Christopher2013-10-041-3/+0
| | | | | | | on platforms with relocations in debug info and also temporarily revert r191800 due to conflicts with the revert of r191792. llvm-svn: 191967
* DebugInfo: Avoid redundantly adding child DIEs to parents.David Blaikie2013-10-031-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DIE::addChild had a shortcircuit that silently no-op'd when a child was readded to the same parent. This hid some quirky/redundant code in DwarfDebug/CompileUnit. By removing that functionality and replacing it with an assert I was able to find and cleanup those cases, mostly centering around adding members to types in various circumstances. 1) The original oddity I noticed while working on type units (which actually was helping me in the short term, by accident) was the addToContextOwner call in constructTypeDIE. This call was completely bogus (why was it only done for non-virtual types? what relevance does that have at all) and redundant with the more uniform addToContextOwner made in getOrCreateTypeDIE. 2) If a member function definition was visited (createSubprogramDIE), it would attempt to build the member function declaration. The declaration DIE would then be added to its context, but in building the context (the type for which this function is a member) the members of the type would be added to the type automatically, so by the time the context was constructed, the member function was already associated with it. 3) The same as (2) but without the member function being constructed first. Whenever a type was constructed, the members would be created and member functions would be created by getOrCreateSubprogramDIE - this would lead to the subprogram being added to the (incomplete) type already, then the general member-construction code would add it again. llvm-svn: 191928
* Debug Info: remove duplication of DIEs when a DIE is part of the type systemManman Ren2013-10-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | and it is shared across CUs. We add a few maps in DwarfDebug to map MDNodes for the type system to the corresponding DIEs: MDTypeNodeToDieMap, MDSPNodeToDieMap, and MDStaticMemberNodeToDieMap. These DIEs can be shared across CUs, that is why we keep the maps in DwarfDebug instead of CompileUnit. Sometimes, when we try to add an attribute to a DIE, the DIE is not yet added to its owner yet, so we don't know whether we should use ref_addr or ref4. We create a worklist that will be processed during finalization to add attributes with the correct form (ref_addr or ref4). We add addDIEEntry to DwarfDebug to be a wrapper around DIE->addValue. It checks whether we know the correct form, if not, we update the worklist (DIEEntryWorklist). 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. llvm-svn: 191792
* Revert "Give internal classes hidden visibility."Benjamin Kramer2013-09-111-11/+11
| | | | | | | It works with clang, but GCC has different rules so we can't make all of those hidden. This reverts commit r190534. llvm-svn: 190536
* Give internal classes hidden visibility.Benjamin Kramer2013-09-111-11/+11
| | | | | | Worth 100k on a linux/x86_64 Release+Asserts clang. llvm-svn: 190534
* Be more rigorous about the sizes of forms and attributes.Eric Christopher2013-08-081-24/+24
| | | | llvm-svn: 187953
* Add a way to grab a particular attribute out of a DIE.Eric Christopher2013-08-071-0/+4
| | | | | | | Use it when we're looking for a string in particular. Update comments as well. llvm-svn: 187844
* Add preliminary support for hashing DIEs and breaking them intoEric Christopher2013-07-261-0/+30
| | | | | | | | | | | | | | | | type units. Initially this support is used in the computation of an ODR checker for C++. For now we're attaching it to the DIE, but in the future it will be attached to the type unit. This also starts breaking out types into the separation for type units, but without actually splitting the DIEs. In preparation for hashing the DIEs this adds a DIEString type that contains a StringRef with the string contained at the label. llvm-svn: 187213
* Debug Info: use module flag to set up Dwarf version.Manman Ren2013-07-021-1/+5
| | | | | | | | Correctly handles ref_addr depending on the Dwarf version. Emit Dwarf with version from module flag. TODO: turn on/off features depending on the Dwarf version. llvm-svn: 185484
* [DebugInfo] Introduce DIEExpr variant of DIEValue to hold MCExpr valuesUlrich Weigand2013-07-021-6/+33
| | | | | | | | | | | | This partially reverts r185202 and restores DIELabel to hold plain MCSymbol references. Instead, we add a new subclass DIEExpr of DIEValue that can hold generic MCExpr references. This is in preparation for supporting debug info for TLS variables on PowerPC, where we need to describe the variable location using a more complex expression than just MCSymbolRefExpr. llvm-svn: 185458
* DebugInfo: Pass MCSymbolRefExprs for labels instead of MCSymbolsDavid Blaikie2013-06-281-3/+7
| | | | | | | This is a precursor to adding debug info support for TLS which requires non-default relocations applied to TLS symbols. llvm-svn: 185202
* Formatting.Eric Christopher2013-06-111-1/+1
| | | | llvm-svn: 183807
* Fix up comment.Eric Christopher2013-06-101-1/+1
| | | | llvm-svn: 183703
* Remove unused function.Eric Christopher2013-06-101-6/+0
| | | | llvm-svn: 183698
* IndentCount is only used within NDEBUG code.Eric Christopher2013-06-101-0/+2
| | | | llvm-svn: 183695
* Const-ify some printing and dumping code for DIEValues.Eric Christopher2013-05-311-7/+7
| | | | llvm-svn: 183057
* Make getCompileUnit non-const and return the current DIE if itEric Christopher2013-05-141-1/+1
| | | | | | | happens to be a compile unit. Noticed on inspection and tested via calling on a newly created compile unit. No functional change. llvm-svn: 181835
OpenPOWER on IntegriCloud