-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[SPIRV] Addition of extension SPV_KHR_non_semantic_info and SPV_KHR_relaxed_extended_instruction #165302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[SPIRV] Addition of extension SPV_KHR_non_semantic_info and SPV_KHR_relaxed_extended_instruction #165302
Changes from 1 commit
2f0079c
0b9225e
1155965
7459b9f
05a244a
e2413dd
ed929f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -196,9 +196,9 @@ struct SPIRVEmitNonSemanticDI : public MachineFunctionPass { | |
| SPIRVCodeGenContext &Ctx, | ||
| const DenseMap<StringRef, Register> &MacroDefRegs); | ||
|
|
||
| void emitDebugTypeEnum( | ||
| const SmallPtrSetImpl<const DICompositeType *> &EnumTypes, | ||
| SPIRVCodeGenContext &Ctx); | ||
| void | ||
| emitDebugTypeEnum(const SmallPtrSetImpl<const DICompositeType *> &EnumTypes, | ||
| SPIRVCodeGenContext &Ctx); | ||
|
|
||
| void emitDebugQualifiedTypes( | ||
| const SmallPtrSetImpl<DIDerivedType *> &QualifiedDerivedTypes, | ||
|
|
@@ -618,17 +618,8 @@ void SPIRVEmitNonSemanticDI::emitDebugTypeEnum( | |
| bool UnderlyingTypeIsFwd = false; | ||
| Register UnderlyingTypeReg = findBaseTypeRegisterRecursive( | ||
| EnumTy->getBaseType(), Ctx, UnderlyingTypeIsFwd); | ||
| if (!UnderlyingTypeReg.isValid()) { | ||
| UnderlyingTypeReg = EmitDIInstruction( | ||
| SPIRV::NonSemanticExtInst::DebugInfoNone, {}, Ctx, false); | ||
| UnderlyingTypeIsFwd = false; | ||
| } | ||
| Register SourceReg = | ||
| findRegisterFromMap(EnumTy->getFile(), Ctx.SourceRegPairs); | ||
| if (!SourceReg.isValid()) { | ||
| SourceReg = EmitDIInstruction(SPIRV::NonSemanticExtInst::DebugInfoNone, | ||
| {}, Ctx, false); | ||
| } | ||
| Register Line = Ctx.GR->buildConstantInt(EnumTy->getLine(), Ctx.MIRBuilder, | ||
| Ctx.I32Ty, false); | ||
| Register Column = | ||
|
|
@@ -639,10 +630,6 @@ void SPIRVEmitNonSemanticDI::emitDebugTypeEnum( | |
| llvm::errs() << "Warning: Could not find Parent scope register for Enum: " | ||
| << EnumTy->getName() << "\n"; | ||
| ParentReg = Ctx.GR->getDebugValue(EnumTy->getFile()); | ||
| if (!ParentReg.isValid()) { | ||
| ParentReg = EmitDIInstruction(SPIRV::NonSemanticExtInst::DebugInfoNone, | ||
| {}, Ctx, false); | ||
| } | ||
| } | ||
| Register Size = Ctx.GR->buildConstantInt(EnumTy->getSizeInBits(), | ||
| Ctx.MIRBuilder, Ctx.I32Ty, false); | ||
|
|
@@ -904,12 +891,12 @@ void SPIRVEmitNonSemanticDI::emitDebugPointerTypes( | |
| Ctx.I32Ty, false, false); | ||
|
|
||
| const DIType *BaseTy = PointerDerivedType->getBaseType(); | ||
| bool HasForwardRef = false; | ||
| bool HasForwardRef = false; | ||
| Register BaseTypeReg = | ||
| findBaseTypeRegisterRecursive(BaseTy, Ctx, HasForwardRef); | ||
|
|
||
| if (!BaseTypeReg.isValid()) { | ||
| llvm::errs() << "Warning: Failed to find or create placeholder for base " | ||
| llvm::errs() << "Warning: Failed to find or create placeholder for base" | ||
| "type of pointer.\n"; | ||
| BaseTypeReg = EmitDIInstruction(SPIRV::NonSemanticExtInst::DebugInfoNone, | ||
| {}, Ctx, false); | ||
|
|
@@ -1102,14 +1089,6 @@ void SPIRVEmitNonSemanticDI::emitDebugQualifiedTypes( | |
| Register BaseTypeReg = findBaseTypeRegisterRecursive( | ||
| QualifiedDT->getBaseType(), Ctx, IsForwardRef); | ||
|
|
||
| if (!BaseTypeReg.isValid()) { | ||
| llvm::errs() | ||
| << "Warning: Could not find base type for DebugTypeQualifier.\n"; | ||
| BaseTypeReg = EmitDIInstruction( | ||
| SPIRV::NonSemanticExtInst::DebugInfoNone, {}, Ctx, false); | ||
| IsForwardRef = false; | ||
| } | ||
|
|
||
| const uint32_t QualifierValue = | ||
| mapTagToQualifierEncoding(QualifiedDT->getTag()); | ||
| const Register QualifierConstReg = Ctx.GR->buildConstantInt( | ||
|
|
@@ -1134,14 +1113,6 @@ void SPIRVEmitNonSemanticDI::emitDebugTypedefs( | |
| Register BaseTypeReg = findBaseTypeRegisterRecursive( | ||
| TypedefDT->getBaseType(), Ctx, HasForwardRef); | ||
|
|
||
| if (!BaseTypeReg.isValid()) { | ||
| llvm::errs() << "Warning: Could not find base type for Typedef: " | ||
| << TypedefDT->getName() << "\n"; | ||
| BaseTypeReg = EmitDIInstruction(SPIRV::NonSemanticExtInst::DebugInfoNone, | ||
| {}, Ctx, false); | ||
| HasForwardRef = false; | ||
| } | ||
|
|
||
| Register DefReg = Ctx.GR->getDebugValue(TypedefDT); | ||
|
|
||
| Register DebugSourceReg = | ||
|
|
@@ -1173,8 +1144,14 @@ void SPIRVEmitNonSemanticDI::emitDebugImportedEntities( | |
| findRegisterFromMap(Imported->getFile(), Ctx.SourceRegPairs); | ||
| // TODO: Handle Entity as there are no current instructions for DINamespace, | ||
| // so replaced by DebugInfoNone | ||
| const Register EntityReg = EmitDIInstruction( | ||
| SPIRV::NonSemanticExtInst::DebugInfoNone, {}, Ctx, false); | ||
| const DINode *Entity = Imported->getEntity(); | ||
| bool HasForwardRef = false; | ||
| Register EntityReg; | ||
| if (auto *Ty = dyn_cast<DIType>(Entity)) | ||
| EntityReg = findBaseTypeRegisterRecursive(Ty, Ctx, HasForwardRef); | ||
| else | ||
| EntityReg = EmitDIInstruction(SPIRV::NonSemanticExtInst::DebugInfoNone, | ||
| {}, Ctx, false); | ||
| const Register LineReg = Ctx.GR->buildConstantInt( | ||
| Imported->getLine(), Ctx.MIRBuilder, Ctx.I32Ty, false, false); | ||
| const Register ColumnReg = | ||
|
|
@@ -1234,30 +1211,11 @@ Register SPIRVEmitNonSemanticDI::emitDebugGlobalVariable( | |
| const DIType *Ty = DIGV->getType(); | ||
| bool HasForwardRef = false; | ||
| Register TypeReg = findBaseTypeRegisterRecursive(Ty, Ctx, HasForwardRef); | ||
|
|
||
| if (!TypeReg.isValid()) { | ||
| llvm::errs() << "Warning: Could not find type for Global Variable: " << Name | ||
| << "\n"; | ||
| TypeReg = EmitDIInstruction(SPIRV::NonSemanticExtInst::DebugInfoNone, {}, | ||
| Ctx, false); | ||
| HasForwardRef = false; | ||
| } | ||
|
|
||
| Register DebugSourceReg = | ||
| findRegisterFromMap(DIGV->getFile(), Ctx.SourceRegPairs); | ||
| Register ParentReg; | ||
| if (ParentScope) { | ||
| ParentReg = Ctx.GR->getDebugValue(ParentScope); | ||
| if (!ParentReg.isValid()) { | ||
| llvm::errs() << "Warning: Could not find parent scope register for " | ||
| "Global Variable.\n"; | ||
| ParentReg = EmitDIInstruction(SPIRV::NonSemanticExtInst::DebugInfoNone, | ||
| {}, Ctx, false); | ||
| } | ||
| } else { | ||
| llvm::errs() << "Warning: DIGlobalVariable has no parent scope\n"; | ||
| ParentReg = EmitDIInstruction(SPIRV::NonSemanticExtInst::DebugInfoNone, {}, | ||
| Ctx, false); | ||
| } | ||
| // TODO: Handle Variable Location operand | ||
| Register VariableReg = EmitDIInstruction( | ||
|
|
@@ -1286,14 +1244,6 @@ void SPIRVEmitNonSemanticDI::emitDebugArrayTypes( | |
| Register BaseTypeReg = | ||
| findBaseTypeRegisterRecursive(ElementType, Ctx, HasForwardRef); | ||
|
|
||
| if (!BaseTypeReg.isValid()) { | ||
| llvm::errs() | ||
| << "Warning: Could not find element type for Array/Vector.\n"; | ||
| BaseTypeReg = EmitDIInstruction(SPIRV::NonSemanticExtInst::DebugInfoNone, | ||
| {}, Ctx, false); | ||
| HasForwardRef = false; | ||
| } | ||
|
|
||
| DINodeArray Subranges = ArrayTy->getElements(); | ||
| if (ArrayTy->isVector()) { | ||
| assert(Subranges.size() == 1 && "Only 1D vectors supported!"); | ||
|
|
@@ -1383,14 +1333,6 @@ void SPIRVEmitNonSemanticDI::emitAllTemplateDebugInstructions( | |
| TypeReg = findBaseTypeRegisterRecursive(TTP->getType(), Ctx, | ||
| ParamHasForwardRef); | ||
|
|
||
| if (!TypeReg.isValid()) { | ||
| llvm::errs() | ||
| << "Warning: Could not find type for DITemplateTypeParameter: " | ||
| << TTP->getName() << "\n"; | ||
| TypeReg = EmitDIInstruction(SPIRV::NonSemanticExtInst::DebugInfoNone, | ||
| {}, Ctx, false); | ||
| ParamHasForwardRef = false; | ||
| } | ||
| if (ParamHasForwardRef) | ||
| HasForwardRef = true; | ||
|
|
||
|
|
@@ -1415,14 +1357,6 @@ void SPIRVEmitNonSemanticDI::emitAllTemplateDebugInstructions( | |
| HasForwardRef = true; | ||
| } | ||
|
|
||
| if (!TypeReg.isValid()) { | ||
| llvm::errs() | ||
| << "Warning: Could not find type for DITemplateValueParameter: " | ||
| << TVP->getName() << "\n"; | ||
| TypeReg = EmitDIInstruction(SPIRV::NonSemanticExtInst::DebugInfoNone, | ||
| {}, Ctx, false); | ||
| } | ||
|
|
||
| int64_t ActualValue = 0; | ||
| if (auto *CAM = dyn_cast_or_null<ConstantAsMetadata>(TVP->getValue())) { | ||
| if (auto *CI = dyn_cast<ConstantInt>(CAM->getValue())) { | ||
|
|
@@ -1650,26 +1584,12 @@ void SPIRVEmitNonSemanticDI::emitDebugTypePtrToMember( | |
| bool MemberTypeIsFwd = false; | ||
| Register MemberTypeReg = | ||
| findBaseTypeRegisterRecursive(BaseTy, Ctx, MemberTypeIsFwd); | ||
| if (!MemberTypeReg.isValid()) { | ||
| llvm::errs() | ||
| << "Warning: Could not find Member Type for PtrToMember.\n"; | ||
| MemberTypeReg = EmitDIInstruction( | ||
| SPIRV::NonSemanticExtInst::DebugInfoNone, {}, Ctx, false); | ||
| MemberTypeIsFwd = false; | ||
| } | ||
| if (MemberTypeIsFwd) | ||
| OpHasForwardRef = true; | ||
| const DIType *ClassTy = PtrToMemberType->getClassType(); | ||
| bool ParentTypeIsFwd = false; | ||
| Register ParentReg = | ||
| findBaseTypeRegisterRecursive(ClassTy, Ctx, ParentTypeIsFwd); | ||
| if (!ParentReg.isValid()) { | ||
|
||
| llvm::errs() | ||
| << "Warning: Could not find Parent Type for PtrToMember.\n"; | ||
| ParentReg = EmitDIInstruction(SPIRV::NonSemanticExtInst::DebugInfoNone, | ||
| {}, Ctx, false); | ||
| ParentTypeIsFwd = false; | ||
| } | ||
| if (ParentTypeIsFwd) | ||
| OpHasForwardRef = true; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can keep
DebugInfoNonefor types and sort it out later either in the specification or implementation.