LLVM 23.0.0git
SPIRVModuleAnalysis.cpp File Reference

Go to the source code of this file.

Classes

struct  AvoidCapabilitiesSet

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
namespace  llvm::SPIRV

Macros

#define DEBUG_TYPE   "spirv-module-analysis"
#define ATOM_FLT_REQ_EXT_MSG(ExtName)

Functions

 INITIALIZE_PASS (SPIRVModuleAnalysis, DEBUG_TYPE, "SPIRV module analysis", true, true) static void reportUnsupported(const MachineInstr &MI
Func getContext ().diagnose(DiagnosticInfoUnsupported(Func
Func MI getDebugLoc ()))
static unsigned getMetadataUInt (MDNode *MdNode, unsigned OpIndex, unsigned DefaultVal=0)
static SPIRV::Requirements getSymbolicOperandRequirements (SPIRV::OperandCategory::OperandCategory Category, unsigned i, const SPIRVSubtarget &ST, SPIRV::RequirementHandler &Reqs)
static void appendDecorationsForReg (const MachineRegisterInfo &MRI, Register R, InstrSignature &Signature)
static InstrSignature instrToSignature (const MachineInstr &MI, SPIRV::ModuleAnalysisInfo &MAI, bool UseDefReg)
static void collectOtherInstr (MachineInstr &MI, SPIRV::ModuleAnalysisInfo &MAI, SPIRV::ModuleSectionType MSType, InstrTraces &IS, bool Append=true)
static void addOpDecorateReqs (const MachineInstr &MI, unsigned DecIndex, SPIRV::RequirementHandler &Reqs, const SPIRVSubtarget &ST)
static void addOpTypeImageReqs (const MachineInstr &MI, SPIRV::RequirementHandler &Reqs, const SPIRVSubtarget &ST)
static bool isBFloat16Type (SPIRVTypeInst TypeDef)
static void AddAtomicVectorFloatRequirements (const MachineInstr &MI, SPIRV::RequirementHandler &Reqs, const SPIRVSubtarget &ST)
static void AddAtomicFloatRequirements (const MachineInstr &MI, SPIRV::RequirementHandler &Reqs, const SPIRVSubtarget &ST)
bool isUniformTexelBuffer (MachineInstr *ImageInst)
bool isStorageTexelBuffer (MachineInstr *ImageInst)
bool isSampledImage (MachineInstr *ImageInst)
bool isInputAttachment (MachineInstr *ImageInst)
bool isStorageImage (MachineInstr *ImageInst)
bool isCombinedImageSampler (MachineInstr *SampledImageInst)
bool hasNonUniformDecoration (Register Reg, const MachineRegisterInfo &MRI)
void addOpAccessChainReqs (const MachineInstr &Instr, SPIRV::RequirementHandler &Handler, const SPIRVSubtarget &Subtarget)
static bool isImageTypeWithUnknownFormat (SPIRVTypeInst TypeInst)
static void AddDotProductRequirements (const MachineInstr &MI, SPIRV::RequirementHandler &Reqs, const SPIRVSubtarget &ST)
void addPrintfRequirements (const MachineInstr &MI, SPIRV::RequirementHandler &Reqs, const SPIRVSubtarget &ST)
static void addImageOperandReqs (const MachineInstr &MI, SPIRV::RequirementHandler &Reqs, const SPIRVSubtarget &ST, unsigned OpIdx)
void addInstrRequirements (const MachineInstr &MI, SPIRV::ModuleAnalysisInfo &MAI, const SPIRVSubtarget &ST)
static void collectReqs (const Module &M, SPIRV::ModuleAnalysisInfo &MAI, MachineModuleInfo *MMI, const SPIRVSubtarget &ST)
static unsigned getFastMathFlags (const MachineInstr &I, const SPIRVSubtarget &ST)
static bool isFastMathModeAvailable (const SPIRVSubtarget &ST)
static void handleMIFlagDecoration (MachineInstr &I, const SPIRVSubtarget &ST, const SPIRVInstrInfo &TII, SPIRV::RequirementHandler &Reqs, const SPIRVGlobalRegistry *GR, SPIRV::FPFastMathDefaultInfoVector &FPFastMathDefaultInfoVec)
static void addDecorations (const Module &M, const SPIRVInstrInfo &TII, MachineModuleInfo *MMI, const SPIRVSubtarget &ST, SPIRV::ModuleAnalysisInfo &MAI, const SPIRVGlobalRegistry *GR)
static void addMBBNames (const Module &M, const SPIRVInstrInfo &TII, MachineModuleInfo *MMI, const SPIRVSubtarget &ST, SPIRV::ModuleAnalysisInfo &MAI)
static void patchPhis (const Module &M, SPIRVGlobalRegistry *GR, const SPIRVInstrInfo &TII, MachineModuleInfo *MMI)
static SPIRV::FPFastMathDefaultInfoVector & getOrCreateFPFastMathDefaultInfoVec (const Module &M, SPIRV::ModuleAnalysisInfo &MAI, const Function *F)
static SPIRV::FPFastMathDefaultInfo & getFPFastMathDefaultInfo (SPIRV::FPFastMathDefaultInfoVector &FPFastMathDefaultInfoVec, const Type *Ty)
static void collectFPFastMathDefaults (const Module &M, SPIRV::ModuleAnalysisInfo &MAI, const SPIRVSubtarget &ST)

Variables

static cl::opt< boolSPVDumpDeps ("spv-dump-deps", cl::desc("Dump MIR with SPIR-V dependencies info"), cl::Optional, cl::init(false))
static cl::list< SPIRV::Capability::Capability > AvoidCapabilities ("avoid-spirv-capabilities", cl::desc("SPIR-V capabilities to avoid if there are " "other options enabling a feature"), cl::Hidden, cl::values(clEnumValN(SPIRV::Capability::Shader, "Shader", "SPIR-V Shader capability")))
const charMsg

Macro Definition Documentation

◆ ATOM_FLT_REQ_EXT_MSG

#define ATOM_FLT_REQ_EXT_MSG ( ExtName)
Value:
"The atomic float instruction requires the following SPIR-V " \
"extension: SPV_EXT_shader_atomic_float" ExtName

Definition at line 1193 of file SPIRVModuleAnalysis.cpp.

Referenced by AddAtomicFloatRequirements().

◆ DEBUG_TYPE

#define DEBUG_TYPE   "spirv-module-analysis"

Definition at line 34 of file SPIRVModuleAnalysis.cpp.

Function Documentation

◆ AddAtomicFloatRequirements()

◆ AddAtomicVectorFloatRequirements()

◆ addDecorations()

◆ AddDotProductRequirements()

◆ addImageOperandReqs()

void addImageOperandReqs ( const MachineInstr & MI,
SPIRV::RequirementHandler & Reqs,
const SPIRVSubtarget & ST,
unsigned OpIdx )
static

◆ addInstrRequirements()

◆ addMBBNames()

◆ addOpAccessChainReqs()

◆ addOpDecorateReqs()

◆ addOpTypeImageReqs()

void addOpTypeImageReqs ( const MachineInstr & MI,
SPIRV::RequirementHandler & Reqs,
const SPIRVSubtarget & ST )
static

◆ addPrintfRequirements()

◆ appendDecorationsForReg()

◆ collectFPFastMathDefaults()

◆ collectOtherInstr()

◆ collectReqs()

◆ getContext()

Func getContext ( )

Referenced by llvm::GlobalVariable::addAttribute(), llvm::GlobalVariable::addAttribute(), llvm::GlobalVariable::addAttributes(), llvm::DbgVariableIntrinsic::addVariableLocationOps(), llvm::AMDGPUMachineModuleInfo::AMDGPUMachineModuleInfo(), llvm::AsmPrinter::AsmPrinter(), llvm::coro::BaseCloner::BaseCloner(), llvm::coro::BaseCloner::BaseCloner(), slpvectorizer::BoUpSLP::BoUpSLP(), llvm::CoroIdInst::clearPromise(), llvm::DIBuilder::DIBuilder(), llvm::dxil::DXILBitcodeWriter::DXILBitcodeWriter(), llvm::dxil::DXILOpBuilder::DXILOpBuilder(), llvm::EscapeEnumerator::EscapeEnumerator(), DarwinRISCVAsmBackend::evaluateFixup(), llvm::PPCInstrInfo::finalizeInsInstrs(), llvm::ReleaseModePriorityAdvisorProvider::getAdvisor(), llvm::GlobalVariable::getAttributesAsList(), llvm::dwarf_linker::parallel::CompileUnit::getDirAndFilenameFromLineTable(), getIntSequenceIfElementsMatch(), llvm::SPIRVGlobalRegistry::getOrCreateConstInt(), INITIALIZE_PASS(), llvm::InnerLoopVectorizer::InnerLoopVectorizer(), llvm::InstCombiner::InstCombiner(), llvm::instrumentor::InstrumentorIRBuilderTy::InstrumentorIRBuilderTy(), LLVMBuildArrayMalloc(), LLVMBuildCatchSwitch(), LLVMBuildCleanupPad(), LLVMBuildMalloc(), LLVMGetBuilderContext(), LLVMGetModuleContext(), LLVMGetTypeByName(), LLVMGetTypeContext(), LLVMGetValueContext(), LLVMPointerType(), llvm::LoopConstrainer::LoopConstrainer(), llvm::coro::LowererBase::LowererBase(), llvm::IRAttribute< AK, BaseType, AAType >::manifest(), llvm::MetadataLoader::MetadataLoaderImpl::MetadataLoaderImpl(), llvm::OpenMPIRBuilder::OpenMPIRBuilder(), llvm::PrologEpilogSGPRSpillBuilder::PrologEpilogSGPRSpillBuilder(), llvm::WinCOFFWriter::recordRelocation(), llvm::DbgVariableIntrinsic::replaceVariableLocationOp(), llvm::DbgVariableIntrinsic::replaceVariableLocationOp(), llvm::ScheduleDAGInstrs::ScheduleDAGInstrs(), llvm::DbgAssignIntrinsic::setAddress(), llvm::DbgAssignIntrinsic::setAssignId(), llvm::MemIntrinsicBase< Derived >::setDestAlignment(), llvm::MemIntrinsicBase< Derived >::setDestAlignment(), llvm::InstrProfCntrInstBase::setIndex(), llvm::DbgLabelInst::setLabel(), llvm::DbgVariableIntrinsic::setRawLocation(), llvm::NoAliasScopeDeclInst::setScopeList(), llvm::Function::setUWTableKind(), llvm::DbgAssignIntrinsic::setValue(), llvm::Module::shouldEmitInstrCountChangedRemark(), validExtractValueIndex(), validInsertValueIndex(), validShuffleVectorIndex(), llvm::VerifierSupport::VerifierSupport(), llvm::VPCostContext::VPCostContext(), and llvm::WinCOFFWriter::writeObject().

◆ getDebugLoc()

◆ getFastMathFlags()

◆ getFPFastMathDefaultInfo()

SPIRV::FPFastMathDefaultInfo & getFPFastMathDefaultInfo ( SPIRV::FPFastMathDefaultInfoVector & FPFastMathDefaultInfoVec,
const Type * Ty )
static

◆ getMetadataUInt()

unsigned getMetadataUInt ( MDNode * MdNode,
unsigned OpIndex,
unsigned DefaultVal = 0 )
static

Definition at line 66 of file SPIRVModuleAnalysis.cpp.

References llvm::mdconst::extract(), and llvm::MDNode::getOperand().

◆ getOrCreateFPFastMathDefaultInfoVec()

SPIRV::FPFastMathDefaultInfoVector & getOrCreateFPFastMathDefaultInfoVec ( const Module & M,
SPIRV::ModuleAnalysisInfo & MAI,
const Function * F )
static

◆ getSymbolicOperandRequirements()

◆ handleMIFlagDecoration()

◆ hasNonUniformDecoration()

bool hasNonUniformDecoration ( Register Reg,
const MachineRegisterInfo & MRI )

Definition at line 1363 of file SPIRVModuleAnalysis.cpp.

References MI, Reg, and llvm::MachineRegisterInfo::reg_instructions().

Referenced by addOpAccessChainReqs().

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( SPIRVModuleAnalysis ,
DEBUG_TYPE ,
"SPIRV module analysis" ,
true ,
true  ) const &

References DEBUG_TYPE.

◆ instrToSignature()

◆ isBFloat16Type()

◆ isCombinedImageSampler()

◆ isFastMathModeAvailable()

bool isFastMathModeAvailable ( const SPIRVSubtarget & ST)
static

Definition at line 2795 of file SPIRVModuleAnalysis.cpp.

Referenced by handleMIFlagDecoration().

◆ isImageTypeWithUnknownFormat()

◆ isInputAttachment()

◆ isSampledImage()

◆ isStorageImage()

◆ isStorageTexelBuffer()

bool isStorageTexelBuffer ( MachineInstr * ImageInst)

◆ isUniformTexelBuffer()

bool isUniformTexelBuffer ( MachineInstr * ImageInst)

◆ patchPhis()

Variable Documentation

◆ AvoidCapabilities

cl::list< SPIRV::Capability::Capability > AvoidCapabilities("avoid-spirv-capabilities", cl::desc("SPIR-V capabilities to avoid if there are " "other options enabling a feature"), cl::Hidden, cl::values(clEnumValN(SPIRV::Capability::Shader, "Shader", "SPIR-V Shader capability"))) ( "avoid-spirv-capabilities" ,
cl::desc("SPIR-V capabilities to avoid if there are " "other options enabling a feature") ,
cl::Hidden ,
cl::values(clEnumValN(SPIRV::Capability::Shader, "Shader", "SPIR-V Shader capability"))  )
static

◆ Msg

Func Msg
Initial value:
{
const Function &Func = MI.getMF()->getFunction()
IRTranslator LLVM IR MI

Definition at line 59 of file SPIRVModuleAnalysis.cpp.

Referenced by annotateAllFunctions(), llvm::Annotations::Annotations(), llvm::ELFYAML::appendUniqueSuffix(), applyMnemonicAliases(), llvm::object::ArchiveMemberHeader::ArchiveMemberHeader(), llvm::cantFail(), llvm::cantFail(), llvm::cantFail(), llvm::MCAsmParser::check(), llvm::MCAsmParser::check(), llvm::MCAsmParserExtension::check(), llvm::MCAsmParserExtension::check(), llvm::checkNotNull(), llvm::coverage::CovMapFunctionRecordV1< IntPtrT >::ConstantInt::get(), llvm::Interpreter::create(), llvm::sampleprof::SampleProfileReader::create(), createMemberHeaderParseError(), llvm::orc::shared::WrapperFunctionBuffer::createOutOfBandError(), llvm::orc::shared::WrapperFunctionBuffer::createOutOfBandError(), createReservedKDBitsError(), llvm::cas::ondisk::createTableConfigError(), CSKYMnemonicSpellCheck(), decodeError(), llvm::object::defaultWarningHandler(), llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization(), llvm::DiagnosticInfoOptimizationFailure::DiagnosticInfoOptimizationFailure(), llvm::MIRProfileLoader::doInitialization(), dumpBytes(), llvm::SystemZHazardRecognizer::dumpCurrGroup(), dumpInlineCallStack(), llvm::PMDataManager::dumpPassInfo(), llvm::MachineInstr::emitGenericError(), llvm::MachineInstr::emitInlineAsmError(), llvm::MCAsmParser::Error(), llvm::MCAsmParserExtension::Error(), llvm::TGParser::Error(), llvm::MCLFIRewriter::error(), errorUnsupported(), fail(), fail(), llvm::PMDataManager::freePass(), llvm::DWARFFormValue::getAsCString(), llvm::PMDataManager::getAsPass(), llvm::BlockFrequencyInfoImplBase::getBlockFreq(), getCGDataErrString(), llvm::ExecutionEngine::getConstantValue(), getCoverageMapErrString(), getDebugLoc(), llvm::MCObjectTargetWriter::getFormat(), getInstrProfErrString(), llvm::WebAssemblyAsmPrinter::getMCSymbolForFunction(), llvm::SourceMgr::GetMessage(), llvm::InstrProfError::getMessage(), llvm::object::Archive::Child::getNext(), getStatString(), llvm::mir2vec::MIRVocabulary::getStringKey(), llvm::IndexedInstrProfReader::getSymtab(), initAndLookupTarget(), isValidInt(), llvm::MCAsmParser::Lex(), llvm::ExecutionEngine::LoadValueFromMemory(), llvm::dxil::makeOpError(), makeStringError(), malformedError(), malformedError(), malformedError(), llvm::ErrorInfoBase::message(), llvm::FileError::messageWithoutFileInfo(), NewSDValueDbgMsg(), llvm::MCAsmParser::Note(), llvm::MCAsmParserExtension::Note(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::MCAsmParser::parseEOL(), llvm::LLLexer::ParseError(), llvm::LLLexer::ParseError(), llvm::object::DirectX::parseFailed(), parseFailed(), llvm::MCAsmParser::parseIntToken(), llvm::MIRFormatter::parseIRValue(), llvm::MCAsmParser::parseToken(), llvm::MCAsmParserExtension::parseToken(), llvm::PrintError(), llvm::PrintError(), llvm::PrintError(), llvm::PrintError(), llvm::PrintError(), llvm::MCAsmParser::printError(), llvm::yaml::Stream::printError(), llvm::yaml::Stream::printError(), llvm::PrintFatalError(), llvm::PrintFatalError(), llvm::PrintFatalError(), llvm::PrintFatalError(), llvm::PrintFatalNote(), llvm::PrintFatalNote(), llvm::PrintFatalNote(), llvm::PrintFatalNote(), llvm::SourceMgr::PrintMessage(), llvm::SourceMgr::PrintMessage(), PrintMessage(), PrintModRefResults(), PrintModRefResults(), llvm::PrintNote(), llvm::PrintNote(), llvm::AsmPrinter::PrintSpecial(), llvm::Pattern::printSubstitutions(), llvm::Pattern::printVariableDefAttempts(), llvm::Pattern::printVariableDefs(), llvm::PrintWarning(), llvm::PrintWarning(), llvm::PrintWarning(), llvm::SymbolRemappingReader::read(), readMemprof(), llvm::MCAssembler::recordError(), llvm::PMDataManager::removeDeadPasses(), llvm::json::Path::report(), ReportErrnumFatal(), llvm::HexagonMCChecker::reportError(), llvm::HexagonMCChecker::reportError(), llvm::HexagonShuffler::reportError(), llvm::MCAssembler::reportError(), llvm::MCContext::reportError(), llvm::MCObjectTargetWriter::reportError(), llvm::sampleprof::SampleProfileReader::reportError(), reportError(), llvm::reportGISelFailure(), reportIllegalCopy(), llvm::ReportLastErrorFatal(), reportNodeError(), llvm::HexagonMCChecker::reportNote(), reportOpenError(), llvm::MCCodeEmitter::reportUnsupportedInst(), llvm::MCCodeEmitter::reportUnsupportedOperand(), llvm::LoopVectorizationUtils::reportVectorizationInfo(), llvm::HexagonMCChecker::reportWarning(), llvm::MCContext::reportWarning(), require(), rewriteAbortKHRCall(), sectionOverflowErrorOrWarning(), llvm::setBugReportMsg(), llvm::yaml::Node::setError(), llvm::SMDiagnostic::SMDiagnostic(), llvm::SMDiagnostic::SMDiagnostic(), STATISTIC(), llvm::BTFParser::symbolize(), llvm::MCAsmParser::TokError(), llvm::MCAsmParserExtension::TokError(), llvm::TGParser::TokError(), llvm::cas::ondisk::OnDiskGraphDB::validate(), llvm::yaml::MappingTraits< std::unique_ptr< ELFYAML::Chunk > >::validate(), llvm::cas::ondisk::OnDiskGraphDB::validateObjectID(), validateOnDiskKeyValueDB(), llvm::DWARFVerifier::verifyDebugStrOffsets(), verifyFuncBFI(), llvm::LLLexer::Warning(), llvm::LLLexer::Warning(), llvm::MCAsmParser::Warning(), llvm::MCAsmParserExtension::Warning(), llvm::MCLFIRewriter::warning(), and llvm::remarks::YAMLParseError::YAMLParseError().

◆ SPVDumpDeps

cl::opt< bool > SPVDumpDeps("spv-dump-deps", cl::desc("Dump MIR with SPIR-V dependencies info"), cl::Optional, cl::init(false)) ( "spv-dump-deps" ,
cl::desc("Dump MIR with SPIR-V dependencies info") ,
cl::Optional ,
cl::init(false)  )
static