LLVM 23.0.0git
llvm::SPIRVNonSemanticDebugHandler Class Reference

AsmPrinter handler that emits NonSemantic.Shader.DebugInfo.100 (NSDI) instructions for the SPIR-V backend. More...

#include "Target/SPIRV/SPIRVNonSemanticDebugHandler.h"

Inheritance diagram for llvm::SPIRVNonSemanticDebugHandler:
[legend]

Public Member Functions

 SPIRVNonSemanticDebugHandler (AsmPrinter &AP)
void beginModule (Module *M) override
 Collect compile-unit metadata from the module.
void emitNonSemanticDebugStrings (SPIRV::ModuleAnalysisInfo &MAI)
 Emit OpString instructions for all NSDI file paths and basic type names into the debug section (section 7 of the SPIR-V module layout).
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 MAI.
void emitNonSemanticGlobalDebugInfo (SPIRV::ModuleAnalysisInfo &MAI)
 Emit module-scope NSDI instructions (DebugSource, DebugCompilationUnit, DebugTypeBasic, DebugTypePointer).
Public Member Functions inherited from llvm::DebugHandlerBase
 ~DebugHandlerBase () override
void beginFunction (const MachineFunction *MF) override
 Gather pre-function debug information.
void endFunction (const MachineFunction *MF) override
 Gather post-function debug information.
void beginBasicBlockSection (const MachineBasicBlock &MBB) override
 Process the beginning of a new basic-block-section within a function.
void endBasicBlockSection (const MachineBasicBlock &MBB) override
 Process the end of a basic-block-section within a function.
MCSymbolgetLabelBeforeInsn (const MachineInstr *MI)
 Return Label preceding the instruction.
MCSymbolgetLabelAfterInsn (const MachineInstr *MI)
 Return Label immediately following the instruction.
const InstructionOrderinggetInstOrdering () const
const LexicalScopesgetLexicalScopes () const
Public Member Functions inherited from llvm::AsmPrinterHandler
virtual ~AsmPrinterHandler ()
 Pin vtables to this file.
