summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Formatting.Eric Christopher2013-11-111-9/+8
| | | | llvm-svn: 194400
* 80-col.Eric Christopher2013-11-111-5/+7
| | | | llvm-svn: 194399
* Just pass the DIComposite type by value instead of by pointer.Eric Christopher2013-11-111-5/+5
| | | | llvm-svn: 194398
* DebugInfo: Emit member variable locations as data instead of expressions in ↵David Blaikie2013-11-011-29/+31
| | | | | | | | | blocks Drive by space optimization. Also makes the DIEs more regular which might speed up DWARF parsing. llvm-svn: 193835
* Debug Info: remove duplication of DIEs when a DIE can be shared across CUs.Manman Ren2013-10-311-4/+46
| | | | | | | | | | | | | | | | | | | 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
* DebugInfo: Push header handling down into CompileUnitDavid Blaikie2013-10-301-0/+13
| | | | | | | This is a preliminary step to handling type units by abstracting over all (type or compile) units. llvm-svn: 193714
* Debug Info: support for DW_FORM_ref_addr.Manman Ren2013-10-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Debug Info: instead of calling addToContextOwner which constructs the contextManman Ren2013-10-291-18/+9
| | | | | | | | | | | | | | | after the DIE creation, we construct the context first. Ensure that we create the context before we create a type so that we can add the newly created type to the parent. Remove last use of addToContextOwner now that it's not needed. We use createAndAddDIE to wrap around "new DIE(". Now all shareable DIEs should be added to their parents right after the creation. Reviewed off-list by Eric, Thanks. llvm-svn: 193657
* Add a helper getSymbol to AsmPrinter.Rafael Espindola2013-10-291-3/+3
| | | | llvm-svn: 193627
* Debug Info: instead of calling addToContextOwner which constructs the contextManman Ren2013-10-291-7/+17
| | | | | | | | | | | | after the DIE creation, we construct the context first. This touches creation of namespaces and global variables. The purpose is to handle all DIE creations similarly: constructs the context first, then creates the DIE and immediately adds the DIE to its parent. We use createAndAddDIE to wrap around "new DIE(". llvm-svn: 193589
* Debug Info: use createAndAddDIE for newly-created Subprogram DIEs.Manman Ren2013-10-291-9/+5
| | | | | | | | | | | More patches will be submitted to convert "new DIE(" to use createAddAndDIE in DwarfCompileUnit.cpp. This will simplify implementation of addDIEEntry where we have to decide between ref4 and ref_addr, because DIEs that can be shared across CU will be added to a CU already. Reviewed off-list by Eric. llvm-svn: 193567
* Debug Info: add a helper function createAndAddDIE.Manman Ren2013-10-291-29/+24
| | | | | | | | | | | | | | It wraps around "new DIE(" and handles the bookkeeping part of the newly-created DIE. It adds the DIE to its parent, and calls insertDIE if necessary. It makes sure that bookkeeping is done at the earliest time and we should not see parentless DIEs if all constructions of DIEs go through this helper function. Later on, we can use an allocator for DIE allocation, and will only need to change createAndAddDIE instead of modifying all the "new DIE(". Reviewed off-list by Eric. llvm-svn: 193566
* Debug Info: code clean up.Manman Ren2013-10-231-22/+14
| | | | | | | | | | | Since we never insert DIE for DITemplateTypeParameter to a map, there is no need to call getDIE in getOrCreateTemplateTypeParameterDIE. It is also renamed to constructTemplateTypeParameterDIE to match with other construct functions in CompileUnit. Same applies to getOrCreateTemplateValueParameterDIE. llvm-svn: 193287
* Debug Info: code clean up.Manman Ren2013-10-231-3/+3
| | | | | | | Rename createMemberDIE to constructMemberDIE to match other construct functions in CompileUnit. llvm-svn: 193286
* Debug Info: code clean up.Manman Ren2013-10-231-14/+8
| | | | | | | Remove the unneeded return values from createMemberDIE, constructEnumTypeDIE, getOrCreateTemplateTypeParameterDIE, and getOrCreateTemplateValueParameterDIE. llvm-svn: 193285
* Debug Info: code clean up.Manman Ren2013-10-231-12/+12
| | | | | | | | | Unifying the argument ordering of private construct functions in CompileUnit to follow constructTypeDIE(DIE &, DIBasicType), constructTypeDIE(DIE &, DIDerivedType), constructTypeDIE(DIE &, DICompositeType), constructSubrangeDIE and constructArrayTypeDIE. llvm-svn: 193284
* Remove {} from one-line block.Manman Ren2013-10-231-2/+1
| | | | llvm-svn: 193276
* Fix up some old review feedback.Eric Christopher2013-10-211-2/+3
| | | | llvm-svn: 193095
* DebugInfo: Put each kind of constant (form, attribute, tag, etc) into its ↵David Blaikie2013-10-211-109/+123
| | | | | | | | | | | 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 unused variable.Benjamin Kramer2013-10-191-2/+1
| | | | llvm-svn: 193038
* Reformat.Eric Christopher2013-10-191-80/+73
| | | | llvm-svn: 193024
* Fix up a few minor performance problems spotted in code review.Eric Christopher2013-10-191-7/+6
| | | | llvm-svn: 193023
* Debug Info: add a newly-created DIE to a parent in the same function.Manman Ren2013-10-181-14/+17
| | | | | | | | | | With this commit, all DIEs created in CompileUnit will be added to parents inside the same function. Also make getOrCreateTemplateType|Value functions private. No functionality change. llvm-svn: 193002
* Debug Info: simplify code a bit.Manman Ren2013-10-181-1/+1
| | | | llvm-svn: 193001
* According to the dwarf standard pubnames and pubtypes for languagesEric Christopher2013-10-171-7/+52
| | | | | | | | | | | like C++ should be the fully qualified names for the type. Add a routine that does a language specific context walk to build up the qualified name and use it when we add types/names to the tables. Expand the gnu pubnames testcase as it's the most complex to make sure that qualified types are also being added. llvm-svn: 192865
* Add the subprogram DIEs to the context they're created with onlyEric Christopher2013-10-171-3/+6
| | | | | | | if they're a declaration, otherwise they're owned by the compile unit. llvm-svn: 192861
* Fix a pair of bugs in the emission of pubname tables:Eric Christopher2013-10-161-3/+5
| | | | | | | | | | | | | | | | 1) Make sure we emit static member variables by checking at the end of createGlobalVariableDIE rather than piecemeal in the function. (As a note, createGlobalVariableDIE needs rewriting.) 2) Make sure we use the definition rather than declaration DIE for two things: a) determining linkage for gnu pubnames, and b) as the address of the DIE for global variables. (As a note, createGlobalVariableDIE really needs rewriting.) Adjust the testcase to make sure we're checking the correct DIEs. llvm-svn: 192761
* Debug Info: static member DIE creation.Manman Ren2013-10-141-12/+22
| | | | | | | | | | | | | Clean up creation of static member DIEs. We can create static member DIEs from two places, so we call getOrCreateStaticMemberDIE from the two places. getOrCreateStaticMemberDIE will get or create the context DIE first, then it will check if the DIE already exists, if not, we create the static member DIE and add it to the context. Creation of static member DIEs are handled in a similar way as subprogram DIEs. llvm-svn: 192618
* Debug Info: remove form from function addDIEEntry.Manman Ren2013-10-111-13/+10
| | | | | | | | | The form must be a reference form in addDIEEntry. Which reference form to use will be decided by the callee. No functionality change. llvm-svn: 192517
* Debug Info: In DIBuilder, the context field of subprogram is updated to useManman Ren2013-10-101-1/+1
| | | | | | | | DIScopeRef. A paired commit at clang is required due to changes to DIBuilder. llvm-svn: 192378
* Debug Info: In DIBuilder, the context and type fields of template_type andManman Ren2013-10-091-3/+4
| | | | | | | | template_value are updated to use DIRef. A paired commit at clang is required due to changes to DIBuilder. llvm-svn: 192320
* Debug Info: rename getOriginalTypeSize to getBaseTypeSize.Manman Ren2013-10-081-4/+4
| | | | llvm-svn: 192216
* Debug Info: take advantage of the existing CU::resolve.Manman Ren2013-10-081-7/+7
| | | | llvm-svn: 192215
* Formally added an explicit enum for DWARF TLS support. No functionality change.Richard Mitton2013-10-071-3/+4
| | | | llvm-svn: 192118
* Debug Info: In DIBuilder, the derived-from field of a DW_TAG_pointer_typeManman Ren2013-10-051-16/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | is updated to use DITypeRef. Move isUnsignedDIType and getOriginalTypeSize from DebugInfo.h to be static helper functions in DwarfCompileUnit. We already have a static helper function "isTypeSigned" in DwarfCompileUnit, and a pointer to DwarfDebug is added to resolve the derived-from field. All three functions need to go across link for derived-from fields, so we need to get hold of a type identifier map. A pointer to DwarfDebug is also added to DbgVariable in order to resolve the derived-from field. Debug info verifier is updated to check a derived-from field is a TypeRef. Verifier will not go across link for derived-from fields, in debug info finder, we go across the link to add derived-from fields to types. Function getDICompositeType is only used by dragonegg and since dragonegg does not generate identifier for types, we use an empty map to resolve the derived-from field. When printing a derived-from field, we use DITypeRef::getName to either return the type identifier or getName of the DIType. A paired commit at clang is required due to changes to DIBuilder. llvm-svn: 192018
* Add a resolve method on CompileUnit that forwards to DwarfDebug.Eric Christopher2013-10-051-6/+6
| | | | llvm-svn: 192014
* Make a bunch of CompileUnit member functions private.Eric Christopher2013-10-051-1/+1
| | | | llvm-svn: 192009
* Minor formatting/comment rewording/etc.David Blaikie2013-10-041-5/+3
| | | | llvm-svn: 192005
* Tighten up some type arguments to functions. Where we expect aEric Christopher2013-10-041-4/+4
| | | | | | scope, pass a scope. llvm-svn: 192002
* Remove some dead code.David Blaikie2013-10-041-5/+0
| | | | llvm-svn: 192000
* Simplify setting of DIE tag for type DIEs by setting it in one* place.David Blaikie2013-10-041-16/+8
| | | | | | * two actually due to some weird template thing... investigating that. llvm-svn: 191998
* Prune includes.Eric Christopher2013-10-041-2/+0
| | | | llvm-svn: 191994
* Use addFlag to add the enum class attribute.Eric Christopher2013-10-041-1/+1
| | | | | | This has the side effect of using DW_FORM_flag_present on dwarf4 and above. llvm-svn: 191991
* Use Die->addValue and DIEIntegerOne directly when we want to addEric Christopher2013-10-041-3/+2
| | | | | | a flag. No functional change. llvm-svn: 191990
* Temporarily revert r176882 as it needs to be implemented in a differentEric Christopher2013-10-041-2/+1
| | | | | | way for all platforms. llvm-svn: 191975
* Temporarily revert r191792 as it is causing some LTO debug failuresEric Christopher2013-10-041-74/+26
| | | | | | | on platforms with relocations in debug info and also temporarily revert r191800 due to conflicts with the revert of r191792. llvm-svn: 191967
* DebugInfo: Fix ordering of members after r191928David Blaikie2013-10-041-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case (shown in the attached test) where a member function definition was emitted into debug info the following could occur: 1) build the debug info for the member function definition 2) in (1), build the debug info for the member function declaration 3) construct and add the member function declaration DIE 4) add it to its context 5) build its context (the type it is a member of) 6) construct the members and add them to the type 7) except don't add member functions because "getOrCreateSubprogram" adds the function to its parent anyway 8) except we're only partway through building this subprogram declaration so it hasn't been added yet - but we returned the partially constructed DIE (since it's already in the MDNode->DIE mapping to avoid infinitely recursing trying to create the member function DIE) 9) once the type is constructed, add the member function to it 10) now the members are out of order (the member function being defined is listed as the last member, even though it was declared as the first) To avoid this, construct the context of the subprogram DIE before we query to see if it exists. That way we never end up creating it before creating its context and ending up in this situation. Alternatively, the type construction that visits/builds all the members could call something like getOrCreateSubprogram, but that doesn't ever do the "add to context" step. Then the type building code would always be responsible for adding members (and the subprogram "addToContextDIE" would no-op because the context building would have added the subprogram declaration to the type/context DIE already). (the test cases updated were overly-sensitive to offsets or abbreviation numbers. We don't have a nice way to make these tests more robust as yet - multiline FileCheck matches would be required) llvm-svn: 191939
* DebugInfo: Avoid redundantly adding child DIEs to parents.David Blaikie2013-10-031-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove wild .debug_aranges entries generated from unimportant labelsAlexey Samsonov2013-10-031-13/+3
| | | | | | | | | | | | | | | | r191052 added emitting .debug_aranges to Clang, but this functionality is broken: it uses all MC labels added in DWARF Asm printer, including the labels for build relocations between different DWARF sections, like .Lsection_line or .Ldebug_loc0. As a result, if any DIE .debug_info would contain "DW_AT_location=0x123" attribute, .debug_aranges would also contain a range starting from 0x123, breaking tools that rely on this section. This patch fixes this by using only MC labels that corresponds to the addresses in the user program. llvm-svn: 191884
* Debug Info: In DIBuilder, the derived-from field of a DW_TAG_pointer_typeManman Ren2013-10-011-16/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | is updated to use DITypeRef. Move isUnsignedDIType and getOriginalTypeSize from DebugInfo.h to be static helper functions in DwarfCompileUnit. We already have a static helper function "isTypeSigned" in DwarfCompileUnit, and a pointer to DwarfDebug is added to resolve the derived-from field. All three functions need to go across link for derived-from fields, so we need to get hold of a type identifier map. A pointer to DwarfDebug is also added to DbgVariable in order to resolve the derived-from field. Debug info verifier is updated to check a derived-from field is a TypeRef. Verifier will not go across link for derived-from fields, in debug info finder, we go across the link to add derived-from fields to types. Function getDICompositeType is only used by dragonegg and since dragonegg does not generate identifier for types, we use an empty map to resolve the derived-from field. When printing a derived-from field, we use DITypeRef::getName to either return the type identifier or getName of the DIType. A paired commit at clang is required due to changes to DIBuilder. llvm-svn: 191800
OpenPOWER on IntegriCloud