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 MDTuple;
30class Value;
31
33
34namespace dxil {
35
36// Returns the resource name from dx_resource_handlefrombinding or
37// dx_resource_handlefromimplicitbinding call
38LLVM_ABI StringRef getResourceNameFromBindingCall(CallInst *CI);
39
40/// The dx.RawBuffer target extension type
41///
42/// `target("dx.RawBuffer", Type, IsWriteable, IsROV)`
43class RawBufferExtType : public TargetExtType {
44public:
45 RawBufferExtType() = delete;
48
49 bool isStructured() const {
50 // TODO: We need to be more prescriptive here, but since there's some debate
51 // over whether byte address buffer should have a void type or an i8 type,
52 // accept either for now.
53 Type *Ty = getTypeParameter(0);
54 return !Ty->isVoidTy() && !Ty->isIntegerTy(8);
55 }
56
58 return isStructured() ? getTypeParameter(0) : nullptr;
59 }
60 bool isWriteable() const { return getIntParameter(0); }
61 bool isROV() const { return getIntParameter(1); }
62
63 static bool classof(const TargetExtType *T) {
64 return T->getName() == "dx.RawBuffer";
65 }
66 static bool classof(const Type *T) {
68 }
69};
70
71/// The dx.TypedBuffer target extension type
72///
73/// `target("dx.TypedBuffer", Type, IsWriteable, IsROV, IsSigned)`
74class TypedBufferExtType : public TargetExtType {
75public:
79
80 Type *getResourceType() const { return getTypeParameter(0); }
81 bool isWriteable() const { return getIntParameter(0); }
82 bool isROV() const { return getIntParameter(1); }
83 bool isSigned() const { return getIntParameter(2); }
84
85 static bool classof(const TargetExtType *T) {
86 return T->getName() == "dx.TypedBuffer";
87 }
88 static bool classof(const Type *T) {
90 }
91};
92
93/// The dx.Texture target extension type
94///
95/// `target("dx.Texture", Type, IsWriteable, IsROV, IsSigned, Dimension)`
96class TextureExtType : public TargetExtType {
97public:
98 TextureExtType() = delete;
99 TextureExtType(const TextureExtType &) = delete;
101
102 Type *getResourceType() const { return getTypeParameter(0); }
103 bool isWriteable() const { return getIntParameter(0); }
104 bool isROV() const { return getIntParameter(1); }
105 bool isSigned() const { return getIntParameter(2); }
107 return static_cast<dxil::ResourceKind>(getIntParameter(3));
108 }
109
110 static bool classof(const TargetExtType *T) {
111 return T->getName() == "dx.Texture";
112 }
113 static bool classof(const Type *T) {
115 }
116};
117
118/// The dx.MSTexture target extension type
119///
120/// `target("dx.MSTexture", Type, IsWriteable, Samples, IsSigned, Dimension)`
121class MSTextureExtType : public TargetExtType {
122public:
126
127 Type *getResourceType() const { return getTypeParameter(0); }
128 bool isWriteable() const { return getIntParameter(0); }
130 bool isSigned() const { return getIntParameter(2); }
132 return static_cast<dxil::ResourceKind>(getIntParameter(3));
133 }
134
135 static bool classof(const TargetExtType *T) {
136 return T->getName() == "dx.MSTexture";
137 }
138 static bool classof(const Type *T) {
140 }
141};
142
143/// The dx.FeedbackTexture target extension type
144///
145/// `target("dx.FeedbackTexture", FeedbackType, Dimension)`
146class FeedbackTextureExtType : public TargetExtType {
147public:
151
156 return static_cast<dxil::ResourceKind>(getIntParameter(1));
157 }
158
159 static bool classof(const TargetExtType *T) {
160 return T->getName() == "dx.FeedbackTexture";
161 }
162 static bool classof(const Type *T) {
164 }
165};
166
167/// The dx.CBuffer target extension type
168///
169/// `target("dx.CBuffer", <Type>, ...)`
170class CBufferExtType : public TargetExtType {
171public:
172 CBufferExtType() = delete;
175
176 Type *getResourceType() const { return getTypeParameter(0); }
177
178 static bool classof(const TargetExtType *T) {
179 return T->getName() == "dx.CBuffer";
180 }
181 static bool classof(const Type *T) {
183 }
184};
185
186/// The dx.Sampler target extension type
187///
188/// `target("dx.Sampler", SamplerType)`
189class SamplerExtType : public TargetExtType {
190public:
191 SamplerExtType() = delete;
194
196 return static_cast<dxil::SamplerType>(getIntParameter(0));
197 }
198
199 static bool classof(const TargetExtType *T) {
200 return T->getName() == "dx.Sampler";
201 }
202 static bool classof(const Type *T) {
204 }
205};
206
207class AnyResourceExtType : public TargetExtType {
208public:
212
214 // Sampler and feedback resources do not have an underlying type.
216 return nullptr;
217 // All other resources store the type in a parameter.
218 return getTypeParameter(0);
219 }
220
227
228 static bool classof(const Type *T) {
230 }
231};
232
233/// The dx.Layout target extension type
234///
235/// `target("dx.Layout", <Type>, <size>, [offsets...])`
236class LayoutExtType : public TargetExtType {
237public:
238 LayoutExtType() = delete;
239 LayoutExtType(const LayoutExtType &) = delete;
241
242 Type *getWrappedType() const { return getTypeParameter(0); }
243 uint32_t getSize() const { return getIntParameter(0); }
244 uint32_t getOffsetOfElement(int I) const { return getIntParameter(I + 1); }
245
246 static bool classof(const TargetExtType *T) {
247 return T->getName() == "dx.Layout";
248 }
249 static bool classof(const Type *T) {
251 }
252};
253
254/// The dx.Padding target extension type
255///
256/// `target("dx.Padding", NumBytes)`
257class PaddingExtType : public TargetExtType {
258public:
259 PaddingExtType() = delete;
262
263 unsigned getNumBytes() const { return getIntParameter(0); }
264
265 static bool classof(const TargetExtType *T) {
266 return T->getName() == "dx.Padding";
267 }
268 static bool classof(const Type *T) {
270 }
271};
272
273//===----------------------------------------------------------------------===//
274
276public:
277 struct UAVInfo {
278 bool IsROV;
279
280 bool operator==(const UAVInfo &RHS) const { return IsROV == RHS.IsROV; }
281 bool operator!=(const UAVInfo &RHS) const { return !(*this == RHS); }
282 bool operator<(const UAVInfo &RHS) const { return IsROV < RHS.IsROV; }
283 };
284
285 struct StructInfo {
287 // Note: we store an integer here rather than using `MaybeAlign` because in
288 // GCC 7 MaybeAlign isn't trivial so having one in this union would delete
289 // our move constructor.
290 // See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0602r4.html
292
293 bool operator==(const StructInfo &RHS) const {
294 return std::tie(Stride, AlignLog2) == std::tie(RHS.Stride, RHS.AlignLog2);
295 }
296 bool operator!=(const StructInfo &RHS) const { return !(*this == RHS); }
297 bool operator<(const StructInfo &RHS) const {
298 return std::tie(Stride, AlignLog2) < std::tie(RHS.Stride, RHS.AlignLog2);
299 }
300 };
301
302 struct TypedInfo {
306
307 bool operator==(const TypedInfo &RHS) const {
308 return std::tie(ElementTy, ElementCount) ==
309 std::tie(RHS.ElementTy, RHS.ElementCount);
310 }
311 bool operator!=(const TypedInfo &RHS) const { return !(*this == RHS); }
312 bool operator<(const TypedInfo &RHS) const {
313 return std::tie(ElementTy, ElementCount) <
314 std::tie(RHS.ElementTy, RHS.ElementCount);
315 }
316 };
317
318private:
319 TargetExtType *HandleTy;
320
323
324public:
326 const dxil::ResourceClass RC,
327 const dxil::ResourceKind Kind);
330
331 TargetExtType *getHandleTy() const { return HandleTy; }
333
334 // Conditions to check before accessing specific views.
335 LLVM_ABI bool isUAV() const;
336 LLVM_ABI bool isCBuffer() const;
337 LLVM_ABI bool isSampler() const;
338 LLVM_ABI bool isStruct() const;
339 LLVM_ABI bool isTyped() const;
340 LLVM_ABI bool isFeedback() const;
341 LLVM_ABI bool isMultiSample() const;
342
343 // Views into the type.
344 LLVM_ABI UAVInfo getUAV() const;
347 LLVM_ABI StructInfo getStruct(const DataLayout &DL) const;
348 LLVM_ABI TypedInfo getTyped() const;
351
353 dxil::ResourceKind getResourceKind() const { return Kind; }
354
355 LLVM_ABI bool operator==(const ResourceTypeInfo &RHS) const;
356 bool operator!=(const ResourceTypeInfo &RHS) const { return !(*this == RHS); }
357 LLVM_ABI bool operator<(const ResourceTypeInfo &RHS) const;
358
359 LLVM_ABI void print(raw_ostream &OS, const DataLayout &DL) const;
360};
361
362//===----------------------------------------------------------------------===//
363
370
372public:
378
384
385 bool operator==(const ResourceBinding &RHS) const {
386 return std::tie(BindingID, Space, LowerBound, Size) ==
387 std::tie(RHS.BindingID, RHS.Space, RHS.LowerBound, RHS.Size);
388 }
389 bool operator!=(const ResourceBinding &RHS) const {
390 return !(*this == RHS);
391 }
392 bool operator<(const ResourceBinding &RHS) const {
393 // a size of 0 indicates unbounded. Accounting for when the size is 0
394 // guarantees a well ordered results.
395 const bool LHSIsUnbounded = Size == 0;
396 const bool RHSIsUnbounded = RHS.Size == 0;
397 return std::tie(BindingID, Space, LowerBound, LHSIsUnbounded, Size) <
398 std::tie(RHS.BindingID, RHS.Space, RHS.LowerBound, RHSIsUnbounded,
399 RHS.Size);
400 }
401 bool overlapsWith(const ResourceBinding &RHS) const {
402 if (Space != RHS.Space)
403 return false;
404 if (Size == 0)
405 return LowerBound < RHS.LowerBound;
406 return LowerBound + Size - 1 >= RHS.LowerBound;
407 }
408 };
409
410private:
411 std::variant<ResourceBinding, uint32_t> BindingOrHeapID;
412 TargetExtType *HandleTy;
413 StringRef Name;
414 GlobalVariable *Symbol = nullptr;
415
416public:
417 bool GloballyCoherent = false;
419 bool HasAtomic64Use = false;
420
422 TargetExtType *HandleTy, StringRef Name = "",
423 GlobalVariable *Symbol = nullptr)
424 : BindingOrHeapID{ResourceBinding{0, Space, LowerBound, Size}},
425 HandleTy(HandleTy), Name(Name), Symbol(Symbol) {}
426
427 ResourceInfo(uint32_t HeapResourceID, TargetExtType *HandleTy)
428 : BindingOrHeapID{HeapResourceID}, HandleTy(HandleTy), Name(""),
429 Symbol(nullptr) {}
430
431 bool hasBinding() const {
432 return std::holds_alternative<ResourceBinding>(BindingOrHeapID);
433 }
434 void setBindingID(unsigned ID) {
435 assert(hasBinding() && "Resource does not have a binding");
436 std::get<ResourceBinding>(BindingOrHeapID).BindingID = ID;
437 }
438
442
444 assert(hasBinding() && "Resource does not have a binding");
445 return std::get<ResourceBinding>(BindingOrHeapID);
446 }
447
449 assert(!hasBinding() && "Resource does not have a heap ID");
450 return std::get<uint32_t>(BindingOrHeapID);
451 }
452
454 return hasBinding() ? std::get<ResourceBinding>(BindingOrHeapID).Size : 1;
455 }
456
457 TargetExtType *getHandleTy() const { return HandleTy; }
458 StringRef getName() const { return Name; }
459
460 bool hasSymbol() const { return Symbol; }
463
464 LLVM_ABI std::pair<uint32_t, uint32_t>
466
467 bool operator==(const ResourceInfo &RHS) const {
468 return std::tie(BindingOrHeapID, HandleTy, Symbol, Name) ==
469 std::tie(RHS.BindingOrHeapID, RHS.HandleTy, RHS.Symbol, RHS.Name);
470 }
471 bool operator!=(const ResourceInfo &RHS) const { return !(*this == RHS); }
472 bool operator<(const ResourceInfo &RHS) const {
473 return BindingOrHeapID < RHS.BindingOrHeapID;
474 }
475
477 const DataLayout &DL) const;
478};
479
480} // namespace dxil
481
482//===----------------------------------------------------------------------===//
483
486
487public:
488 LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
489 ModuleAnalysisManager::Invalidator &Inv);
490
492 auto It = Infos.find(Ty);
493 if (It != Infos.end())
494 return It->second;
495 auto [NewIt, Inserted] = Infos.try_emplace(Ty, Ty);
496 return NewIt->second;
497 }
498};
499
501 : public AnalysisInfoMixin<DXILResourceTypeAnalysis> {
503
504 LLVM_ABI static AnalysisKey Key;
505
506public:
508
510 // Running the pass just generates an empty map, which will be filled when
511 // users of the pass query the results.
512 return Result();
513 }
514};
515
518
519 virtual void anchor();
520
521public:
522 static char ID;
524
526 const DXILResourceTypeMap &getResourceTypeMap() const { return DRTM; }
527};
528
530
531//===----------------------------------------------------------------------===//
532
534 using CallMapTy = DenseMap<CallInst *, unsigned>;
535
537 CallMapTy CallMap;
538 unsigned FirstUAV = 0;
539 unsigned FirstCBuffer = 0;
540 unsigned FirstSampler = 0;
541 bool HasInvalidDirection = false;
542
543 /// Populate all the resource instance data.
544 void populate(Module &M, DXILResourceTypeMap &DRTM);
545 /// Populate the map given the resource binding calls in the given module.
546 void populateResourceInfos(Module &M, DXILResourceTypeMap &DRTM);
547 /// Analyze uses to fill in per-resource dynamic state — counter directions
548 /// and 64-bit atomic use.
549 void populateFromInstructions(Module &M);
550 void populateAtomicUses(Instruction &I);
551 void populateRecordCounterDirection(Instruction &I);
552
553 /// Resolves a resource handle into a vector of ResourceInfos that
554 /// represent the possible unique creations of the handle. Certain cases are
555 /// ambiguous so multiple creation instructions may be returned. The resulting
556 /// ResourceInfo can be used to depuplicate unique handles that
557 /// reference the same resource
559
560public:
563
564 iterator begin() { return Infos.begin(); }
565 const_iterator begin() const { return Infos.begin(); }
566 iterator end() { return Infos.end(); }
567 const_iterator end() const { return Infos.end(); }
568
569 bool empty() const { return Infos.empty(); }
570
572 auto Pos = CallMap.find(Key);
573 return Pos == CallMap.end() ? Infos.end() : (Infos.begin() + Pos->second);
574 }
575
577 auto Pos = CallMap.find(Key);
578 return Pos == CallMap.end() ? Infos.end() : (Infos.begin() + Pos->second);
579 }
580
581 iterator srv_begin() { return begin(); }
582 const_iterator srv_begin() const { return begin(); }
583 iterator srv_end() { return begin() + FirstUAV; }
584 const_iterator srv_end() const { return begin() + FirstUAV; }
589
590 iterator uav_begin() { return begin() + FirstUAV; }
591 const_iterator uav_begin() const { return begin() + FirstUAV; }
592 iterator uav_end() { return begin() + FirstCBuffer; }
593 const_iterator uav_end() const { return begin() + FirstCBuffer; }
598
599 iterator cbuffer_begin() { return begin() + FirstCBuffer; }
600 const_iterator cbuffer_begin() const { return begin() + FirstCBuffer; }
601 iterator cbuffer_end() { return begin() + FirstSampler; }
602 const_iterator cbuffer_end() const { return begin() + FirstSampler; }
609
610 iterator sampler_begin() { return begin() + FirstSampler; }
611 const_iterator sampler_begin() const { return begin() + FirstSampler; }
612 iterator sampler_end() { return end(); }
613 const_iterator sampler_end() const { return end(); }
620
622 : iterator_adaptor_base<call_iterator, CallMapTy::iterator> {
623 call_iterator() = default;
626
627 CallInst *operator*() const { return I->first; }
628 };
629
630 call_iterator call_begin() { return call_iterator(CallMap.begin()); }
631 call_iterator call_end() { return call_iterator(CallMap.end()); }
635
636 bool hasInvalidCounterDirection() const { return HasInvalidDirection; }
637
639 const DataLayout &DL) const;
640
643};
644
645class DXILResourceAnalysis : public AnalysisInfoMixin<DXILResourceAnalysis> {
647
648 LLVM_ABI static AnalysisKey Key;
649
650public:
652
653 /// Gather resource info for the module \c M.
655};
656
657/// Printer pass for the \c DXILResourceAnalysis results.
659 : public RequiredPassInfoMixin<DXILResourcePrinterPass> {
660 raw_ostream &OS;
661
662public:
663 explicit DXILResourcePrinterPass(raw_ostream &OS) : OS(OS) {}
664
666};
667
669 std::unique_ptr<DXILResourceMap> Map;
671
672public:
673 static char ID; // Class identification, replacement for typeinfo
674
677
678 const DXILResourceMap &getResourceMap() const { return *Map; }
679 DXILResourceMap &getResourceMap() { return *Map; }
680
681 void getAnalysisUsage(AnalysisUsage &AU) const override;
682 bool runOnModule(Module &M) override;
683 void releaseMemory() override;
684
685 void print(raw_ostream &OS, const Module *M) const override;
686 void dump() const;
687};
688
690
691//===----------------------------------------------------------------------===//
692
693// DXILResourceBindingInfo stores the results of DXILResourceBindingAnalysis
694// which analyses all llvm.dx.resource.handlefrombinding calls in the module
695// and puts together lists of used virtual register spaces and available
696// virtual register slot ranges for each binding type.
697// It also stores additional information found during the analysis such as
698// whether the module uses implicit bindings or if any of the bindings overlap.
699//
700// This information will be used in DXILResourceImplicitBindings pass to assign
701// register slots to resources with implicit bindings, and in a
702// post-optimization validation pass that will raise diagnostic about
703// overlapping bindings.
705 hlsl::BindingInfo Bindings;
706 bool HasImplicitBinding = false;
707 bool HasOverlappingBinding = false;
708
709 // Populate the resource binding info given explicit resource binding calls
710 // in the module.
711 void populate(Module &M, DXILResourceTypeMap &DRTM);
712
713public:
714 bool hasImplicitBinding() const { return HasImplicitBinding; }
715 void setHasImplicitBinding(bool Value) { HasImplicitBinding = Value; }
716 bool hasOverlappingBinding() const { return HasOverlappingBinding; }
717 void setHasOverlappingBinding(bool Value) { HasOverlappingBinding = Value; }
718
719 std::optional<uint32_t> findAvailableBinding(dxil::ResourceClass RC,
720 uint32_t Space, int32_t Size) {
721 return Bindings.findAvailableBinding(RC, Space, Size);
722 }
723
726};
727
729 : public AnalysisInfoMixin<DXILResourceBindingAnalysis> {
731
732 LLVM_ABI static AnalysisKey Key;
733
734public:
736
738};
739
741 std::unique_ptr<DXILResourceBindingInfo> BindingInfo;
742
743public:
744 static char ID;
745
748
749 DXILResourceBindingInfo &getBindingInfo() { return *BindingInfo; }
750 const DXILResourceBindingInfo &getBindingInfo() const { return *BindingInfo; }
751
752 void getAnalysisUsage(AnalysisUsage &AU) const override;
753 bool runOnModule(Module &M) override;
754 void releaseMemory() override;
755};
756
758
759} // namespace llvm
760
761#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:211
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:63
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT > iterator
Definition DenseMap.h:678
ImmutablePass(char &pid)
Definition Pass.h:285
Tuple of metadata.
Definition Metadata.h:1505
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition Pass.h:253
ModulePass(char &pid)
Definition Pass.h:255
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
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:1933
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:879
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