[llvm] [SPIRV] Addition of extension SPV_KHR_non_semantic_info (PR #165302)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 27 12:28:57 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-spir-v
Author: Aadesh Premkumar (aadeshps-mcw)
<details>
<summary>Changes</summary>
--Added support for the extension SPV_KHR_non_semantic_info
--Added 19 instructions from the documentation.
--Added supporting tests for the same.
---
Patch is 659.07 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/165302.diff
18 Files Affected:
- (modified) llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp (+1408-168)
- (modified) llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h (+11)
- (modified) llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp (+26-2)
- (added) llvm/test/CodeGen/SPIRV/debug-info/debug-build-identifier-storagepath.ll (+56)
- (added) llvm/test/CodeGen/SPIRV/debug-info/debug-function.ll (+54)
- (added) llvm/test/CodeGen/SPIRV/debug-info/debug-imported-entity.ll (+66)
- (added) llvm/test/CodeGen/SPIRV/debug-info/debug-lexical-scope.ll (+60)
- (added) llvm/test/CodeGen/SPIRV/debug-info/debug-macro-def-undef.ll (+88)
- (added) llvm/test/CodeGen/SPIRV/debug-info/debug-qualifier.ll (+58)
- (added) llvm/test/CodeGen/SPIRV/debug-info/debug-source-continued.ll (+52)
- (added) llvm/test/CodeGen/SPIRV/debug-info/debug-type-array.ll (+74)
- (modified) llvm/test/CodeGen/SPIRV/debug-info/debug-type-basic.ll (+1)
- (added) llvm/test/CodeGen/SPIRV/debug-info/debug-type-composite.ll (+69)
- (added) llvm/test/CodeGen/SPIRV/debug-info/debug-type-inheritance.ll (+88)
- (modified) llvm/test/CodeGen/SPIRV/debug-info/debug-type-pointer.ll (+2-2)
- (added) llvm/test/CodeGen/SPIRV/debug-info/debug-type-ptrtomember.ll (+78)
- (added) llvm/test/CodeGen/SPIRV/debug-info/debug-type-template.ll (+85)
- (added) llvm/test/CodeGen/SPIRV/debug-info/debug-typedef.ll (+86)
``````````diff
diff --git a/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp b/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
index 318ef0679ba03..416a87559d6b4 100644
--- a/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
@@ -18,6 +18,7 @@
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Register.h"
+#include "llvm/Config/llvm-config.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugProgramInstruction.h"
#include "llvm/IR/Metadata.h"
@@ -29,6 +30,71 @@
using namespace llvm;
namespace {
+struct SPIRVCodeGenContext {
+ MachineIRBuilder &MIRBuilder;
+ MachineRegisterInfo &MRI;
+ SPIRVGlobalRegistry *GR;
+ const SPIRVType *VoidTy;
+ const SPIRVType *I32Ty;
+ const SPIRVInstrInfo *TII;
+ const SPIRVRegisterInfo *TRI;
+ const RegisterBankInfo *RBI;
+ MachineFunction &MF;
+ const Register &I32ZeroReg;
+ SPIRVTargetMachine *TM;
+ SmallVector<std::pair<const DIFile *const, const Register>, 12>
+ &SourceRegPairs;
+ SmallVector<std::pair<const DIScope *const, const Register>, 12>
+ &ScopeRegPairs;
+ SmallVector<std::pair<const DISubroutineType *const, const Register>, 12>
+ &SubRoutineTypeRegPairs;
+ SmallVector<std::pair<const DIBasicType *const, const Register>, 12>
+ &BasicTypeRegPairs;
+ SmallVector<std::pair<const DICompositeType *const, const Register>, 12>
+ &CompositeTypeRegPairs;
+
+ SPIRVCodeGenContext(
+ MachineIRBuilder &Builder, MachineRegisterInfo &RegInfo,
+ SPIRVGlobalRegistry *Registry, const SPIRVType *VTy,
+ const SPIRVType *I32Ty, const SPIRVInstrInfo *TI,
+ const SPIRVRegisterInfo *TR, const RegisterBankInfo *RB,
+ MachineFunction &Function, const Register &ZeroReg,
+ SPIRVTargetMachine *TargetMachine,
+ SmallVector<std::pair<const DIFile *const, const Register>, 12>
+ &SourceRegisterPairs,
+ SmallVector<std::pair<const DIScope *const, const Register>, 12>
+ &ScopeRegisterPairs,
+ SmallVector<std::pair<const DISubroutineType *const, const Register>, 12>
+ &SubRoutineTypeRegisterPairs,
+ SmallVector<std::pair<const DIBasicType *const, const Register>, 12>
+ &BasicTypePairs,
+ SmallVector<std::pair<const DICompositeType *const, const Register>, 12>
+ &CompositeTypePairs)
+ : MIRBuilder(Builder), MRI(RegInfo), GR(Registry), VoidTy(VTy),
+ I32Ty(I32Ty), TII(TI), TRI(TR), RBI(RB), MF(Function),
+ I32ZeroReg(ZeroReg), TM(TargetMachine),
+ SourceRegPairs(SourceRegisterPairs), ScopeRegPairs(ScopeRegisterPairs),
+ SubRoutineTypeRegPairs(SubRoutineTypeRegisterPairs),
+ BasicTypeRegPairs(BasicTypePairs),
+ CompositeTypeRegPairs(CompositeTypePairs) {}
+};
+struct DebugInfoCollector {
+ SmallPtrSet<DIBasicType *, 12> BasicTypes;
+ SmallPtrSet<DIDerivedType *, 12> PointerDerivedTypes;
+ SmallPtrSet<DIDerivedType *, 12> QualifiedDerivedTypes;
+ SmallPtrSet<DIDerivedType *, 12> TypedefTypes;
+ SmallPtrSet<DIDerivedType *, 12> InheritedTypes;
+ SmallPtrSet<DIDerivedType *, 12> PtrToMemberTypes;
+ SmallVector<const DIImportedEntity *, 5> ImportedEntities;
+ SmallPtrSet<DISubprogram *, 12> SubPrograms;
+ SmallPtrSet<DISubroutineType *, 12> SubRoutineTypes;
+ SmallPtrSet<DIScope *, 12> LexicalScopes;
+ SmallPtrSet<DICompositeType *, 12> ArrayTypes;
+ SmallPtrSet<const DICompositeType *, 8> CompositeTypesWithTemplates;
+ SmallPtrSet<const DICompositeType *, 8> CompositeTypes;
+ SmallPtrSet<const DICompositeType *, 8> EnumTypes;
+ DenseSet<const DIType *> visitedTypes;
+};
struct SPIRVEmitNonSemanticDI : public MachineFunctionPass {
static char ID;
SPIRVTargetMachine *TM;
@@ -40,6 +106,115 @@ struct SPIRVEmitNonSemanticDI : public MachineFunctionPass {
private:
bool IsGlobalDIEmitted = false;
bool emitGlobalDI(MachineFunction &MF);
+ Register EmitOpString(StringRef, SPIRVCodeGenContext &Ctx);
+ uint32_t transDebugFlags(const DINode *DN);
+ uint32_t mapTagToCompositeEncoding(const DICompositeType *CT);
+ uint32_t mapTagToQualifierEncoding(unsigned Tag);
+ uint32_t mapDebugFlags(DINode::DIFlags DFlags);
+ uint32_t mapImportedTagToEncoding(const DIImportedEntity *Imported);
+
+ Register EmitDIInstruction(SPIRV::NonSemanticExtInst::NonSemanticExtInst Inst,
+ ArrayRef<Register> Operands,
+ SPIRVCodeGenContext &Ctx);
+
+ Register findEmittedBasicTypeReg(
+ const DIType *BaseType,
+ const SmallVectorImpl<std::pair<const DIBasicType *const, const Register>>
+ &BasicTypeRegPairs);
+
+ Register findEmittedCompositeTypeReg(
+ const DIType *BaseType,
+ const SmallVectorImpl<std::pair<const DICompositeType *const,
+ const Register>> &CompositeTypeRegPairs);
+
+ void extractTypeMetadata(DIType *Ty, DebugInfoCollector &Collector);
+
+ void handleCompositeType(DICompositeType *CT, DebugInfoCollector &Collector);
+ void handleDerivedType(DIDerivedType *DT, DebugInfoCollector &Collector);
+
+ void emitDebugBuildIdentifier(StringRef BuildIdentifier,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitDebugStoragePath(StringRef BuildStoragePath,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitDebugBasicTypes(const SmallPtrSetImpl<DIBasicType *> &BasicTypes,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitDebugPointerTypes(
+ const SmallPtrSetImpl<DIDerivedType *> &PointerDerivedTypes,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitSingleCompilationUnit(StringRef FilePath, int64_t SourceLanguage,
+ SPIRVCodeGenContext &Ctx,
+ Register DebugInfoVersionReg,
+ Register DwarfVersionReg,
+ Register &DebugSourceResIdReg,
+ Register &DebugCompUnitResIdReg);
+
+ // void emitDebugTypeInheritance(
+ // const SmallPtrSetImpl<DIDerivedType *> &InheritedTypes,
+ // SPIRVCodeGenContext &Ctx);
+
+ void emitLexicalScopes(const SmallPtrSetImpl<DIScope *> &LexicalScopes,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitDebugArrayTypes(const SmallPtrSetImpl<DICompositeType *> &ArrayTypes,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitDebugVectorTypes(DICompositeType *ArrayTy, Register BaseTypeReg,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitDebugTypeComposite(const DICompositeType *CompTy,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitAllTemplateDebugInstructions(
+ const SmallPtrSetImpl<const DICompositeType *> &TemplatedTypes,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitAllDebugTypeComposites(
+ const SmallPtrSetImpl<const DICompositeType *> &CompositeTypes,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitSubroutineTypes(
+ const SmallPtrSet<DISubroutineType *, 12> &SubRoutineTypes,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitSubprograms(const SmallPtrSet<DISubprogram *, 12> &SubPrograms,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitDebugTypeMember(const DIDerivedType *Member,
+ SPIRVCodeGenContext &Ctx,
+ const Register &CompositeReg,
+ SmallVectorImpl<Register> &MemberRegs,
+ Register DebugSourceReg);
+
+ void emitDebugMacroDefs(MachineFunction &MF, SPIRVCodeGenContext &Ctx);
+
+ void emitDebugMacroUndef(const DIMacro *MacroUndef, StringRef FileName,
+ SPIRVCodeGenContext &Ctx,
+ const DenseMap<StringRef, Register> &MacroDefRegs);
+
+ void emitDebugQualifiedTypes(
+ const SmallPtrSetImpl<DIDerivedType *> &QualifiedDerivedTypes,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitDebugTypedefs(const SmallPtrSetImpl<DIDerivedType *> &TypedefTypes,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitDebugImportedEntities(
+ const SmallVectorImpl<const DIImportedEntity *> &ImportedEntities,
+ SPIRVCodeGenContext &Ctx);
+
+ Register emitDebugGlobalVariable(const DIGlobalVariableExpression *GVE,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitAllDebugGlobalVariables(MachineFunction &MF,
+ SPIRVCodeGenContext &Ctx);
+
+ void emitDebugTypePtrToMember(
+ const SmallPtrSetImpl<DIDerivedType *> &PtrToMemberTypes,
+ SPIRVCodeGenContext &Ctx);
};
} // anonymous namespace
@@ -64,6 +239,12 @@ enum BaseTypeAttributeEncoding {
UnsignedChar = 7
};
+enum CompositeTypeAttributeEncoding { Class = 0, Struct = 1, Union = 2 };
+enum ImportedEnityAttributeEncoding {
+ ImportedModule = 0,
+ ImportedDeclaration = 1
+};
+
enum SourceLanguage {
Unknown = 0,
ESSL = 1,
@@ -77,9 +258,53 @@ enum SourceLanguage {
NZSL = 9,
WGSL = 10,
Slang = 11,
- Zig = 12
+ Zig = 12,
+ CPP = 13
+};
+
+enum QualifierTypeAttributeEncoding {
+ ConstType = 0,
+ VolatileType = 1,
+ RestrictType = 2,
+ AtomicType = 3
+};
+
+enum Flag {
+ FlagIsProtected = 1 << 0,
+ FlagIsPrivate = 1 << 1,
+ FlagIsPublic = FlagIsPrivate | FlagIsProtected,
+ FlagAccess = FlagIsPublic,
+ FlagIsLocal = 1 << 2,
+ FlagIsDefinition = 1 << 3,
+ FlagIsFwdDecl = 1 << 4,
+ FlagIsArtificial = 1 << 5,
+ FlagIsExplicit = 1 << 6,
+ FlagIsPrototyped = 1 << 7,
+ FlagIsObjectPointer = 1 << 8,
+ FlagIsStaticMember = 1 << 9,
+ FlagIsIndirectVariable = 1 << 10,
+ FlagIsLValueReference = 1 << 11,
+ FlagIsRValueReference = 1 << 12,
+ FlagIsOptimized = 1 << 13,
+ FlagIsEnumClass = 1 << 14,
+ FlagTypePassByValue = 1 << 15,
+ FlagTypePassByReference = 1 << 16,
+ FlagUnknownPhysicalLayout = 1 << 17,
+ FlagBitField = 1 << 18
};
+template <typename T, typename Container>
+Register findRegisterFromMap(const T *DIType, const Container &RegPairs,
+ Register DefaultReg = Register()) {
+ if (!DIType)
+ return DefaultReg;
+ for (const auto &[DefinedType, Reg] : RegPairs) {
+ if (DefinedType == DIType)
+ return Reg;
+ }
+ return DefaultReg;
+}
+
bool SPIRVEmitNonSemanticDI::emitGlobalDI(MachineFunction &MF) {
// If this MachineFunction doesn't have any BB repeat procedure
// for the next
@@ -88,16 +313,17 @@ bool SPIRVEmitNonSemanticDI::emitGlobalDI(MachineFunction &MF) {
return false;
}
- // Required variables to get from metadata search
LLVMContext *Context;
SmallVector<SmallString<128>> FilePaths;
SmallVector<int64_t> LLVMSourceLanguages;
int64_t DwarfVersion = 0;
int64_t DebugInfoVersion = 0;
- SmallPtrSet<DIBasicType *, 12> BasicTypes;
- SmallPtrSet<DIDerivedType *, 12> PointerDerivedTypes;
- // Searching through the Module metadata to find nescessary
- // information like DwarfVersion or SourceLanguage
+ SmallString<128> BuildIdentifier;
+ SmallString<128> BuildStoragePath;
+ Register DebugCompUnitResIdReg;
+ Register DebugSourceResIdReg;
+ DebugInfoCollector Collector;
+
{
const MachineModuleInfo &MMI =
getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
@@ -108,6 +334,22 @@ bool SPIRVEmitNonSemanticDI::emitGlobalDI(MachineFunction &MF) {
return false;
for (const auto *Op : DbgCu->operands()) {
if (const auto *CompileUnit = dyn_cast<DICompileUnit>(Op)) {
+ if (CompileUnit->getDWOId())
+ BuildIdentifier = std::to_string(CompileUnit->getDWOId());
+ if (!CompileUnit->getSplitDebugFilename().empty())
+ BuildStoragePath = CompileUnit->getSplitDebugFilename();
+
+ for (auto *GVE : CompileUnit->getGlobalVariables()) {
+ if (auto *DIGV = dyn_cast<DIGlobalVariable>(GVE->getVariable())) {
+ extractTypeMetadata(DIGV->getType(), Collector);
+ }
+ }
+ for (const auto *IE : CompileUnit->getImportedEntities()) {
+ if (const auto *Imported = dyn_cast<DIImportedEntity>(IE)) {
+ Collector.ImportedEntities.push_back(Imported);
+ }
+ }
+
DIFile *File = CompileUnit->getFile();
FilePaths.emplace_back();
sys::path::append(FilePaths.back(), File->getDirectory(),
@@ -135,25 +377,25 @@ bool SPIRVEmitNonSemanticDI::emitGlobalDI(MachineFunction &MF) {
// This traversal is the only supported way to access
// instruction related DI metadata like DIBasicType
for (auto &F : *M) {
+ if (DISubprogram *SP = F.getSubprogram()) {
+ Collector.SubPrograms.insert(SP);
+ if (auto *SubType = dyn_cast<DISubroutineType>(SP->getType()))
+ Collector.SubRoutineTypes.insert(SubType);
+ }
for (auto &BB : F) {
for (auto &I : BB) {
for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) {
- DILocalVariable *LocalVariable = DVR.getVariable();
- if (auto *BasicType =
- dyn_cast<DIBasicType>(LocalVariable->getType())) {
- BasicTypes.insert(BasicType);
- } else if (auto *DerivedType =
- dyn_cast<DIDerivedType>(LocalVariable->getType())) {
- if (DerivedType->getTag() == dwarf::DW_TAG_pointer_type) {
- PointerDerivedTypes.insert(DerivedType);
- // DIBasicType can be unreachable from DbgRecord and only
- // pointed on from other DI types
- // DerivedType->getBaseType is null when pointer
- // is representing a void type
- if (auto *BT = dyn_cast_or_null<DIBasicType>(
- DerivedType->getBaseType()))
- BasicTypes.insert(BT);
- }
+ if (DILocalVariable *LocalVariable = DVR.getVariable())
+ extractTypeMetadata(LocalVariable->getType(), Collector);
+ }
+ if (const DebugLoc &DL = I.getDebugLoc()) {
+ if (const DILocation *Loc = DL.get()) {
+ DIScope *Scope = Loc->getScope();
+ if (auto *SP = dyn_cast<DISubprogram>(Scope))
+ Collector.SubPrograms.insert(SP);
+ else if (isa<DILexicalBlock>(Scope) ||
+ isa<DILexicalBlockFile>(Scope))
+ Collector.LexicalScopes.insert(Scope);
}
}
}
@@ -175,185 +417,1183 @@ bool SPIRVEmitNonSemanticDI::emitGlobalDI(MachineFunction &MF) {
// and before first terminator
MachineIRBuilder MIRBuilder(MBB, MBB.getFirstTerminator());
- const auto EmitOpString = [&](StringRef SR) {
- const Register StrReg = MRI.createVirtualRegister(&SPIRV::IDRegClass);
- MRI.setType(StrReg, LLT::scalar(32));
- MachineInstrBuilder MIB = MIRBuilder.buildInstr(SPIRV::OpString);
- MIB.addDef(StrReg);
- addStringImm(SR, MIB);
- return StrReg;
- };
+ SmallVector<std::pair<const DIBasicType *const, const Register>, 12>
+ BasicTypeRegPairs;
+ SmallVector<std::pair<const DICompositeType *const, const Register>, 12>
+ CompositeTypeRegPairs;
+ SmallVector<std::pair<const DIFile *const, const Register>, 12>
+ SourceRegPairs;
+ SmallVector<std::pair<const DIScope *const, const Register>, 12>
+ ScopeRegPairs;
+ SmallVector<std::pair<const DISubroutineType *const, const Register>, 12>
+ SubRoutineTypeRegPairs;
const SPIRVType *VoidTy =
GR->getOrCreateSPIRVType(Type::getVoidTy(*Context), MIRBuilder,
SPIRV::AccessQualifier::ReadWrite, false);
-
- const auto EmitDIInstruction =
- [&](SPIRV::NonSemanticExtInst::NonSemanticExtInst Inst,
- std::initializer_list<Register> Registers) {
- const Register InstReg =
- MRI.createVirtualRegister(&SPIRV::IDRegClass);
- MRI.setType(InstReg, LLT::scalar(32));
- MachineInstrBuilder MIB =
- MIRBuilder.buildInstr(SPIRV::OpExtInst)
- .addDef(InstReg)
- .addUse(GR->getSPIRVTypeID(VoidTy))
- .addImm(static_cast<int64_t>(
- SPIRV::InstructionSet::NonSemantic_Shader_DebugInfo_100))
- .addImm(Inst);
- for (auto Reg : Registers) {
- MIB.addUse(Reg);
- }
- MIB.constrainAllUses(*TII, *TRI, *RBI);
- GR->assignSPIRVTypeToVReg(VoidTy, InstReg, MF);
- return InstReg;
- };
-
const SPIRVType *I32Ty =
GR->getOrCreateSPIRVType(Type::getInt32Ty(*Context), MIRBuilder,
SPIRV::AccessQualifier::ReadWrite, false);
+ const Register I32ZeroReg =
+ GR->buildConstantInt(1, MIRBuilder, I32Ty, false);
+
const Register DwarfVersionReg =
GR->buildConstantInt(DwarfVersion, MIRBuilder, I32Ty, false);
const Register DebugInfoVersionReg =
GR->buildConstantInt(DebugInfoVersion, MIRBuilder, I32Ty, false);
+ SPIRVCodeGenContext Ctx(MIRBuilder, MRI, GR, VoidTy, I32Ty, TII, TRI, RBI,
+ MF, I32ZeroReg, TM, SourceRegPairs, ScopeRegPairs,
+ SubRoutineTypeRegPairs, BasicTypeRegPairs,
+ CompositeTypeRegPairs);
+
for (unsigned Idx = 0; Idx < LLVMSourceLanguages.size(); ++Idx) {
- const Register FilePathStrReg = EmitOpString(FilePaths[Idx]);
-
- const Register DebugSourceResIdReg = EmitDIInstruction(
- SPIRV::NonSemanticExtInst::DebugSource, {FilePathStrReg});
-
- SourceLanguage SpirvSourceLanguage = SourceLanguage::Unknown;
- switch (LLVMSourceLanguages[Idx]) {
- case dwarf::DW_LANG_OpenCL:
- SpirvSourceLanguage = SourceLanguage::OpenCL_C;
- break;
- case dwarf::DW_LANG_OpenCL_CPP:
- SpirvSourceLanguage = SourceLanguage::OpenCL_CPP;
- break;
- case dwarf::DW_LANG_CPP_for_OpenCL:
- SpirvSourceLanguage = SourceLanguage::CPP_for_OpenCL;
- break;
- case dwarf::DW_LANG_GLSL:
- SpirvSourceLanguage = SourceLanguage::GLSL;
- break;
- case dwarf::DW_LANG_HLSL:
- SpirvSourceLanguage = SourceLanguage::HLSL;
- break;
- case dwarf::DW_LANG_SYCL:
- SpirvSourceLanguage = SourceLanguage::SYCL;
- break;
- case dwarf::DW_LANG_Zig:
- SpirvSourceLanguage = SourceLanguage::Zig;
+ emitSingleCompilationUnit(FilePaths[Idx], LLVMSourceLanguages[Idx], Ctx,
+ DebugInfoVersionReg, DwarfVersionReg,
+ DebugSourceResIdReg, DebugCompUnitResIdReg);
+
+ if (const DISubprogram *SP = Ctx.MF.getFunction().getSubprogram()) {
+ if (const DIFile *File = SP->getFile())
+ Ctx.GR->addDebugValue(File, DebugCompUnitResIdReg);
+ if (const DICompileUnit *Unit = SP->getUnit())
+ Ctx.GR->addDebugValue(Unit, DebugCompUnitResIdReg);
+ }
+ }
+ emitDebugMacroDefs(MF, Ctx);
+ emitSubroutineTypes(Collector.SubRoutineTypes, Ctx);
+ emitSubprograms(Collector.SubPrograms, Ctx);
+ emitLexicalScopes(Collector.LexicalScopes, Ctx);
+ emitDebugBuildIdentifier(BuildIdentifier, Ctx);
+ emitDebugStoragePath(BuildStoragePath, Ctx);
+ emitDebugBasicTypes(Collector.BasicTypes, Ctx);
+ emitDebugPointerTypes(Collector.PointerDerivedTypes, Ctx);
+ emitDebugArrayTypes(Collector.ArrayTypes, Ctx);
+ emitAllDebugTypeComposites(Collector.CompositeTypes, Ctx);
+ emitAllTemplateDebugInstructions(Collector.CompositeTypesWithTemplates,
+ Ctx);
+ emitAllDebugGlobalVariables(MF, Ctx);
+ emitDebugQualifiedTypes(Collector.QualifiedDerivedTypes, Ctx);
+ emitDebugTypedefs(Collector.TypedefTypes, Ctx);
+ emitDebugImportedEntities(Collector.ImportedEntities, Ctx);
+ // emitDebugTypeInheritance(Collector.InheritedTypes, Ctx);
+ emitDebugTypePtrToMember(Collector.PtrToMemberTypes, Ctx);
+ }
+ return true;
+}
+
+bool SPIRVEmitNonSemanticDI::runOnMachineFunction(MachineFunction &MF) {
+ bool Res = false;
+ if (!IsGlobalDIEmitted) {
+ IsGlobalDIEmitted = true;
+ Res = emitGlobalDI(MF);
+ }
+ return Res;
+}
+
+Register SPIRVEmitNonSemanticDI::EmitOpString(StringRef SR,
+ SPIRVCodeGenContext &Ctx) {
+ const Register StrReg = Ctx.MRI.createVirtual...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/165302
More information about the llvm-commits
mailing list