14#ifndef LLVM_LIB_TARGET_SPIRV_SPIRVMODULEANALYSIS_H
15#define LLVM_LIB_TARGET_SPIRV_SPIRVMODULEANALYSIS_H
48 const std::optional<Capability::Capability>
Cap;
54 std::optional<Capability::Capability>
Cap = {},
88 AvailableCaps.clear();
89 AllExtensions.clear();
103 AllExtensions.insert_range(ToAdd);
105 void addExtension(Extension::Extension ToAdd) { AllExtensions.insert(ToAdd); }
120 return AvailableCaps.contains(Cap);
125 const Capability::Capability IfPresent);
132 std::map<const MachineFunction *, LocalToGlobalRegTable>;
138 MemoryModel::MemoryModel
Mem;
139 AddressingModel::AddressingModel
Addr;
171 assert(GO &&
"GlobalObject is null");
186 auto RI = RegTable.find(
Reg);
187 if (RI == RegTable.end()) {
196 return RI->second.find(
Reg) != RI->second.end();
203 auto Key = std::make_pair(
MBB.getParent(),
MBB.getNumber());
208 auto Key = std::make_pair(
MBB.getParent(),
MBB.getNumber());
216 ModuleAnalysisManager::Invalidator &) {
236 void setBaseInfo(
const Module &M);
238 void processOtherInstrs(
const Module &M);
239 void numberRegistersGlobally(
const Module &M);
242 void collectDeclarations(
const Module &M);
244 std::map<const Value *, unsigned> &GlobalToGReg,
247 std::map<const Value *, unsigned> &GlobalToGReg);
252 std::map<const Value *, unsigned> &GlobalToGReg,
256 std::map<const Value *, unsigned> &GlobalToGReg,
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
ReachingDefInfo InstSet & ToRemove
This file defines the DenseMap class.
This header defines various interfaces for pass management in LLVM.
ModuleAnalysisManager MAM
This file defines the SmallSet class.
This file defines the SmallVector class.
Represent the analysis usage information of a pass.
Implements a dense probed hash-table based set.
Wrapper class representing physical registers. Should be passed by value.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
Wrapper class representing virtual and physical registers.
void run(const Module &M)
SPIRVModuleAnalysisImpl(const SPIRVSubtarget &ST, SPIRV::ModuleAnalysisInfo &MAI, MachineFunctionGetter GetMF)
SPIRV::ModuleAnalysisInfo Result
Result run(Module &M, ModuleAnalysisManager &MAM)
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringSet - A wrapper for StringMap that provides set-like functionality.
Represents a version number in the form major[.minor[.subminor[.build]]].
An efficient, type-erasing, non-owning reference to a callable.
@ MB_DebugModuleProcessed
std::map< Register, MCRegister > LocalToGlobalRegTable
SmallVector< const MachineInstr * > InstrList
std::map< const MachineFunction *, LocalToGlobalRegTable > RegisterAliasMapTy
This is an optimization pass for GlobalISel generic memory operations.
SmallVector< SPIRV::Extension::Extension, 8 > ExtensionList
SmallVector< size_t > InstrSignature
function_ref< MachineFunction *(const Function &)> MachineFunctionGetter
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
SmallVector< SPIRV::Capability::Capability, 8 > CapabilityList
std::set< InstrSignature > InstrTraces
std::map< SmallVector< size_t >, unsigned > InstrGRegsMap
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Implement std::hash so that hash_code can be used in STL containers.
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
SPIRV::ModuleAnalysisInfo MAI
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
SPIRVModuleAnalysisWrapperPass()
SmallVector< const MachineInstr *, 4 > GlobalVarList
MCRegister getExtInstSetReg(unsigned SetNum)
bool hasMBBRegister(const MachineBasicBlock &MBB)
DenseMap< std::pair< const MachineFunction *, int >, MCRegister > BBNumToRegMap
DenseMap< unsigned, MCRegister > ExtInstSetMap
void setSkipEmission(const MachineInstr *MI)
DenseSet< const MachineInstr * > InstrsToDelete
bool hasRegisterAlias(const MachineFunction *MF, Register Reg)
RegisterAliasMapTy RegisterAliasTable
InstrList & getMSInstrs(unsigned MSType)
MCRegister getRegisterAlias(const MachineFunction *MF, Register Reg)
bool getSkipEmission(const MachineInstr *MI)
MemoryModel::MemoryModel Mem
MCRegister getOrCreateMBBRegister(const MachineBasicBlock &MBB)
InstrList MS[NUM_MODULE_SECTIONS]
AddressingModel::AddressingModel Addr
void setRegisterAlias(const MachineFunction *MF, Register Reg, MCRegister AliasReg)
bool invalidate(Module &, const PreservedAnalyses &, ModuleAnalysisManager::Invalidator &)
SourceLanguage::SourceLanguage SrcLang
MCRegister getGlobalObjReg(const GlobalObject *GO)
DenseMap< const Function *, SPIRV::FPFastMathDefaultInfoVector > FPFastMathDefaultInfoMap
MCRegister getNextIDRegister()
DenseMap< const GlobalObject *, MCRegister > GlobalObjMap
void checkSatisfiable(const SPIRVSubtarget &ST) const
void getAndAddRequirements(SPIRV::OperandCategory::OperandCategory Category, uint32_t i, const SPIRVSubtarget &ST)
void addRequirements(const Requirements &Req)
bool isCapabilityAvailable(Capability::Capability Cap) const
void removeCapabilityIf(const Capability::Capability ToRemove, const Capability::Capability IfPresent)
void addExtensions(const ExtensionList &ToAdd)
void addAvailableCaps(const CapabilityList &ToAdd)
void addExtension(Extension::Extension ToAdd)
void initAvailableCapabilities(const SPIRVSubtarget &ST)
void addCapability(Capability::Capability ToAdd)
void addCapabilities(const CapabilityList &ToAdd)
const CapabilityList & getMinimalCapabilities() const
const SmallSet< Extension::Extension, 4 > & getExtensions() const
RequirementHandler()=default
Requirements(bool IsSatisfiable=false, std::optional< Capability::Capability > Cap={}, ExtensionList Exts={}, VersionTuple MinVer=VersionTuple(), VersionTuple MaxVer=VersionTuple())
const std::optional< Capability::Capability > Cap
const VersionTuple MinVer
Requirements(Capability::Capability Cap)
const VersionTuple MaxVer