summaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DIE.h
Commit message (Collapse)AuthorAge
* Debug Info: remove duplication of DIEs when a DIE can be shared across CUs.Manman Ren2013-10-31
| | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193779 91177308-0d34-0410-b5e6-96231b3b80d8
* Debug Info: support for DW_FORM_ref_addr.Manman Ren2013-10-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193658 91177308-0d34-0410-b5e6-96231b3b80d8
* DIEHash: Refactor ref attribute hashing into smaller functionsDavid Blaikie2013-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193360 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused debug-only member variable.David Blaikie2013-10-24
| | | | | | | This may've been used at some point but the 'print' member function grew an Indent parameter that entirely shadows this parameter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193358 91177308-0d34-0410-b5e6-96231b3b80d8
* DebugInfo: Put each kind of constant (form, attribute, tag, etc) into its ↵David Blaikie2013-10-21
| | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193091 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove some dead code.David Blaikie2013-10-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192000 91177308-0d34-0410-b5e6-96231b3b80d8
* Temporarily revert r176882 as it needs to be implemented in a differentEric Christopher2013-10-04
| | | | | | way for all platforms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191975 91177308-0d34-0410-b5e6-96231b3b80d8
* Temporarily revert r191792 as it is causing some LTO debug failuresEric Christopher2013-10-04
| | | | | | | on platforms with relocations in debug info and also temporarily revert r191800 due to conflicts with the revert of r191792. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191967 91177308-0d34-0410-b5e6-96231b3b80d8
* DebugInfo: Avoid redundantly adding child DIEs to parents.David Blaikie2013-10-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191928 91177308-0d34-0410-b5e6-96231b3b80d8
* Debug Info: remove duplication of DIEs when a DIE is part of the type systemManman Ren2013-10-01
| | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191792 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Give internal classes hidden visibility."Benjamin Kramer2013-09-11
| | | | | | | It works with clang, but GCC has different rules so we can't make all of those hidden. This reverts commit r190534. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190536 91177308-0d34-0410-b5e6-96231b3b80d8
* Give internal classes hidden visibility.Benjamin Kramer2013-09-11
| | | | | | Worth 100k on a linux/x86_64 Release+Asserts clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190534 91177308-0d34-0410-b5e6-96231b3b80d8
* Be more rigorous about the sizes of forms and attributes.Eric Christopher2013-08-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187953 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a way to grab a particular attribute out of a DIE.Eric Christopher2013-08-07
| | | | | | | Use it when we're looking for a string in particular. Update comments as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187844 91177308-0d34-0410-b5e6-96231b3b80d8
* Add preliminary support for hashing DIEs and breaking them intoEric Christopher2013-07-26
| | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187213 91177308-0d34-0410-b5e6-96231b3b80d8
* Debug Info: use module flag to set up Dwarf version.Manman Ren2013-07-02
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185484 91177308-0d34-0410-b5e6-96231b3b80d8
* [DebugInfo] Introduce DIEExpr variant of DIEValue to hold MCExpr valuesUlrich Weigand2013-07-02
| | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185458 91177308-0d34-0410-b5e6-96231b3b80d8
* DebugInfo: Pass MCSymbolRefExprs for labels instead of MCSymbolsDavid Blaikie2013-06-28
| | | | | | | This is a precursor to adding debug info support for TLS which requires non-default relocations applied to TLS symbols. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185202 91177308-0d34-0410-b5e6-96231b3b80d8
* Formatting.Eric Christopher2013-06-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183807 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix up comment.Eric Christopher2013-06-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183703 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused function.Eric Christopher2013-06-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183698 91177308-0d34-0410-b5e6-96231b3b80d8
* IndentCount is only used within NDEBUG code.Eric Christopher2013-06-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183695 91177308-0d34-0410-b5e6-96231b3b80d8
* Const-ify some printing and dumping code for DIEValues.Eric Christopher2013-05-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183057 91177308-0d34-0410-b5e6-96231b3b80d8
* Make getCompileUnit non-const and return the current DIE if itEric Christopher2013-05-14
| | | | | | | happens to be a compile unit. Noticed on inspection and tested via calling on a newly created compile unit. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181835 91177308-0d34-0410-b5e6-96231b3b80d8
* Assert that DIEEntries are constructed with non-null DIEsDavid Blaikie2013-05-14
| | | | | | | This just brings a crash a little further forward from DWARF emission to DIE construction to make errors easier to diagnose. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181748 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unnecessary instance variable and rework logic accordingly.Eric Christopher2013-05-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181227 91177308-0d34-0410-b5e6-96231b3b80d8
* Debug Info: revert 178722 for now.Manman Ren2013-04-04
| | | | | | | | | | | | | | There is a difference for FORM_ref_addr between DWARF 2 and DWARF 3+. Since Eric is against guarding DWARF 2 ref_addr with DarwinGDBCompat, we are still in discussion on how to handle this. The correct solution is to update our header to say version 4 instead of version 2 and update tool chains as well. rdar://problem/13559431 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178806 91177308-0d34-0410-b5e6-96231b3b80d8
* Debug Info: according to DWARF 2, FORM_ref_addr the same size as an address onManman Ren2013-04-04
| | | | | | | | | | | | the target system. It was hard-coded to 4 bytes before. I can't get llvm to generate a ref_addr on a reasonably sized testing case. rdar://problem/13559431 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178722 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix grammar.Eric Christopher2013-04-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178624 91177308-0d34-0410-b5e6-96231b3b80d8
* Use SmallVectorImpl instead of SmallVector at the uses.Eric Christopher2013-03-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178386 91177308-0d34-0410-b5e6-96231b3b80d8
* Use 12 as the magic number for our abbreviation data and ourEric Christopher2013-03-29
| | | | | | | die values. A lot of DIEs have 10 attributes in C++ code (example clang), none had more than 12. Seems like a good default. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178366 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix integer comparison in DIEInteger::BestForm.Hans Wennborg2013-03-18
| | | | | | | The always-true "(int)Int == (signed)Int" comparison was found while experimenting with a potential new Clang warning. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177290 91177308-0d34-0410-b5e6-96231b3b80d8
* Debug Info: use DW_FORM_ref_addr instead of DW_FORM_ref4 if the referenced DIEManman Ren2013-03-12
| | | | | | | | | | | | | | | | | belongs to a different compile unit. DW_FORM_ref_addr should be used for cross compile-unit reference. When compiling a large application, we got a dwarfdump verification error where abstract_origin points to nowhere. This error can't be reproduced on any testing case in MultiSource. We may have other cases where we use DW_FORM_ref4 unconditionally. rdar://problem/13370501 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176882 91177308-0d34-0410-b5e6-96231b3b80d8
* Whitespace and 80-col.Eric Christopher2013-01-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171803 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-19
| | | | | | single attribute in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170502 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unnecessary classof()'sSean Silva2012-10-11
| | | | | | | isa<> et al. automatically infer when the cast is an upcast (including a self-cast), so these are no longer necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165767 91177308-0d34-0410-b5e6-96231b3b80d8
* Bit pack DIE structures better.Benjamin Kramer2012-01-24
| | | | | | 16 bits are sufficient to store attributes, tags and forms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148799 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove generation of DW_AT_sibling. Nothing as far as I can tell uses it.Eric Christopher2012-01-24
| | | | | | | | Saves about 1.5% on debug info size. rdar://10278198 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148794 91177308-0d34-0410-b5e6-96231b3b80d8
* Unweaken vtables as per ↵David Blaikie2011-12-20
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146960 91177308-0d34-0410-b5e6-96231b3b80d8
* Always use the string pool, even when it makes the .o larger. This may helpNick Lewycky2011-10-28
| | | | | | | | tools that read the debug info in the .o files by making the DIE sizes more consistent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143186 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove dead enum value. There is no DIESectionOffset.Nick Lewycky2011-10-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142912 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some typo/formatting issues. No functionality change.Nick Lewycky2011-10-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142435 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused virtual dtor.Benjamin Kramer2011-03-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127331 91177308-0d34-0410-b5e6-96231b3b80d8
* Roll out r126425 and r126450 to see if it fixes the failures on the buildbots.Cameron Zwarich2011-02-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126488 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable DebugInfo support for COFF object files.Devang Patel2011-02-24
| | | | | | | | Patch by Nathan Jeffords! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126425 91177308-0d34-0410-b5e6-96231b3b80d8
* First cut at supporting .debug_loc section. Devang Patel2010-05-25
| | | | | | | This is used to track variable information. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104649 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support to emit dwarf ranges.Devang Patel2010-04-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101575 91177308-0d34-0410-b5e6-96231b3b80d8
* change SizeOf to take AsmPrinter instead of TargetData, Chris Lattner2010-04-05
| | | | | | | simplifying a bunch of code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100373 91177308-0d34-0410-b5e6-96231b3b80d8
* 1) make DIE take AsmPrinter instead of DwarfPrinter.Chris Lattner2010-04-05
| | | | | | | | 2) change DwarfDebug to not inherit from DwarfPrinter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100372 91177308-0d34-0410-b5e6-96231b3b80d8
* DwarfDebug: Allocate DIEValues with a BumpPtrAllocator. Most of them areBenjamin Kramer2010-03-31
| | | | | | | | | | | POD-like anyway, so we don't even care about calling their d'tors (DIEBlock being the exception). ~6% less mallocs and ~1% compile time improvement on clang -O0 -g oggenc.c git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100035 91177308-0d34-0410-b5e6-96231b3b80d8