LLVM 24.0.0git
DXILShaderFlags.cpp
Go to the documentation of this file.
1//===- DXILShaderFlags.cpp - DXIL Shader Flags helper objects -------------===//
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/// \file This file contains helper objects and APIs for working with DXIL
10/// Shader Flags.
11///
12//===----------------------------------------------------------------------===//
13
14#include "DXILShaderFlags.h"
16#include "DirectX.h"
21#include "llvm/IR/Attributes.h"
23#include "llvm/IR/Instruction.h"
26#include "llvm/IR/Intrinsics.h"
27#include "llvm/IR/IntrinsicsDirectX.h"
28#include "llvm/IR/Module.h"
32
33using namespace llvm;
34using namespace llvm::dxil;
35
36static bool hasUAVsAtEveryStage(const DXILResourceMap &DRM,
37 const ModuleMetadataInfo &MMDI) {
38 // Heap resources do not count towards hasUAVsAtEveryStage.
39 bool HasUAVWithBinding = any_of(
40 DRM.uavs(), [](const ResourceInfo &RI) { return RI.hasBinding(); });
41 if (!HasUAVWithBinding)
42 return false;
43
44 switch (MMDI.ShaderProfile) {
45 default:
46 return false;
49 return false;
54 return true;
64 return MMDI.ValidatorVersion < VersionTuple(1, 8);
65 }
66}
67
68static bool checkWaveOps(Intrinsic::ID IID) {
69 // Currently unsupported intrinsics
70 // case Intrinsic::dx_wave_readfirst:
71 // case Intrinsic::dx_wave_reduce.and:
72 // case Intrinsic::dx_wave_reduce.or:
73 // case Intrinsic::dx_wave_reduce.xor:
74 // case Intrinsic::dx_wave_prefixop:
75 // case Intrinsic::dx_quad.readat:
76 // case Intrinsic::dx_quad.readacrossy:
77 // case Intrinsic::dx_quad.readacrossdiagonal:
78 // case Intrinsic::dx_wave_prefixballot:
79 // case Intrinsic::dx_wave_match:
80 // case Intrinsic::dx_wavemulti.*:
81 // case Intrinsic::dx_wavemulti.ballot:
82 // case Intrinsic::dx_quad.vote:
83 switch (IID) {
84 default:
85 return false;
86 case Intrinsic::dx_wave_is_first_lane:
87 case Intrinsic::dx_wave_getlaneindex:
88 case Intrinsic::dx_wave_get_lane_count:
89 case Intrinsic::dx_wave_any:
90 case Intrinsic::dx_wave_all_equal:
91 case Intrinsic::dx_wave_all:
92 case Intrinsic::dx_wave_readlane:
93 case Intrinsic::dx_wave_readlane_first:
94 case Intrinsic::dx_wave_active_countbits:
95 case Intrinsic::dx_wave_ballot:
96 case Intrinsic::dx_wave_prefix_bit_count:
97 // Wave Active Op Variants
98 case Intrinsic::dx_wave_reduce_or:
99 case Intrinsic::dx_wave_reduce_xor:
100 case Intrinsic::dx_wave_reduce_and:
101 case Intrinsic::dx_wave_reduce_sum:
102 case Intrinsic::dx_wave_reduce_usum:
103 case Intrinsic::dx_wave_product:
104 case Intrinsic::dx_wave_uproduct:
105 case Intrinsic::dx_wave_reduce_max:
106 case Intrinsic::dx_wave_reduce_umax:
107 case Intrinsic::dx_wave_reduce_min:
108 case Intrinsic::dx_wave_reduce_umin:
109 // Wave Prefix Op Variants
110 case Intrinsic::dx_wave_prefix_sum:
111 case Intrinsic::dx_wave_prefix_usum:
112 case Intrinsic::dx_wave_prefix_product:
113 case Intrinsic::dx_wave_prefix_uproduct:
114 case Intrinsic::dx_wave_multi_prefix_bit_and:
115 case Intrinsic::dx_wave_multi_prefix_bit_or:
116 case Intrinsic::dx_wave_multi_prefix_bit_xor:
117 case Intrinsic::dx_wave_multi_prefix_product:
118 case Intrinsic::dx_wave_multi_prefix_uproduct:
119 case Intrinsic::dx_wave_multi_prefix_sum:
120 case Intrinsic::dx_wave_multi_prefix_usum:
121 // Quad Op Variants
122 case Intrinsic::dx_quad_read_across_x:
123 case Intrinsic::dx_quad_read_across_y:
124 case Intrinsic::dx_quad_read_across_diagonal:
125 return true;
126 }
127}
128
130 switch (IID) {
131 default:
132 return false;
133 case Intrinsic::fma:
134 return true;
135 }
136}
137
138/// Texture load and sample operations accept "programmable offsets", i.e.
139/// offsets that are not compile-time constants. Such offsets require the
140/// AdvancedTextureOps shader feature flag. Returns true if \p II is one of
141/// those operations and its offsets operand is not a constant.
143 // TODO: (#116137) Several other DXIL ops also require this feature flag, but
144 // none of them can be generated yet:
145 // - SampleCmp, SampleCmpBias, SampleCmpGrad and SampleCmpLevelZero set the
146 // flag for non-constant offsets, exactly like the ops handled below.
147 // - SampleCmpLevel, TextureGatherRaw and TextureStoreSample set the flag
148 // unconditionally, and have no intrinsics yet.
149
150 // The offsets operand index differs between the intrinsics.
151 unsigned OffsetsIdx;
152 switch (II.getIntrinsicID()) {
153 default:
154 return false;
155 case Intrinsic::dx_resource_load_level:
156 case Intrinsic::dx_resource_sample:
157 case Intrinsic::dx_resource_sample_clamp:
158 OffsetsIdx = 3;
159 break;
160 case Intrinsic::dx_resource_samplebias:
161 case Intrinsic::dx_resource_samplebias_clamp:
162 case Intrinsic::dx_resource_samplelevel:
163 OffsetsIdx = 4;
164 break;
165 case Intrinsic::dx_resource_samplegrad:
166 case Intrinsic::dx_resource_samplegrad_clamp:
167 OffsetsIdx = 5;
168 break;
169 }
170 return !isa<Constant>(II.getArgOperand(OffsetsIdx));
171}
172
173static bool isOptimizationDisabled(const Module &M) {
174 const StringRef Key = "dx.disable_optimizations";
175 if (auto *Flag = mdconst::extract_or_null<ConstantInt>(M.getModuleFlag(Key)))
176 return Flag->getValue().getBoolValue();
177 return false;
178}
179
180// Checks to see if the status bit from a load with status
181// instruction is ever extracted. If it is, the module needs
182// to have the TiledResources shader flag set.
184 [[maybe_unused]] Intrinsic::ID IID = II.getIntrinsicID();
185 assert(IID == Intrinsic::dx_resource_load_typedbuffer ||
186 IID == Intrinsic::dx_resource_load_rawbuffer &&
187 "unexpected intrinsic ID");
188 for (const User *U : II.users()) {
189 if (const ExtractValueInst *EVI = dyn_cast<ExtractValueInst>(U)) {
190 // Resource load operations return a {result, status} pair.
191 // Check if we extract the status
192 if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 1)
193 return true;
194 }
195 }
196
197 return false;
198}
199
200/// Update the shader flags mask based on the given instruction.
201/// \param CSF Shader flags mask to update.
202/// \param I Instruction to check.
203void ModuleShaderFlags::updateFunctionFlags(ComputedShaderFlags &CSF,
204 const Instruction &I,
206 const ModuleMetadataInfo &MMDI) {
207 if (!CSF.Doubles)
208 CSF.Doubles = I.getType()->getScalarType()->isDoubleTy();
209
210 if (!CSF.Doubles) {
211 for (const Value *Op : I.operands()) {
212 if (Op->getType()->getScalarType()->isDoubleTy()) {
213 CSF.Doubles = true;
214 break;
215 }
216 }
217 }
218
219 if (CSF.Doubles) {
220 switch (I.getOpcode()) {
221 case Instruction::FDiv:
222 case Instruction::UIToFP:
223 case Instruction::SIToFP:
224 case Instruction::FPToUI:
225 case Instruction::FPToSI:
226 CSF.DX11_1_DoubleExtensions = true;
227 break;
228 }
229 }
230
231 if (!CSF.LowPrecisionPresent)
232 CSF.LowPrecisionPresent = I.getType()->getScalarType()->isIntegerTy(16) ||
233 I.getType()->getScalarType()->isHalfTy();
234
235 if (!CSF.LowPrecisionPresent) {
236 for (const Value *Op : I.operands()) {
237 if (Op->getType()->getScalarType()->isIntegerTy(16) ||
238 Op->getType()->getScalarType()->isHalfTy()) {
239 CSF.LowPrecisionPresent = true;
240 break;
241 }
242 }
243 }
244
245 if (CSF.LowPrecisionPresent) {
246 if (CSF.NativeLowPrecisionMode)
247 CSF.NativeLowPrecision = true;
248 else
249 CSF.MinimumPrecision = true;
250 }
251
252 if (!CSF.Int64Ops)
253 CSF.Int64Ops = I.getType()->getScalarType()->isIntegerTy(64);
254
255 if (!CSF.Int64Ops && !isa<LifetimeIntrinsic>(&I)) {
256 for (const Value *Op : I.operands()) {
257 if (Op->getType()->getScalarType()->isIntegerTy(64)) {
258 CSF.Int64Ops = true;
259 break;
260 }
261 }
262 }
263
264 if (const auto *II = dyn_cast<IntrinsicInst>(&I)) {
265 CSF.AdvancedTextureOps |= checkAdvancedTextureOps(*II);
266
267 switch (II->getIntrinsicID()) {
268 default:
269 break;
270 case Intrinsic::dx_start_vertex_location:
271 case Intrinsic::dx_start_instance_location:
272 CSF.ExtendedCommandInfo = true;
273 break;
274 case Intrinsic::dx_view_id:
275 CSF.ViewID = true;
276 break;
277 case Intrinsic::dx_resource_handlefrombinding: {
278 dxil::ResourceTypeInfo &RTI = DRTM[cast<TargetExtType>(II->getType())];
279
280 // Set ResMayNotAlias if DXIL validator version >= 1.8 and the function
281 // uses UAVs
282 if (!CSF.ResMayNotAlias && CanSetResMayNotAlias &&
283 MMDI.ValidatorVersion >= VersionTuple(1, 8) && RTI.isUAV())
284 CSF.ResMayNotAlias = true;
285
286 switch (RTI.getResourceKind()) {
289 CSF.EnableRawAndStructuredBuffers = true;
290 break;
291 default:
292 break;
293 }
294 break;
295 }
296 case Intrinsic::dx_resource_handlefromheap: {
297 dxil::ResourceTypeInfo &RTI = DRTM[cast<TargetExtType>(II->getType())];
298 bool IsSamplerHeap = RTI.isSampler();
299 CSF.SamplerDescriptorHeapIndexing |= IsSamplerHeap;
300 CSF.ResourceDescriptorHeapIndexing |= !IsSamplerHeap;
301
302 if (!CSF.ResMayNotAlias && CanSetResMayNotAlias && RTI.isUAV() &&
303 MMDI.ValidatorVersion >= VersionTuple(1, 8)) {
304 CSF.ResMayNotAlias = true;
305 }
306 break;
307 }
308 case Intrinsic::dx_resource_load_level:
309 case Intrinsic::dx_resource_load_typedbuffer: {
310 dxil::ResourceTypeInfo &RTI =
311 DRTM[cast<TargetExtType>(II->getArgOperand(0)->getType())];
312 if (RTI.isTyped() && RTI.isUAV())
313 CSF.TypedUAVLoadAdditionalFormats |= RTI.getTyped().ElementCount > 1;
314 if (II->getIntrinsicID() == Intrinsic::dx_resource_load_typedbuffer &&
315 !CSF.TiledResources && checkIfStatusIsExtracted(*II))
316 CSF.TiledResources = true;
317 break;
318 }
319 case Intrinsic::dx_resource_load_rawbuffer: {
320 if (!CSF.TiledResources && checkIfStatusIsExtracted(*II))
321 CSF.TiledResources = true;
322 break;
323 }
324 case Intrinsic::dx_resource_atomic_binop:
325 case Intrinsic::dx_resource_atomic_compare_exchange: {
326 if (II->getType()->isIntegerTy(64)) {
327 dxil::ResourceTypeInfo &RTI =
328 DRTM[cast<TargetExtType>(II->getArgOperand(0)->getType())];
329 if (RTI.isTyped())
330 CSF.AtomicInt64OnTypedResource = true;
331 // TODO(https://github.com/llvm/llvm-project/issues/116152): Set
332 // AtomicInt64OnHeapResource when heap-resource intrinsics are added.
333 }
334 break;
335 }
336 }
337 }
338 // 64-bit atomics on groupshared memory (address space 3).
339 if (const auto *ARMW = dyn_cast<AtomicRMWInst>(&I)) {
340 if (ARMW->getValOperand()->getType()->isIntegerTy(64) &&
341 ARMW->getPointerAddressSpace() == 3)
342 CSF.AtomicInt64OnGroupShared = true;
343 } else if (const auto *AXCG = dyn_cast<AtomicCmpXchgInst>(&I)) {
344 if (AXCG->getNewValOperand()->getType()->isIntegerTy(64) &&
345 AXCG->getPointerAddressSpace() == 3)
346 CSF.AtomicInt64OnGroupShared = true;
347 }
348 // Handle call instructions
349 if (auto *CI = dyn_cast<CallInst>(&I)) {
350 const Function *CF = CI->getCalledFunction();
351 // Merge-in shader flags mask of the called function in the current module
352 if (FunctionFlags.contains(CF))
353 CSF.merge(FunctionFlags[CF]);
354
355 CSF.DX11_1_DoubleExtensions |=
356 checkDoubleExtensionOps(CI->getIntrinsicID());
357 CSF.WaveOps |= checkWaveOps(CI->getIntrinsicID());
358 }
359}
360
361/// Set shader flags that apply to all functions within the module
363ModuleShaderFlags::gatherGlobalModuleFlags(const Module &M,
364 const DXILResourceMap &DRM,
365 const ModuleMetadataInfo &MMDI) {
366
367 ComputedShaderFlags CSF;
368
369 CSF.DisableOptimizations = isOptimizationDisabled(M);
370
371 CSF.UAVsAtEveryStage = hasUAVsAtEveryStage(DRM, MMDI);
372
373 // Set the Max64UAVs flag if the number of UAVs is > 8
374 uint32_t NumUAVs = 0;
375 for (auto &UAV : DRM.uavs()) {
376 // Heap resources do not count towards Max64UAVs flag.
377 if (!UAV.hasBinding())
378 continue;
379 if (MMDI.ValidatorVersion < VersionTuple(1, 6)) {
380 NumUAVs++;
381 } else { // MMDI.ValidatorVersion >= VersionTuple(1, 6)
382 uint32_t Size = UAV.getSize();
383 uint32_t NewNum = NumUAVs + (Size == 0 ? ~0U : Size);
384 if (NewNum < NumUAVs)
385 NewNum = ~0U;
386 NumUAVs = NewNum;
387 }
388 }
389 if (NumUAVs > 8)
390 CSF.Max64UAVs = true;
391
392 // Set the module flag that enables native low-precision execution mode.
393 // NativeLowPrecisionMode can only be set when the command line option
394 // -enable-16bit-types is provided. This is indicated by the dx.nativelowprec
395 // module flag being set
396 // This flag is needed even if the module does not use 16-bit types because a
397 // corresponding debug module may include 16-bit types, and tools that use the
398 // debug module may expect it to have the same flags as the original
399 if (auto *NativeLowPrec = mdconst::extract_or_null<ConstantInt>(
400 M.getModuleFlag("dx.nativelowprec")))
401 if (MMDI.ShaderModelVersion >= VersionTuple(6, 2))
402 CSF.NativeLowPrecisionMode = NativeLowPrec->getValue().getBoolValue();
403
404 // Set ResMayNotAlias to true if DXIL validator version < 1.8 and there
405 // are UAVs present globally.
406 if (CanSetResMayNotAlias && MMDI.ValidatorVersion < VersionTuple(1, 8))
407 CSF.ResMayNotAlias = !DRM.uavs().empty();
408
409 // The command line option -all-resources-bound will set the
410 // dx.allresourcesbound module flag to 1
411 if (auto *AllResourcesBound = mdconst::extract_or_null<ConstantInt>(
412 M.getModuleFlag("dx.allresourcesbound")))
413 if (AllResourcesBound->getValue().getBoolValue())
414 CSF.AllResourcesBound = true;
415
416 return CSF;
417}
418
419/// Construct ModuleShaderFlags for module Module M
421 const DXILResourceMap &DRM,
422 const ModuleMetadataInfo &MMDI,
423 const ModuleSignatureInfo &Signatures) {
424
425 CanSetResMayNotAlias = MMDI.DXILVersion >= VersionTuple(1, 7);
426 // The command line option -res-may-alias will set the dx.resmayalias module
427 // flag to 1, thereby disabling the ability to set the ResMayNotAlias flag
428 if (auto *ResMayAlias = mdconst::extract_or_null<ConstantInt>(
429 M.getModuleFlag("dx.resmayalias")))
430 if (ResMayAlias->getValue().getBoolValue())
431 CanSetResMayNotAlias = false;
432
433 ComputedShaderFlags GlobalSFMask = gatherGlobalModuleFlags(M, DRM, MMDI);
434
435 CallGraph CG(M);
436
437 // Compute Shader Flags Mask for all functions using post-order visit of SCC
438 // of the call graph.
439 for (scc_iterator<CallGraph *> SCCI = scc_begin(&CG); !SCCI.isAtEnd();
440 ++SCCI) {
441 const std::vector<CallGraphNode *> &CurSCC = *SCCI;
442
443 // Union of shader masks of all functions in CurSCC
445 // List of functions in CurSCC that are neither external nor declarations
446 // and hence whose flags are collected
447 SmallVector<Function *> CurSCCFuncs;
448 for (CallGraphNode *CGN : CurSCC) {
449 Function *F = CGN->getFunction();
450 if (!F)
451 continue;
452
453 if (F->isDeclaration()) {
454 assert(!F->getName().starts_with("dx.op.") &&
455 "DXIL Shader Flag analysis should not be run post-lowering.");
456 continue;
457 }
458
459 ComputedShaderFlags CSF = GlobalSFMask;
460 for (const auto &BB : *F)
461 for (const auto &I : BB)
462 updateFunctionFlags(CSF, I, DRTM, MMDI);
463 // An unused signature element still contributes to the shader's type
464 // requirements even when no instruction uses that component type.
465 if (const EntrySignature *Sig = Signatures.get(F)) {
466 CSF.Barycentrics |= llvm::any_of(Sig->Inputs, [](const auto &E) {
467 return E.SemanticKind == dxbc::PSV::SemanticKind::Barycentrics;
468 });
469 // Unallocated elements do not occupy signature registers. Their type
470 // requirements come from the instructions that access them.
471 auto HasLowPrecision = [](const auto &Elements) {
472 return llvm::any_of(Elements, [](const auto &E) {
473 return E.isAllocated() && (E.CompType == ElementType::F16 ||
474 E.CompType == ElementType::I16 ||
475 E.CompType == ElementType::U16);
476 });
477 };
478 if (HasLowPrecision(Sig->Inputs) || HasLowPrecision(Sig->Outputs)) {
479 CSF.LowPrecisionPresent = true;
480 if (Sig->UseNative16Bit)
481 CSF.NativeLowPrecision = true;
482 else
483 CSF.MinimumPrecision = true;
484 }
485 // Declaring SV_ShadingRate in either signature requires the feature,
486 // regardless of whether it is accessed.
487 auto HasShadingRate = [](const auto &Elements) {
488 return llvm::any_of(Elements, [](const auto &E) {
489 return E.SemanticKind == dxbc::PSV::SemanticKind::ShadingRate;
490 });
491 };
492 if (HasShadingRate(Sig->Inputs) || HasShadingRate(Sig->Outputs))
493 CSF.ShadingRate = true;
494 }
495 // Update combined shader flags mask for all functions in this SCC
496 SCCSF.merge(CSF);
497
498 CurSCCFuncs.push_back(F);
499 }
500
501 // Update combined shader flags mask for all functions of the module
502 CombinedSFMask.merge(SCCSF);
503
504 // Shader flags mask of each of the functions in an SCC of the call graph is
505 // the union of all functions in the SCC. Update shader flags masks of
506 // functions in CurSCC accordingly. This is trivially true if SCC contains
507 // one function.
508 for (Function *F : CurSCCFuncs)
509 // Merge SCCSF with that of F
510 FunctionFlags[F].merge(SCCSF);
511 }
512}
513
515 uint64_t FlagVal = (uint64_t) * this;
516 OS << formatv("; Shader Flags Value: {0:x8}\n;\n", FlagVal);
517 if (FlagVal == 0)
518 return;
519 OS << "; Note: shader requires additional functionality:\n";
520#define SHADER_FEATURE_FLAG(FeatureBit, DxilModuleNum, FlagName, Str) \
521 if (FlagName) \
522 (OS << ";").indent(7) << Str << "\n";
523#include "llvm/BinaryFormat/DXContainerConstants.def"
524 OS << "; Note: extra DXIL module flags:\n";
525#define DXIL_MODULE_FLAG(DxilModuleBit, FlagName, Str) \
526 if (FlagName) \
527 (OS << ";").indent(7) << Str << "\n";
528#include "llvm/BinaryFormat/DXContainerConstants.def"
529 OS << ";\n";
530}
531
532/// Return the shader flags mask of the specified function Func.
535 auto Iter = FunctionFlags.find(Func);
536 assert((Iter != FunctionFlags.end() && Iter->first == Func) &&
537 "Get Shader Flags : No Shader Flags Mask exists for function");
538 return Iter->second;
539}
540
541//===----------------------------------------------------------------------===//
542// ShaderFlagsAnalysis and ShaderFlagsAnalysisPrinterPass
543
544// Provide an explicit template instantiation for the static ID.
545AnalysisKey ShaderFlagsAnalysis::Key;
546
558
561 const ModuleShaderFlags &FlagsInfo = AM.getResult<ShaderFlagsAnalysis>(M);
562 // Print description of combined shader flags for all module functions
563 OS << "; Combined Shader Flags for Module\n";
564 FlagsInfo.getCombinedFlags().print(OS);
565 // Print shader flags mask for each of the module functions
566 OS << "; Shader Flags for Module Functions\n";
567 for (const auto &F : M.getFunctionList()) {
568 if (F.isDeclaration())
569 continue;
570 const ComputedShaderFlags &SFMask = FlagsInfo.getFunctionFlags(&F);
571 OS << formatv("; Function {0} : {1:x8}\n;\n", F.getName(),
572 (uint64_t)(SFMask));
573 }
574
575 return PreservedAnalyses::all();
576}
577
578//===----------------------------------------------------------------------===//
579// ShaderFlagsAnalysis and ShaderFlagsAnalysisPrinterPass
580
582 DXILResourceTypeMap &DRTM =
583 getAnalysis<DXILResourceTypeWrapperPass>().getResourceTypeMap();
584 DXILResourceMap &DRM =
585 getAnalysis<DXILResourceWrapperPass>().getResourceMap();
586 const ModuleMetadataInfo MMDI =
588
589 MSFI.initialize(M, DRTM, DRM, MMDI,
590 getAnalysis<SignatureAnalysisWrapper>().getSignatureInfo());
591 return false;
592}
593
601
603
605 "DXIL Shader Flag Analysis", true, true)
610 "DXIL Shader Flag Analysis", true, true)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains the simple types necessary to represent the attributes associated with functions a...
This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...
bool checkIfStatusIsExtracted(const IntrinsicInst &II)
static bool isOptimizationDisabled(const Module &M)
static bool hasUAVsAtEveryStage(const DXILResourceMap &DRM, const ModuleMetadataInfo &MMDI)
static bool checkDoubleExtensionOps(Intrinsic::ID IID)
static bool checkAdvancedTextureOps(const IntrinsicInst &II)
Texture load and sample operations accept "programmable offsets", i.e.
static bool checkWaveOps(Intrinsic::ID IID)
Module.h This file contains the declarations for the Module class.
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
uint64_t IntrinsicInst * II
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition PassSupport.h:42
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition PassSupport.h:44
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Definition PassSupport.h:39
This builds on the llvm/ADT/GraphTraits.h file to find the strongly connected components (SCCs) of a ...
This file defines the SmallVector class.
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.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
AnalysisUsage & addRequiredTransitive()
A node in the call graph for a module.
Definition CallGraph.h:162
The basic data container for the call graph of a Module of IR.
Definition CallGraph.h:72
iterator_range< iterator > uavs()
This instruction extracts a struct member or array element value from an aggregate value.
A wrapper class for inspecting calls to intrinsic functions.
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - 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.
Definition Analysis.h:112
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition Analysis.h:118
void push_back(const T &Elt)
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
@ RayGeneration
Definition Triple.h:405
@ Amplification
Definition Triple.h:412
Represents a version number in the form major[.minor[.subminor[.build]]].
const EntrySignature * get(const Function *F) const
LLVM_ABI bool isUAV() const
LLVM_ABI bool isSampler() const
LLVM_ABI bool isTyped() const
LLVM_ABI TypedInfo getTyped() const
dxil::ResourceKind getResourceKind() const
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Wrapper pass for the legacy pass manager.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
ModuleShaderFlags run(Module &M, ModuleAnalysisManager &AM)
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
Enumerate the SCCs of a directed graph in reverse topological order of the SCC DAG.
Definition SCCIterator.h:48
bool isAtEnd() const
Direct loop termination test which is more efficient than comparison with end().
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract_or_null(Y &&MD)
Extract a Value from Metadata, allowing null.
Definition Metadata.h:694
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
scc_iterator< T > scc_begin(const T &G)
Construct the begin iterator for a deduced graph type T.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
Definition InstrProf.h:143
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1762
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
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
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Definition MIRParser.h:39
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition Analysis.h:29
void merge(const ComputedShaderFlags CSF)
void print(raw_ostream &OS=dbgs()) const
Triple::EnvironmentType ShaderProfile
const ComputedShaderFlags & getFunctionFlags(const Function *) const
Return the shader flags mask of the specified function Func.
void initialize(Module &, DXILResourceTypeMap &DRTM, const DXILResourceMap &DRM, const ModuleMetadataInfo &MMDI, const ModuleSignatureInfo &Signatures)
Construct ModuleShaderFlags for module Module M.
const ComputedShaderFlags & getCombinedFlags() const