LLVM 24.0.0git
DXILResource.h
Go to the documentation of this file.
1//===- DXILResource.h - Representations of DXIL resources -------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_ANALYSIS_DXILRESOURCE_H
10#define LLVM_ANALYSIS_DXILRESOURCE_H
11
12#include "llvm/ADT/MapVector.h"
14#include "llvm/ADT/StringRef.h"
18#include "llvm/IR/PassManager.h"
19#include "llvm/Pass.h"
23#include <cstdint>
24#include <variant>
25
26namespace llvm {
27class CallInst;
28class DataLayout;
29class LLVMContext;
30class MDTuple;
31class Value;
32
34
35namespace dxil {
36
37// Returns the resource name from dx_resource_handlefrombinding or
38// dx_resource_handlefromimplicitbinding call
39LLVM_ABI StringRef getResourceNameFromBindingCall(CallInst *CI);
40
41/// The dx.RawBuffer target extension type
42///
43/// `target("dx.RawBuffer", Type, IsWriteable, IsROV)`
44class RawBufferExtType : public TargetExtType {
45public:
46 RawBufferExtType() = delete;
49
50 bool isStructured() const {
51 // TODO: We need to be more prescriptive here, but since there's some debate
52 // over whether byte address buffer should have a void type or an i8 type,
53 // accept either for now.
54 Type *Ty = getTypeParameter(0);
55 return !Ty->isVoidTy() && !Ty->isIntegerTy(8);
56 }
57
59 return isStructured() ? getTypeParameter(0) : nullptr;
60 }
61 bool isWriteable() const { return getIntParameter(0); }
62 bool isROV() const { return getIntParameter(1); }
63
64 static bool classof(const TargetExtType *T) {
65 return T->getName() == "dx.RawBuffer";
66 }
67 static bool classof(const Type *T) {
69 }
70};
71
72/// The dx.TypedBuffer target extension type
73///
74/// `target("dx.TypedBuffer", Type, IsWriteable, IsROV, IsSigned)`
75class TypedBufferExtType : public TargetExtType {
76public:
80
81 Type *getResourceType() const { return getTypeParameter(0); }
82 bool isWriteable() const { return getIntParameter(0); }
83 bool isROV() const { return getIntParameter(1); }
84 bool isSigned() const { return getIntParameter(2); }
85
86 static bool classof(const TargetExtType *T) {
87 return T->getName() == "dx.TypedBuffer";
88 }
89 static bool classof(const Type *T) {
91 }
92};
93
94/// The dx.Texture target extension type
95///
96/// `target("dx.Texture", Type, IsWriteable, IsROV, IsSigned, Dimension)`
97class TextureExtType : public TargetExtType {
98public:
99 TextureExtType() = delete;
102
103 Type *getResourceType() const { return getTypeParameter(0); }
104 bool isWriteable() const { return getIntParameter(0); }
105 bool isROV() const { return getIntParameter(1); }
106 bool isSigned() const { return getIntParameter(2); }
108 return static_cast<dxil::ResourceKind>(getIntParameter(3));
109 }
110
111 static bool classof(const TargetExtType *T) {
112 return T->getName() == "dx.Texture";
113 }
114 static bool classof(const Type *T) {
116 }
117};
118
119/// The dx.MSTexture target extension type
120///
121/// `target("dx.MSTexture", Type, IsWriteable, Samples, IsSigned, Dimension)`
122class MSTextureExtType : public TargetExtType {
123public:
127
128 Type *getResourceType() const { return getTypeParameter(0); }
129 bool isWriteable() const { return getIntParameter(0); }
131 bool isSigned() const { return getIntParameter(2); }
133 return static_cast<dxil::ResourceKind>(getIntParameter(3));
134 }
135
136 static bool classof(const TargetExtType *T) {
137 return T->getName() == "dx.MSTexture";
138 }
139 static bool classof(const Type *T) {
141 }
142};
143
144/// The dx.FeedbackTexture target extension type
145///
146/// `target("dx.FeedbackTexture", FeedbackType, Dimension)`
147class FeedbackTextureExtType : public TargetExtType {
148public:
152
157 return static_cast<dxil::ResourceKind>(getIntParameter(1));
158 }
159
160 static bool classof(const TargetExtType *T) {
161 return T->getName() == "dx.FeedbackTexture";
162 }
163 static bool classof(const Type *T) {
165 }
166};
167
168/// The dx.CBuffer target extension type
169///
170/// `target("dx.CBuffer", <Type>, ...)`
171class CBufferExtType : public TargetExtType {
172public:
173 CBufferExtType() = delete;
176
177 Type *getResourceType() const { return getTypeParameter(0); }
178
179 static bool classof(const TargetExtType *T) {
180 return T->getName() == "dx.CBuffer";
181 }
182 static bool classof(const Type *T) {
184 }
185};
186
187/// The dx.Sampler target extension type
188///
189/// `target("dx.Sampler", SamplerType)`
190class SamplerExtType : public TargetExtType {
191public:
192 SamplerExtType() = delete;
195
197 return static_cast<dxil::SamplerType>(getIntParameter(0));
198 }
199
200 static bool classof(const TargetExtType *T) {
201 return T->getName() == "dx.Sampler";
202 }
203 static bool classof(const Type *T) {
205 }
206};
207
208class AnyResourceExtType : public TargetExtType {
209public:
213
215 // Sampler and feedback resources do not have an underlying type.
217 return nullptr;
218 // All other resources store the type in a parameter.
219 return getTypeParameter(0);
220 }
221
228
229 static bool classof(const Type *T) {
231 }
232};
233
234/// The dx.Layout target extension type
235///
236/// `target("dx.Layout", <Type>, <size>, [offsets...])`
237class LayoutExtType : public TargetExtType {
238public:
239 LayoutExtType() = delete;
240 LayoutExtType(const LayoutExtType &) = delete;
242
243 Type *getWrappedType() const { return getTypeParameter(0); }
244 uint32_t getSize() const { return getIntParameter(0); }
245 uint32_t getOffsetOfElement(int I) const { return getIntParameter(I + 1); }
246
247 static bool classof(const TargetExtType *T) {
248 return T->getName() == "dx.Layout";
249 }
250 static bool classof(const Type *T) {
252 }
253};
254
255/// The dx.Padding target extension type
256///
257/// `target("dx.Padding", NumBytes)`
258class PaddingExtType : public TargetExtType {
259public:
260 PaddingExtType() = delete;
263
264 unsigned getNumBytes() const { return getIntParameter(0); }
265
266 static bool classof(const TargetExtType *T) {
267 return T->getName() == "dx.Padding";
268 }
269 static bool classof(const Type *T) {
271 }
272};
273
274//===----------------------------------------------------------------------===//
275
277public:
278 struct UAVInfo {
279 bool IsROV;
280
281 bool operator==(const UAVInfo &RHS) const { return IsROV == RHS.IsROV; }
282 bool operator!=(const UAVInfo &RHS) const { return !(*this == RHS); }
283 bool operator<(const UAVInfo &RHS) const { return IsROV < RHS.IsROV; }
284 };
285
286 struct StructInfo {
288 // Note: we store an integer here rather than using `MaybeAlign` because in
289 // GCC 7 MaybeAlign isn't trivial so having one in this union would delete
290 // our move constructor.
291 // See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0602r4.html
293
294 bool operator==(const StructInfo &RHS) const {
295 return std::tie(Stride, AlignLog2) == std::tie(RHS.Stride, RHS.AlignLog2);
296 }
297 bool operator!=(const StructInfo &RHS) const { return !(*this == RHS); }
298 bool operator<(const StructInfo &RHS) const {
299 return std::tie(Stride, AlignLog2) < std::tie(RHS.Stride, RHS.AlignLog2);
300 }
301 };
302
303 struct TypedInfo {
307
308 bool operator==(const TypedInfo &RHS) const {
309 return std::tie(ElementTy, ElementCount) ==
310 std::tie(RHS.ElementTy, RHS.ElementCount);
311 }
312 bool operator!=(const TypedInfo &RHS) const { return !(*this == RHS); }
313 bool operator<(const TypedInfo &RHS) const {
314 return std::tie(ElementTy, ElementCount) <
315 std::tie(RHS.ElementTy, RHS.ElementCount);
316 }
317 };
318
319private:
320 TargetExtType *HandleTy;
321
324
325public:
327 const dxil::ResourceClass RC,
328 const dxil::ResourceKind Kind);
331
332 TargetExtType *getHandleTy() const { return HandleTy; }
334
335 // Conditions to check before accessing specific views.
336 LLVM_ABI bool isUAV() const;
337 LLVM_ABI bool isCBuffer() const;
338 LLVM_ABI bool isSampler() const;
339 LLVM_ABI bool isStruct() const;
340 LLVM_ABI bool isTyped() const;
341 LLVM_ABI bool isFeedback() const;
342 LLVM_ABI bool isMultiSample() const;
343
344 // Views into the type.
345 LLVM_ABI UAVInfo getUAV() const;
348 LLVM_ABI StructInfo getStruct(const DataLayout &DL) const;
349 LLVM_ABI TypedInfo getTyped() const;
352
354 dxil::ResourceKind getResourceKind() const { return Kind; }
355
356 LLVM_ABI bool operator==(const ResourceTypeInfo &RHS) const;
357 bool operator!=(const ResourceTypeInfo &RHS) const { return !(*this == RHS); }
358 LLVM_ABI bool operator<(const ResourceTypeInfo &RHS) const;
359
360 LLVM_ABI void print(raw_ostream &OS, const DataLayout &DL) const;
361};
362
363//===----------------------------------------------------------------------===//
364
371
373public:
379
385
386 bool operator==(const ResourceBinding &RHS) const {
387 return std::tie(BindingID, Space, LowerBound, Size) ==
388 std::tie(RHS.BindingID, RHS.Space, RHS.LowerBound, RHS.Size);
389 }
390 bool operator!=(const ResourceBinding &RHS) const {
391 return !(*this == RHS);
392 }
393 bool operator<(const ResourceBinding &RHS) const {
394 // a size of 0 indicates unbounded. Accounting for when the size is 0
395 // guarantees a well ordered results.
396 const bool LHSIsUnbounded = Size == 0;
397 const bool RHSIsUnbounded = RHS.Size == 0;
398 return std::tie(BindingID, Space, LowerBound, LHSIsUnbounded, Size) <
399 std::tie(RHS.BindingID, RHS.Space, RHS.LowerBound, RHSIsUnbounded,
400 RHS.Size);
401 }
402 bool overlapsWith(const ResourceBinding &RHS) const {
403 if (Space != RHS.Space)
404 return false;
405 if (Size == 0)
406 return LowerBound < RHS.LowerBound;
407 return LowerBound + Size - 1 >= RHS.LowerBound;
408 }
409 };
410
411private:
412 std::variant<ResourceBinding, uint32_t> BindingOrHeapID;
413 TargetExtType *HandleTy;
414 StringRef Name;
415 GlobalVariable *Symbol = nullptr;
416
417public:
418 bool GloballyCoherent = false;
420 bool HasAtomic64Use = false;
421
423 TargetExtType *HandleTy, StringRef Name = "",
424 GlobalVariable *Symbol = nullptr)
425 : BindingOrHeapID{ResourceBinding{0, Space, LowerBound, Size}},
426 HandleTy(HandleTy), Name(Name), Symbol(Symbol) {}
427
428 ResourceInfo(uint32_t HeapResourceID, TargetExtType *HandleTy)
429 : BindingOrHeapID{HeapResourceID}, HandleTy(HandleTy), Name(""),
430 Symbol(nullptr) {}
431
432 bool hasBinding() const {
433 return std::holds_alternative<ResourceBinding>(BindingOrHeapID);
434 }
435 void setBindingID(unsigned ID) {
436 assert(hasBinding() && "Resource does not have a binding");
437 std::get<ResourceBinding>(BindingOrHeapID).BindingID = ID;
438 }
439
443
445 assert(hasBinding() && "Resource does not have a binding");
446 return std::get<ResourceBinding>(BindingOrHeapID);
447 }
448
450 assert(!hasBinding() && "Resource does not have a heap ID");
451 return std::get<uint32_t>(BindingOrHeapID);
452 }
453
455 return hasBinding() ? std::get<ResourceBinding>(BindingOrHeapID).Size : 1;
456 }
457
458 TargetExtType *getHandleTy() const { return HandleTy; }
459 StringRef getName() const { return Name; }
460
461 bool hasSymbol() const { return Symbol; }
464
465 LLVM_ABI std::pair<uint32_t, uint32_t>
467
468 bool operator==(const ResourceInfo &RHS) const {
469 return std::tie(BindingOrHeapID, HandleTy, Symbol, Name) ==
470 std::tie(RHS.BindingOrHeapID, RHS.HandleTy, RHS.Symbol, RHS.Name);
471 }
472 bool operator!=(const ResourceInfo &RHS) const { return !(*this == RHS); }
473 bool operator<(const ResourceInfo &RHS) const {
474 return BindingOrHeapID < RHS.BindingOrHeapID;
475 }
476
478 const DataLayout &DL) const;
479};
480
481} // namespace dxil
482
483//===----------------------------------------------------------------------===//
484
487
488public:
489 LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
490 ModuleAnalysisManager::Invalidator &Inv);
491
493 auto It = Infos.find(Ty);
494 if (It != Infos.end())
495 return It->second;
496 auto [NewIt, Inserted] = Infos.try_emplace(Ty, Ty);
497 return NewIt->second;
498 }
499};
500
502 : public AnalysisInfoMixin<DXILResourceTypeAnalysis> {
504
505 LLVM_ABI static AnalysisKey Key;
506
507public:
509
511 // Running the pass just generates an empty map, which will be filled when
512 // users of the pass query the results.
513 return Result();
514 }
515};
516
519
520 virtual void anchor();
521
522public:
523 static char ID;
525
527 const DXILResourceTypeMap &getResourceTypeMap() const { return DRTM; }
528};
529
531
532//===----------------------------------------------------------------------===//
533
535 using CallMapTy = DenseMap<CallInst *, unsigned>;
536
538 CallMapTy CallMap;
539 unsigned FirstUAV = 0;
540 unsigned FirstCBuffer = 0;
541 unsigned FirstSampler = 0;
542 bool HasInvalidDirection = false;
543
544 /// Populate all the resource instance data.
545 void populate(Module &M, DXILResourceTypeMap &DRTM);
546 /// Populate the map given the resource binding calls in the given module.
547 void populateResourceInfos(Module &M, DXILResourceTypeMap &DRTM);
548 /// Analyze uses to fill in per-resource dynamic state — counter directions
549 /// and 64-bit atomic use.
550 void populateFromInstructions(Module &M);
551 void populateAtomicUses(Instruction &I);
552 void populateRecordCounterDirection(Instruction &I);
553
554 /// Resolves a resource handle into a vector of ResourceInfos that
555 /// represent the possible unique creations of the handle. Certain cases are
556 /// ambiguous so multiple creation instructions may be returned. The resulting
557 /// ResourceInfo can be used to depuplicate unique handles that
558 /// reference the same resource
560
561public:
564
565 iterator begin() { return Infos.begin(); }
566 const_iterator begin() const { return Infos.begin(); }
567 iterator end() { return Infos.end(); }
568 const_iterator end() const { return Infos.end(); }
569
570 bool empty() const { return Infos.empty(); }
571
573 auto Pos = CallMap.find(Key);
574 return Pos == CallMap.end() ? Infos.end() : (Infos.begin() + Pos->second);
575 }
576
578 auto Pos = CallMap.find(Key);
579 return Pos == CallMap.end() ? Infos.end() : (Infos.begin() + Pos->second);
580 }
581
582 iterator srv_begin() { return begin(); }
583 const_iterator srv_begin() const { return begin(); }
584 iterator srv_end() { return begin() + FirstUAV; }
585 const_iterator srv_end() const { return begin() + FirstUAV; }
590
591 iterator uav_begin() { return begin() + FirstUAV; }
592 const_iterator uav_begin() const { return begin() + FirstUAV; }
593 iterator uav_end() { return begin() + FirstCBuffer; }
594 const_iterator uav_end() const { return begin() + FirstCBuffer; }
599
600 iterator cbuffer_begin() { return begin() + FirstCBuffer; }
601 const_iterator cbuffer_begin() const { return begin() + FirstCBuffer; }
602 iterator cbuffer_end() { return begin() + FirstSampler; }
603 const_iterator cbuffer_end() const { return begin() + FirstSampler; }
610
611 iterator sampler_begin() { return begin() + FirstSampler; }
612 const_iterator sampler_begin() const { return begin() + FirstSampler; }
613 iterator sampler_end() { return end(); }
614 const_iterator sampler_end() const { return end(); }
621
623 : iterator_adaptor_base<call_iterator, CallMapTy::iterator> {
624 call_iterator() = default;
627
628 CallInst *operator*() const { return I->first; }
629 };
630
631 call_iterator call_begin() { return call_iterator(CallMap.begin()); }
632 call_iterator call_end() { return call_iterator(CallMap.end()); }
636
637 bool hasInvalidCounterDirection() const { return HasInvalidDirection; }
638
640 const DataLayout &DL) const;
641
644};
645
646class DXILResourceAnalysis : public AnalysisInfoMixin<DXILResourceAnalysis> {
648
649 LLVM_ABI static AnalysisKey Key;
650
651public:
653
654 /// Gather resource info for the module \c M.
656};
657
658/// Printer pass for the \c DXILResourceAnalysis results.
660 : public RequiredPassInfoMixin<DXILResourcePrinterPass> {
661 raw_ostream &OS;
662
663public:
664 explicit DXILResourcePrinterPass(raw_ostream &OS) : OS(OS) {}
665
667};
668
670 std::unique_ptr<DXILResourceMap> Map;
672
673public:
674 static char ID; // Class identification, replacement for typeinfo
675
678
679 const DXILResourceMap &getResourceMap() const { return *Map; }
680 DXILResourceMap &getResourceMap() { return *Map; }
681
682 void getAnalysisUsage(AnalysisUsage &AU) const override;
683 bool runOnModule(Module &M) override;
684 void releaseMemory() override;
685
686 void print(raw_ostream &OS, const Module *M) const override;
687 void dump() const;
688};
689
691
692//===----------------------------------------------------------------------===//
693
694// DXILResourceBindingInfo stores the results of DXILResourceBindingAnalysis
695// which analyses all llvm.dx.resource.handlefrombinding calls in the module
696// and puts together lists of used virtual register spaces and available
697// virtual register slot ranges for each binding type.
698// It also stores additional information found during the analysis such as
699// whether the module uses implicit bindings or if any of the bindings overlap.
700//
701// This information will be used in DXILResourceImplicitBindings pass to assign
702// register slots to resources with implicit bindings, and in a
703// post-optimization validation pass that will raise diagnostic about
704// overlapping bindings.
706 hlsl::BindingInfo Bindings;
707 bool HasImplicitBinding = false;
708 bool HasOverlappingBinding = false;
709
710 // Populate the resource binding info given explicit resource binding calls
711 // in the module.
712 void populate(Module &M, DXILResourceTypeMap &DRTM);
713
714public:
715 bool hasImplicitBinding() const { return HasImplicitBinding; }
716 void setHasImplicitBinding(bool Value) { HasImplicitBinding = Value; }
717 bool hasOverlappingBinding() const { return HasOverlappingBinding; }
718 void setHasOverlappingBinding(bool Value) { HasOverlappingBinding = Value; }
719
720 std::optional<uint32_t> findAvailableBinding(dxil::ResourceClass RC,
721 uint32_t Space, int32_t Size) {
722 return Bindings.findAvailableBinding(RC, Space, Size);
723 }
724
727};
728
730 : public AnalysisInfoMixin<DXILResourceBindingAnalysis> {
732
733 LLVM_ABI static AnalysisKey Key;
734
735public:
737
739};
740
742 std::unique_ptr<DXILResourceBindingInfo> BindingInfo;
743
744public:
745 static char ID;
746
749
750 DXILResourceBindingInfo &getBindingInfo() { return *BindingInfo; }
751 const DXILResourceBindingInfo &getBindingInfo() const { return *BindingInfo; }
752
753 void getAnalysisUsage(AnalysisUsage &AU) const override;
754 bool runOnModule(Module &M) override;
755 void releaseMemory() override;
756};
757
759
760} // namespace llvm
761
762#endif // LLVM_ANALYSIS_DXILRESOURCE_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
#define LLVM_ABI
Definition Compiler.h:215
This header defines various interfaces for pass management in LLVM.
#define I(x, y, z)
Definition MD5.cpp:57
This file implements a map that provides insertion order iteration.
#define T
This file defines the SmallVector class.
Value * RHS
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)
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()
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
call_iterator call_end()
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)
dxil::ResourceTypeInfo & operator[](TargetExtType *Ty)
LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA, ModuleAnalysisManager::Invalidator &Inv)
DXILResourceTypeMap & getResourceTypeMap()
const DXILResourceTypeMap & getResourceTypeMap() const
DXILResourceMap & getResourceMap()
const DXILResourceMap & getResourceMap() const
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT > iterator
Definition DenseMap.h:133
ImmutablePass(char &pid)
Definition Pass.h:287
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
Tuple of metadata.
Definition Metadata.h:1484
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition Pass.h:255
ModulePass(char &pid)
Definition Pass.h:257
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
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.
Definition StringRef.h:56
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)
Definition Type.h:95
LLVM Value Representation.
Definition Value.h:75
static bool classof(const Type *T)
AnyResourceExtType & operator=(const AnyResourceExtType &)=delete
static bool classof(const TargetExtType *T)
AnyResourceExtType(const 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)
static bool classof(const Type *T)
static bool classof(const Type *T)
LayoutExtType(const LayoutExtType &)=delete
uint32_t getSize() const
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)
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)
RawBufferExtType(const RawBufferExtType &)=delete
static bool classof(const Type *T)
RawBufferExtType & operator=(const RawBufferExtType &)=delete
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
uint32_t getSize() const
LLVM_ABI void print(raw_ostream &OS, dxil::ResourceTypeInfo &RTI, const DataLayout &DL) const
void setBindingID(unsigned ID)
uint32_t getHeapID() const
bool operator==(const ResourceInfo &RHS) const
const ResourceBinding & getBinding() const
ResourceInfo(uint32_t HeapResourceID, TargetExtType *HandleTy)
LLVM_ABI GlobalVariable * createSymbol(Module &M, StructType *Ty)
ResourceInfo(uint32_t Space, uint32_t LowerBound, uint32_t Size, TargetExtType *HandleTy, StringRef Name="", GlobalVariable *Symbol=nullptr)
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)
TypedBufferExtType & operator=(const 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.
Definition HLSLBinding.h:46
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
ResourceKind
The kind of resource for an SRV or UAV resource.
Definition DXILABI.h:44
SamplerFeedbackType
Definition DXILABI.h:105
ElementType
The element type of an SRV or UAV resource.
Definition DXILABI.h:68
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...
Definition Casting.h:547
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.
Definition STLExtras.h:1917
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
LLVM_ABI ModulePass * createDXILResourceWrapperPassPass()
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Definition MIRParser.h:39
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:878
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...
Definition Analysis.h:29
call_iterator(CallMapTy::iterator Iter)
A CRTP mix-in for passes that should not be skipped.
bool operator!=(const ResourceBinding &RHS) const
ResourceBinding(uint32_t BindingID, uint32_t Space, uint32_t LowerBound, uint32_t Size)
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
bool operator<(const TypedInfo &RHS) const
bool operator==(const TypedInfo &RHS) const
bool operator!=(const TypedInfo &RHS) const
bool operator!=(const UAVInfo &RHS) const
bool operator==(const UAVInfo &RHS) const
bool operator<(const UAVInfo &RHS) const