#include "llvm/Analysis/DXILResource.h"
#include "llvm/ADT/APInt.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsDirectX.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/InitializePasses.h"
#define DEBUG_TYPE …
usingnamespacellvm;
usingnamespacedxil;
static StringRef getResourceClassName(ResourceClass RC) { … }
static StringRef getResourceKindName(ResourceKind RK) { … }
static StringRef getElementTypeName(ElementType ET) { … }
static StringRef getSamplerTypeName(SamplerType ST) { … }
static StringRef getSamplerFeedbackTypeName(SamplerFeedbackType SFT) { … }
bool ResourceInfo::isUAV() const { … }
bool ResourceInfo::isCBuffer() const { … }
bool ResourceInfo::isSampler() const { … }
bool ResourceInfo::isStruct() const { … }
bool ResourceInfo::isTyped() const { … }
bool ResourceInfo::isFeedback() const { … }
bool ResourceInfo::isMultiSample() const { … }
ResourceInfo ResourceInfo::SRV(Value *Symbol, StringRef Name,
ElementType ElementTy, uint32_t ElementCount,
ResourceKind Kind) { … }
ResourceInfo ResourceInfo::RawBuffer(Value *Symbol, StringRef Name) { … }
ResourceInfo ResourceInfo::StructuredBuffer(Value *Symbol, StringRef Name,
uint32_t Stride,
MaybeAlign Alignment) { … }
ResourceInfo ResourceInfo::Texture2DMS(Value *Symbol, StringRef Name,
ElementType ElementTy,
uint32_t ElementCount,
uint32_t SampleCount) { … }
ResourceInfo ResourceInfo::Texture2DMSArray(Value *Symbol, StringRef Name,
ElementType ElementTy,
uint32_t ElementCount,
uint32_t SampleCount) { … }
ResourceInfo ResourceInfo::UAV(Value *Symbol, StringRef Name,
ElementType ElementTy, uint32_t ElementCount,
bool GloballyCoherent, bool IsROV,
ResourceKind Kind) { … }
ResourceInfo ResourceInfo::RWRawBuffer(Value *Symbol, StringRef Name,
bool GloballyCoherent, bool IsROV) { … }
ResourceInfo ResourceInfo::RWStructuredBuffer(Value *Symbol, StringRef Name,
uint32_t Stride,
MaybeAlign Alignment,
bool GloballyCoherent, bool IsROV,
bool HasCounter) { … }
ResourceInfo ResourceInfo::RWTexture2DMS(Value *Symbol, StringRef Name,
ElementType ElementTy,
uint32_t ElementCount,
uint32_t SampleCount,
bool GloballyCoherent) { … }
ResourceInfo ResourceInfo::RWTexture2DMSArray(Value *Symbol, StringRef Name,
ElementType ElementTy,
uint32_t ElementCount,
uint32_t SampleCount,
bool GloballyCoherent) { … }
ResourceInfo ResourceInfo::FeedbackTexture2D(Value *Symbol, StringRef Name,
SamplerFeedbackType FeedbackTy) { … }
ResourceInfo
ResourceInfo::FeedbackTexture2DArray(Value *Symbol, StringRef Name,
SamplerFeedbackType FeedbackTy) { … }
ResourceInfo ResourceInfo::CBuffer(Value *Symbol, StringRef Name,
uint32_t Size) { … }
ResourceInfo ResourceInfo::Sampler(Value *Symbol, StringRef Name,
SamplerType SamplerTy) { … }
bool ResourceInfo::operator==(const ResourceInfo &RHS) const { … }
bool ResourceInfo::operator<(const ResourceInfo &RHS) const { … }
MDTuple *ResourceInfo::getAsMetadata(LLVMContext &Ctx) const { … }
std::pair<uint32_t, uint32_t> ResourceInfo::getAnnotateProps() const { … }
void ResourceInfo::print(raw_ostream &OS) const { … }
static dxil::ElementType toDXILElementType(Type *Ty, bool IsSigned) { … }
namespace {
class ResourceMapper { … };
}
DXILResourceMap::DXILResourceMap(
SmallVectorImpl<std::pair<CallInst *, dxil::ResourceInfo>> &&CIToRI) { … }
void DXILResourceMap::print(raw_ostream &OS) const { … }
AnalysisKey DXILResourceAnalysis::Key;
DXILResourceMap DXILResourceAnalysis::run(Module &M,
ModuleAnalysisManager &AM) { … }
PreservedAnalyses DXILResourcePrinterPass::run(Module &M,
ModuleAnalysisManager &AM) { … }
DXILResourceWrapperPass::DXILResourceWrapperPass() : … { … }
DXILResourceWrapperPass::~DXILResourceWrapperPass() = default;
void DXILResourceWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { … }
bool DXILResourceWrapperPass::runOnModule(Module &M) { … }
void DXILResourceWrapperPass::releaseMemory() { … }
void DXILResourceWrapperPass::print(raw_ostream &OS, const Module *) const { … }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD
void DXILResourceWrapperPass::dump() const { print(dbgs(), nullptr); }
#endif
INITIALIZE_PASS(…)
char DXILResourceWrapperPass::ID = …;
ModulePass *llvm::createDXILResourceWrapperPassPass() { … }