[llvm] r207719 - Revert "Emit DW_AT_object_pointer once, on the declaration, for each function."

David Blaikie dblaikie at gmail.com
Wed Apr 30 16:10:54 PDT 2014


On Wed, Apr 30, 2014 at 3:58 PM, David Blaikie <dblaikie at gmail.com> wrote:
> Author: dblaikie
> Date: Wed Apr 30 17:58:19 2014
> New Revision: 207719
>
> URL: http://llvm.org/viewvc/llvm-project?rev=207719&view=rev
> Log:
> Revert "Emit DW_AT_object_pointer once, on the declaration, for each function."
>
> Breaks GDB buildbot
> (http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/14517)
>
> GCC emits DW_AT_object_pointer /everywhere/ (declaration, abstract
> definition, inlined subroutine), but it looks like GCC relies on it
> being somewhere other than the declaration, at least.

Checked again, GCC puts it on the declaration and (abstract or
concrete) definition, but not the inlined_subroutine. Clang (without
r207705) puts it on the abstract or concrete definition only, and with
r207705 puts it on the declaration only. Given GDB's expectation of
finding this on the definition I'm just going to leave it there for
now rather than duplicating it in both declaration and definition
since it appears GDB doesn't need it on the declaration and doesn't
take it from there for the definition.

Pity.