virtual void markFunctionEnd ()
virtual void setSymbolSize (const MCSymbol *Sym, uint64_t Size)
 For symbols that have a size designated (e.g.
virtual void beginCodeAlignment (const MachineBasicBlock &MBB)
virtual void beginFunclet (const MachineBasicBlock &MBB, MCSymbol *Sym=nullptr)
 Emit target-specific EH funclet machinery.
virtual void endFunclet ()

Protected Member Functions

void endModule () override
 Emit all sections that should come after the content.
void beginInstruction (const MachineInstr *MI) override
 Process beginning of an instruction.
void endInstruction () override
 Process end of an instruction.
void beginFunctionImpl (const MachineFunction *MF) override
void endFunctionImpl (const MachineFunction *MF) override
Protected Member Functions inherited from llvm::DebugHandlerBase
 DebugHandlerBase (AsmPrinter *A)
void identifyScopeMarkers ()
 Indentify instructions that are marking the beginning of or ending of a scope.
void requestLabelBeforeInsn (const MachineInstr *MI)
 Ensure that a label will be emitted before MI.
void requestLabelAfterInsn (const MachineInstr *MI)
 Ensure that a label will be emitted after MI.
virtual void skippedNonDebugFunction ()

Additional Inherited Members

Static Public Member Functions inherited from llvm::DebugHandlerBase
static uint64_t getBaseTypeSize (const DIType *Ty)
 If this type is derived from a base type then return base type size.
static bool isUnsignedDIType (const DIType *Ty)
 Return true if type encoding is unsigned.
Protected Attributes inherited from llvm::DebugHandlerBase
AsmPrinterAsm = nullptr
 Target of debug info emission.
MachineModuleInfoMMI = nullptr
 Collected machine module information.
DebugLoc PrevInstLoc
 Previous instruction's location information.
MCSymbolPrevLabel = nullptr
const MachineBasicBlockPrevInstBB = nullptr
const MachineInstrPrologEndLoc
 This location indicates end of function prologue and beginning of function body.
const MachineBasicBlockEpilogBeginBlock = nullptr
 This block includes epilogue instructions.
const MachineInstrCurMI = nullptr
 If nonnull, stores the current machine instruction we're processing.
LexicalScopes LScopes
DbgValueHistoryMap DbgValues
 History of DBG_VALUE and clobber instructions for each user variable.
DbgLabelInstrMap DbgLabels
 Mapping of inlined labels and DBG_LABEL machine instruction.
DenseMap< const MachineInstr *, MCSymbol * > LabelsBeforeInsn
 Maps instruction with label emitted before instruction.
DenseMap< const MachineInstr *, MCSymbol * > LabelsAfterInsn
 Maps instruction with label emitted after instruction.

Detailed Description

AsmPrinter handler that emits NonSemantic.Shader.DebugInfo.100 (NSDI) instructions for the SPIR-V backend.

Registered with SPIRVAsmPrinter when the module contains debug info (llvm.dbg.cu).

Call sequence: beginModule() – collect compile-unit metadata. prepareModuleOutput() – add extension + ext inst set to MAI. emitNonSemanticGlobalDebugInfo() – emit DebugSource, DebugCompilationUnit, DebugTypeBasic, DebugTypePointer. beginFunctionImpl() – no-op (no per-function DI yet). endFunctionImpl() – no-op.

Definition at line 48 of file SPIRVNonSemanticDebugHandler.h.

Constructor & Destructor Documentation

◆ SPIRVNonSemanticDebugHandler()

SPIRVNonSemanticDebugHandler::SPIRVNonSemanticDebugHandler ( AsmPrinter & AP)
explicit

Member Function Documentation

◆ beginFunctionImpl()

void llvm::SPIRVNonSemanticDebugHandler::beginFunctionImpl ( const MachineFunction * MF)
inlineoverrideprotectedvirtual

Implements llvm::DebugHandlerBase.

Definition at line 133 of file SPIRVNonSemanticDebugHandler.h.

◆ beginInstruction()

void llvm::SPIRVNonSemanticDebugHandler::beginInstruction ( const MachineInstr * MI)
inlineoverrideprotectedvirtual

Process beginning of an instruction.

Reimplemented from llvm::DebugHandlerBase.

Definition at line 126 of file SPIRVNonSemanticDebugHandler.h.

References MI.

◆ beginModule()

void SPIRVNonSemanticDebugHandler::beginModule ( Module * M)
overridevirtual

◆ emitNonSemanticDebugStrings()

void SPIRVNonSemanticDebugHandler::emitNonSemanticDebugStrings ( SPIRV::ModuleAnalysisInfo & MAI)

Emit OpString instructions for all NSDI file paths and basic type names into the debug section (section 7 of the SPIR-V module layout).

Must be called from SPIRVAsmPrinter::outputDebugSourceAndStrings(), after prepareModuleOutput() has registered the ext inst set. The resulting registers are cached in FileStringRegs and BasicTypeNameRegs for use by emitNonSemanticGlobalDebugInfo().

Definition at line 248 of file SPIRVNonSemanticDebugHandler.cpp.

References llvm::SPIRV::ModuleAnalysisInfo::getExtInstSetReg(), and llvm::MCRegister::isValid().

◆ emitNonSemanticGlobalDebugInfo()

void SPIRVNonSemanticDebugHandler::emitNonSemanticGlobalDebugInfo ( SPIRV::ModuleAnalysisInfo & MAI)

Emit module-scope NSDI instructions (DebugSource, DebugCompilationUnit, DebugTypeBasic, DebugTypePointer).

Called by SPIRVAsmPrinter:: outputModuleSections() at section 10 in place of outputModuleSection(MB_NonSemanticGlobalDI).

Definition at line 267 of file SPIRVNonSemanticDebugHandler.cpp.

References assert(), llvm::SPIRV::ModuleAnalysisInfo::getExtInstSetReg(), llvm::MCRegister::isValid(), llvm::map_to_vector(), and llvm::zip().

◆ endFunctionImpl()

void llvm::SPIRVNonSemanticDebugHandler::endFunctionImpl ( const MachineFunction * MF)
inlineoverrideprotectedvirtual

Implements llvm::DebugHandlerBase.

Definition at line 135 of file SPIRVNonSemanticDebugHandler.h.

◆ endInstruction()

void llvm::SPIRVNonSemanticDebugHandler::endInstruction ( )
inlineoverrideprotectedvirtual

Process end of an instruction.

Reimplemented from llvm::DebugHandlerBase.

Definition at line 127 of file SPIRVNonSemanticDebugHandler.h.

◆ endModule()

void llvm::SPIRVNonSemanticDebugHandler::endModule ( )
inlineoverrideprotectedvirtual

Emit all sections that should come after the content.

Implements llvm::AsmPrinterHandler.

Definition at line 116 of file SPIRVNonSemanticDebugHandler.h.

◆ prepareModuleOutput()

void SPIRVNonSemanticDebugHandler::prepareModuleOutput ( const SPIRVSubtarget & ST,
SPIRV::ModuleAnalysisInfo & MAI )

Add SPV_KHR_non_semantic_info extension and NonSemantic.Shader.DebugInfo.100 ext inst set entry to MAI.

Must be called before outputGlobalRequirements() and outputOpExtInstImports() in SPIRVAsmPrinter::outputModuleSections().

Definition at line 113 of file SPIRVNonSemanticDebugHandler.cpp.

References llvm::SPIRV::RequirementHandler::addExtension(), llvm::SPIRV::ModuleAnalysisInfo::ExtInstSetMap, llvm::SPIRV::ModuleAnalysisInfo::getNextIDRegister(), and llvm::SPIRV::ModuleAnalysisInfo::Reqs.


The documentation for this class was generated from the following files: