14#ifndef LLVM_LIB_TARGET_SPIRV_SPIRVMODULEANALYSIS_H
15#define LLVM_LIB_TARGET_SPIRV_SPIRVMODULEANALYSIS_H
27class MachineModuleInfo;
48 const std::optional<Capability::Capability>
Cap;
54 std::optional<Capability::Capability>
Cap = {},
88 AvailableCaps.
clear();
89 AllExtensions.
clear();
125 const Capability::Capability IfPresent);
132 std::map<const MachineFunction *, LocalToGlobalRegTable>;
138 MemoryModel::MemoryModel
Mem;
139 AddressingModel::AddressingModel
Addr;
164 assert(
F &&
"Function is null");
165 auto FuncPtrRegPair =
FuncMap.find(
F);
167 : FuncPtrRegPair->second;
181 auto RI = RegTable.find(
Reg);
182 if (RI == RegTable.end()) {
191 return RI->second.find(
Reg) != RI->second.end();
198 auto Key = std::make_pair(
MBB.getParent(),
MBB.getNumber());
203 auto Key = std::make_pair(
MBB.getParent(),
MBB.getNumber());
221 :
ModulePass(
ID), ST(nullptr), GR(nullptr), TII(nullptr), MMI(nullptr) {}
228 void setBaseInfo(
const Module &M);
230 void processOtherInstrs(
const Module &M);
231 void numberRegistersGlobally(
const Module &M);
234 void collectDeclarations(
const Module &M);
236 std::map<const Value *, unsigned> &GlobalToGReg,
239 std::map<const Value *, unsigned> &GlobalToGReg);
244 std::map<const Value *, unsigned> &GlobalToGReg,
247 std::map<const Value *, unsigned> &GlobalToGReg,
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
ReachingDefAnalysis InstSet & ToRemove
This file defines the DenseMap class.
const HexagonInstrInfo * TII
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.
This class contains meta information specific to a module.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
A Module instance is used to store all the information related to an LLVM module.
Wrapper class representing virtual and physical registers.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
void insert_range(Range &&R)
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
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]]].
bool contains(const_arg_type_t< ValueT > V) const
Check if the set contains the given element.
std::map< const MachineFunction *, LocalToGlobalRegTable > RegisterAliasMapTy
@ MB_DebugModuleProcessed
std::map< Register, MCRegister > LocalToGlobalRegTable
This is an optimization pass for GlobalISel generic memory operations.
std::set< InstrSignature > InstrTraces
std::map< SmallVector< size_t >, unsigned > InstrGRegsMap
static struct SPIRV::ModuleAnalysisInfo MAI
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
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
DenseMap< const Function *, MCRegister > FuncMap
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)
SourceLanguage::SourceLanguage SrcLang
MCRegister getFuncReg(const Function *F)
MCRegister getNextIDRegister()
void addCapabilities(const CapabilityList &ToAdd)
bool isCapabilityAvailable(Capability::Capability Cap) const
void addExtensions(const ExtensionList &ToAdd)
void checkSatisfiable(const SPIRVSubtarget &ST) const
void getAndAddRequirements(SPIRV::OperandCategory::OperandCategory Category, uint32_t i, const SPIRVSubtarget &ST)
void addExtension(Extension::Extension ToAdd)
void initAvailableCapabilities(const SPIRVSubtarget &ST)
void removeCapabilityIf(const Capability::Capability ToRemove, const Capability::Capability IfPresent)
void addCapability(Capability::Capability ToAdd)
void addAvailableCaps(const CapabilityList &ToAdd)
const CapabilityList & getMinimalCapabilities() const
const SmallSet< Extension::Extension, 4 > & getExtensions() const
void addRequirements(const Requirements &Req)
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