LLVM 20.0.0git
Classes | Namespaces | Macros | Typedefs | Functions | Variables
SPIRVModuleAnalysis.cpp File Reference
#include "SPIRVModuleAnalysis.h"
#include "MCTargetDesc/SPIRVBaseInfo.h"
#include "MCTargetDesc/SPIRVMCTargetDesc.h"
#include "SPIRV.h"
#include "SPIRVSubtarget.h"
#include "SPIRVTargetMachine.h"
#include "SPIRVUtils.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/TargetPassConfig.h"

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)
 

Typedefs

using InstrTraces = std::set< InstrSignature >
 

Functions

void llvm::initializeSPIRVModuleAnalysisPass (PassRegistry &)
 
 INITIALIZE_PASS (SPIRVModuleAnalysis, DEBUG_TYPE, "SPIRV module analysis", true, true) static unsigned getMetadataUInt(MDNode *MdNode
 
static InstrSignature instrToSignature (MachineInstr &MI, SPIRV::ModuleAnalysisInfo &MAI)
 
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 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 (SPIRVType *TypeInst)
 
static void AddDotProductRequirements (const MachineInstr &MI, SPIRV::RequirementHandler &Reqs, const SPIRVSubtarget &ST)
 
void addInstrRequirements (const MachineInstr &MI, SPIRV::RequirementHandler &Reqs, const SPIRVSubtarget &ST)
 
static void collectReqs (const Module &M, SPIRV::ModuleAnalysisInfo &MAI, MachineModuleInfo *MMI, const SPIRVSubtarget &ST)
 
static unsigned getFastMathFlags (const MachineInstr &I)
 
static void handleMIFlagDecoration (MachineInstr &I, const SPIRVSubtarget &ST, const SPIRVInstrInfo &TII, SPIRV::RequirementHandler &Reqs)
 
static void addDecorations (const Module &M, const SPIRVInstrInfo &TII, MachineModuleInfo *MMI, const SPIRVSubtarget &ST, SPIRV::ModuleAnalysisInfo &MAI)
 
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)
 

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::ZeroOrMore, cl::Hidden, cl::values(clEnumValN(SPIRV::Capability::Shader, "Shader", "SPIR-V Shader capability")))
 
unsigned OpIndex
 
unsigned unsigned DefaultVal
 

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 828 of file SPIRVModuleAnalysis.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "spirv-module-analysis"

Definition at line 30 of file SPIRVModuleAnalysis.cpp.

Typedef Documentation

◆ InstrTraces

using InstrTraces = std::set<InstrSignature>

Definition at line 372 of file SPIRVModuleAnalysis.cpp.

Function Documentation

◆ AddAtomicFloatRequirements()

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

◆ addDecorations()

static void addDecorations ( const Module M,
const SPIRVInstrInfo TII,
MachineModuleInfo MMI,
const SPIRVSubtarget ST,
SPIRV::ModuleAnalysisInfo MAI 
)
static

◆ AddDotProductRequirements()

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

◆ addInstrRequirements()

void addInstrRequirements ( const MachineInstr MI,
SPIRV::RequirementHandler Reqs,
const SPIRVSubtarget ST 
)

◆ addMBBNames()

static void addMBBNames ( const Module M,
const SPIRVInstrInfo TII,
MachineModuleInfo MMI,
const SPIRVSubtarget ST,
SPIRV::ModuleAnalysisInfo MAI 
)
static

◆ addOpAccessChainReqs()

void addOpAccessChainReqs ( const MachineInstr Instr,
SPIRV::RequirementHandler Handler,
const SPIRVSubtarget Subtarget 
)

◆ addOpDecorateReqs()

static void addOpDecorateReqs ( const MachineInstr MI,
unsigned  DecIndex,
SPIRV::RequirementHandler Reqs,
const SPIRVSubtarget ST 
)
static

◆ addOpTypeImageReqs()

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

◆ collectOtherInstr()

static void collectOtherInstr ( MachineInstr MI,
SPIRV::ModuleAnalysisInfo MAI,
SPIRV::ModuleSectionType  MSType,
InstrTraces IS,
bool  Append = true 
)
static

◆ collectReqs()

static void collectReqs ( const Module M,
SPIRV::ModuleAnalysisInfo MAI,
MachineModuleInfo MMI,
const SPIRVSubtarget ST 
)
static

◆ getFastMathFlags()

static unsigned getFastMathFlags ( const MachineInstr I)
static

◆ handleMIFlagDecoration()

static void handleMIFlagDecoration ( MachineInstr I,
const SPIRVSubtarget ST,
const SPIRVInstrInfo TII,
SPIRV::RequirementHandler Reqs 
)
static

◆ hasNonUniformDecoration()

bool hasNonUniformDecoration ( Register  Reg,
const MachineRegisterInfo MRI 
)

Definition at line 938 of file SPIRVModuleAnalysis.cpp.

References MI, and MRI.

Referenced by addOpAccessChainReqs().

◆ INITIALIZE_PASS()

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

◆ instrToSignature()

static InstrSignature instrToSignature ( MachineInstr MI,
SPIRV::ModuleAnalysisInfo MAI 
)
static

◆ isCombinedImageSampler()

bool isCombinedImageSampler ( MachineInstr SampledImageInst)

◆ isImageTypeWithUnknownFormat()

static bool isImageTypeWithUnknownFormat ( SPIRVType TypeInst)
static

◆ isInputAttachment()

bool isInputAttachment ( MachineInstr ImageInst)

◆ isSampledImage()

bool isSampledImage ( MachineInstr ImageInst)

◆ isStorageImage()

bool isStorageImage ( MachineInstr ImageInst)

◆ isStorageTexelBuffer()

bool isStorageTexelBuffer ( MachineInstr ImageInst)

◆ isUniformTexelBuffer()

bool isUniformTexelBuffer ( MachineInstr ImageInst)

◆ patchPhis()

static void patchPhis ( const Module M,
SPIRVGlobalRegistry GR,
const SPIRVInstrInfo TII,
MachineModuleInfo MMI 
)
static

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::ZeroOrMore, 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::ZeroOrMore  ,
cl::Hidden  ,
cl::values(clEnumValN(SPIRV::Capability::Shader, "Shader", "SPIR-V Shader capability"))   
)
static

◆ DefaultVal

unsigned unsigned DefaultVal

Definition at line 64 of file SPIRVModuleAnalysis.cpp.

Referenced by llvm::AMDGPU::getIntegerVecAttribute().

◆ OpIndex

unsigned OpIndex

◆ 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