From 5d7b7c96f461ea8c278be43c00ef014a7bdde7c1 Mon Sep 17 00:00:00 2001 From: Viktoria Maximova Date: Thu, 23 Mar 2023 09:20:23 -0700 Subject: [PATCH] [PATCH 28/79] [Backport to 15][DebugInfo] Align Instruction names to the specification (#1896) This patch fixes the discovered typos in Debug Instruction names, so we can generate spec-conformant SPIR-V module. https://registry.khronos.org/SPIR-V/specs/unified1/DebugInfo.html Gbp-Pq: Name 0028-Backport-to-15-DebugInfo-Align-Instruction-names-to-.patch --- lib/SPIRV/LLVMToSPIRVDbgTran.cpp | 18 +++--- lib/SPIRV/LLVMToSPIRVDbgTran.h | 2 +- lib/SPIRV/SPIRVToLLVMDbgTran.cpp | 57 ++++++++++--------- lib/SPIRV/SPIRVToLLVMDbgTran.h | 12 ++-- lib/SPIRV/libSPIRV/SPIRV.debug.h | 12 ++-- lib/SPIRV/libSPIRV/SPIRVExtInst.h | 16 +++--- test/DebugInfo/DebugFunction.cl | 6 +- .../DebugInfoSubrangeWithOnlyCount.spt | 4 +- .../DebugInfo/Generic/tu-member-opaque.spvasm | 2 +- test/DebugInfo/NonSemantic/DebugFunction.cl | 6 +- .../NonSemantic/Shader200/DIModule.ll | 2 +- .../Shader200/DebugInfoSubrange.ll | 4 +- .../Shader200/SourceLanguageLLVMToSPIRV.ll | 8 +-- test/DebugInfo/OpenCL100/DebugInfoSubrange.ll | 2 +- test/DebugInfo/SourceLanguageLLVMToSPIRV.ll | 4 +- 15 files changed, 79 insertions(+), 76 deletions(-) diff --git a/lib/SPIRV/LLVMToSPIRVDbgTran.cpp b/lib/SPIRV/LLVMToSPIRVDbgTran.cpp index a48be01..4d7caea 100644 --- a/lib/SPIRV/LLVMToSPIRVDbgTran.cpp +++ b/lib/SPIRV/LLVMToSPIRVDbgTran.cpp @@ -344,7 +344,7 @@ SPIRVEntry *LLVMToSPIRVDbgTran::transDbgEntryImpl(const MDNode *MDN) { // Compilation unit case dwarf::DW_TAG_compile_unit: - return transDbgCompilationUnit(cast(DIEntry)); + return transDbgCompileUnit(cast(DIEntry)); // Templates case dwarf::DW_TAG_template_type_parameter: @@ -539,8 +539,7 @@ SPIRVId LLVMToSPIRVDbgTran::getDebugInfoNoneId() { // Compilation unit -SPIRVEntry * -LLVMToSPIRVDbgTran::transDbgCompilationUnit(const DICompileUnit *CU) { +SPIRVEntry *LLVMToSPIRVDbgTran::transDbgCompileUnit(const DICompileUnit *CU) { using namespace SPIRVDebug::Operand::CompilationUnit; SPIRVWordVec Ops(OperandCount); Ops[SPIRVDebugInfoVersionIdx] = SPIRVDebug::DebugInfoVersion; @@ -977,7 +976,7 @@ SPIRVEntry *LLVMToSPIRVDbgTran::transDbgInheritance(const DIDerivedType *DT) { Ops[FlagsIdx] = transDebugFlags(DT); if (isNonSemanticDebugInfo()) transformToConstant(Ops, {FlagsIdx}); - return BM->addDebugInfo(SPIRVDebug::Inheritance, getVoidTy(), Ops); + return BM->addDebugInfo(SPIRVDebug::TypeInheritance, getVoidTy(), Ops); } SPIRVEntry *LLVMToSPIRVDbgTran::transDbgPtrToMember(const DIDerivedType *DT) { @@ -992,7 +991,7 @@ SPIRVEntry *LLVMToSPIRVDbgTran::transDbgPtrToMember(const DIDerivedType *DT) { SPIRVEntry * LLVMToSPIRVDbgTran::transDbgTemplateParams(DITemplateParameterArray TPA, const SPIRVEntry *Target) { - using namespace SPIRVDebug::Operand::Template; + using namespace SPIRVDebug::Operand::TypeTemplate; SPIRVWordVec Ops(MinOperandCount); Ops[TargetIdx] = Target->getId(); for (DITemplateParameter *TP : TPA) { @@ -1003,7 +1002,7 @@ LLVMToSPIRVDbgTran::transDbgTemplateParams(DITemplateParameterArray TPA, SPIRVEntry * LLVMToSPIRVDbgTran::transDbgTemplateParameter(const DITemplateParameter *TP) { - using namespace SPIRVDebug::Operand::TemplateParameter; + using namespace SPIRVDebug::Operand::TypeTemplateParameter; SPIRVWordVec Ops(OperandCount); Ops[NameIdx] = BM->getString(TP->getName().str())->getId(); Ops[TypeIdx] = transDbgEntry(TP->getType())->getId(); @@ -1023,7 +1022,7 @@ LLVMToSPIRVDbgTran::transDbgTemplateParameter(const DITemplateParameter *TP) { SPIRVEntry *LLVMToSPIRVDbgTran::transDbgTemplateTemplateParameter( const DITemplateValueParameter *TVP) { - using namespace SPIRVDebug::Operand::TemplateTemplateParameter; + using namespace SPIRVDebug::Operand::TypeTemplateTemplateParameter; SPIRVWordVec Ops(OperandCount); assert(isa(TVP->getValue())); MDString *Val = cast(TVP->getValue()); @@ -1040,7 +1039,7 @@ SPIRVEntry *LLVMToSPIRVDbgTran::transDbgTemplateTemplateParameter( SPIRVEntry *LLVMToSPIRVDbgTran::transDbgTemplateParameterPack( const DITemplateValueParameter *TVP) { - using namespace SPIRVDebug::Operand::TemplateParameterPack; + using namespace SPIRVDebug::Operand::TypeTemplateParameterPack; SPIRVWordVec Ops(MinOperandCount); assert(isa(TVP->getValue())); MDNode *Params = cast(TVP->getValue()); @@ -1120,7 +1119,8 @@ SPIRVEntry *LLVMToSPIRVDbgTran::transDbgFunction(const DISubprogram *Func) { SPIRVEntry *DebugFunc = nullptr; if (!Func->isDefinition()) { - DebugFunc = BM->addDebugInfo(SPIRVDebug::FunctionDecl, getVoidTy(), Ops); + DebugFunc = + BM->addDebugInfo(SPIRVDebug::FunctionDeclaration, getVoidTy(), Ops); } else { // Here we add operands specific function definition using namespace SPIRVDebug::Operand::Function; diff --git a/lib/SPIRV/LLVMToSPIRVDbgTran.h b/lib/SPIRV/LLVMToSPIRVDbgTran.h index c17a67d..9e5f711 100644 --- a/lib/SPIRV/LLVMToSPIRVDbgTran.h +++ b/lib/SPIRV/LLVMToSPIRVDbgTran.h @@ -99,7 +99,7 @@ private: SPIRVId getDebugInfoNoneId(); // Compilation unit - SPIRVEntry *transDbgCompilationUnit(const DICompileUnit *CU); + SPIRVEntry *transDbgCompileUnit(const DICompileUnit *CU); /// The following methods (till the end of the file) implement translation /// of debug instrtuctions described in the spec. diff --git a/lib/SPIRV/SPIRVToLLVMDbgTran.cpp b/lib/SPIRV/SPIRVToLLVMDbgTran.cpp index d798613..152683a 100644 --- a/lib/SPIRV/SPIRVToLLVMDbgTran.cpp +++ b/lib/SPIRV/SPIRVToLLVMDbgTran.cpp @@ -149,7 +149,7 @@ DIScope *SPIRVToLLVMDbgTran::getScope(const SPIRVEntry *ScopeInst) { } DICompileUnit * -SPIRVToLLVMDbgTran::transCompileUnit(const SPIRVExtInst *DebugInst) { +SPIRVToLLVMDbgTran::transCompilationUnit(const SPIRVExtInst *DebugInst) { const SPIRVWordVec &Ops = DebugInst->getArguments(); using namespace SPIRVDebug::Operand::CompilationUnit; @@ -337,8 +337,8 @@ SPIRVToLLVMDbgTran::transTypeArrayDynamic(const SPIRVExtInst *DebugInst) { DINodeArray SubscriptArray = Builder.getOrCreateArray(Subscripts); size_t Size = getDerivedSizeInBits(BaseTy) * TotalCount; - auto TransOperand = [&](SPIRVWord Idx) -> PointerUnion { + auto TransOperand = + [&](SPIRVWord Idx) -> PointerUnion { if (!getDbgInst(Ops[Idx])) { if (const auto *GV = getDbgInst(Ops[Idx])) return transDebugInst(GV); @@ -737,9 +737,10 @@ DINode *SPIRVToLLVMDbgTran::transFunction(const SPIRVExtInst *DebugInst) { // Here we create fake array of template parameters. If it was plain nullptr, // the template parameter operand would be removed in DISubprogram::getImpl. - // But we want it to be there, because if there is DebugTemplate instruction - // refering to this function, TransTemplate method must be able to replace the - // template parameter operand, thus it must be in the operands list. + // But we want it to be there, because if there is DebugTypeTemplate + // instruction refering to this function, transTypeTemplate method must be + // able to replace the template parameter operand, thus it must be in the + // operands list. SmallVector Elts; DINodeArray TParams = Builder.getOrCreateArray(Elts); llvm::DITemplateParameterArray TParamsArray = TParams.get(); @@ -816,9 +817,10 @@ DINode *SPIRVToLLVMDbgTran::transFunctionDecl(const SPIRVExtInst *DebugInst) { // Here we create fake array of template parameters. If it was plain nullptr, // the template parameter operand would be removed in DISubprogram::getImpl. - // But we want it to be there, because if there is DebugTemplate instruction - // refering to this function, TransTemplate method must be able to replace the - // template parameter operand, thus it must be in the operands list. + // But we want it to be there, because if there is DebugTypeTemplate + // instruction refering to this function, transTypeTemplate method must be + // able to replace the template parameter operand, thus it must be in the + // operands list. SmallVector Elts; DINodeArray TParams = Builder.getOrCreateArray(Elts); llvm::DITemplateParameterArray TParamsArray = TParams.get(); @@ -932,7 +934,8 @@ DINode *SPIRVToLLVMDbgTran::transTypedef(const SPIRVExtInst *DebugInst) { return Builder.createTypedef(Ty, Alias, File, LineNo, Scope); } -DINode *SPIRVToLLVMDbgTran::transInheritance(const SPIRVExtInst *DebugInst) { +DINode * +SPIRVToLLVMDbgTran::transTypeInheritance(const SPIRVExtInst *DebugInst) { using namespace SPIRVDebug::Operand::TypeInheritance; const SPIRVWordVec &Ops = DebugInst->getArguments(); assert(Ops.size() >= OperandCount && "Invalid number of operands"); @@ -953,8 +956,8 @@ DINode *SPIRVToLLVMDbgTran::transInheritance(const SPIRVExtInst *DebugInst) { } DINode * -SPIRVToLLVMDbgTran::transTemplateParameter(const SPIRVExtInst *DebugInst) { - using namespace SPIRVDebug::Operand::TemplateParameter; +SPIRVToLLVMDbgTran::transTypeTemplateParameter(const SPIRVExtInst *DebugInst) { + using namespace SPIRVDebug::Operand::TypeTemplateParameter; const SPIRVWordVec &Ops = DebugInst->getArguments(); assert(Ops.size() >= OperandCount && "Invalid number of operands"); StringRef Name = getString(Ops[NameIdx]); @@ -972,9 +975,9 @@ SPIRVToLLVMDbgTran::transTemplateParameter(const SPIRVExtInst *DebugInst) { return Builder.createTemplateTypeParameter(Context, Name, Ty, false); } -DINode *SPIRVToLLVMDbgTran::transTemplateTemplateParameter( +DINode *SPIRVToLLVMDbgTran::transTypeTemplateTemplateParameter( const SPIRVExtInst *DebugInst) { - using namespace SPIRVDebug::Operand::TemplateTemplateParameter; + using namespace SPIRVDebug::Operand::TypeTemplateTemplateParameter; const SPIRVWordVec &Ops = DebugInst->getArguments(); assert(Ops.size() >= OperandCount && "Invalid number of operands"); StringRef Name = getString(Ops[NameIdx]); @@ -984,9 +987,9 @@ DINode *SPIRVToLLVMDbgTran::transTemplateTemplateParameter( TemplName); } -DINode * -SPIRVToLLVMDbgTran::transTemplateParameterPack(const SPIRVExtInst *DebugInst) { - using namespace SPIRVDebug::Operand::TemplateParameterPack; +DINode *SPIRVToLLVMDbgTran::transTypeTemplateParameterPack( + const SPIRVExtInst *DebugInst) { + using namespace SPIRVDebug::Operand::TypeTemplateParameterPack; const SPIRVWordVec &Ops = DebugInst->getArguments(); assert(Ops.size() >= MinOperandCount && "Invalid number of operands"); StringRef Name = getString(Ops[NameIdx]); @@ -999,8 +1002,8 @@ SPIRVToLLVMDbgTran::transTemplateParameterPack(const SPIRVExtInst *DebugInst) { return Builder.createTemplateParameterPack(Context, Name, nullptr, Pack); } -MDNode *SPIRVToLLVMDbgTran::transTemplate(const SPIRVExtInst *DebugInst) { - using namespace SPIRVDebug::Operand::Template; +MDNode *SPIRVToLLVMDbgTran::transTypeTemplate(const SPIRVExtInst *DebugInst) { + using namespace SPIRVDebug::Operand::TypeTemplate; const SPIRVWordVec &Ops = DebugInst->getArguments(); const size_t NumOps = Ops.size(); assert(NumOps >= MinOperandCount && "Invalid number of operands"); @@ -1104,7 +1107,7 @@ MDNode *SPIRVToLLVMDbgTran::transDebugInstImpl(const SPIRVExtInst *DebugInst) { return nullptr; case SPIRVDebug::CompilationUnit: - return transCompileUnit(DebugInst); + return transCompilationUnit(DebugInst); case SPIRVDebug::TypeBasic: return transTypeBasic(DebugInst); @@ -1151,7 +1154,7 @@ MDNode *SPIRVToLLVMDbgTran::transDebugInstImpl(const SPIRVExtInst *DebugInst) { case SPIRVDebug::Function: return transFunction(DebugInst); - case SPIRVDebug::FunctionDecl: + case SPIRVDebug::FunctionDeclaration: return transFunctionDecl(DebugInst); case SPIRVDebug::GlobalVariable: @@ -1166,20 +1169,20 @@ MDNode *SPIRVToLLVMDbgTran::transDebugInstImpl(const SPIRVExtInst *DebugInst) { case SPIRVDebug::InlinedAt: return transDebugInlined(DebugInst); - case SPIRVDebug::Inheritance: - return transInheritance(DebugInst); + case SPIRVDebug::TypeInheritance: + return transTypeInheritance(DebugInst); case SPIRVDebug::TypeTemplateParameter: - return transTemplateParameter(DebugInst); + return transTypeTemplateParameter(DebugInst); case SPIRVDebug::TypeTemplateTemplateParameter: - return transTemplateTemplateParameter(DebugInst); + return transTypeTemplateTemplateParameter(DebugInst); case SPIRVDebug::TypeTemplateParameterPack: - return transTemplateParameterPack(DebugInst); + return transTypeTemplateParameterPack(DebugInst); case SPIRVDebug::TypeTemplate: - return transTemplate(DebugInst); + return transTypeTemplate(DebugInst); case SPIRVDebug::ImportedEntity: return transImportedEntry(DebugInst); diff --git a/lib/SPIRV/SPIRVToLLVMDbgTran.h b/lib/SPIRV/SPIRVToLLVMDbgTran.h index 28a42d3..2102f21 100644 --- a/lib/SPIRV/SPIRVToLLVMDbgTran.h +++ b/lib/SPIRV/SPIRVToLLVMDbgTran.h @@ -102,7 +102,7 @@ private: MDNode *transDebugInlined(const SPIRVExtInst *Inst); - DICompileUnit *transCompileUnit(const SPIRVExtInst *DebugInst); + DICompileUnit *transCompilationUnit(const SPIRVExtInst *DebugInst); DIBasicType *transTypeBasic(const SPIRVExtInst *DebugInst); @@ -127,11 +127,11 @@ private: DINode *transTypeEnum(const SPIRVExtInst *DebugInst); - DINode *transTemplateParameter(const SPIRVExtInst *DebugInst); - DINode *transTemplateTemplateParameter(const SPIRVExtInst *DebugInst); - DINode *transTemplateParameterPack(const SPIRVExtInst *DebugInst); + DINode *transTypeTemplateParameter(const SPIRVExtInst *DebugInst); + DINode *transTypeTemplateTemplateParameter(const SPIRVExtInst *DebugInst); + DINode *transTypeTemplateParameterPack(const SPIRVExtInst *DebugInst); - MDNode *transTemplate(const SPIRVExtInst *DebugInst); + MDNode *transTypeTemplate(const SPIRVExtInst *DebugInst); DINode *transTypeFunction(const SPIRVExtInst *DebugInst); @@ -150,7 +150,7 @@ private: DINode *transTypedef(const SPIRVExtInst *DebugInst); - DINode *transInheritance(const SPIRVExtInst *DebugInst); + DINode *transTypeInheritance(const SPIRVExtInst *DebugInst); DINode *transImportedEntry(const SPIRVExtInst *DebugInst); diff --git a/lib/SPIRV/libSPIRV/SPIRV.debug.h b/lib/SPIRV/libSPIRV/SPIRV.debug.h index dfe2535..3454d7c 100644 --- a/lib/SPIRV/libSPIRV/SPIRV.debug.h +++ b/lib/SPIRV/libSPIRV/SPIRV.debug.h @@ -26,14 +26,14 @@ enum Instruction { TypeEnum = 9, TypeComposite = 10, TypeMember = 11, - Inheritance = 12, + TypeInheritance = 12, TypePtrToMember = 13, TypeTemplate = 14, TypeTemplateParameter = 15, TypeTemplateParameterPack = 16, TypeTemplateTemplateParameter = 17, GlobalVariable = 18, - FunctionDecl = 19, + FunctionDeclaration = 19, Function = 20, LexicalBlock = 21, LexicalBlockDiscriminator = 22, @@ -456,7 +456,7 @@ enum { }; } -namespace Template { +namespace TypeTemplate { enum { TargetIdx = 0, FirstParameterIdx = 1, @@ -464,7 +464,7 @@ enum { }; } -namespace TemplateParameter { +namespace TypeTemplateParameter { enum { NameIdx = 0, TypeIdx = 1, @@ -476,7 +476,7 @@ enum { }; } -namespace TemplateTemplateParameter { +namespace TypeTemplateTemplateParameter { enum { NameIdx = 0, TemplateNameIdx = 1, @@ -487,7 +487,7 @@ enum { }; } -namespace TemplateParameterPack { +namespace TypeTemplateParameterPack { enum { NameIdx = 0, SourceIdx = 1, diff --git a/lib/SPIRV/libSPIRV/SPIRVExtInst.h b/lib/SPIRV/libSPIRV/SPIRVExtInst.h index 2085db6..f9d5543 100644 --- a/lib/SPIRV/libSPIRV/SPIRVExtInst.h +++ b/lib/SPIRV/libSPIRV/SPIRVExtInst.h @@ -221,7 +221,7 @@ SPIRV_DEF_NAMEMAP(OCLExtOpKind, OCLExtOpMap) typedef SPIRVDebug::Instruction SPIRVDebugExtOpKind; template <> inline void SPIRVMap::init() { add(SPIRVDebug::DebugInfoNone, "DebugInfoNone"); - add(SPIRVDebug::CompilationUnit, "DebugCompileUnit"); + add(SPIRVDebug::CompilationUnit, "DebugCompilationUnit"); add(SPIRVDebug::Source, "DebugSource"); add(SPIRVDebug::TypeBasic, "DebugTypeBasic"); add(SPIRVDebug::TypePointer, "DebugTypePointer"); @@ -234,19 +234,19 @@ template <> inline void SPIRVMap::init() { add(SPIRVDebug::TypeMember, "DebugTypeMember"); add(SPIRVDebug::TypeEnum, "DebugTypeEnum"); add(SPIRVDebug::Typedef, "DebugTypedef"); - add(SPIRVDebug::TypeTemplateParameter, "DebugTemplateParameter"); - add(SPIRVDebug::TypeTemplateParameterPack, "DebugTemplateParameterPack"); + add(SPIRVDebug::TypeTemplateParameter, "DebugTypeTemplateParameter"); + add(SPIRVDebug::TypeTemplateParameterPack, "DebugTypeTemplateParameterPack"); add(SPIRVDebug::TypeTemplateTemplateParameter, - "DebugTemplateTemplateParameter"); - add(SPIRVDebug::TypeTemplate, "DebugTemplate"); + "DebugTypeTemplateTemplateParameter"); + add(SPIRVDebug::TypeTemplate, "DebugTypeTemplate"); add(SPIRVDebug::TypePtrToMember, "DebugTypePtrToMember,"); add(SPIRVDebug::TypeSubrange, "DebugTypeSubrange"); add(SPIRVDebug::TypeString, "DebugTypeString"); - add(SPIRVDebug::Inheritance, "DebugInheritance"); + add(SPIRVDebug::TypeInheritance, "DebugTypeInheritance"); add(SPIRVDebug::Function, "DebugFunction"); - add(SPIRVDebug::FunctionDecl, "DebugFunctionDecl"); + add(SPIRVDebug::FunctionDeclaration, "DebugFunctionDeclaration"); add(SPIRVDebug::LexicalBlock, "DebugLexicalBlock"); - add(SPIRVDebug::LexicalBlockDiscriminator, "LexicalBlockDiscriminator"); + add(SPIRVDebug::LexicalBlockDiscriminator, "DebugLexicalBlockDiscriminator"); add(SPIRVDebug::LocalVariable, "DebugLocalVariable"); add(SPIRVDebug::InlinedVariable, "DebugInlinedVariable"); add(SPIRVDebug::GlobalVariable, "DebugGlobalVariable"); diff --git a/test/DebugInfo/DebugFunction.cl b/test/DebugInfo/DebugFunction.cl index a587b93..c7e5899 100644 --- a/test/DebugInfo/DebugFunction.cl +++ b/test/DebugInfo/DebugFunction.cl @@ -1,8 +1,8 @@ // Check for 2 things: // - After round trip translation function definition has !dbg metadata attached // specifically if -gline-tables-only was used for Clang -// - Parent operand of DebugFunction is DebugCompileUnit, not an OpString, even -// if in LLVM IR it points to a DIFile instead of DICompileUnit. +// - Parent operand of DebugFunction is DebugCompilationUnit, not an OpString, +// even if in LLVM IR it points to a DIFile instead of DICompileUnit. // RUN: %clang_cc1 %s -cl-std=clc++ -emit-llvm-bc -triple spir -debug-info-kind=line-tables-only -O0 -o - -no-opaque-pointers | llvm-spirv -o %t.spv // RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV @@ -17,7 +17,7 @@ void kernel k() { // CHECK-SPIRV: String [[foo:[0-9]+]] "foo" // CHECK-SPIRV: String [[k:[0-9]+]] "k" -// CHECK-SPIRV: [[CU:[0-9]+]] {{[0-9]+}} DebugCompileUnit +// CHECK-SPIRV: [[CU:[0-9]+]] {{[0-9]+}} DebugCompilationUnit // CHECK-SPIRV: DebugFunction [[foo]] {{.*}} [[CU]] {{.*}} [[foo_id:[0-9]+]] {{[0-9]+}} {{$}} // CHECK-SPIRV: DebugFunction [[k]] {{.*}} [[CU]] {{.*}} [[k_id:[0-9]+]] {{[0-9]+}} {{$}} diff --git a/test/DebugInfo/DebugInfoSubrangeWithOnlyCount.spt b/test/DebugInfo/DebugInfoSubrangeWithOnlyCount.spt index 28f9051..67d2a51 100644 --- a/test/DebugInfo/DebugInfoSubrangeWithOnlyCount.spt +++ b/test/DebugInfo/DebugInfoSubrangeWithOnlyCount.spt @@ -56,14 +56,14 @@ 5 ExtInst 3 27 2 DebugInfoNone 7 ExtInst 3 30 2 DebugSource 29 27 -9 ExtInst 3 31 2 DebugCompileUnit 65536 4 30 21 +9 ExtInst 3 31 2 DebugCompilationUnit 65536 4 30 21 7 ExtInst 3 32 2 DebugTypeFunction 0 27 8 ExtInst 3 35 2 DebugTypeBasic 33 34 3 7 ExtInst 3 36 2 DebugTypeArray 35 11 ; Count = 1000 8 ExtInst 3 37 2 DebugTypePointer 36 4294967295 0 16 ExtInst 3 40 2 DebugFunction 38 32 30 25 0 31 39 44 25 27 27 12 ExtInst 3 42 2 DebugLocalVariable 41 37 30 15 0 40 0 -6 ExtInst 3 43 2 DebugTemplate 40 +6 ExtInst 3 43 2 DebugTypeTemplate 40 6 ExtInst 3 44 2 DebugOperation 0 6 ExtInst 3 45 2 DebugExpression 44 diff --git a/test/DebugInfo/Generic/tu-member-opaque.spvasm b/test/DebugInfo/Generic/tu-member-opaque.spvasm index 135afcb..bebeb67 100644 --- a/test/DebugInfo/Generic/tu-member-opaque.spvasm +++ b/test/DebugInfo/Generic/tu-member-opaque.spvasm @@ -52,7 +52,7 @@ 5 ExtInst 3 7 2 DebugInfoNone 7 ExtInst 3 10 2 DebugSource 9 7 -9 ExtInst 3 11 2 DebugCompileUnit 65536 0 10 12 +9 ExtInst 3 11 2 DebugCompilationUnit 65536 0 10 12 7 ExtInst 3 12 2 DebugTypeFunction 0 7 7 ExtInst 3 16 2 DebugSource 15 7 8 ExtInst 3 21 2 DebugTypeBasic 20 18 4 diff --git a/test/DebugInfo/NonSemantic/DebugFunction.cl b/test/DebugInfo/NonSemantic/DebugFunction.cl index c913fc0..da27864 100644 --- a/test/DebugInfo/NonSemantic/DebugFunction.cl +++ b/test/DebugInfo/NonSemantic/DebugFunction.cl @@ -1,8 +1,8 @@ // Check for 2 things: // - After round trip translation function definition has !dbg metadata attached // specifically if -gline-tables-only was used for Clang -// - Parent operand of DebugFunction is DebugCompileUnit, not an OpString, even -// if in LLVM IR it points to a DIFile instead of DICompileUnit. +// - Parent operand of DebugFunction is DebugCompilationUnit, not an OpString, +// even if in LLVM IR it points to a DIFile instead of DICompileUnit. // RUN: %clang_cc1 %s -cl-std=clc++ -emit-llvm-bc -triple spir -debug-info-kind=line-tables-only -O0 -o - | llvm-spirv -o %t.spv // RUN: llvm-spirv %t.spv --spirv-debug-info-version=nonsemantic-shader-100 -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV @@ -17,7 +17,7 @@ void kernel k() { // CHECK-SPIRV: String [[foo:[0-9]+]] "foo" // CHECK-SPIRV: String [[k:[0-9]+]] "k" -// CHECK-SPIRV: [[CU:[0-9]+]] {{[0-9]+}} DebugCompileUnit +// CHECK-SPIRV: [[CU:[0-9]+]] {{[0-9]+}} DebugCompilationUnit // CHECK-SPIRV: DebugFunction [[foo]] {{.*}} [[CU]] {{.*}} [[foo_id:[0-9]+]] {{[0-9]+}} {{$}} // CHECK-SPIRV: DebugFunction [[k]] {{.*}} [[CU]] {{.*}} [[k_id:[0-9]+]] {{[0-9]+}} {{$}} diff --git a/test/DebugInfo/NonSemantic/Shader200/DIModule.ll b/test/DebugInfo/NonSemantic/Shader200/DIModule.ll index 8347d01..fb83dfc 100644 --- a/test/DebugInfo/NonSemantic/Shader200/DIModule.ll +++ b/test/DebugInfo/NonSemantic/Shader200/DIModule.ll @@ -34,7 +34,7 @@ target triple = "spir64-unknown-unknown" ; CHECK-SPIRV-DAG: Constant [[#TypeInt32]] [[#DWARF:]] 4 ; CHECK-SPIRV: ExtInst [[#]] [[#Source:]] [[#]] DebugSource [[#FileName]] -; CHECK-SPIRV: ExtInst [[#]] [[#Parent:]] [[#]] DebugCompileUnit [[#Version]] [[#DWARF]] +; CHECK-SPIRV: ExtInst [[#]] [[#Parent:]] [[#]] DebugCompilationUnit [[#Version]] [[#DWARF]] ; CHECK-SPIRV: ExtInst [[#]] [[#SourceEmpty:]] [[#]] DebugSource [[#EmptyStr]] ; CHECK-SPIRV: ExtInst [[#]] [[#Module:]] [[#]] DebugModule [[#Name]] [[#SourceEmpty]] [[#Constant0]] [[#Parent]] [[#Defines]] [[#IncludePath]] [[#ApiNotes]] [[#Constant0]] ; CHECK-SPIRV: ExtInst [[#]] [[#]] [[#]] DebugImportedEntity [[#]] [[#]] [[#]] [[#Source]] [[#Module]] diff --git a/test/DebugInfo/NonSemantic/Shader200/DebugInfoSubrange.ll b/test/DebugInfo/NonSemantic/Shader200/DebugInfoSubrange.ll index 23a729f..d83e170 100644 --- a/test/DebugInfo/NonSemantic/Shader200/DebugInfoSubrange.ll +++ b/test/DebugInfo/NonSemantic/Shader200/DebugInfoSubrange.ll @@ -16,8 +16,8 @@ ; CHECK-SPIRV: [[#DINoneId:]] [[#EISId]] DebugInfoNone ; CHECK-SPIRV: [[#DebugFuncId:]] [[#EISId]] DebugFunction -; CHECK-SPIRV: [[#DebugTemplate:]] [[#EISId]] DebugTemplate [[#DebugFuncId]] -; CHECK-SPIRV: [[#LocalVarId:]] [[#EISId]] DebugLocalVariable [[#LocalVarNameId]] [[#]] [[#]] [[#]] [[#]] [[#DebugTemplate]] +; CHECK-SPIRV: [[#DebugTypeTemplate:]] [[#EISId]] DebugTypeTemplate [[#DebugFuncId]] +; CHECK-SPIRV: [[#LocalVarId:]] [[#EISId]] DebugLocalVariable [[#LocalVarNameId]] [[#]] [[#]] [[#]] [[#]] [[#DebugTypeTemplate]] ; CHECK-SPIRV: [[#EISId]] DebugTypeSubrange [[#DINoneId]] [[#Constant1Id]] [[#LocalVarId]] [[#DINoneId]] ; CHECK-SPIRV: [[#DIExprId:]] [[#EISId]] DebugExpression diff --git a/test/DebugInfo/NonSemantic/Shader200/SourceLanguageLLVMToSPIRV.ll b/test/DebugInfo/NonSemantic/Shader200/SourceLanguageLLVMToSPIRV.ll index c1b3d8c..e27e0f7 100644 --- a/test/DebugInfo/NonSemantic/Shader200/SourceLanguageLLVMToSPIRV.ll +++ b/test/DebugInfo/NonSemantic/Shader200/SourceLanguageLLVMToSPIRV.ll @@ -14,13 +14,13 @@ ; RUN: llvm-spirv --spirv-debug-info-version=nonsemantic-shader-200 -spirv-text %t.bc -o - | FileCheck %s --check-prefix=CHECK-CPP14 ; CHECK-C99: Constant [[#]] [[#Constant:]] 211 -; CHECK-C99: DebugCompileUnit [[#]] [[#]] [[#]] [[#Constant]] +; CHECK-C99: DebugCompilationUnit [[#]] [[#]] [[#]] [[#Constant]] ; CHECK-OPENCLC: Constant [[#]] [[#Constant:]] 3 -; CHECK-OPENCLC: DebugCompileUnit [[#]] [[#]] [[#]] [[#Constant]] +; CHECK-OPENCLC: DebugCompilationUnit [[#]] [[#]] [[#]] [[#Constant]] ; CHECK-CPP: Constant [[#]] [[#Constant:]] 214 -; CHECK-CPP: DebugCompileUnit [[#]] [[#]] [[#]] [[#Constant]] +; CHECK-CPP: DebugCompilationUnit [[#]] [[#]] [[#]] [[#Constant]] ; CHECK-CPP14: Constant [[#]] [[#Constant:]] 217 -; CHECK-CPP14: DebugCompileUnit [[#]] [[#]] [[#]] [[#Constant]] +; CHECK-CPP14: DebugCompilationUnit [[#]] [[#]] [[#]] [[#Constant]] target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" target triple = "spir64-unknown-unknown" diff --git a/test/DebugInfo/OpenCL100/DebugInfoSubrange.ll b/test/DebugInfo/OpenCL100/DebugInfoSubrange.ll index 27c8108..fcc1148 100644 --- a/test/DebugInfo/OpenCL100/DebugInfoSubrange.ll +++ b/test/DebugInfo/OpenCL100/DebugInfoSubrange.ll @@ -14,7 +14,7 @@ ; CHECK-SPIRV: Constant [[#TypeInt64Id]] [[#NegativeCount:]] 4294967295 4294967295 ; CHECK-SPIRV: [[#DbgFuncId:]] [[#]] DebugFunction [[#FuncNameId]] -; CHECK-SPIRV: [[#DbgTemplateId:]] [[#]] DebugTemplate [[#DbgFuncId]] +; CHECK-SPIRV: [[#DbgTemplateId:]] [[#]] DebugTypeTemplate [[#DbgFuncId]] ; CHECK-SPIRV: [[#]] [[#DbgLocVarId:]] [[#]] DebugLocalVariable [[#VarNameId]] [[#]] [[#]] [[#]] [[#]] [[#DbgTemplateId]] ; CHECK-SPIRV: DebugTypeArray [[#]] [[#DbgLocVarId]] [[#LowerBoundId]] diff --git a/test/DebugInfo/SourceLanguageLLVMToSPIRV.ll b/test/DebugInfo/SourceLanguageLLVMToSPIRV.ll index f6c381c..51b4376 100644 --- a/test/DebugInfo/SourceLanguageLLVMToSPIRV.ll +++ b/test/DebugInfo/SourceLanguageLLVMToSPIRV.ll @@ -39,5 +39,5 @@ entry: !7 = distinct !DISubprogram(name: "func", scope: !8, file: !8, line: 1, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) !8 = !DIFile(filename: "test.cl", directory: "/tmp", checksumkind: CSK_MD5, checksum: "18aa9ce738eaafc7b7b7181c19092815") -; CHECK-OPENCLC: DebugCompileUnit {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} 3 -; CHECK-CPP4OPENCL: DebugCompileUnit {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} 6 +; CHECK-OPENCLC: DebugCompilationUnit {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} 3 +; CHECK-CPP4OPENCL: DebugCompilationUnit {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} 6 -- 2.30.2