9#ifndef LLVM_ANALYSIS_DXILRESOURCE_H 
   10#define LLVM_ANALYSIS_DXILRESOURCE_H 
   54    return !Ty->isVoidTy() && !Ty->isIntegerTy(8);
 
 
   64    return T->getName() == 
"dx.RawBuffer";
 
 
 
   86    return T->getName() == 
"dx.TypedBuffer";
 
 
 
  111    return T->getName() == 
"dx.Texture";
 
 
 
  136    return T->getName() == 
"dx.MSTexture";
 
 
 
  160    return T->getName() == 
"dx.FeedbackTexture";
 
 
 
  179    return T->getName() == 
"dx.CBuffer";
 
 
 
  200    return T->getName() == 
"dx.Sampler";
 
 
 
  239    return T->getName() == 
"dx.Layout";
 
 
 
  258    return T->getName() == 
"dx.Padding";
 
 
 
  301             std::tie(
RHS.ElementTy, 
RHS.ElementCount);
 
 
  306             std::tie(
RHS.ElementTy, 
RHS.ElementCount);
 
 
 
 
  373             std::tie(
RHS.RecordID, 
RHS.Space, 
RHS.LowerBound, 
RHS.Size);
 
 
  376      return !(*
this == 
RHS);
 
 
  380             std::tie(
RHS.RecordID, 
RHS.Space, 
RHS.LowerBound, 
RHS.Size);
 
 
  385      if (
Size == UINT32_MAX)
 
 
 
  404      : Binding{RecordID, Space, LowerBound, 
Size}, HandleTy(HandleTy),
 
  405        Name(Name), Symbol(Symbol) {}
 
 
  421  LLVM_ABI std::pair<uint32_t, uint32_t>
 
  425    return std::tie(Binding, HandleTy, Symbol, Name) ==
 
  426           std::tie(
RHS.Binding, 
RHS.HandleTy, 
RHS.Symbol, 
RHS.Name);
 
 
  430    return Binding < 
RHS.Binding;
 
 
 
  446                           ModuleAnalysisManager::Invalidator &Inv);
 
  449    auto It = Infos.find(Ty);
 
  450    if (It != Infos.end())
 
  452    auto [NewIt, Inserted] = Infos.try_emplace(Ty, Ty);
 
  453    return NewIt->second;
 
 
 
  476  virtual void anchor();
 
 
  495  unsigned FirstUAV = 0;
 
  496  unsigned FirstCBuffer = 0;
 
  497  unsigned FirstSampler = 0;
 
  498  bool HasInvalidDirection = 
false;
 
  505  void populateCounterDirections(
Module &M);
 
  523  bool empty()
 const { 
return Infos.empty(); }
 
  526    auto Pos = CallMap.find(
Key);
 
  527    return Pos == CallMap.end() ? Infos.end() : (Infos.begin() + Pos->second);
 
 
  531    auto Pos = CallMap.find(
Key);
 
  532    return Pos == CallMap.end() ? Infos.end() : (Infos.begin() + Pos->second);
 
 
 
  624  std::unique_ptr<DXILResourceMap> Map;
 
  637  bool runOnModule(
Module &M) 
override;
 
  638  void releaseMemory() 
override;
 
 
  661  bool HasImplicitBinding = 
false;
 
  662  bool HasOverlappingBinding = 
false;
 
  676    return Bindings.findAvailableBinding(RC, Space, 
Size);
 
 
 
  696  std::unique_ptr<DXILResourceBindingInfo> BindingInfo;
 
  708  bool runOnModule(
Module &M) 
override;
 
  709  void releaseMemory() 
override;
 
 
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
 
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
 
DXIL Resource Implicit Binding
 
This header defines various interfaces for pass management in LLVM.
 
This file implements a map that provides insertion order iteration.
 
This file defines the SmallVector class.
 
Represent the analysis usage information of a pass.
 
This class represents a function call, abstracting a target machine's calling convention.
 
LLVM_ABI DXILResourceMap run(Module &M, ModuleAnalysisManager &AM)
Gather resource info for the module M.
 
DXILResourceBindingInfo Result
 
LLVM_ABI DXILResourceBindingInfo run(Module &M, ModuleAnalysisManager &AM)
 
bool hasOverlappingBinding() const
 
bool hasImplicitBinding() const
 
friend class DXILResourceBindingWrapperPass
 
void setHasImplicitBinding(bool Value)
 
std::optional< uint32_t > findAvailableBinding(dxil::ResourceClass RC, uint32_t Space, int32_t Size)
 
friend class DXILResourceBindingAnalysis
 
void setHasOverlappingBinding(bool Value)
 
const DXILResourceBindingInfo & getBindingInfo() const
 
DXILResourceBindingInfo & getBindingInfo()
 
~DXILResourceBindingWrapperPass() override
 
DXILResourceBindingWrapperPass()
 
const_iterator sampler_end() const
 
iterator find(const CallInst *Key)
 
bool hasInvalidCounterDirection() const
 
const_iterator find(const CallInst *Key) const
 
iterator_range< iterator > samplers()
 
