33template <
typename MapT>
34static std::optional<MCRegister> lookupOptReg(
const MapT &Map,
35 typename MapT::key_type
Key) {
39 assert(It->second.isValid() &&
"invalid register stored in map");
63 if (CT->getTag() == dwarf::DW_TAG_array_type && CT->isVector())
68 if (DT && DT->getTag() == dwarf::DW_TAG_pointer_type)
73 NSDIFlagIsProtected = 1u << 0,
74 NSDIFlagIsPrivate = 1u << 1,
75 NSDIFlagIsPublic = NSDIFlagIsPrivate | NSDIFlagIsProtected,
76 NSDIFlagIsLocal = 1u << 2,
77 NSDIFlagIsDefinition = 1u << 3,
78 NSDIFlagFwdDecl = 1u << 4,
79 NSDIFlagArtificial = 1u << 5,
80 NSDIFlagExplicit = 1u << 6,
81 NSDIFlagPrototyped = 1u << 7,
82 NSDIFlagObjectPointer = 1u << 8,
83 NSDIFlagStaticMember = 1u << 9,
84 NSDIFlagIndirectVariable = 1u << 10,
85 NSDIFlagLValueReference = 1u << 11,
86 NSDIFlagRValueReference = 1u << 12,
87 NSDIFlagIsOptimized = 1u << 13,
88 NSDIFlagIsEnumClass = 1u << 14,
89 NSDIFlagTypePassByValue = 1u << 15,
90 NSDIFlagTypePassByReference = 1u << 16,
91 NSDIFlagUnknownPhysicalLayout = 1u << 17,
97 Flags |= NSDIFlagIsPublic;
99 Flags |= NSDIFlagIsProtected;
101 Flags |= NSDIFlagIsPrivate;
102 if (DFlags & DINode::FlagFwdDecl)
103 Flags |= NSDIFlagFwdDecl;
104 if (DFlags & DINode::FlagArtificial)
105 Flags |= NSDIFlagArtificial;
106 if (DFlags & DINode::FlagExplicit)
107 Flags |= NSDIFlagExplicit;
108 if (DFlags & DINode::FlagPrototyped)
109 Flags |= NSDIFlagPrototyped;
110 if (DFlags & DINode::FlagObjectPointer)
111 Flags |= NSDIFlagObjectPointer;
112 if (DFlags & DINode::FlagStaticMember)
113 Flags |= NSDIFlagStaticMember;
114 if (DFlags & DINode::FlagLValueReference)
115 Flags |= NSDIFlagLValueReference;
116 if (DFlags & DINode::FlagRValueReference)
117 Flags |= NSDIFlagRValueReference;
118 if (DFlags & DINode::FlagTypePassByValue)
119 Flags |= NSDIFlagTypePassByValue;
120 if (DFlags & DINode::FlagTypePassByReference)
121 Flags |= NSDIFlagTypePassByReference;
122 if (DFlags & DINode::FlagEnumClass)
123 Flags |= NSDIFlagIsEnumClass;
130 if (GV->isLocalToUnit())
131 Flags |= NSDIFlagIsLocal;
132 if (GV->isDefinition())
133 Flags |= NSDIFlagIsDefinition;
136 if (SP->isLocalToUnit())
137 Flags |= NSDIFlagIsLocal;
138 if (SP->isOptimized())
139 Flags |= NSDIFlagIsOptimized;
140 if (SP->isDefinition())
141 Flags |= NSDIFlagIsDefinition;
142 Flags |= mapDIFlagsToNonSemantic(SP->getFlags());
144 if (DN->
getTag() == dwarf::DW_TAG_reference_type)
145 Flags |= NSDIFlagLValueReference;
146 if (DN->
getTag() == dwarf::DW_TAG_rvalue_reference_type)
147 Flags |= NSDIFlagRValueReference;
149 Flags |= mapDIFlagsToNonSemantic(Ty->getFlags());
151 Flags |= mapDIFlagsToNonSemantic(LV->getFlags());
163unsigned SPIRVNonSemanticDebugHandler::toNSDISrcLang(
unsigned DwarfSrcLang) {
164 switch (DwarfSrcLang) {
165 case dwarf::DW_LANG_OpenCL:
167 case dwarf::DW_LANG_OpenCL_CPP:
169 case dwarf::DW_LANG_CPP_for_OpenCL:
171 case dwarf::DW_LANG_GLSL:
173 case dwarf::DW_LANG_HLSL:
175 case dwarf::DW_LANG_SYCL:
177 case dwarf::DW_LANG_Zig:
192 CompileUnits.clear();
194 PointerTypes.clear();
195 SubroutineTypes.clear();
197 SubprogramDeclarations.clear();
198 GlobalVariableDebugInfoMap.clear();
199 DebugFunctionDeclarationRegs.clear();
200 ScopeToPathOpStringReg.clear();
201 CUToCompilationUnitDbgReg.clear();
202 DebugSourceRegByFileStr.clear();
203 DebugTypeRegs.clear();
204 OpStringContentCache.clear();
205 I32ConstantCache.clear();
206 DebugTypeFunctionCache.clear();
207 GlobalDIEmitted =
false;
209 NonSemanticOpStringsSectionEmitted =
false;
219 CompileUnitInfo Info;
222 Info.FilePath = File->getFilename();
225 File->getFilename());
228 Info.SpirvSourceLanguage = toNSDISrcLang(
CU->getSourceLanguage().getName());
229 CompileUnits.push_back(std::move(Info));
235 if (
const NamedMDNode *Flags = M->getNamedMetadata(
"llvm.module.flags")) {
236 for (
const auto *
Op : Flags->operands()) {
250 partitionTypes(Ty, BasicTypes, PointerTypes, SubroutineTypes, VectorTypes);
254 if (!SP->isDefinition())
255 SubprogramDeclarations.push_back(SP);
262 G.getDebugInfo(GVEs);
273 GlobalVariableDebugInfoMap.try_emplace(
274 GV, GlobalVariableDebugInfo{Expr, DIGVToLLVMGV.
lookup(GV)});
280 if (CompileUnits.empty())
282 if (!ST.canUseExtension(SPIRV::Extension::SPV_KHR_non_semantic_info))
291 constexpr unsigned NSSet =
static_cast<unsigned>(
292 SPIRV::InstructionSet::NonSemantic_Shader_DebugInfo_100);
297void SPIRVNonSemanticDebugHandler::emitMCInst(
MCInst &Inst) {
302SPIRVNonSemanticDebugHandler::emitOpString(
StringRef S,
313MCRegister SPIRVNonSemanticDebugHandler::emitOpStringIfNew(
316 assert(!NonSemanticOpStringsSectionEmitted &&
317 "emitOpStringIfNew is only valid while emitting SPIR-V section 7");
319 auto [It,
Inserted] = OpStringContentCache.try_emplace(S, MCRegister());
321 It->second = emitOpString(S, MAI);
328 assert(NonSemanticOpStringsSectionEmitted &&
329 "getCachedOpStringReg requires emitNonSemanticDebugStrings() first");
331 auto It = OpStringContentCache.find(S);
332 assert(It != OpStringContentCache.end() &&
333 "NSDI OpString missing from cache; emitNonSemanticDebugStrings must "
334 "cache every string used in section 10");
338MCRegister SPIRVNonSemanticDebugHandler::getCachedScopePathOpStringReg(
339 const DIScope *Scope,
bool UseEmptyPathIfNullScope) {
341 assert(UseEmptyPathIfNullScope &&
342 "null scope path lookup requires UseEmptyPathIfNullScope");
343 assert(CachedEmptyStringReg.isValid() &&
344 "empty path OpString must be cached in emitNonSemanticDebugStrings");
345 return CachedEmptyStringReg;
347 auto It = ScopeToPathOpStringReg.find(Scope);
348 assert(It != ScopeToPathOpStringReg.end() &&
349 "path OpString must be cached in emitNonSemanticDebugStrings");
350 MCRegister FileStrReg = It->second;
351 assert(FileStrReg.
isValid() &&
"path OpString id must be valid once cached");
355MCRegister SPIRVNonSemanticDebugHandler::emitOpConstantI32(
372MCRegister SPIRVNonSemanticDebugHandler::emitExtInst(
373 SPIRV::NonSemanticExtInst::NonSemanticExtInst Opcode,
383 for (MCRegister R : Operands)
389MCRegister SPIRVNonSemanticDebugHandler::getOrEmitDebugTypeFunction(
397 MCRegister
Reg = emitExtInst(SPIRV::NonSemanticExtInst::DebugTypeFunction,
398 VoidTypeReg, ExtInstSetReg,
Ops, MAI);
403MCRegister SPIRVNonSemanticDebugHandler::getOrEmitOpTypeVoidReg(
405 if (!CachedOpTypeVoidReg.isValid())
406 CachedOpTypeVoidReg = findOrEmitOpTypeVoid(MAI);
407 return CachedOpTypeVoidReg;
410MCRegister SPIRVNonSemanticDebugHandler::getOrEmitOpTypeInt32Reg(
412 if (!CachedOpTypeInt32Reg.isValid())
413 CachedOpTypeInt32Reg = findOrEmitOpTypeInt32(MAI);
414 return CachedOpTypeInt32Reg;
417MCRegister SPIRVNonSemanticDebugHandler::findOrEmitOpTypeVoid(
420 if (
MI->getOpcode() == SPIRV::OpTypeVoid)
431MCRegister SPIRVNonSemanticDebugHandler::findOrEmitOpTypeInt32(
434 if (
MI->getOpcode() == SPIRV::OpTypeInt &&
435 MI->getOperand(1).getImm() == 32 &&
MI->getOperand(2).getImm() == 0)
448std::optional<MCRegister> SPIRVNonSemanticDebugHandler::emitDebugTypePointer(
453 if (!PT->getDWARFAddressSpace().has_value())
456 MCRegister VoidTypeReg = getOrEmitOpTypeVoidReg(MAI);
457 MCRegister I32TypeReg = getOrEmitOpTypeInt32Reg(MAI);
458 MCRegister DebugTypePointerFlagsReg =
459 emitOpConstantI32(transDebugFlags(PT), I32TypeReg, MAI);
463 const auto &
ST =
static_cast<const SPIRVSubtarget &
>(
Asm->getSubtargetInfo());
464 MCRegister StorageClassReg = emitOpConstantI32(
468 if (
const DIType *BaseTy = PT->getBaseType()) {
469 auto BaseIt = DebugTypeRegs.find(BaseTy);
470 if (BaseIt != DebugTypeRegs.end())
472 SPIRV::NonSemanticExtInst::DebugTypePointer, VoidTypeReg,
474 {BaseIt->second, StorageClassReg, DebugTypePointerFlagsReg}, MAI);
483 SPIRV::NonSemanticExtInst::DebugTypePointer, VoidTypeReg, ExtInstSetReg,
484 {CachedDebugInfoNoneReg, StorageClassReg, DebugTypePointerFlagsReg}, MAI);
487std::optional<MCRegister>
488SPIRVNonSemanticDebugHandler::emitDebugTypeFunctionForSubroutineType(
491 MCRegister VoidTypeReg = getOrEmitOpTypeVoidReg(MAI);
492 MCRegister I32TypeReg = getOrEmitOpTypeInt32Reg(MAI);
493 MCRegister DebugTypeFunctionFlagsReg =
494 emitOpConstantI32(transDebugFlags(ST), I32TypeReg, MAI);
495 DITypeArray
TA =
ST->getTypeArray();
497 Ops.push_back(DebugTypeFunctionFlagsReg);
502 Ops.push_back(VoidTypeReg);
504 for (
unsigned I = 0,
E =
TA.size();
I !=
E; ++
I) {
505 bool IsReturnType = (
I == 0);
506 auto OptReg = mapDISignatureTypeToReg(TA[
I], VoidTypeReg, IsReturnType);
511 Ops.push_back(*OptReg);
514 return getOrEmitDebugTypeFunction(
Ops, VoidTypeReg, ExtInstSetReg, MAI);
518std::optional<MCRegister>
519SPIRVNonSemanticDebugHandler::resolveDebugFunctionDeclarationParent(
521 const DIScope *
Scope =
SP->getScope();
528 return lookupOptReg(DebugTypeRegs, Ty);
531 const DICompileUnit *ParentCU =
SP->getUnit();
532 if (!ParentCU && !CompileUnits.empty())
533 ParentCU = CompileUnits[0].TheCU;
536 return lookupOptReg(CUToCompilationUnitDbgReg, ParentCU);
539std::optional<MCRegister>
540SPIRVNonSemanticDebugHandler::emitDebugFunctionDeclaration(
543 assert(SP &&
"SP must not be null in emitDebugFunctionDeclaration");
545 "SP must not be a definition in emitDebugFunctionDeclaration");
548 const DISubroutineType *
ST =
SP->getType();
550 auto FnTyRegOpt = lookupOptReg(DebugTypeRegs, ST);
553 MCRegister FnTyReg = *FnTyRegOpt;
555 auto ParentRegOpt = resolveDebugFunctionDeclarationParent(SP);
559 MCRegister ParentReg = *ParentRegOpt;
561 MCRegister FileStrReg = getCachedScopePathOpStringReg(SP);
563 MCRegister NameReg = getCachedOpStringReg(
SP->getName());
564 MCRegister LinkageReg = getCachedOpStringReg(
SP->getLinkageName());
565 MCRegister SrcReg = getOrEmitDebugSourceForFileStrReg(FileStrReg, VoidTypeReg,
569 emitOpConstantI32(
static_cast<uint32_t
>(
SP->getLine()), I32TypeReg, MAI);
570 MCRegister ColReg = emitOpConstantI32(0, I32TypeReg, MAI);
572 uint32_t FlagsVal = transDebugFlags(SP);
575 FlagsVal &= ~NSDIFlagIsDefinition;
576 MCRegister FlagsReg = emitOpConstantI32(FlagsVal, I32TypeReg, MAI);
578 return emitExtInst(SPIRV::NonSemanticExtInst::DebugFunctionDeclaration,
579 VoidTypeReg, ExtInstSetReg,
580 {NameReg, FnTyReg, SrcReg, LineReg, ColReg, ParentReg,
581 LinkageReg, FlagsReg},
585std::optional<MCRegister> SPIRVNonSemanticDebugHandler::mapDISignatureTypeToReg(
590 assert(CachedDebugInfoNoneReg.isValid() &&
591 "DebugInfoNone must be emitted before DISubroutineType operands");
592 return CachedDebugInfoNoneReg;
594 return lookupOptReg(DebugTypeRegs, Ty);
597MCRegister SPIRVNonSemanticDebugHandler::resolveGlobalVariableParent(
604 assert(!CompileUnits.empty() &&
605 "resolveGlobalVariableParent requires non-empty CompileUnits");
606 std::optional<MCRegister> ParentRegOpt =
607 lookupOptReg(CUToCompilationUnitDbgReg, CompileUnits[0].TheCU);
608 assert(ParentRegOpt &&
"DebugCompilationUnit must be emitted before "
609 "resolveGlobalVariableParent");
611 return *ParentRegOpt;
615std::optional<MCRegister> SPIRVNonSemanticDebugHandler::emitDebugExpression(
620std::optional<MCRegister> SPIRVNonSemanticDebugHandler::emitDebugGlobalVariable(
624 assert(GV &&
"GV must not be null in emitDebugGlobalVariable");
626 MCRegister ParentReg = resolveGlobalVariableParent(GV);
632 MCRegister TyReg = CachedDebugInfoNoneReg;
633 if (
const DIType *Ty = GV->
getType()) {
634 auto TyRegOpt = lookupOptReg(DebugTypeRegs, Ty);
640 std::optional<MCRegister> StaticMemberRegOpt;
642 StaticMemberRegOpt = lookupOptReg(DebugTypeRegs,
SM);
643 if (!StaticMemberRegOpt)
647 MCRegister NameReg = getCachedOpStringReg(GV->
getName());
648 MCRegister LinkageReg = getCachedOpStringReg(GV->
getLinkageName());
649 MCRegister FileStrReg = getCachedScopePathOpStringReg(
651 MCRegister SrcReg = getOrEmitDebugSourceForFileStrReg(FileStrReg, VoidTypeReg,
655 emitOpConstantI32(
static_cast<uint32_t
>(GV->
getLine()), I32TypeReg, MAI);
659 MCRegister ColReg = emitOpConstantI32(0, I32TypeReg, MAI);
663 MCRegister VariableReg = CachedDebugInfoNoneReg;
664 if (
const GlobalVariable *LLVMGV =
Info.LLVMGV) {
668 }
else if (
Info.Expr) {
670 emitDebugExpression(
Info.Expr, VoidTypeReg, ExtInstSetReg, MAI))
671 VariableReg = *ExprReg;
674 MCRegister FlagsReg = emitOpConstantI32(transDebugFlags(GV), I32TypeReg, MAI);
677 LineReg, ColReg, ParentReg,
678 LinkageReg, VariableReg, FlagsReg};
680 if (StaticMemberRegOpt)
681 Ops.push_back(*StaticMemberRegOpt);
683 return emitExtInst(SPIRV::NonSemanticExtInst::DebugGlobalVariable,
684 VoidTypeReg, ExtInstSetReg,
Ops, MAI);
687std::optional<MCRegister> SPIRVNonSemanticDebugHandler::emitDebugTypeVector(
693 auto BTIt = DebugTypeRegs.find(BaseTy);
694 if (BTIt == DebugTypeRegs.end())
707 MCRegister VoidTypeReg = getOrEmitOpTypeVoidReg(MAI);
708 MCRegister I32TypeReg = getOrEmitOpTypeInt32Reg(MAI);
709 MCRegister CountReg = emitOpConstantI32(
710 static_cast<uint32_t
>(CI->getZExtValue()), I32TypeReg, MAI);
711 return emitExtInst(SPIRV::NonSemanticExtInst::DebugTypeVector, VoidTypeReg,
712 ExtInstSetReg, {BTIt->second, CountReg}, MAI);
717 if (CompileUnits.empty())
722 constexpr unsigned NSSet =
static_cast<unsigned>(
723 SPIRV::InstructionSet::NonSemantic_Shader_DebugInfo_100);
727 for (
const CompileUnitInfo &Info : CompileUnits) {
729 MCRegister PathReg = emitOpStringIfNew(Info.FilePath, MAI);
730 ScopeToPathOpStringReg[Info.TheCU] = PathReg;
731 if (
const DIFile *
F = Info.TheCU->getFile())
732 ScopeToPathOpStringReg[
F] = PathReg;
737 emitOpStringIfNew(
BT->getName(), MAI);
740 emitOpStringIfNew(SP->getName(), MAI);
741 emitOpStringIfNew(SP->getLinkageName(), MAI);
742 ScopeToPathOpStringReg[SP] = emitOpStringIfNew(getDebugFullPath(SP), MAI);
745 for (
const auto &[GV,
_] : GlobalVariableDebugInfoMap) {
746 emitOpStringIfNew(GV->
getName(), MAI);
749 MCRegister PathReg = emitOpStringIfNew(Path, MAI);
751 ScopeToPathOpStringReg[
F] = PathReg;
754 CachedEmptyStringReg = emitOpStringIfNew(
"", MAI);
757 NonSemanticOpStringsSectionEmitted =
true;
763 if (GlobalDIEmitted || CompileUnits.empty())
765 GlobalDIEmitted =
true;
768 constexpr unsigned NSSet =
static_cast<unsigned>(
769 SPIRV::InstructionSet::NonSemantic_Shader_DebugInfo_100);
775 assert(NonSemanticOpStringsSectionEmitted &&
776 "emitNonSemanticDebugStrings() must run before "
777 "emitNonSemanticGlobalDebugInfo()");
780 MCRegister VoidTypeReg = getOrEmitOpTypeVoidReg(MAI);
781 MCRegister I32TypeReg = getOrEmitOpTypeInt32Reg(MAI);
783 CachedDebugInfoNoneReg = emitExtInst(SPIRV::NonSemanticExtInst::DebugInfoNone,
784 VoidTypeReg, ExtInstSetReg, {}, MAI);
796 MCRegister DebugInfoVersionReg = emitOpConstantI32(100, I32TypeReg, MAI);
798 emitOpConstantI32(
static_cast<uint32_t>(DwarfVersion), I32TypeReg, MAI);
803 map_to_vector(CompileUnits, [&](
const CompileUnitInfo &Info) {
804 return emitOpConstantI32(Info.SpirvSourceLanguage, I32TypeReg, MAI);
808 for (
auto [Info, SrcLangReg] :
llvm::zip(CompileUnits, SrcLangRegs)) {
809 MCRegister FileStrReg = ScopeToPathOpStringReg.lookup(Info.TheCU);
811 "CU path OpString must be emitted in emitNonSemanticDebugStrings");
812 MCRegister DebugSourceReg = getOrEmitDebugSourceForFileStrReg(
813 FileStrReg, VoidTypeReg, ExtInstSetReg, MAI);
815 SPIRV::NonSemanticExtInst::DebugCompilationUnit, VoidTypeReg,
817 {DebugInfoVersionReg, DwarfVersionReg, DebugSourceReg, SrcLangReg},
820 CUToCompilationUnitDbgReg[Info.TheCU] = CUDbgReg;
825 MCRegister I32ZeroReg = emitOpConstantI32(0, I32TypeReg, MAI);
827 DebugTypeRegs.clear();
830 MCRegister NameReg = getCachedOpStringReg(
BT->getName());
832 static_cast<uint32_t>(
BT->getSizeInBits()), I32TypeReg, MAI);
836 unsigned Encoding = 0;
837 switch (
BT->getEncoding()) {
838 case dwarf::DW_ATE_address:
841 case dwarf::DW_ATE_boolean:
844 case dwarf::DW_ATE_float:
847 case dwarf::DW_ATE_signed:
850 case dwarf::DW_ATE_signed_char:
853 case dwarf::DW_ATE_unsigned:
856 case dwarf::DW_ATE_unsigned_char:
860 MCRegister EncodingReg = emitOpConstantI32(Encoding, I32TypeReg, MAI);
863 SPIRV::NonSemanticExtInst::DebugTypeBasic, VoidTypeReg, ExtInstSetReg,
864 {NameReg, SizeReg, EncodingReg, I32ZeroReg}, MAI);
865 DebugTypeRegs[
BT] = BTReg;
870 if (
auto VecReg = emitDebugTypeVector(VT, ExtInstSetReg, MAI))
871 DebugTypeRegs[VT] = *VecReg;
876 if (
auto PtrReg = emitDebugTypePointer(PT, ExtInstSetReg, MAI))
877 DebugTypeRegs[PT] = *PtrReg;
883 emitDebugTypeFunctionForSubroutineType(ST, ExtInstSetReg, MAI))
884 DebugTypeRegs[ST] = *FnTyReg;
889 if (
auto DeclReg = emitDebugFunctionDeclaration(SP, VoidTypeReg, I32TypeReg,
891 DebugFunctionDeclarationRegs[SP] = *DeclReg;
895 for (
const auto &[GV, Info] : GlobalVariableDebugInfoMap)
896 emitDebugGlobalVariable(GV, Info, VoidTypeReg, I32TypeReg, ExtInstSetReg,
901SPIRVNonSemanticDebugHandler::getDebugFullPath(
const DIScope *Scope)
const {
917MCRegister SPIRVNonSemanticDebugHandler::getOrEmitDebugSourceForFileStrReg(
920 const unsigned Key = FileStrReg.
id();
921 auto It = DebugSourceRegByFileStr.find(
Key);
922 if (It != DebugSourceRegByFileStr.end())
925 MCRegister
DS = emitExtInst(SPIRV::NonSemanticExtInst::DebugSource,
926 VoidTypeReg, ExtInstSetReg, {FileStrReg}, MAI);
927 DebugSourceRegByFileStr[
Key] =
DS;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file contains constants used for implementing Dwarf debug support.
Module.h This file contains the declarations for the Module class.
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
static constexpr unsigned SM(unsigned Version)
static constexpr StringLiteral Filename
Represent a constant reference to an array (0 or more elements consecutively in memory),...
This class is intended to be used as a driving class for all asm writers.
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
const MCSubtargetInfo & getSubtargetInfo() const
Return information about subtarget.
Basic type, like 'int' or 'float'.
DINodeArray getElements() const
DIType * getBaseType() const
A pair of DIGlobalVariable and DIExpression.
DIDerivedType * getStaticDataMemberDeclaration() const
StringRef getLinkageName() const
Tagged DWARF-like metadata node.
LLVM_ABI dwarf::Tag getTag() const
Base class for scope-like contexts.
Subprogram description. Uses SubclassData1.
Type array for a subprogram.
StringRef getName() const
AsmPrinter * Asm
Target of debug info emission.
DebugHandlerBase(AsmPrinter *A)
void beginModule(Module *M) override
Utility to find all debug info in a module.
LLVM_ABI void processModule(const Module &M)
Process entire module and collect debug info anchors.
iterator_range< global_variable_expression_iterator > global_variables() const
iterator_range< subprogram_iterator > subprograms() const
iterator_range< type_iterator > types() const
ValueT lookup(const_arg_type_t< KeyT > Val) const
Return the entry for the specified key, or a default constructed value if no such entry exists.
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&...Args)
Instances of this class represent a single low-level machine instruction.
void addOperand(const MCOperand Op)
void setOpcode(unsigned Op)
static MCOperand createReg(MCRegister Reg)
static MCOperand createImm(int64_t Val)
Wrapper class representing physical registers. Should be passed by value.
constexpr bool isValid() const
constexpr unsigned id() const
Tracking metadata reference owned by Metadata.
bool equalsStr(StringRef Str) const
A Module instance is used to store all the information related to an LLVM module.
void emitNonSemanticDebugStrings(SPIRV::ModuleAnalysisInfo &MAI)
Emit OpString instructions for all NSDI file paths and basic type names into the debug section (secti...
void beginModule(Module *M) override
Collect compile-unit metadata from the module.
void emitNonSemanticGlobalDebugInfo(SPIRV::ModuleAnalysisInfo &MAI)
Emit module-scope NSDI instructions (DebugSource, DebugCompilationUnit, DebugTypeBasic,...
void prepareModuleOutput(const SPIRVSubtarget &ST, SPIRV::ModuleAnalysisInfo &MAI)
Add SPV_KHR_non_semantic_info extension and NonSemantic.Shader.DebugInfo.100 ext inst set entry to MA...
SPIRVNonSemanticDebugHandler(AsmPrinter &AP)
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
void assign(StringRef RHS)
Assign from a StringRef.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
LLVM Value Representation.
Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface o...
LLVM_ABI bool is_absolute(const Twine &path, Style style=Style::native)
Is path absolute?
LLVM_ABI void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
This is an optimization pass for GlobalISel generic memory operations.
detail::zippy< detail::zip_shortest, T, U, Args... > zip(T &&t, U &&u, Args &&...args)
zip iterator for two or more iteratable types.
UnaryFunction for_each(R &&Range, UnaryFunction F)
Provide wrappers to std::for_each which take ranges instead of having to pass begin/end explicitly.
void addStringImm(StringRef Str, MCInst &Inst)
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
auto map_to_vector(ContainerTy &&C, FuncTy &&F)
Map a range to a SmallVector with element types deduced from the mapping.
auto dyn_cast_if_present(const Y &Val)
dyn_cast_if_present<X> - Functionally identical to dyn_cast, except that a null (or none in the case ...
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
auto dyn_cast_or_null(const Y &Val)
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
SPIRV::StorageClass::StorageClass addressSpaceToStorageClass(unsigned AddrSpace, const SPIRVSubtarget &STI)
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
MCRegister getExtInstSetReg(unsigned SetNum)
DenseMap< unsigned, MCRegister > ExtInstSetMap
InstrList & getMSInstrs(unsigned MSType)
MCRegister getRegisterAlias(const MachineFunction *MF, Register Reg)
MCRegister getGlobalObjReg(const GlobalObject *GO)
MCRegister getNextIDRegister()
void addExtension(Extension::Extension ToAdd)