LLVM: lib/Analysis/DXILResource.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
19#include "llvm/IR/IntrinsicsDirectX.h"
25#include
26
27#define DEBUG_TYPE "dxil-resource"
28
29using namespace llvm;
30using namespace dxil;
31
33 switch (RK) {
34 case ResourceKind::Texture1D:
35 return "Texture1D";
36 case ResourceKind::Texture2D:
37 return "Texture2D";
38 case ResourceKind::Texture2DMS:
39 return "Texture2DMS";
40 case ResourceKind::Texture3D:
41 return "Texture3D";
42 case ResourceKind::TextureCube:
43 return "TextureCube";
44 case ResourceKind::Texture1DArray:
45 return "Texture1DArray";
46 case ResourceKind::Texture2DArray:
47 return "Texture2DArray";
48 case ResourceKind::Texture2DMSArray:
49 return "Texture2DMSArray";
50 case ResourceKind::TextureCubeArray:
51 return "TextureCubeArray";
52 case ResourceKind::TypedBuffer:
53 return "Buffer";
54 case ResourceKind::RawBuffer:
55 return "RawBuffer";
56 case ResourceKind::StructuredBuffer:
57 return "StructuredBuffer";
58 case ResourceKind::CBuffer:
59 return "CBuffer";
60 case ResourceKind::Sampler:
61 return "Sampler";
62 case ResourceKind::TBuffer:
63 return "TBuffer";
64 case ResourceKind::RTAccelerationStructure:
65 return "RTAccelerationStructure";
66 case ResourceKind::FeedbackTexture2D:
67 return "FeedbackTexture2D";
68 case ResourceKind::FeedbackTexture2DArray:
69 return "FeedbackTexture2DArray";
70 case ResourceKind::NumEntries:
71 case ResourceKind::Invalid:
72 return "";
73 }
75}
76
78 switch (ET) {
79 case ElementType::I1:
80 return "i1";
81 case ElementType::I16:
82 return "i16";
83 case ElementType::U16:
84 return "u16";
85 case ElementType::I32:
86 return "i32";
87 case ElementType::U32:
88 return "u32";
89 case ElementType::I64:
90 return "i64";
91 case ElementType::U64:
92 return "u64";
93 case ElementType::F16:
94 return "f16";
95 case ElementType::F32:
96 return "f32";
97 case ElementType::F64:
98 return "f64";
99 case ElementType::SNormF16:
100 return "snorm_f16";
101 case ElementType::UNormF16:
102 return "unorm_f16";
103 case ElementType::SNormF32:
104 return "snorm_f32";
105 case ElementType::UNormF32:
106 return "unorm_f32";
107 case ElementType::SNormF64:
108 return "snorm_f64";
109 case ElementType::UNormF64:
110 return "unorm_f64";
111 case ElementType::PackedS8x32:
112 return "p32i8";
113 case ElementType::PackedU8x32:
114 return "p32u8";
115 case ElementType::Invalid:
116 return "";
117 }
119}
120
122 switch (ET) {
123 case ElementType::I1:
124 return "bool";
125 case ElementType::I16:
126 return "int16_t";
127 case ElementType::U16:
128 return "uint16_t";
129 case ElementType::I32:
130 return "int32_t";
131 case ElementType::U32:
132 return "uint32_t";
133 case ElementType::I64:
134 return "int64_t";
135 case ElementType::U64:
136 return "uint32_t";
137 case ElementType::F16:
138 case ElementType::SNormF16:
139 case ElementType::UNormF16:
140 return "half";
141 case ElementType::F32:
142 case ElementType::SNormF32:
143 case ElementType::UNormF32:
144 return "float";
145 case ElementType::F64:
146 case ElementType::SNormF64:
147 case ElementType::UNormF64:
148 return "double";
149 case ElementType::PackedS8x32:
150 return "int8_t4_packed";
151 case ElementType::PackedU8x32:
152 return "uint8_t4_packed";
153 case ElementType::Invalid:
154 return "";
155 }
157}
158
160 switch (ST) {
161 case SamplerType::Default:
162 return "Default";
163 case SamplerType::Comparison:
164 return "Comparison";
165 case SamplerType::Mono:
166 return "Mono";
167 }
169}
170
172 switch (SFT) {
173 case SamplerFeedbackType::MinMip:
174 return "MinMip";
175 case SamplerFeedbackType::MipRegionUsed:
176 return "MipRegionUsed";
177 }
179}
180
182
183 Ty = Ty->getScalarType();
184
185 if (Ty->isIntegerTy()) {
186 switch (Ty->getIntegerBitWidth()) {
187 case 16:
188 return IsSigned ? ElementType::I16 : ElementType::U16;
189 case 32:
190 return IsSigned ? ElementType::I32 : ElementType::U32;
191 case 64:
192 return IsSigned ? ElementType::I64 : ElementType::U64;
193 case 1:
194 default:
195 return ElementType::Invalid;
196 }
197 } else if (Ty->isFloatTy()) {
198 return ElementType::F32;
199 } else if (Ty->isDoubleTy()) {
200 return ElementType::F64;
201 } else if (Ty->isHalfTy()) {
202 return ElementType::F16;
203 }
204
205 return ElementType::Invalid;
206}
207
215
219 : HandleTy(HandleTy) {
220
222 RC = RC_;
223 Kind = Kind_;
224 return;
225 }
226
236 Kind = Ty->getDimension();
239 Kind = Ty->getDimension();
242 Kind = Ty->getDimension();
249 } else
251}
252
254 bool IsWriteable, bool IsROV,
255 Type *ContainedType = nullptr,
256 bool IsSigned = true) {
258 if (IsWriteable)
259 DestStream << (IsROV ? "RasterizerOrdered" : "RW");
260 DestStream << Name;
261
262 if (!ContainedType)
263 return;
264
267 ArrayDimensions.push_back(AT->getNumElements());
268 ContainedType = AT->getElementType();
269 }
270
275 } else {
277 "invalid element type for raw buffer");
279 if (!ST->hasName())
280 return;
281 ElementName = ST->getStructName();
282 }
283
284 DestStream << "<" << ElementName;
286 DestStream << VTy->getNumElements();
287 for (uint64_t Dim : ArrayDimensions)
288 DestStream << "[" << Dim << "]";
289 DestStream << ">";
290}
291
294 if (Ty && Ty->getNumElements() == 1 && Ty->getElementType(0) == ElemType)
295 return Ty;
297}
298
300
304 ElementTypes.reserve(ST->getNumElements());
305 for (Type *ElTy : ST->elements()) {
307 continue;
309 }
310
311
312 if (ElementTypes.size() == 2)
314 if (ElementTypes[1] == AT->getElementType())
315 return ArrayType::get(ElementTypes[1], AT->getNumElements() + 1);
316
317
318 if (ElementTypes.size() == 1)
319 return ElementTypes[0];
320
321 return StructType::get(Ctx, ElementTypes, false);
322 }
323
326 AT->getNumElements());
327
328 return Ty;
329}
330
333
334 switch (Kind) {
344 RTy->isROV(), RTy->getResourceType(), RTy->isSigned());
346 }
351 false, RTy->getResourceType(), RTy->isSigned());
353 }
357 RTy->isROV(), RTy->getResourceType(), RTy->isSigned());
359 }
362 formatTypeName(TypeName, "ByteAddressBuffer", RTy->isWriteable(),
363 RTy->isROV());
365 TypeName);
366 }
369 Type *Ty = RTy->getResourceType();
370 formatTypeName(TypeName, "StructuredBuffer", RTy->isWriteable(),
371 RTy->isROV(), RTy->getResourceType(), true);
373 }
380 TypeName);
381 }
385 if (!CBufferName.empty()) {
386 Name.append(".");
387 Name.append(CBufferName);
388 }
389
390
395 }
396
399 }
402 TypeName = formatv("SamplerState<{0}>",
405 TypeName);
406 }
413 }
415}
416
418
422
426
430
432 switch (Kind) {
443 return true;
452 return false;
456 }
458}
459
464
469
471 switch (Kind) {
489 return false;
497 }
499}
500
503 return {isROV(Kind, HandleTy)};
504}
505
508
510
511
513 return LayoutTy->getSize();
514
515 return DL.getTypeAllocSize(ElTy);
516}
517
522
526
528
529 uint32_t Stride = DL.getTypeAllocSize(ElTy);
532 Alignment = DL.getStructLayout(STy)->getAlignment();
533 uint32_t AlignLog2 = Alignment ? Log2(*Alignment) : 0;
534 return {Stride, AlignLog2};
535}
536
539 switch (Kind) {
548 return {RTy->getResourceType(), RTy->isSigned()};
549 }
553 return {RTy->getResourceType(), RTy->isSigned()};
554 }
557 return {RTy->getResourceType(), RTy->isSigned()};
558 }
570 }
572}
573
576
582 Count = VTy->getNumElements();
583 return {ET, DXILStorageTy, Count};
584}
585
594
596 return HandleTy == RHS.HandleTy;
597}
598
600
602 if (std::tie(RC, Kind) < std::tie(RHS.RC, RHS.Kind))
603 return true;
604 if (isCBuffer() && RHS.isCBuffer() &&
605 getCBufferSize(DummyDL) < RHS.getCBufferSize(DummyDL))
606 return true;
608 return true;
609 if (isUAV() && RHS.isUAV() && getUAV() < RHS.getUAV())
610 return true;
611 if (isStruct() && RHS.isStruct() &&
612 getStruct(DummyDL) < RHS.getStruct(DummyDL))
613 return true;
614 if (isFeedback() && RHS.isFeedback() &&
616 return true;
617 if (isTyped() && RHS.isTyped() && getTyped() < RHS.getTyped())
618 return true;
621 return true;
622 return false;
623}
624
628
633 } else {
636 OS << " IsROV: " << UAVFlags.IsROV << "\n";
637 }
640
643 OS << " Buffer Stride: " << Struct.Stride << "\n";
644 OS << " Alignment: " << Struct.AlignLog2 << "\n";
650 OS << "\n"
651 << " Element Count: " << Typed.ElementCount << "\n";
654 << "\n";
655 }
656}
657
659 assert(!Symbol && "Symbol has already been created");
660 Type *ResTy = Ty;
661 int64_t Size = Binding.Size;
662 if (Size != 1)
663
665 Symbol = new GlobalVariable(M, ResTy, true,
667 nullptr, Name);
668 return Symbol;
669}
670
675
677
680 auto getIntMD = [&I32Ty](uint32_t V) {
683 };
684 auto getBoolMD = [&I1Ty](uint32_t V) {
687 };
688
689 MDVals.push_back(getIntMD(Binding.RecordID));
690 assert(Symbol && "Cannot yet create useful resource metadata without symbol");
693 MDVals.push_back(getIntMD(Binding.Space));
694 MDVals.push_back(getIntMD(Binding.LowerBound));
695 MDVals.push_back(getIntMD(Binding.Size));
696
703 } else {
705
706 if (RTI.isUAV()) {
711 } else {
712
713
714
717 MDVals.push_back(getIntMD(SampleCount));
718 }
719
720
726 } else if (RTI.isTyped()) {
734 }
736 }
737
739}
740
741std::pair<uint32_t, uint32_t>
744
747 bool IsUAV = RTI.isUAV();
750 bool IsROV = IsUAV && UAVFlags.IsROV;
752 uint8_t SamplerCmpOrHasCounter = 0;
753 if (IsUAV)
754 SamplerCmpOrHasCounter = hasCounter();
757
758
759
762 Word0 |= (AlignLog2 & 0xF) << 8;
763 Word0 |= (IsUAV & 1) << 12;
764 Word0 |= (IsROV & 1) << 13;
765 Word0 |= (IsGloballyCoherent & 1) << 14;
766 Word0 |= (SamplerCmpOrHasCounter & 1) << 15;
767
775 else if (RTI.isTyped()) {
780
781 Word1 |= (CompType & 0xFF) << 0;
782 Word1 |= (CompCount & 0xFF) << 8;
783 Word1 |= (SampleCount & 0xFF) << 16;
784 }
785
786 return {Word0, Word1};
787}
788
791 if (!Name.empty())
792 OS << " Name: " << Name << "\n";
793
794 if (Symbol) {
795 OS << " Symbol: ";
796 Symbol->printAsOperand(OS);
797 OS << "\n";
798 }
799
800 OS << " Binding:\n"
801 << " Record ID: " << Binding.RecordID << "\n"
802 << " Space: " << Binding.Space << "\n"
803 << " Lower Bound: " << Binding.LowerBound << "\n"
804 << " Size: " << Binding.Size << "\n";
805
807 OS << " Counter Direction: ";
808
811 OS << "Increment\n";
812 break;
814 OS << "Decrement\n";
815 break;
817 OS << "Unknown\n";
818 break;
820 OS << "Invalid\n";
821 break;
822 }
823
825}
826
827
828
830 ModuleAnalysisManager::Invalidator &Inv) {
831
833 return !PAC.preservedWhenStateless();
834}
835
836
838 return F.getIntrinsicID() == Intrinsic::dx_resource_updatecounter;
839}
840
844 default:
846 case Intrinsic::dx_resource_handlefrombinding:
847 case Intrinsic::dx_resource_handlefromimplicitbinding:
849 break;
850 }
851
853 if (!GV)
854 return "";
855
857 assert(CA && CA->isString() && "expected constant string");
858 StringRef Name = CA->getAsString();
859
860 if (Name.ends_with('\0'))
861 Name = Name.drop_back(1);
862 return Name;
863}
864
865void DXILResourceMap::populateResourceInfos(Module &M,
868
869 for (Function &F : M.functions()) {
870 if (.isDeclaration())
871 continue;
872 LLVM_DEBUG(dbgs() << "Function: " << F.getName() << "\n");
874 switch (ID) {
875 default:
876 continue;
877 case Intrinsic::dx_resource_handlefrombinding: {
880
891
893 ResourceInfo{0, Space, LowerBound,
894 Size, HandleTy, Name};
895
897 }
898
899 break;
900 }
901 }
902 }
903
905 const auto &[LCI, LRI, LRTI] = LHS;
906 const auto &[RCI, RRI, RRTI] = RHS;
907
908
911
912 return std::tie(LRC, LRI, LRTI) < std::tie(RRC, RRI, RRTI);
913 });
914 for (auto [CI, RI, RTI] : CIToInfos) {
915 if (Infos.empty() || RI != Infos.back())
916 Infos.push_back(RI);
917 CallMap[CI] = Infos.size() - 1;
918 }
919
920 unsigned Size = Infos.size();
921
922 FirstUAV = FirstCBuffer = FirstSampler = Size;
923 uint32_t NextID = 0;
924 for (unsigned I = 0, E = Size; I != E; ++I) {
927 if (RTI.isUAV() && FirstUAV == Size) {
928 FirstUAV = I;
929 NextID = 0;
930 } else if (RTI.isCBuffer() && FirstCBuffer == Size) {
931 FirstCBuffer = I;
932 NextID = 0;
933 } else if (RTI.isSampler() && FirstSampler == Size) {
934 FirstSampler = I;
935 NextID = 0;
936 }
937
938
939
940 FirstCBuffer = std::min({FirstCBuffer, FirstSampler});
941 FirstUAV = std::min({FirstUAV, FirstCBuffer});
942
943
945 }
946}
947
948void DXILResourceMap::populateCounterDirections(Module &M) {
949 for (Function &F : M.functions()) {
951 continue;
952
953 LLVM_DEBUG(dbgs() << "Update Counter Function: " << F.getName() << "\n");
954
955 for (const User *U : F.users()) {
957 assert(CI && "Users of dx_resource_updateCounter must be call instrs");
958
959
962 int64_t CountLiteral = CountValue->getSExtValue();
963
964
965 if (CountLiteral == 0)
966 continue;
967
969 if (CountLiteral > 0)
971
972
977 RBInfo->CounterDirection = Direction;
978 else if (RBInfo->CounterDirection != Direction) {
980 HasInvalidDirection = true;
981 }
982 }
983 }
984 }
985}
986
987void DXILResourceMap::populate(Module &M, DXILResourceTypeMap &DRTM) {
988 populateResourceInfos(M, DRTM);
989 populateCounterDirections(M);
990}
991
994 for (unsigned I = 0, E = Infos.size(); I != E; ++I) {
995 OS << "Resource " << I << ":\n";
998 OS << "\n";
999 }
1000
1001 for (const auto &[CI, Index] : CallMap) {
1002 OS << "Call bound to " << Index << ":";
1004 OS << "\n";
1005 }
1006}
1007
1011 for (const Value *V : Phi->operands()) {
1012 Children.append(findByUse(V));
1013 }
1014 return Children;
1015 }
1016
1018 if (!CI)
1019 return {};
1020
1022
1023 case Intrinsic::dx_resource_handlefrombinding: {
1024 auto Pos = CallMap.find(CI);
1025 assert(Pos != CallMap.end() && "HandleFromBinding must be in resource map");
1026 return {&Infos[Pos->second]};
1027 }
1028 default:
1029 break;
1030 }
1031
1032
1033
1036 for (const Value *V : CI->args()) {
1037 if (V->getType() != UseType)
1038 continue;
1039
1040 Children.append(findByUse(V));
1041 }
1042
1044}
1045
1046
1047
1048void DXILResourceBindingInfo::populate(Module &M, DXILResourceTypeMap &DRTM) {
1049 hlsl::BindingInfoBuilder Builder;
1050
1051
1052
1053 for (Function &F : M.functions()) {
1054 if (.isDeclaration())
1055 continue;
1056
1057 switch (F.getIntrinsicID()) {
1058 default:
1059 continue;
1060 case Intrinsic::dx_resource_handlefrombinding: {
1063
1064 for (User *U : F.users())
1066 uint32_t Space =
1068 uint32_t LowerBound =
1070 int32_t Size =
1073
1074
1075
1076 assert((Size < 0 || (unsigned)LowerBound + Size - 1 <= UINT32_MAX) &&
1077 "upper bound register overflow");
1078 uint32_t UpperBound = Size < 0 ? UINT32_MAX : LowerBound + Size - 1;
1080 UpperBound, Name);
1081 }
1082 break;
1083 }
1084 case Intrinsic::dx_resource_handlefromimplicitbinding: {
1085 HasImplicitBinding = true;
1086 break;
1087 }
1088 }
1089 }
1090
1092 [this](auto, auto) { this->HasOverlappingBinding = true; });
1093}
1094
1095
1096
1097AnalysisKey DXILResourceTypeAnalysis::Key;
1098AnalysisKey DXILResourceAnalysis::Key;
1099AnalysisKey DXILResourceBindingAnalysis::Key;
1100
1105 Data.populate(M, DRTM);
1106 return Data;
1107}
1108
1113 Data.populate(M, DRTM);
1114 return Data;
1115}
1116
1121
1122 DRM.print(OS, DRTM, M.getDataLayout());
1124}
1125
1126void DXILResourceTypeWrapperPass::anchor() {}
1127
1130
1132 "DXIL Resource Type Analysis", false, true)
1134
1137}
1138
1140
1142
1147
1150
1152 Map->populate(M, *DRTM);
1153
1154 return false;
1155}
1156
1158
1160 if (!Map) {
1161 OS << "No resource map has been built!\n";
1162 return;
1163 }
1164 Map->print(OS, *DRTM, M->getDataLayout());
1165}
1166
1167#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1170#endif
1171
1173 "DXIL Resources Analysis", false, true)
1175
1178}
1179
1182
1184
1189
1192
1195 BindingInfo->populate(M, DRTM);
1196
1197 return false;
1198}
1199
1201
1203 "DXIL Resource Binding Analysis", false, true)
1205
1208}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements a class to represent arbitrary precision integral constant values and operations...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static dxil::ElementType toDXILElementType(Type *Ty, bool IsSigned)
Definition DXILResource.cpp:181
static bool isUpdateCounterIntrinsic(Function &F)
Definition DXILResource.cpp:837
static StructType * getOrCreateElementStruct(Type *ElemType, StringRef Name)
Definition DXILResource.cpp:292
static void formatTypeName(SmallString< 64 > &Dest, StringRef Name, bool IsWriteable, bool IsROV, Type *ContainedType=nullptr, bool IsSigned=true)
Definition DXILResource.cpp:253
static StringRef getElementTypeName(ElementType ET)
Definition DXILResource.cpp:77
static std::pair< Type *, bool > getTypedElementType(dxil::ResourceKind Kind, TargetExtType *Ty)
Definition DXILResource.cpp:537
static dxil::ElementType toDXILStorageType(dxil::ElementType ET)
Definition DXILResource.cpp:208
static bool isROV(dxil::ResourceKind Kind, TargetExtType *Ty)
Definition DXILResource.cpp:470
static Type * getTypeWithoutPadding(Type *Ty)
Definition DXILResource.cpp:299
static StringRef getResourceKindName(ResourceKind RK)
Definition DXILResource.cpp:32
static StringRef getSamplerTypeName(SamplerType ST)
Definition DXILResource.cpp:159
static StringRef getSamplerFeedbackTypeName(SamplerFeedbackType SFT)
Definition DXILResource.cpp:171
static StringRef getElementTypeNameForTemplate(ElementType ET)
Definition DXILResource.cpp:121
Module.h This file contains the declarations for the Module class.
Loop::LoopBounds::Direction Direction
Machine Check Debug Module
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the SmallString class.
This file defines the SmallVector class.
Class for arbitrary precision integers.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
AnalysisUsage & addRequiredTransitive()
static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation or the function signa...
Value * getArgOperand(unsigned i) const
LLVM_ABI Intrinsic::ID getIntrinsicID() const
Returns the intrinsic ID of the intrinsic called or Intrinsic::not_intrinsic if the called function i...
iterator_range< User::op_iterator > args()
Iteration adapter for range-for loops.
This class represents a function call, abstracting a target machine's calling convention.
int64_t getSExtValue() const
Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the ...
static LLVM_ABI Constant * getIntegerValue(Type *Ty, const APInt &V)
Return the value for an integer or pointer constant, or a vector thereof, with the given scalar value...
LLVM_ABI DXILResourceMap run(Module &M, ModuleAnalysisManager &AM)
Gather resource info for the module M.
Definition DXILResource.cpp:1101
LLVM_ABI DXILResourceBindingInfo run(Module &M, ModuleAnalysisManager &AM)
Definition DXILResource.cpp:1110
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
Definition DXILResource.cpp:1190
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition DXILResource.cpp:1185
~DXILResourceBindingWrapperPass() override
DXILResourceBindingWrapperPass()
Definition DXILResource.cpp:1180
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
Definition DXILResource.cpp:1200
LLVM_ABI void print(raw_ostream &OS, DXILResourceTypeMap &DRTM, const DataLayout &DL) const
Definition DXILResource.cpp:992
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition DXILResource.cpp:1117
LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA, ModuleAnalysisManager::Invalidator &Inv)
Definition DXILResource.cpp:829
DXILResourceTypeWrapperPass()
Definition DXILResource.cpp:1128
DXILResourceWrapperPass()
Definition DXILResource.cpp:1139
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
Definition DXILResource.cpp:1148
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition DXILResource.cpp:1143
~DXILResourceWrapperPass() override
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
Definition DXILResource.cpp:1157
void print(raw_ostream &OS, const Module *M) const override
print - Print out the internal state of the pass.
Definition DXILResource.cpp:1159
void dump() const
Definition DXILResource.cpp:1169
A parsed version of the target data layout string in and methods for querying it.
Class to represent fixed width SIMD vectors.
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
@ ExternalLinkage
Externally visible function.
This is an important class for using LLVM in a threaded context.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static LLVM_ABI MDString * get(LLVMContext &Context, StringRef Str)
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.
AnalysisType & getAnalysis() const
getAnalysis() - This function is used by subclasses to get to the analysis information ...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
reference emplace_back(ArgTypes &&... Args)
void reserve(size_type N)
void push_back(const T &Elt)
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.
constexpr bool empty() const
empty - Check if the string is empty.
Class to represent struct types.
static LLVM_ABI StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
static LLVM_ABI StructType * getTypeByName(LLVMContext &C, StringRef Name)
Return the type with the specified name, or null if there is none by that name.
static LLVM_ABI StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Class to represent target extensions types, which are generally unintrospectable from target-independ...
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
static LLVM_ABI IntegerType * getInt1Ty(LLVMContext &C)
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
The dx.Layout target extension type.
TargetExtType * getHandleTy() const
LLVM_ABI std::pair< uint32_t, uint32_t > getAnnotateProps(Module &M, dxil::ResourceTypeInfo &RTI) const
Definition DXILResource.cpp:742
LLVM_ABI void print(raw_ostream &OS, dxil::ResourceTypeInfo &RTI, const DataLayout &DL) const
Definition DXILResource.cpp:789
void setBindingID(unsigned ID)
LLVM_ABI GlobalVariable * createSymbol(Module &M, StructType *Ty)
Definition DXILResource.cpp:658
LLVM_ABI MDTuple * getAsMetadata(Module &M, dxil::ResourceTypeInfo &RTI) const
Definition DXILResource.cpp:671
ResourceCounterDirection CounterDirection
dxil::ResourceClass getResourceClass() const
LLVM_ABI uint32_t getMultiSampleCount() const
Definition DXILResource.cpp:590
LLVM_ABI uint32_t getCBufferSize(const DataLayout &DL) const
Definition DXILResource.cpp:506
LLVM_ABI bool operator<(const ResourceTypeInfo &RHS) const
Definition DXILResource.cpp:599
LLVM_ABI bool isUAV() const
Definition DXILResource.cpp:417
LLVM_ABI bool isMultiSample() const
Definition DXILResource.cpp:465
LLVM_ABI bool isSampler() const
Definition DXILResource.cpp:423
LLVM_ABI bool isTyped() const
Definition DXILResource.cpp:431
LLVM_ABI dxil::SamplerType getSamplerType() const
Definition DXILResource.cpp:518
LLVM_ABI ResourceTypeInfo(TargetExtType *HandleTy, const dxil::ResourceClass RC, const dxil::ResourceKind Kind)
Definition DXILResource.cpp:216
LLVM_ABI bool isCBuffer() const
Definition DXILResource.cpp:419
LLVM_ABI TypedInfo getTyped() const
Definition DXILResource.cpp:574
LLVM_ABI StructType * createElementStruct(StringRef CBufferName="")
Definition DXILResource.cpp:331
LLVM_ABI bool isFeedback() const
Definition DXILResource.cpp:460
LLVM_ABI UAVInfo getUAV() const
Definition DXILResource.cpp:501
LLVM_ABI StructInfo getStruct(const DataLayout &DL) const
Definition DXILResource.cpp:524
LLVM_ABI bool isStruct() const
Definition DXILResource.cpp:427
LLVM_ABI dxil::SamplerFeedbackType getFeedbackType() const
Definition DXILResource.cpp:586
LLVM_ABI bool operator==(const ResourceTypeInfo &RHS) const
Definition DXILResource.cpp:595
dxil::ResourceKind getResourceKind() const
LLVM_ABI void print(raw_ostream &OS, const DataLayout &DL) const
Definition DXILResource.cpp:625
void trackBinding(dxil::ResourceClass RC, uint32_t Space, uint32_t LowerBound, uint32_t UpperBound, const void *Cookie)
LLVM_ABI BindingInfo calculateBindingInfo(llvm::function_ref< void(const BindingInfoBuilder &Builder, const Binding &Overlapping)> ReportOverlap)
Calculate the binding info - ReportOverlap will be called once for each overlapping binding.
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an SmallVector or SmallString.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
LLVM_ABI StringRef getResourceClassName(ResourceClass RC)
ResourceKind
The kind of resource for an SRV or UAV resource.
@ RTAccelerationStructure
ElementType
The element type of an SRV or UAV resource.
LLVM_ABI StringRef getResourceNameFromBindingCall(CallInst *CI)
Definition DXILResource.cpp:841
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
LLVM_ABI ModulePass * createDXILResourceBindingWrapperPassPass()
void stable_sort(R &&Range)
decltype(auto) dyn_cast(const From &Val)
dyn_cast - Return the argument parameter cast to the specified type.
LLVM_ABI ModulePass * createDXILResourceTypeWrapperPassPass()
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
constexpr std::underlying_type_t< Enum > to_underlying(Enum E)
Returns underlying integer value of an enum.
FunctionAddr VTableAddr Count
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa - 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
FunctionAddr VTableAddr uintptr_t uintptr_t Data
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.
unsigned Log2(Align A)
Returns the log2 of the alignment.
LLVM_ABI ModulePass * createDXILResourceWrapperPassPass()
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
dxil::ElementType DXILStorageTy
dxil::ElementType ElementTy