> I'll experiment
> further & can hopefully still remove it from the inlined_subroutine.
>
> This reverts commit r207705.
>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
>     llvm/trunk/test/DebugInfo/X86/DW_AT_object_pointer.ll
>     llvm/trunk/test/DebugInfo/X86/inline-member-function.ll
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=207719&r1=207718&r2=207719&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Apr 30 17:58:19 2014
> @@ -557,16 +557,11 @@ DIE *DwarfDebug::createScopeChildrenDIE(
>  }
>
>  void DwarfDebug::createAndAddScopeChildren(DwarfCompileUnit &TheCU,
> -                                           LexicalScope *Scope,
> -                                           DISubprogram Sub, DIE &ScopeDIE) {
> +                                           LexicalScope *Scope, DIE &ScopeDIE) {
>    // We create children when the scope DIE is not null.
>    SmallVector<std::unique_ptr<DIE>, 8> Children;
>    if (DIE *ObjectPointer = createScopeChildrenDIE(TheCU, Scope, Children))
> -    // The declaration will have the object_pointer, otherwise put it on the
> -    // definition. This happens with ObjC blocks that have object_pointer on
> -    // non-member functions.
> -    if (!Sub.getFunctionDeclaration())
> -      TheCU.addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer);
> +    TheCU.addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer);
>
>    // Add children
>    for (auto &I : Children)
> @@ -585,7 +580,7 @@ void DwarfDebug::constructAbstractSubpro
>
>    if (DIE *ScopeDIE = TheCU.getDIE(Sub)) {
>      AbstractSPDies.insert(std::make_pair(Sub, ScopeDIE));
> -    createAndAddScopeChildren(TheCU, Scope, Sub, *ScopeDIE);
> +    createAndAddScopeChildren(TheCU, Scope, *ScopeDIE);
>    }
>  }
>
> @@ -602,7 +597,7 @@ DIE &DwarfDebug::constructSubprogramScop
>
>    DIE &ScopeDIE = updateSubprogramScopeDIE(TheCU, Sub);
>
> -  createAndAddScopeChildren(TheCU, Scope, Sub, ScopeDIE);
> +  createAndAddScopeChildren(TheCU, Scope, ScopeDIE);
>
>    return ScopeDIE;
>  }
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=207719&r1=207718&r2=207719&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Apr 30 17:58:19 2014
> @@ -368,7 +368,7 @@ class DwarfDebug : public AsmPrinterHand
>    std::unique_ptr<DIE> constructScopeDIE(DwarfCompileUnit &TheCU,
>                                           LexicalScope *Scope);
>    void createAndAddScopeChildren(DwarfCompileUnit &TheCU, LexicalScope *Scope,
> -                                 DISubprogram Sub, DIE &ScopeDIE);
> +                                 DIE &ScopeDIE);
>    /// \brief Construct a DIE for this abstract scope.
>    void constructAbstractSubprogramScopeDIE(DwarfCompileUnit &TheCU,
>                                             LexicalScope *Scope);
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=207719&r1=207718&r2=207719&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Wed Apr 30 17:58:19 2014
> @@ -1164,8 +1164,7 @@ void DwarfUnit::constructTypeDIE(DIE &Bu
>  }
>
>  /// constructSubprogramArguments - Construct function argument DIEs.
> -DIE *DwarfUnit::constructSubprogramArguments(DIE &Buffer, DIArray Args) {
> -  DIE *ObjectPointer = nullptr;
> +void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DIArray Args) {
>    for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
>      DIDescriptor Ty = Args.getElement(i);
>      if (Ty.isUnspecifiedParameter()) {
> @@ -1176,11 +1175,8 @@ DIE *DwarfUnit::constructSubprogramArgum
>        addType(Arg, DIType(Ty));
>        if (DIType(Ty).isArtificial())
>          addFlag(Arg, dwarf::DW_AT_artificial);
> -      if (DIType(Ty).isObjectPointer())
> -        ObjectPointer = &Arg;
>      }
>    }
> -  return ObjectPointer;
>  }
>
>  /// constructTypeDIE - Construct type DIE from DICompositeType.
> @@ -1501,8 +1497,7 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE
>
>      // Add arguments. Do not add arguments for subprogram definition. They will
>      // be handled while processing variables.
> -    if (DIE *ObjectPointer = constructSubprogramArguments(SPDie, Args))
> -      addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, *ObjectPointer);
> +    constructSubprogramArguments(SPDie, Args);
>    }
>
>    if (SP.isArtificial())
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=207719&r1=207718&r2=207719&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Wed Apr 30 17:58:19 2014
> @@ -418,7 +418,7 @@ public:
>                                              AbstractOrInlined AbsIn = AOI_None);
>
>    /// constructSubprogramArguments - Construct function argument DIEs.
> -  DIE *constructSubprogramArguments(DIE &Buffer, DIArray Args);
> +  void constructSubprogramArguments(DIE &Buffer, DIArray Args);
>
>    /// Create a DIE with the given Tag, add the DIE to its parent, and
>    /// call insertDIE if MD is not null.
>
> Modified: llvm/trunk/test/DebugInfo/X86/DW_AT_object_pointer.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/DW_AT_object_pointer.ll?rev=207719&r1=207718&r2=207719&view=diff
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/X86/DW_AT_object_pointer.ll (original)
> +++ llvm/trunk/test/DebugInfo/X86/DW_AT_object_pointer.ll Wed Apr 30 17:58:19 2014
> @@ -1,28 +1,13 @@
>  ; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
>  ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
>
> -; Emit the DW_TAG_object_pointer on the declaration only, not the definition.
> -; This seems the most correct thing - the DW_TAG_object_pointer is inherited
> -; from the declaration to any (abstract or concrete) definitions and DWARF
> -; consumers can use this information for callers that can only see the
> -; declaration.
> -; That said, it isn't very space efficient - making member function
> -; declarations 11 bytes instead of 7 and I'm not sure which tools actually
> -; use this information here (ObjC Blocks are a different story & most likely
> -; require object_pointer) - perhaps we should omit it entirely for space.
> -; No overall space impact study has been performed.
> -
> -; CHECK: [[DEFINITION:0x[0-9a-f]*]]: DW_TAG_subprogram
> -; CHECK-NOT: DW_TAG
> -; CHECK-NOT: DW_TAG_object_pointer
> +; CHECK: DW_TAG_formal_parameter [
> +; CHECK-NOT: ""
>  ; CHECK: DW_TAG
> -
>  ; CHECK: DW_TAG_class_type
> -; CHECK-NOT: NULL
> -; CHECK: DW_TAG_subprogram
> -; CHECK-NEXT: DW_AT_name {{.*}} "A"
>  ; CHECK: DW_AT_object_pointer [DW_FORM_ref4]     (cu + 0x{{[0-9a-f]*}} => {[[PARAM:0x[0-9a-f]*]]})
>  ; CHECK: [[PARAM]]:     DW_TAG_formal_parameter
> +; CHECK-NEXT: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x{{[0-9a-f]*}}] = "this")
>
>  %class.A = type { i32 }
>
>
> Modified: llvm/trunk/test/DebugInfo/X86/inline-member-function.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/inline-member-function.ll?rev=207719&r1=207718&r2=207719&view=diff
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/X86/inline-member-function.ll (original)
> +++ llvm/trunk/test/DebugInfo/X86/inline-member-function.ll Wed Apr 30 17:58:19 2014
> @@ -22,20 +22,11 @@
>  ; CHECK-NOT: DW_AT_artificial
>  ; CHECK: DW_TAG
>
> -; But make sure we emit DW_AT_object_pointer on the declaration.
> -; CHECK: DW_TAG_structure_type
> -; CHECK-NEXT: DW_AT_name {{.*}} "foo"
> -; CHECK-NOT: NULL
> -; CHECK: [[DECLARATION:0x[0-9a-e]*]]: DW_TAG_subprogram
> -; CHECK-NOT: DW_TAG
> -; CHECK: DW_AT_object_pointer
> -
> -; But don't put it on the abstract definition, either.
> +; But make sure we emit DW_AT_object_pointer on the abstract definition.
>  ; CHECK: [[ABSTRACT_ORIGIN]]: DW_TAG_subprogram
> -; CHECK-NEXT: DW_AT_specification {{.*}}{[[DECLARATION]]}
>  ; CHECK-NOT: NULL
> -; CHECK-NOT: DW_AT_object_pointer
> -; CHECK: DW_TAG_formal_parameter
> +; CHECK-NOT: TAG
> +; CHECK: DW_AT_object_pointer
>
>  %struct.foo = type { i8 }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list