iterator_range< const_iterator > uavs() const
 
friend class DXILResourceAnalysis
 
const_iterator cbuffer_end() const
 
iterator_range< const_iterator > srvs() const
 
call_iterator call_begin()
 
const_iterator uav_begin() const
 
const_iterator begin() const
 
iterator_range< const_iterator > samplers() const
 
LLVM_ABI void print(raw_ostream &OS, DXILResourceTypeMap &DRTM, const DataLayout &DL) const
 
const_iterator srv_begin() const
 
iterator_range< iterator > srvs()
 
iterator_range< iterator > cbuffers()
 
iterator_range< iterator > uavs()
 
iterator_range< call_iterator > calls()
 
const_iterator uav_end() const
 
const_iterator sampler_begin() const
 
SmallVector< dxil::ResourceInfo >::iterator iterator
 
friend class DXILResourceWrapperPass
 
const_iterator cbuffer_begin() const
 
const_iterator srv_end() const
 
iterator_range< const_iterator > cbuffers() const
 
SmallVector< dxil::ResourceInfo >::const_iterator const_iterator
 
const_iterator end() const
 
DXILResourcePrinterPass(raw_ostream &OS)
 
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
 
DXILResourceTypeMap run(Module &M, ModuleAnalysisManager &AM)
 
DXILResourceTypeMap Result
 
dxil::ResourceTypeInfo & operator[](TargetExtType *Ty)
 
LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA, ModuleAnalysisManager::Invalidator &Inv)
 
DXILResourceTypeWrapperPass()
 
DXILResourceTypeMap & getResourceTypeMap()
 
const DXILResourceTypeMap & getResourceTypeMap() const
 
DXILResourceMap & getResourceMap()
 
DXILResourceWrapperPass()
 
~DXILResourceWrapperPass() override
 
const DXILResourceMap & getResourceMap() const
 
A parsed version of the target data layout string in and methods for querying it.
 
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT > iterator
 
This is an important class for using LLVM in a threaded context.
 
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.
 
A set of analyses that are preserved following a run of a transformation pass.
 
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
 
StringRef - Represent a constant reference to a string, i.e.
 
Class to represent struct types.
 
Class to represent target extensions types, which are generally unintrospectable from target-independ...
 
Type * getTypeParameter(unsigned i) const
 
unsigned getIntParameter(unsigned i) const
 
Type(LLVMContext &C, TypeID tid)
 
LLVM Value Representation.
 
static bool classof(const Type *T)
 
AnyResourceExtType & operator=(const AnyResourceExtType &)=delete
 
static bool classof(const TargetExtType *T)
 
AnyResourceExtType(const AnyResourceExtType &)=delete
 
AnyResourceExtType()=delete
 
static bool classof(const TargetExtType *T)
 
CBufferExtType & operator=(const CBufferExtType &)=delete
 
CBufferExtType(const CBufferExtType &)=delete
 
static bool classof(const Type *T)
 
Type * getResourceType() const
 
dxil::SamplerFeedbackType getFeedbackType() const
 
FeedbackTextureExtType(const FeedbackTextureExtType &)=delete
 
dxil::ResourceKind getDimension() const
 
FeedbackTextureExtType & operator=(const FeedbackTextureExtType &)=delete
 
static bool classof(const TargetExtType *T)
 
FeedbackTextureExtType()=delete
 
static bool classof(const Type *T)
 
static bool classof(const Type *T)
 
LayoutExtType(const LayoutExtType &)=delete
 
LayoutExtType & operator=(const LayoutExtType &)=delete
 
static bool classof(const TargetExtType *T)
 
uint32_t getOffsetOfElement(int I) const
 
Type * getWrappedType() const
 
dxil::ResourceKind getDimension() const
 
MSTextureExtType(const MSTextureExtType &)=delete
 
static bool classof(const TargetExtType *T)
 
MSTextureExtType()=delete
 
Type * getResourceType() const
 
uint32_t getSampleCount() const
 
static bool classof(const Type *T)
 
MSTextureExtType & operator=(const MSTextureExtType &)=delete
 
static bool classof(const TargetExtType *T)
 
PaddingExtType & operator=(const PaddingExtType &)=delete
 
PaddingExtType(const PaddingExtType &)=delete
 
unsigned getNumBytes() const
 
static bool classof(const Type *T)
 
static bool classof(const TargetExtType *T)
 
bool isStructured() const
 
RawBufferExtType()=delete
 
RawBufferExtType(const RawBufferExtType &)=delete
 
static bool classof(const Type *T)
 
RawBufferExtType & operator=(const RawBufferExtType &)=delete
 
Type * getResourceType() const
 
StringRef getName() const
 
bool operator<(const ResourceInfo &RHS) const
 
bool operator!=(const ResourceInfo &RHS) const
 
TargetExtType * getHandleTy() const
 
LLVM_ABI std::pair< uint32_t, uint32_t > getAnnotateProps(Module &M, dxil::ResourceTypeInfo &RTI) const
 
