mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-11 21:38:19 +00:00
Address review comments for r202188.
This is refactoring / simplifying code, updating comments and enabling the testcase on non-x86 platforms. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202199 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -403,22 +403,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(DwarfCompileUnit *SPCU,
|
|||||||
DIArray Args = SPTy.getTypeArray();
|
DIArray Args = SPTy.getTypeArray();
|
||||||
uint16_t SPTag = SPTy.getTag();
|
uint16_t SPTag = SPTy.getTag();
|
||||||
if (SPTag == dwarf::DW_TAG_subroutine_type)
|
if (SPTag == dwarf::DW_TAG_subroutine_type)
|
||||||
// FIXME: Use DwarfUnit::constructSubprogramArguments() here.
|
SPCU->constructSubprogramArguments(*SPDie, Args);
|
||||||
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
|
|
||||||
DIType ATy(Args.getElement(i));
|
|
||||||
if (ATy.isUnspecifiedParameter()) {
|
|
||||||
assert(i == N-1 && "ellipsis must be the last argument");
|
|
||||||
SPCU->createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, *SPDie);
|
|
||||||
} else {
|
|
||||||
DIE *Arg =
|
|
||||||
SPCU->createAndAddDIE(dwarf::DW_TAG_formal_parameter, *SPDie);
|
|
||||||
SPCU->addType(Arg, ATy);
|
|
||||||
if (ATy.isArtificial())
|
|
||||||
SPCU->addFlag(Arg, dwarf::DW_AT_artificial);
|
|
||||||
if (ATy.isObjectPointer())
|
|
||||||
SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, Arg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DIE *SPDeclDie = SPDie;
|
DIE *SPDeclDie = SPDie;
|
||||||
SPDie = SPCU->createAndAddDIE(dwarf::DW_TAG_subprogram,
|
SPDie = SPCU->createAndAddDIE(dwarf::DW_TAG_subprogram,
|
||||||
*SPCU->getUnitDie());
|
*SPCU->getUnitDie());
|
||||||
@ -598,9 +583,8 @@ DIE *DwarfDebug::createScopeChildrenDIE(DwarfCompileUnit *TheCU,
|
|||||||
ObjectPointer = Arg;
|
ObjectPointer = Arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the unspecified parameter that marks a function as variadic.
|
// If this is a variadic function, add an unspecified parameter.
|
||||||
DISubprogram SP(Scope->getScopeNode());
|
DISubprogram SP(Scope->getScopeNode());
|
||||||
assert(SP.Verify());
|
|
||||||
DIArray FnArgs = SP.getType().getTypeArray();
|
DIArray FnArgs = SP.getType().getTypeArray();
|
||||||
if (FnArgs.getElement(FnArgs.getNumElements()-1).isUnspecifiedParameter()) {
|
if (FnArgs.getElement(FnArgs.getNumElements()-1).isUnspecifiedParameter()) {
|
||||||
DIE *Ellipsis = new DIE(dwarf::DW_TAG_unspecified_parameters);
|
DIE *Ellipsis = new DIE(dwarf::DW_TAG_unspecified_parameters);
|
||||||
|
@ -1141,18 +1141,18 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DIDerivedType DTy) {
|
|||||||
|
|
||||||
/// constructSubprogramArguments - Construct function argument DIEs.
|
/// constructSubprogramArguments - Construct function argument DIEs.
|
||||||
void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DIArray Args) {
|
void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DIArray Args) {
|
||||||
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
|
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
|
||||||
DIDescriptor Ty = Args.getElement(i);
|
DIDescriptor Ty = Args.getElement(i);
|
||||||
if (Ty.isUnspecifiedParameter()) {
|
if (Ty.isUnspecifiedParameter()) {
|
||||||
assert(i == N-1 && "ellipsis must be the last argument");
|
assert(i == N-1 && "Unspecified parameter must be the last argument");
|
||||||
createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, Buffer);
|
createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, Buffer);
|
||||||
} else {
|
} else {
|
||||||
DIE *Arg = createAndAddDIE(dwarf::DW_TAG_formal_parameter, Buffer);
|
DIE *Arg = createAndAddDIE(dwarf::DW_TAG_formal_parameter, Buffer);
|
||||||
addType(Arg, DIType(Ty));
|
addType(Arg, DIType(Ty));
|
||||||
if (DIType(Ty).isArtificial())
|
if (DIType(Ty).isArtificial())
|
||||||
addFlag(Arg, dwarf::DW_AT_artificial);
|
addFlag(Arg, dwarf::DW_AT_artificial);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// constructTypeDIE - Construct type DIE from DICompositeType.
|
/// constructTypeDIE - Construct type DIE from DICompositeType.
|
||||||
|
@ -452,6 +452,9 @@ public:
|
|||||||
/// constructVariableDIE - Construct a DIE for the given DbgVariable.
|
/// constructVariableDIE - Construct a DIE for the given DbgVariable.
|
||||||
DIE *constructVariableDIE(DbgVariable &DV, bool isScopeAbstract);
|
DIE *constructVariableDIE(DbgVariable &DV, bool isScopeAbstract);
|
||||||
|
|
||||||
|
/// constructSubprogramArguments - Construct function argument DIEs.
|
||||||
|
void constructSubprogramArguments(DIE &Buffer, DIArray Args);
|
||||||
|
|
||||||
/// Create a DIE with the given Tag, add the DIE to its parent, and
|
/// Create a DIE with the given Tag, add the DIE to its parent, and
|
||||||
/// call insertDIE if MD is not null.
|
/// call insertDIE if MD is not null.
|
||||||
DIE *createAndAddDIE(unsigned Tag, DIE &Parent,
|
DIE *createAndAddDIE(unsigned Tag, DIE &Parent,
|
||||||
@ -476,9 +479,6 @@ protected:
|
|||||||
DIE *getOrCreateStaticMemberDIE(DIDerivedType DT);
|
DIE *getOrCreateStaticMemberDIE(DIDerivedType DT);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// constructSubprogramArguments - Construct function argument DIEs.
|
|
||||||
void constructSubprogramArguments(DIE &Buffer, DIArray Args);
|
|
||||||
|
|
||||||
/// constructTypeDIE - Construct basic type die from DIBasicType.
|
/// constructTypeDIE - Construct basic type die from DIBasicType.
|
||||||
void constructTypeDIE(DIE &Buffer, DIBasicType BTy);
|
void constructTypeDIE(DIE &Buffer, DIBasicType BTy);
|
||||||
|
|
||||||
|
@ -1,18 +1,31 @@
|
|||||||
; RUN: llc -O0 -filetype=obj -o %t.o %s
|
; RUN: llc -O0 -filetype=obj -o %t.o %s
|
||||||
; RUN: llvm-dwarfdump -debug-dump=info %t.o | FileCheck %s
|
; RUN: llvm-dwarfdump -debug-dump=info %t.o | FileCheck %s
|
||||||
|
; REQUIRES: object-emission
|
||||||
|
;
|
||||||
|
; Test debug info for variadic function arguments.
|
||||||
|
; Created from tools/clang/tests/CodeGenCXX/debug-info-varargs.cpp
|
||||||
|
;
|
||||||
|
; The ... parameter of variadic should be emitted as
|
||||||
|
; DW_TAG_unspecified_parameters.
|
||||||
;
|
;
|
||||||
; Normal variadic function.
|
; Normal variadic function.
|
||||||
|
; void b(int c, ...);
|
||||||
;
|
;
|
||||||
; CHECK: DW_TAG_subprogram
|
; CHECK: DW_TAG_subprogram
|
||||||
; CHECK-NOT: DW_TAG
|
; CHECK-NOT: DW_TAG
|
||||||
|
; CHECK: DW_AT_name {{.*}} "b"
|
||||||
|
; CHECK-NOT: DW_TAG
|
||||||
; CHECK: DW_TAG_formal_parameter
|
; CHECK: DW_TAG_formal_parameter
|
||||||
; CHECK-NOT: DW_TAG
|
; CHECK-NOT: DW_TAG
|
||||||
; CHECK: DW_TAG_unspecified_parameters
|
; CHECK: DW_TAG_unspecified_parameters
|
||||||
;
|
;
|
||||||
; Variadic C++ member function.
|
; Variadic C++ member function.
|
||||||
|
; struct A { void a(int c, ...); }
|
||||||
;
|
;
|
||||||
; CHECK: DW_TAG_subprogram
|
; CHECK: DW_TAG_subprogram
|
||||||
; CHECK-NOT: DW_TAG
|
; CHECK-NOT: DW_TAG
|
||||||
|
; CHECK: DW_AT_name {{.*}} "a"
|
||||||
|
; CHECK-NOT: DW_TAG
|
||||||
; CHECK: DW_TAG_formal_parameter
|
; CHECK: DW_TAG_formal_parameter
|
||||||
; CHECK-NOT: DW_TAG
|
; CHECK-NOT: DW_TAG
|
||||||
; CHECK: DW_TAG_formal_parameter
|
; CHECK: DW_TAG_formal_parameter
|
||||||
@ -20,6 +33,7 @@
|
|||||||
; CHECK: DW_TAG_unspecified_parameters
|
; CHECK: DW_TAG_unspecified_parameters
|
||||||
;
|
;
|
||||||
; Variadic function pointer.
|
; Variadic function pointer.
|
||||||
|
; void (*fptr)(int, ...);
|
||||||
;
|
;
|
||||||
; CHECK: DW_TAG_subroutine_type
|
; CHECK: DW_TAG_subroutine_type
|
||||||
; CHECK-NOT: DW_TAG
|
; CHECK-NOT: DW_TAG
|
||||||
@ -27,12 +41,7 @@
|
|||||||
; CHECK-NOT: DW_TAG
|
; CHECK-NOT: DW_TAG
|
||||||
; CHECK: DW_TAG_unspecified_parameters
|
; CHECK: DW_TAG_unspecified_parameters
|
||||||
;
|
;
|
||||||
; Test debug info for variadic function arguments.
|
|
||||||
; Created from tools/clang/tests/CodeGenCXX/debug-info-varargs.cpp
|
|
||||||
;
|
|
||||||
; ModuleID = 'llvm/tools/clang/test/CodeGenCXX/debug-info-varargs.cpp'
|
; ModuleID = 'llvm/tools/clang/test/CodeGenCXX/debug-info-varargs.cpp'
|
||||||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
||||||
target triple = "x86_64-apple-macosx10.9.0"
|
|
||||||
|
|
||||||
%struct.A = type { i8 }
|
%struct.A = type { i8 }
|
||||||
|
|
Reference in New Issue
Block a user