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>;
140 MemoryModel::MemoryModel
Mem;
141 AddressingModel::AddressingModel
Addr;
188 assert(GO &&
"GlobalObject is null");
203 auto RI = RegTable.find(
Reg);
204 if (RI == RegTable.end()) {
213 return RI->second.find(
Reg) != RI->second.end();
220 auto Key = std::make_pair(
MBB.getParent(),
MBB.getNumber());
225 auto Key = std::make_pair(
MBB.getParent(),
MBB.getNumber());
234 return "amdgpu.no.fine.grained.memory";
236 return "amdgpu.no.remote.memory";
238 return "atomic.ignore.denormal.mode";
244 ModuleAnalysisManager::Invalidator &) {
264 void setBaseInfo(
const Module &M);
266 void processOtherInstrs(
const Module &M);
267 void numberRegistersGlobally(
const Module &M);
270 void collectDeclarations(
const Module &M);
272 std::map<const Value *, unsigned> &GlobalToGReg,
275 std::map<const Value *, unsigned> &GlobalToGReg);
280 std::map<const Value *, unsigned> &GlobalToGReg,
284 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.
Represent a constant reference to a string, i.e.
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.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ MB_DebugModuleProcessed
DenseMap< const Function *, FPFastMathDefaultInfoVector > FPFastMathDefaultInfoMapTy
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()
const MachineFunction * MF
FPFastMathDefaultInfoMapTy FPFastMathDefaultInfoMap
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)
SmallVector< InstrAuxDataRecord > InstrAuxDataRecords
InstrList MS[NUM_MODULE_SECTIONS]
AddressingModel::AddressingModel Addr
void setRegisterAlias(const MachineFunction *MF, Register Reg, MCRegister AliasReg)
static StringRef getAMDGPUAtomicMDName(AMDGPUAtomicMDKind Kind)
bool invalidate(Module &, const PreservedAnalyses &, ModuleAnalysisManager::Invalidator &)
SmallVector< std::pair< MCRegister, StringRef > > MBBNames
SourceLanguage::SourceLanguage SrcLang
MCRegister getGlobalObjReg(const GlobalObject *GO)
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