LLVM_ABI void print(raw_ostream &OS, dxil::ResourceTypeInfo &RTI, const DataLayout &DL) const
 
ResourceInfo(uint32_t RecordID, uint32_t Space, uint32_t LowerBound, uint32_t Size, TargetExtType *HandleTy, StringRef Name="", GlobalVariable *Symbol=nullptr)
 
void setBindingID(unsigned ID)
 
bool operator==(const ResourceInfo &RHS) const
 
const ResourceBinding & getBinding() const
 
LLVM_ABI GlobalVariable * createSymbol(Module &M, StructType *Ty)
 
LLVM_ABI MDTuple * getAsMetadata(Module &M, dxil::ResourceTypeInfo &RTI) const
 
ResourceCounterDirection CounterDirection
 
dxil::ResourceClass getResourceClass() const
 
LLVM_ABI uint32_t getMultiSampleCount() const
 
LLVM_ABI uint32_t getCBufferSize(const DataLayout &DL) const
 
LLVM_ABI bool operator<(const ResourceTypeInfo &RHS) const
 
LLVM_ABI bool isUAV() const
 
LLVM_ABI bool isMultiSample() const
 
LLVM_ABI bool isSampler() const
 
LLVM_ABI bool isTyped() const
 
LLVM_ABI dxil::SamplerType getSamplerType() const
 
LLVM_ABI ResourceTypeInfo(TargetExtType *HandleTy, const dxil::ResourceClass RC, const dxil::ResourceKind Kind)
 
LLVM_ABI bool isCBuffer() const
 
LLVM_ABI TypedInfo getTyped() const
 
bool operator!=(const ResourceTypeInfo &RHS) const
 
LLVM_ABI StructType * createElementStruct(StringRef CBufferName="")
 
TargetExtType * getHandleTy() const
 
LLVM_ABI bool isFeedback() const
 
ResourceTypeInfo(TargetExtType *HandleTy)
 
LLVM_ABI UAVInfo getUAV() const
 
LLVM_ABI StructInfo getStruct(const DataLayout &DL) const
 
LLVM_ABI bool isStruct() const
 
LLVM_ABI dxil::SamplerFeedbackType getFeedbackType() const
 
LLVM_ABI bool operator==(const ResourceTypeInfo &RHS) const
 
dxil::ResourceKind getResourceKind() const
 
LLVM_ABI void print(raw_ostream &OS, const DataLayout &DL) const
 
SamplerExtType(const SamplerExtType &)=delete
 
static bool classof(const Type *T)
 
dxil::SamplerType getSamplerType() const
 
SamplerExtType & operator=(const SamplerExtType &)=delete
 
static bool classof(const TargetExtType *T)
 
static bool classof(const TargetExtType *T)
 
dxil::ResourceKind getDimension() const
 
Type * getResourceType() const
 
TextureExtType & operator=(const TextureExtType &)=delete
 
TextureExtType(const TextureExtType &)=delete
 
static bool classof(const Type *T)
 
Type * getResourceType() const
 
TypedBufferExtType & operator=(const TypedBufferExtType &)=delete
 
TypedBufferExtType()=delete
 
static bool classof(const TargetExtType *T)
 
TypedBufferExtType(const TypedBufferExtType &)=delete
 
static bool classof(const Type *T)
 
BindingInfo represents the ranges of bindings and free space for each dxil::ResourceClass.
 
iterator_adaptor_base()=default
 
A range adaptor for a pair of iterators.
 
This class implements an extremely fast bulk output stream that can only output to a stream.
 
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
 
ResourceKind
The kind of resource for an SRV or UAV resource.
 
ElementType
The element type of an SRV or UAV resource.
 
LLVM_ABI StringRef getResourceNameFromBindingCall(CallInst *CI)
 
This is an optimization pass for GlobalISel generic memory operations.
 
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
 
LLVM_ABI ModulePass * createDXILResourceBindingWrapperPassPass()
 
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
 
LLVM_ABI ModulePass * createDXILResourceTypeWrapperPassPass()
 
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
 
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.
 
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
 
LLVM_ABI ModulePass * createDXILResourceWrapperPassPass()
 
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...
 
CallInst * operator*() const
 
call_iterator(CallMapTy::iterator Iter)
 
A CRTP mix-in to automatically provide informational APIs needed for passes.
 
bool operator!=(const ResourceBinding &RHS) const
 
bool operator==(const ResourceBinding &RHS) const
 
bool overlapsWith(const ResourceBinding &RHS) const
 
bool operator<(const ResourceBinding &RHS) const
 
bool operator==(const StructInfo &RHS) const
 
bool operator!=(const StructInfo &RHS) const
 
bool operator<(const StructInfo &RHS) const
 
dxil::ElementType DXILStorageTy
 
bool operator<(const TypedInfo &RHS) const
 
bool operator==(const TypedInfo &RHS) const
 
dxil::ElementType ElementTy
 
bool operator!=(const TypedInfo &RHS) const
 
bool operator!=(const UAVInfo &RHS) const
 
bool operator==(const UAVInfo &RHS) const
 
bool operator<(const UAVInfo &RHS) const