28 if (!Entry || Entry->getNumOperands() == 0)
32 for (
auto *Res : Entry->operands()) {
39 if (!Entry || Entry->getNumOperands() == 0)
43 for (
auto *Res : Entry->operands()) {
61 LowerBound(R.getResourceIndex()), RangeSize(1) {
117 case Kinds::RawBuffer:
120 case Kinds::StructuredBuffer:
128 case Kinds::NumEntries:
135 case Kinds::NumEntries:
138 case Kinds::Texture1D:
140 case Kinds::Texture2D:
142 case Kinds::Texture2DMS:
144 case Kinds::Texture3D:
146 case Kinds::TextureCube:
148 case Kinds::Texture1DArray:
150 case Kinds::Texture2DArray:
152 case Kinds::Texture2DMSArray:
154 case Kinds::TextureCubeArray:
156 case Kinds::TypedBuffer:
158 case Kinds::RawBuffer:
160 case Kinds::StructuredBuffer:
168 case Kinds::RTAccelerationStructure:
170 case Kinds::FeedbackTexture2D:
172 case Kinds::FeedbackTexture2DArray:
173 return "fbtex2darray";
184 case Kinds::RawBuffer:
185 case Kinds::StructuredBuffer:
195 case Kinds::TypedBuffer:
198 case Kinds::Texture2DMS:
199 case Kinds::Texture2DMSArray: {
202 DimName += std::to_string(SampleCount);
210 case Kinds::NumEntries:
217 std::string ResID = IDPrefix.
str();
218 ResID += std::to_string(
ID);
221 std::string Bind = BindingPrefix.
str();
224 Bind +=
",space" + std::to_string(
Space);
237 parseSourceType(R.getSourceType());
259void UAVResource::parseSourceType(
StringRef S) {
262 S = S.
substr(strlen(
"RasterizerOrdered"));
264 S = S.
substr(strlen(
"RW"));
271 .
StartsWith(
"ByteAddressBuffer<", Kinds::RawBuffer)
272 .
StartsWith(
"StructuredBuffer<", Kinds::StructuredBuffer)
274 assert(Shape != Kinds::Invalid &&
"Unsupported buffer type");
280 S = S.
substr(PrefixLen, S.
find(
",") - PrefixLen);
320 for (
auto &Res :
Data)
328 Entries.emplace_back(
359 Entries[10] = ExtProps.write(Ctx);
377 for (
auto &Res :
Data)
382 Entry->eraseFromParent();
388 Metadata *ResourceMDs[4] = {
nullptr,
nullptr,
nullptr,
nullptr};
390 ResourceMDs[1] = UAVs.write(M);
392 ResourceMDs[2] = CBuffers.write(M);
394 bool HasResource = ResourceMDs[0] !=
nullptr || ResourceMDs[1] !=
nullptr ||
395 ResourceMDs[2] !=
nullptr || ResourceMDs[3] !=
nullptr;
398 NamedMDNode *DXResMD = M.getOrInsertNamedMetadata(
"dx.resources");
402 NamedMDNode *Entry = M.getNamedMetadata(
"hlsl.uavs");
404 Entry->eraseFromParent();
409 <<
"; Resource Bindings:\n"
411 <<
"; Name Type Format Dim "
412 "ID HLSL Bind Count\n"
413 <<
"; ------------------------------ ---------- ------- ----------- "
414 "------- -------------- ------\n";
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Module.h This file contains the declarations for the Module class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
static GlobalVariable * getGlobalVariable(Module &M, Type *Ty, WebAssemblyTargetMachine &TM, const char *Name)
Type * getValueType() const
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
This is an important class for using LLVM in a threaded context.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static MDString * get(LLVMContext &Context, StringRef Str)
A Module instance is used to store all the information related to an LLVM module.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
void addOperand(MDNode *M)
reference emplace_back(ArgTypes &&... Args)
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.
std::string str() const
str - Get the contents as an std::string.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
constexpr size_t size() const
size - Get the string size.
bool startswith(StringRef Prefix) const
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
StringSwitch & StartsWith(StringLiteral S, T Value)
LLVMContext & getContext() const
All values hold a context through their type.
ConstantBuffer(uint32_t I, hlsl::FrontendResource R)
void setSize(CBufferDataLayout &DL)
void print(raw_ostream &O) const
void print(raw_ostream &O, StringRef IDPrefix, StringRef BindingPrefix) const
ResourceBase(uint32_t I, hlsl::FrontendResource R)
static void printKind(Kinds Kind, unsigned Alignment, raw_ostream &OS, bool SRV=false, bool HasCounter=false, uint32_t SampleCount=0)
static StringRef getKindName(Kinds Kind)
static void printComponentType(Kinds Kind, ComponentType CompType, unsigned Alignment, raw_ostream &OS)
static StringRef getComponentTypeName(ComponentType CompType)
void write(LLVMContext &Ctx, MutableArrayRef< Metadata * > Entries) const
void print(raw_ostream &O) const
MDNode * write(Module &M) const
LLVM_DUMP_METHOD void dump() const
void print(raw_ostream &O) const
void write(Module &M) const
UAVResource(uint32_t I, hlsl::FrontendResource R)
void print(raw_ostream &O) const
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
FormattedString right_justify(StringRef Str, unsigned Width)
right_justify - add spaces before string so total output is Width characters.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
FormattedString left_justify(StringRef Str, unsigned Width)
left_justify - append spaces after string so total output is Width characters.
std::optional< ComponentType > ElementType
MDNode * write(LLVMContext &Ctx) const