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 // Quad Op Variants
115 case Intrinsic::dx_quad_read_across_x:
116 case Intrinsic::dx_quad_read_across_y:
117 case Intrinsic::dx_quad_read_across_diagonal:
118 return true;
119 }
120}
121
123 switch (IID) {
124 default:
125 return false;
126 case Intrinsic::fma:
127 return true;
128 }
129}
130
131/// Texture load and sample operations accept "programmable offsets", i.e.
132/// offsets that are not compile-time constants. Such offsets require the
133/// AdvancedTextureOps shader feature flag. Returns true if \p II is one of
134/// those operations and its offsets operand is not a constant.
136 // TODO: (#116137) Several other DXIL ops also require this feature flag, but
137 // none of them can be generated yet:
138 // - SampleCmp, SampleCmpBias, SampleCmpGrad and SampleCmpLevelZero set the
139 // flag for non-constant offsets, exactly like the ops handled below.
140 // - SampleCmpLevel, TextureGatherRaw and TextureStoreSample set the flag
141 // unconditionally, and have no intrinsics yet.
142
143 // The offsets operand index differs between the intrinsics.
144 unsigned OffsetsIdx;
145 switch (II.getIntrinsicID()) {
146 default:
147 return false;
148 case Intrinsic::dx_resource_load_level:
149 case Intrinsic::dx_resource_sample:
150 case Intrinsic::dx_resource_sample_clamp:
151 OffsetsIdx = 3;
152 break;
153 case Intrinsic::dx_resource_samplebias:
154 case Intrinsic::dx_resource_samplebias_clamp:
155 case Intrinsic::dx_resource_samplelevel:
156 OffsetsIdx = 4;
157 break;
158 case Intrinsic::dx_resource_samplegrad:
159 case Intrinsic::dx_resource_samplegrad_clamp:
160 OffsetsIdx = 5;
161 break;
162 }
163 return !isa<Constant>(II.getArgOperand(OffsetsIdx));
164}
165
166static bool isOptimizationDisabled(const Module &M) {
167 const StringRef Key = "dx.disable_optimizations";
168 if (auto *Flag = mdconst::extract_or_null<ConstantInt>(M.getModuleFlag(Key)))
169 return Flag->getValue().getBoolValue();
170 return false;
171}
172
173// Checks to see if the status bit from a load with status
174// instruction is ever extracted. If it is, the module needs
175// to have the TiledResources shader flag set.
177 [[maybe_unused]] Intrinsic::ID IID = II.getIntrinsicID();
178 assert(IID == Intrinsic::dx_resource_load_typedbuffer ||
179 IID == Intrinsic::dx_resource_load_rawbuffer &&
180 "unexpected intrinsic ID");
181 for (const User *U : II.users()) {
182 if (const ExtractValueInst *EVI = dyn_cast<ExtractValueInst>(U)) {
183 // Resource load operations return a {result, status} pair.
184 // Check if we extract the status
185 if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 1)
186 return true;
187 }
188 }
189
190 return false;
191}
192
193/// Update the shader flags mask based on the given instruction.
194/// \param CSF Shader flags mask to update.
195/// \param I Instruction to check.
196void ModuleShaderFlags::updateFunctionFlags(ComputedShaderFlags &CSF,
197 const Instruction &I,
199 const ModuleMetadataInfo &MMDI) {
200 if (!CSF.Doubles)
201 CSF.Doubles = I.getType()->getScalarType()->isDoubleTy();
202
203 if (!CSF.Doubles) {
204 for (const Value *Op : I.operands()) {
205 if (Op->getType()->getScalarType()->isDoubleTy()) {
206 CSF.Doubles = true;
207 break;
208 }
209 }
210 }
211
212 if (CSF.Doubles) {
213 switch (I.getOpcode()) {
214 case Instruction::FDiv:
215 case Instruction::UIToFP:
216 case Instruction::SIToFP:
217 case Instruction::FPToUI:
218 case Instruction::FPToSI:
219 CSF.DX11_1_DoubleExtensions = true;
220 break;
221 }
222 }
223
224 if (!CSF.LowPrecisionPresent)
225 CSF.LowPrecisionPresent = I.getType()->getScalarType()->isIntegerTy(16) ||
226 I.getType()->getScalarType()->isHalfTy();
227
228 if (!CSF.LowPrecisionPresent) {
229 for (const Value *Op : I.operands()) {
230 if (Op->getType()->getScalarType()->isIntegerTy(16) ||
231 Op->getType()->getScalarType()->isHalfTy()) {
232 CSF.LowPrecisionPresent = true;
233 break;
234 }
235 }
236 }
237
238 if (CSF.LowPrecisionPresent) {
239 if (CSF.NativeLowPrecisionMode)
240 CSF.NativeLowPrecision = true;
241 else
242 CSF.MinimumPrecision = true;
243 }
244
245 if (!CSF.Int64Ops)
246 CSF.Int64Ops = I.getType()->getScalarType()->isIntegerTy(64);
247
248 if (!CSF.Int64Ops && !isa<LifetimeIntrinsic>(&I)) {
249 for (const Value *Op : I.operands()) {
250 if (Op->getType()->getScalarType()->isIntegerTy(64)) {
251 CSF.Int64Ops = true;
252 break;
253 }
254 }
255 }
256
257 if (const auto *II = dyn_cast<IntrinsicInst>(&I)) {
258 CSF.AdvancedTextureOps |= checkAdvancedTextureOps(*II);
259
260 switch (II->getIntrinsicID()) {
261 default:
262 break;
263 case Intrinsic::dx_start_vertex_location:
264 case Intrinsic::dx_start_instance_location:
265 CSF.ExtendedCommandInfo = true;
266 break;
267 case Intrinsic::dx_view_id:
268 CSF.ViewID = true;
269 break;
270 case Intrinsic::dx_resource_handlefrombinding: {
271 dxil::ResourceTypeInfo &RTI = DRTM[cast<TargetExtType>(II->getType())];
272
273 // Set ResMayNotAlias if DXIL validator version >= 1.8 and the function
274 // uses UAVs
275 if (!CSF.ResMayNotAlias && CanSetResMayNotAlias &&
276 MMDI.ValidatorVersion >= VersionTuple(1, 8) && RTI.isUAV())
277 CSF.ResMayNotAlias = true;
278
279 switch (RTI.getResourceKind()) {
282 CSF.EnableRawAndStructuredBuffers = true;
283 break;
284 default:
285 break;
286 }
287 break;
288 }
289 case Intrinsic::dx_resource_handlefromheap: {
290 dxil::ResourceTypeInfo &RTI = DRTM[cast<TargetExtType>(II->getType())];
291 bool IsSamplerHeap = RTI.isSampler();
292 CSF.SamplerDescriptorHeapIndexing |= IsSamplerHeap;
293 CSF.ResourceDescriptorHeapIndexing |= !IsSamplerHeap;
294
295 if (!CSF.ResMayNotAlias && CanSetResMayNotAlias && RTI.isUAV() &&
296 MMDI.ValidatorVersion >= VersionTuple(1, 8)) {
297 CSF.ResMayNotAlias = true;
298 }
299 break;
300 }
301 case Intrinsic::dx_resource_load_level:
302 case Intrinsic::dx_resource_load_typedbuffer: {
303 dxil::ResourceTypeInfo &RTI =
304 DRTM[cast<TargetExtType>(II->getArgOperand(0)->getType())];
305 if (RTI.isTyped() && RTI.isUAV())
306 CSF.TypedUAVLoadAdditionalFormats |= RTI.getTyped().ElementCount > 1;
307 if (II->getIntrinsicID() == Intrinsic::dx_resource_load_typedbuffer &&
308 !CSF.TiledResources && checkIfStatusIsExtracted(*II))
309 CSF.TiledResources = true;
310 break;
311 }
312 case Intrinsic::dx_resource_load_rawbuffer: {
313 if (!CSF.TiledResources && checkIfStatusIsExtracted(*II))
314 CSF.TiledResources = true;
315 break;
316 }
317 case Intrinsic::dx_resource_atomic_binop:
318 case Intrinsic::dx_resource_atomic_compare_exchange: {
319 if (II->getType()->isIntegerTy(64)) {
320 dxil::ResourceTypeInfo &RTI =
321 DRTM[cast<TargetExtType>(II->getArgOperand(0)->getType())];
322 if (RTI.isTyped())
323 CSF.AtomicInt64OnTypedResource = true;
324 // TODO(https://github.com/llvm/llvm-project/issues/116152): Set
325 // AtomicInt64OnHeapResource when heap-resource intrinsics are added.
326 }
327 break;
328 }
329 }
330 }
331 // 64-bit atomics on groupshared memory (address space 3).
332 if (const auto *ARMW = dyn_cast<AtomicRMWInst>(&I)) {
333 if (ARMW->getValOperand()->getType()->isIntegerTy(64) &&
334 ARMW->getPointerAddressSpace() == 3)
335 CSF.AtomicInt64OnGroupShared = true;
336 } else if (const auto *AXCG = dyn_cast<AtomicCmpXchgInst>(&I)) {
337 if (AXCG->getNewValOperand()->getType()->isIntegerTy(64) &&
338 AXCG->getPointerAddressSpace() == 3)
339 CSF.AtomicInt64OnGroupShared = true;
340 }
341 // Handle call instructions
342 if (auto *CI = dyn_cast<CallInst>(&I)) {
343 const Function *CF = CI->getCalledFunction();
344 // Merge-in shader flags mask of the called function in the current module
345 if (FunctionFlags.contains(CF))
346 CSF.merge(FunctionFlags[CF]);
347
348 CSF.DX11_1_DoubleExtensions |=
349 checkDoubleExtensionOps(CI->getIntrinsicID());
350 CSF.WaveOps |= checkWaveOps(CI->getIntrinsicID());
351 }
352}
353
354/// Set shader flags that apply to all functions within the module
356ModuleShaderFlags::gatherGlobalModuleFlags(const Module &M,
357 const DXILResourceMap &DRM,
358 const ModuleMetadataInfo &MMDI) {
359
360 ComputedShaderFlags CSF;
361
362 CSF.DisableOptimizations = isOptimizationDisabled(M);
363
364 CSF.UAVsAtEveryStage = hasUAVsAtEveryStage(DRM, MMDI);
365
366 // Set the Max64UAVs flag if the number of UAVs is > 8
367 uint32_t NumUAVs = 0;
368 for (auto &UAV : DRM.uavs()) {
369 // Heap resources do not count towards Max64UAVs flag.
370 if (!UAV.hasBinding())
371 continue;
372 if (MMDI.ValidatorVersion < VersionTuple(1, 6)) {
373 NumUAVs++;
374 } else { // MMDI.ValidatorVersion >= VersionTuple(1, 6)
375 uint32_t Size = UAV.getSize();
376 uint32_t NewNum = NumUAVs + (Size == 0 ? ~0U : Size);
377 if (NewNum < NumUAVs)
378 NewNum = ~0U;
379 NumUAVs = NewNum;
380 }
381 }
382 if (NumUAVs > 8)
383 CSF.Max64UAVs = true;
384
385 // Set the module flag that enables native low-precision execution mode.
386 // NativeLowPrecisionMode can only be set when the command line option
387 // -enable-16bit-types is provided. This is indicated by the dx.nativelowprec
388 // module flag being set
389 // This flag is needed even if the module does not use 16-bit types because a
390 // corresponding debug module may include 16-bit types, and tools that use the
391 // debug module may expect it to have the same flags as the original
392 if (auto *NativeLowPrec = mdconst::extract_or_null<ConstantInt>(
393 M.getModuleFlag("dx.nativelowprec")))
394 if (MMDI.ShaderModelVersion >= VersionTuple(6, 2))
395 CSF.NativeLowPrecisionMode = NativeLowPrec->getValue().getBoolValue();
396
397 // Set ResMayNotAlias to true if DXIL validator version < 1.8 and there
398 // are UAVs present globally.
399 if (CanSetResMayNotAlias && MMDI.ValidatorVersion < VersionTuple(1, 8))
400 CSF.ResMayNotAlias = !DRM.uavs().empty();
401
402 // The command line option -all-resources-bound will set the
403 // dx.allresourcesbound module flag to 1
404 if (auto *AllResourcesBound = mdconst::extract_or_null<ConstantInt>(
405 M.getModuleFlag("dx.allresourcesbound")))
406 if (AllResourcesBound->getValue().getBoolValue())
407 CSF.AllResourcesBound = true;
408
409 return CSF;
410}
411
412/// Construct ModuleShaderFlags for module Module M
414 const DXILResourceMap &DRM,
415 const ModuleMetadataInfo &MMDI,
416 const ModuleSignatureInfo &Signatures) {
417
418 CanSetResMayNotAlias = MMDI.DXILVersion >= VersionTuple(1, 7);
419 // The command line option -res-may-alias will set the dx.resmayalias module
420 // flag to 1, thereby disabling the ability to set the ResMayNotAlias flag
421 if (auto *ResMayAlias = mdconst::extract_or_null<ConstantInt>(
422 M.getModuleFlag("dx.resmayalias")))
423 if (ResMayAlias->getValue().getBoolValue())
424 CanSetResMayNotAlias = false;
425
426 ComputedShaderFlags GlobalSFMask = gatherGlobalModuleFlags(M, DRM, MMDI);
427
428 CallGraph CG(M);
429
430 // Compute Shader Flags Mask for all functions using post-order visit of SCC
431 // of the call graph.
432 for (scc_iterator<CallGraph *> SCCI = scc_begin(&CG); !SCCI.isAtEnd();
433 ++SCCI) {
434 const std::vector<CallGraphNode *> &CurSCC = *SCCI;
435
436 // Union of shader masks of all functions in CurSCC
438 // List of functions in CurSCC that are neither external nor declarations
439 // and hence whose flags are collected
440 SmallVector<Function *> CurSCCFuncs;
441 for (CallGraphNode *CGN : CurSCC) {
442 Function *F = CGN->getFunction();
443 if (!F)
444 continue;
445
446 if (F->isDeclaration()) {
447 assert(!F->getName().starts_with("dx.op.") &&
448 "DXIL Shader Flag analysis should not be run post-lowering.");
449 continue;
450 }
451
452 ComputedShaderFlags CSF = GlobalSFMask;
453 for (const auto &BB : *F)
454 for (const auto &I : BB)
455 updateFunctionFlags(CSF, I, DRTM, MMDI);
456 // An unused signature element still contributes to the shader's type
457 // requirements even when no instruction uses that component type.
458 if (const EntrySignature *Sig = Signatures.get(F)) {
459 CSF.Barycentrics |= llvm::any_of(Sig->Inputs, [](const auto &E) {
460 return E.SemanticKind == dxbc::PSV::SemanticKind::Barycentrics;
461 });
462 // Unallocated elements do not occupy signature registers. Their type
463 // requirements come from the instructions that access them.
464 auto HasLowPrecision = [](const auto &Elements) {
465 return llvm::any_of(Elements, [](const auto &E) {
466 return E.isAllocated() && (E.CompType == ElementType::F16 ||
467 E.CompType == ElementType::I16 ||
468 E.CompType == ElementType::U16);
469 });
470 };
471 if (HasLowPrecision(Sig->Inputs) || HasLowPrecision(Sig->Outputs)) {
472 CSF.LowPrecisionPresent = true;
473 if (Sig->UseNative16Bit)
474 CSF.NativeLowPrecision = true;
475 else
476 CSF.MinimumPrecision = true;
477 }
478 // Declaring SV_ShadingRate in either signature requires the feature,
479 // regardless of whether it is accessed.
480 auto HasShadingRate = [](const auto &Elements) {
481 return llvm::any_of(Elements, [](const auto &E) {
482 return E.SemanticKind == dxbc::PSV::SemanticKind::ShadingRate;
483 });
484 };
485 if (HasShadingRate(Sig->Inputs) || HasShadingRate(Sig->Outputs))
486 CSF.ShadingRate = true;
487 }
488 // Update combined shader flags mask for all functions in this SCC
489 SCCSF.merge(CSF);
490
491 CurSCCFuncs.push_back(F);
492 }
493
494 // Update combined shader flags mask for all functions of the module
495 CombinedSFMask.merge(SCCSF);
496
497 // Shader flags mask of each of the functions in an SCC of the call graph is
498 // the union of all functions in the SCC. Update shader flags masks of
499 // functions in CurSCC accordingly. This is trivially true if SCC contains
500 // one function.
501 for (Function *F : CurSCCFuncs)
502 // Merge SCCSF with that of F
503 FunctionFlags[F].merge(SCCSF);
504 }
505}
506
508 uint64_t FlagVal = (uint64_t) * this;
509 OS << formatv("; Shader Flags Value: {0:x8}\n;\n", FlagVal);
510 if (FlagVal == 0)
511 return;
512 OS << "; Note: shader requires additional functionality:\n";
513#define SHADER_FEATURE_FLAG(FeatureBit, DxilModuleNum, FlagName, Str) \
514 if (FlagName) \
515 (OS << ";").indent(7) << Str << "\n";
516#include "llvm/BinaryFormat/DXContainerConstants.def"
517 OS << "; Note: extra DXIL module flags:\n";
518#define DXIL_MODULE_FLAG(DxilModuleBit, FlagName, Str) \
519 if (FlagName) \
520 (OS << ";").indent(7) << Str << "\n";
521#include "llvm/BinaryFormat/DXContainerConstants.def"
522 OS << ";\n";
523}
524
525/// Return the shader flags mask of the specified function Func.
528 auto Iter = FunctionFlags.find(Func);
529 assert((Iter != FunctionFlags.end() && Iter->first == Func) &&
530 "Get Shader Flags : No Shader Flags Mask exists for function");
531 return Iter->second;
532}
533
534//===----------------------------------------------------------------------===//
535// ShaderFlagsAnalysis and ShaderFlagsAnalysisPrinterPass
536
537// Provide an explicit template instantiation for the static ID.
538AnalysisKey ShaderFlagsAnalysis::Key;
539
551
554 const ModuleShaderFlags &FlagsInfo = AM.getResult<ShaderFlagsAnalysis>(M);
555 // Print description of combined shader flags for all module functions
556 OS << "; Combined Shader Flags for Module\n";
557 FlagsInfo.getCombinedFlags().print(OS);
558 // Print shader flags mask for each of the module functions
559 OS << "; Shader Flags for Module Functions\n";
560 for (const auto &F : M.getFunctionList()) {
561 if (F.isDeclaration())
562 continue;
563 const ComputedShaderFlags &SFMask = FlagsInfo.getFunctionFlags(&F);
564 OS << formatv("; Function {0} : {1:x8}\n;\n", F.getName(),
565 (uint64_t)(SFMask));
566 }
567
568 return PreservedAnalyses::all();
569}
570
571//===----------------------------------------------------------------------===//
572// ShaderFlagsAnalysis and ShaderFlagsAnalysisPrinterPass
573
575 DXILResourceTypeMap &DRTM =
576 getAnalysis<DXILResourceTypeWrapperPass>().getResourceTypeMap();
577 DXILResourceMap &DRM =
578 getAnalysis<DXILResourceWrapperPass>().getResourceMap();
579 const ModuleMetadataInfo MMDI =
581
582 MSFI.initialize(M, DRTM, DRM, MMDI,
583 getAnalysis<SignatureAnalysisWrapper>().getSignatureInfo());
584 return false;
585}
586
594
596
598 "DXIL Shader Flag Analysis", true, true)
603 "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