LLVM 24.0.0git
DXILContainerGlobals.cpp
Go to the documentation of this file.
1//===- DXILContainerGlobals.cpp - DXContainer global generator pass -------===//
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// DXILContainerGlobalsPass implementation.
10//
11//===----------------------------------------------------------------------===//
12
13#include "DXILRootSignature.h"
14#include "DXILShaderFlags.h"
16#include "DirectX.h"
20#include "llvm/ADT/StringRef.h"
24#include "llvm/CodeGen/Passes.h"
25#include "llvm/IR/Analysis.h"
26#include "llvm/IR/Constants.h"
27#include "llvm/IR/Module.h"
28#include "llvm/IR/PassManager.h"
33#include "llvm/Pass.h"
34#include "llvm/Support/MD5.h"
35#include "llvm/Support/Path.h"
38#include <cstdint>
39
40using namespace llvm;
41using namespace llvm::dxil;
42using namespace llvm::mcdxbc;
43
44namespace {
45class DXILContainerGlobalsLegacy : public ModulePass {
46public:
47 static char ID; // Pass identification, replacement for typeid
48 DXILContainerGlobalsLegacy() : ModulePass(ID) {}
49
50 StringRef getPassName() const override {
51 return "DXContainer Global Emitter";
52 }
53
54 bool runOnModule(Module &M) override;
55
56 void getAnalysisUsage(AnalysisUsage &AU) const override {
57 AU.setPreservesAll();
58 AU.addRequired<ShaderFlagsAnalysisWrapper>();
59 AU.addRequired<RootSignatureAnalysisWrapper>();
60 AU.addRequired<SignatureAnalysisWrapper>();
61 AU.addRequired<DXILMetadataAnalysisWrapperPass>();
62 AU.addRequired<DXILResourceTypeWrapperPass>();
63 AU.addRequired<DXILResourceWrapperPass>();
64 }
65};
66
67} // namespace
68
70 StringRef Name,
72 auto *GV = new llvm::GlobalVariable(
73 M, Content->getType(), true, GlobalValue::PrivateLinkage, Content, Name);
74 GV->setSection(SectionName);
75 GV->setAlignment(Align(4));
76 return GV;
77}
78
79static GlobalVariable *
81 function_ref<const ModuleShaderFlags &()> GetShaderFlags) {
82 uint64_t CombinedFeatureFlags =
83 GetShaderFlags().getCombinedFlags().getFeatureFlags();
84
85 Constant *FeatureFlagsConstant =
86 ConstantInt::get(M.getContext(), APInt(64, CombinedFeatureFlags));
87 return buildContainerGlobal(M, FeatureFlagsConstant, "dx.sfi0", "SFI0");
88}
89
91 StringRef SectionData, StringRef MetadataName,
93 Constant *SectionConstant = ConstantDataArray::getString(
94 M.getContext(), SectionData, /*AddNull*/ false);
95 Globals.emplace_back(
96 buildContainerGlobal(M, SectionConstant, MetadataName, SectionName));
97}
98
101 ConstantDataArray *DXILConstant;
102 MD5 Digest;
103 dxbc::ShaderHash HashData = {0, {0}};
104 const auto &Opts = M.getContext().getLibraryOptions().get<DirectXMCOptions>();
105
106 if (Opts.Zss) {
107 if (auto *ILDB = M.getNamedGlobal("dx.ildb")) {
108 DXILConstant = cast<ConstantDataArray>(ILDB->getInitializer());
109 HashData.Flags = static_cast<uint32_t>(dxbc::HashFlags::IncludesSource);
110 } else {
111 reportFatalUsageError("/Zss requires debug info (/Zi or /Zs)");
112 }
113 } else {
114 DXILConstant =
115 cast<ConstantDataArray>(M.getNamedGlobal("dx.dxil")->getInitializer());
116 }
117
118 Digest.update(DXILConstant->getRawDataValues());
119 MD5::MD5Result MD5 = Digest.final();
120
121 memcpy(reinterpret_cast<void *>(&HashData.Digest), MD5.data(), 16);
123 HashData.swapBytes();
124 StringRef Data(reinterpret_cast<char *>(&HashData), sizeof(dxbc::ShaderHash));
125
126 Constant *ModuleConstant =
128 Globals.emplace_back(
129 buildContainerGlobal(M, ModuleConstant, "dx.hash", "HASH"));
130
131 if (M.debug_compile_units().empty())
132 return;
133
134 SmallString<40> DebugNameStr;
135 Digest.stringifyResult(MD5, DebugNameStr);
136 DebugNameStr += ".pdb";
137 if (!Opts.pdb_path.empty() || Opts.pdb_in_private) {
138 if (!Opts.pdb_path.empty()) {
139 StringRef DebugFile = Opts.pdb_path;
140 SmallString<256> AbsoluteDebugName;
141 if (sys::path::is_separator(DebugFile.back())) {
142 // If PDB output path was specified as a directory, put the MD5.pdb file
143 // there.
144 AbsoluteDebugName = DebugFile;
145 sys::path::append(AbsoluteDebugName, DebugNameStr);
146 } else {
147 // Otherwise, use PDB output path as a user-provided PDB file name.
148 DebugNameStr = DebugFile;
149 AbsoluteDebugName = DebugNameStr;
150 }
151
152 // Pass PDB name to DXContainerPDBPass via PDBNAME section.
153 addSection(M, Globals, AbsoluteDebugName, "dx.pdb.name",
155 }
156
157 // Pass module hash to DXContainerPDBPass.
158 Globals.emplace_back(buildContainerGlobal(
159 M, ConstantDataArray::get(M.getContext(), ArrayRef(HashData.Digest)),
160 "dx.pdb.hash", ModuleHashSectionName));
161 }
162
163 // Emit ILDN part in debug info mode.
165 DebugName.setFilename(DebugNameStr);
166 SmallString<64> ILDNData;
167 raw_svector_ostream OS(ILDNData);
168 DebugName.write(OS);
169 addSection(M, Globals, ILDNData, "dx.ildn", "ILDN");
170}
171
174 const dxil::ModuleMetadataInfo &MMI) {
178 bool Legacy = !V.empty() && V != VersionTuple(0, 0) && V < VersionTuple(1, 7);
179 Sig.write(OS, /*PadToDword=*/!Legacy);
181 ConstantDataArray::getString(M.getContext(), Data, /*AddNull*/ false);
182 return buildContainerGlobal(M, Constant, Name, SectionName);
183}
184
185static void
187 function_ref<dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo,
188 function_ref<const ModuleSignatureInfo &()> GetSignatureInfo) {
189 const ModuleMetadataInfo &MMI = GetModuleMetadataInfo();
190 const ModuleSignatureInfo &Signatures = GetSignatureInfo();
191 Signature InputSig, OutputSig;
192 if (MMI.ShaderProfile != Triple::Library && MMI.EntryPropertyVec.size() == 1)
193 if (const auto *Sig = Signatures.get(MMI.EntryPropertyVec[0].Entry))
194 Sig->buildSignatures(InputSig, OutputSig, MMI.ValidatorVersion);
195
196 Globals.emplace_back(buildSignature(M, InputSig, "dx.isg1", "ISG1", MMI));
197 Globals.emplace_back(buildSignature(M, OutputSig, "dx.osg1", "OSG1", MMI));
198}
199
202 function_ref<dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo,
203 function_ref<RootSignatureBindingInfo &()> GetRootSignatureBindingInfo) {
204
205 dxil::ModuleMetadataInfo &MMI = GetModuleMetadataInfo();
206
207 // Root Signature in Library don't compile to DXContainer.
209 return;
210
211 RootSignatureBindingInfo &RSA = GetRootSignatureBindingInfo();
212 const Function *EntryFunction = nullptr;
213
215 assert(MMI.EntryPropertyVec.size() == 1);
216 EntryFunction = MMI.EntryPropertyVec[0].Entry;
217 }
218
219 const mcdxbc::RootSignatureDesc *RS = RSA.getDescForFunction(EntryFunction);
220 if (!RS)
221 return;
222
225
226 RS->write(OS);
227
228 addSection(M, Globals, Data, "dx.rts0", "RTS0");
229}
230
231static void
233 function_ref<DXILResourceMap &()> GetResourceMap,
234 function_ref<DXILResourceTypeMap &()> GetResourceTypeMap) {
235 const DXILResourceMap &DRM = GetResourceMap();
236 DXILResourceTypeMap &DRTM = GetResourceTypeMap();
237
238 auto MakeBinding = [](const dxil::ResourceInfo::ResourceBinding &Binding,
240 const dxil::ResourceKind Kind,
241 const dxbc::PSV::ResourceFlags Flags =
244 BindInfo.Type = Type;
245 BindInfo.LowerBound = Binding.LowerBound;
246 assert((Binding.Size == 0 ||
247 (uint64_t)Binding.LowerBound + Binding.Size - 1 <= UINT32_MAX) &&
248 "Resource range is too large");
249 BindInfo.UpperBound = (Binding.Size == 0)
250 ? UINT32_MAX
251 : Binding.LowerBound + Binding.Size - 1;
252 BindInfo.Space = Binding.Space;
253 BindInfo.Kind = static_cast<dxbc::PSV::ResourceKind>(Kind);
254 BindInfo.Flags = Flags;
255 return BindInfo;
256 };
257
258 for (const dxil::ResourceInfo &RI : DRM.cbuffers()) {
259 if (!RI.hasBinding())
260 continue;
261 const dxil::ResourceInfo::ResourceBinding &Binding = RI.getBinding();
262 PSV.Resources.push_back(MakeBinding(Binding, dxbc::PSV::ResourceType::CBV,
264 }
265 for (const dxil::ResourceInfo &RI : DRM.samplers()) {
266 if (!RI.hasBinding())
267 continue;
268 const dxil::ResourceInfo::ResourceBinding &Binding = RI.getBinding();
269 PSV.Resources.push_back(MakeBinding(Binding,
270 dxbc::PSV::ResourceType::Sampler,
272 }
273 for (const dxil::ResourceInfo &RI : DRM.srvs()) {
274 if (!RI.hasBinding())
275 continue;
276 const dxil::ResourceInfo::ResourceBinding &Binding = RI.getBinding();
277
278 dxil::ResourceTypeInfo &TypeInfo = DRTM[RI.getHandleTy()];
280 if (TypeInfo.isStruct())
281 ResType = dxbc::PSV::ResourceType::SRVStructured;
282 else if (TypeInfo.isTyped())
283 ResType = dxbc::PSV::ResourceType::SRVTyped;
284 else
285 ResType = dxbc::PSV::ResourceType::SRVRaw;
286
287 PSV.Resources.push_back(
288 MakeBinding(Binding, ResType, TypeInfo.getResourceKind()));
289 }
290 for (const dxil::ResourceInfo &RI : DRM.uavs()) {
291 if (!RI.hasBinding())
292 continue;
293 const dxil::ResourceInfo::ResourceBinding &Binding = RI.getBinding();
294
295 dxil::ResourceTypeInfo &TypeInfo = DRTM[RI.getHandleTy()];
297 if (RI.hasCounter())
298 ResType = dxbc::PSV::ResourceType::UAVStructuredWithCounter;
299 else if (TypeInfo.isStruct())
300 ResType = dxbc::PSV::ResourceType::UAVStructured;
301 else if (TypeInfo.isTyped())
302 ResType = dxbc::PSV::ResourceType::UAVTyped;
303 else
304 ResType = dxbc::PSV::ResourceType::UAVRaw;
305
307 Flags.Bits.UsedByAtomic64 = RI.HasAtomic64Use;
308
309 PSV.Resources.push_back(
310 MakeBinding(Binding, ResType, TypeInfo.getResourceKind(), Flags));
311 }
312}
313
316 function_ref<dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo,
317 function_ref<DXILResourceMap &()> GetResourceMap,
318 function_ref<DXILResourceTypeMap &()> GetResourceTypeMap,
319 function_ref<const ModuleShaderFlags &()> GetModuleShaderFlags,
320 function_ref<const ModuleSignatureInfo &()> GetModuleSignatureInfo) {
323 PSVRuntimeInfo PSV;
325 PSV.BaseData.MaximumWaveLaneCount = std::numeric_limits<uint32_t>::max();
326
327 dxil::ModuleMetadataInfo &MMI = GetModuleMetadataInfo();
328 assert(MMI.EntryPropertyVec.size() == 1 ||
332 static_cast<uint8_t>(MMI.ShaderProfile - Triple::Pixel);
333
334 addResourcesForPSV(M, PSV, GetResourceMap, GetResourceTypeMap);
335 unsigned PSVVersion = 3;
336 if (MMI.ShaderProfile != Triple::Library &&
337 MMI.EntryPropertyVec.size() == 1) {
338 const Function *Entry = MMI.EntryPropertyVec[0].Entry;
339 bool UsesViewID = GetModuleShaderFlags().getFunctionFlags(Entry).ViewID;
340 PSV.BaseData.UsesViewID = UsesViewID;
341 const ModuleSignatureInfo &Signatures = GetModuleSignatureInfo();
342 if (const auto *Sig = Signatures.get(Entry)) {
343 Sig->updatePSV(PSV, MMI.ValidatorVersion, UsesViewID);
344 // Preserve the existing empty-signature path, and select an ABI version
345 // compatible with the validator for graphics signature data.
347 if ((!Sig->Inputs.empty() || !Sig->Outputs.empty()) && !V.empty() &&
348 V != VersionTuple(0, 0))
349 PSVVersion = V < VersionTuple(1, 1) ? 0
350 : V < VersionTuple(1, 6) ? 1
351 : V < VersionTuple(1, 8) ? 2
352 : 3;
353 }
354 }
355
356 // Hardcoded values here to unblock loading the shader into D3D.
357 //
358 // TODO: Lots more stuff to do here!
359 //
360 // See issue https://github.com/llvm/llvm-project/issues/96674.
361 switch (MMI.ShaderProfile) {
362 case Triple::Compute:
363 PSV.BaseData.NumThreadsX = MMI.EntryPropertyVec[0].NumThreadsX;
364 PSV.BaseData.NumThreadsY = MMI.EntryPropertyVec[0].NumThreadsY;
365 PSV.BaseData.NumThreadsZ = MMI.EntryPropertyVec[0].NumThreadsZ;
366 if (MMI.EntryPropertyVec[0].WaveSizeMin) {
367 PSV.BaseData.MinimumWaveLaneCount = MMI.EntryPropertyVec[0].WaveSizeMin;
369 MMI.EntryPropertyVec[0].WaveSizeMax
370 ? MMI.EntryPropertyVec[0].WaveSizeMax
371 : MMI.EntryPropertyVec[0].WaveSizeMin;
372 }
373 break;
374 default:
375 break;
376 }
377
378 if (MMI.ShaderProfile != Triple::Library &&
380 PSV.EntryName = MMI.EntryPropertyVec[0].Entry->getName();
381
382 PSV.finalize(MMI.ShaderProfile, PSVVersion);
383 PSV.write(OS, PSVVersion);
384 addSection(M, Globals, Data, "dx.psv0", "PSV0");
385}
386
388 if (M.debug_compile_units().empty())
389 return;
390
395 addSection(M, Globals, Data, "dx.vers", "VERS");
396}
397
398static void addSourceInfo(
400 function_ref<dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo) {
401 dxil::ModuleMetadataInfo &MMI = GetModuleMetadataInfo();
402
403 const auto &Opts = M.getContext().getLibraryOptions().get<DirectXMCOptions>();
404
405 if (!MMI.SourceInfo || Opts.source_in_debug_module)
406 return;
407
408 MMI.SourceInfo->computeEntries();
409 MMI.SourceInfo->finalize();
412 MMI.SourceInfo->write(OS);
413 addSection(M, Globals, Data, "dx.srci", "SRCI");
414}
415
417 Module &M, function_ref<dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo,
418 function_ref<DXILResourceMap &()> GetResourceMap,
419 function_ref<DXILResourceTypeMap &()> GetResourceTypeMap,
420 function_ref<const ModuleShaderFlags &()> GetModuleShaderFlags,
421 function_ref<const ModuleSignatureInfo &()> GetModuleSignatureInfo,
422 function_ref<RootSignatureBindingInfo &()> GetRootSignatureBindingInfo) {
424 Globals.push_back(getFeatureFlags(M, GetModuleShaderFlags));
426 addSignature(M, Globals, GetModuleMetadataInfo, GetModuleSignatureInfo);
427 addRootSignature(M, Globals, GetModuleMetadataInfo,
428 GetRootSignatureBindingInfo);
429 addPipelineStateValidationInfo(M, Globals, GetModuleMetadataInfo,
430 GetResourceMap, GetResourceTypeMap,
431 GetModuleShaderFlags, GetModuleSignatureInfo);
432 addCompilerVersion(M, Globals);
433 addSourceInfo(M, Globals, GetModuleMetadataInfo);
434 appendToCompilerUsed(M, Globals);
435 return true;
436}
437
438bool DXILContainerGlobalsLegacy::runOnModule(Module &M) {
440 M,
441 [&]() -> ModuleMetadataInfo & {
442 return getAnalysis<DXILMetadataAnalysisWrapperPass>()
443 .getModuleMetadata();
444 },
445 [&]() -> DXILResourceMap & {
446 return getAnalysis<DXILResourceWrapperPass>().getResourceMap();
447 },
448 [&]() -> DXILResourceTypeMap & {
449 return getAnalysis<DXILResourceTypeWrapperPass>().getResourceTypeMap();
450 },
451 [&]() -> const ModuleShaderFlags & {
452 return getAnalysis<ShaderFlagsAnalysisWrapper>().getShaderFlags();
453 },
454 [&]() -> const ModuleSignatureInfo & {
455 return getAnalysis<SignatureAnalysisWrapper>().getSignatureInfo();
456 },
457 [&]() -> RootSignatureBindingInfo & {
458 return getAnalysis<RootSignatureAnalysisWrapper>().getRSInfo();
459 });
460}
461
465 M,
466 [&]() -> ModuleMetadataInfo & {
467 return MAM.getResult<DXILMetadataAnalysis>(M);
468 },
469 [&]() -> DXILResourceMap & {
470 return MAM.getResult<DXILResourceAnalysis>(M);
471 },
472 [&]() -> DXILResourceTypeMap & {
473 return MAM.getResult<DXILResourceTypeAnalysis>(M);
474 },
475 [&]() -> const ModuleShaderFlags & {
476 return MAM.getResult<ShaderFlagsAnalysis>(M);
477 },
478 [&]() -> const ModuleSignatureInfo & {
479 return MAM.getResult<SignatureAnalysis>(M);
480 },
481 [&]() -> RootSignatureBindingInfo & {
482 return MAM.getResult<RootSignatureAnalysis>(M);
483 });
484 return PreservedAnalyses::all();
485}
486
487char DXILContainerGlobalsLegacy::ID = 0;
488INITIALIZE_PASS_BEGIN(DXILContainerGlobalsLegacy, "dxil-container-globals",
489 "DXContainer Global Emitter", false, true)
495INITIALIZE_PASS_END(DXILContainerGlobalsLegacy, "dxil-container-globals",
496 "DXContainer Global Emitter", false, true)
497
499 return new DXILContainerGlobalsLegacy();
500}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
uint64_t uint64_t
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static GlobalVariable * buildContainerGlobal(Module &M, Constant *Content, StringRef Name, StringRef SectionName)
static void addCompilerVersion(Module &M, SmallVector< GlobalValue * > &Globals)
static void addSourceInfo(Module &M, SmallVector< GlobalValue * > &Globals, function_ref< dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo)
static GlobalVariable * buildSignature(Module &M, Signature &Sig, StringRef Name, StringRef SectionName, const dxil::ModuleMetadataInfo &MMI)
static void computeShaderHashAndDebugName(Module &M, SmallVector< GlobalValue * > &Globals)
static GlobalVariable * getFeatureFlags(Module &M, function_ref< const ModuleShaderFlags &()> GetShaderFlags)
static void addSection(Module &M, SmallVector< GlobalValue * > &Globals, StringRef SectionData, StringRef MetadataName, StringRef SectionName)
static void addResourcesForPSV(Module &M, PSVRuntimeInfo &PSV, function_ref< DXILResourceMap &()> GetResourceMap, function_ref< DXILResourceTypeMap &()> GetResourceTypeMap)
static void addRootSignature(Module &M, SmallVector< GlobalValue * > &Globals, function_ref< dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo, function_ref< RootSignatureBindingInfo &()> GetRootSignatureBindingInfo)
static void addPipelineStateValidationInfo(Module &M, SmallVector< GlobalValue * > &Globals, function_ref< dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo, function_ref< DXILResourceMap &()> GetResourceMap, function_ref< DXILResourceTypeMap &()> GetResourceTypeMap, function_ref< const ModuleShaderFlags &()> GetModuleShaderFlags, function_ref< const ModuleSignatureInfo &()> GetModuleSignatureInfo)
static void addSignature(Module &M, SmallVector< GlobalValue * > &Globals, function_ref< dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo, function_ref< const ModuleSignatureInfo &()> GetSignatureInfo)
static bool runContainerGlobalsOnModule(Module &M, function_ref< dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo, function_ref< DXILResourceMap &()> GetResourceMap, function_ref< DXILResourceTypeMap &()> GetResourceTypeMap, function_ref< const ModuleShaderFlags &()> GetModuleShaderFlags, function_ref< const ModuleSignatureInfo &()> GetModuleSignatureInfo, function_ref< RootSignatureBindingInfo &()> GetRootSignatureBindingInfo)
DXIL Resource Implicit Binding
Module.h This file contains the declarations for the Module class.
This header defines various interfaces for pass management in LLVM.
ModuleAnalysisManager MAM
#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 file defines the SmallVector class.
This file contains some functions that are useful when dealing with strings.
Class for arbitrary precision integers.
Definition APInt.h:78
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
An array constant whose element type is a simple 1/2/4/8-byte integer, bytes or float/double,...
Definition Constants.h:865
static Constant * get(LLVMContext &Context, ArrayRef< ElementTy > Elts)
get() constructor - Return a constant with array type with an element count and element type matching...
Definition Constants.h:878
static LLVM_ABI Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true, bool ByteString=false)
This method constructs a CDS and initializes it with a text string.
LLVM_ABI StringRef getRawDataValues() const
Return the raw, underlying, bytes of this data.
This is an important base class in LLVM.
Definition Constant.h:44
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM)
iterator_range< iterator > samplers()
iterator_range< iterator > srvs()
iterator_range< iterator > cbuffers()
iterator_range< iterator > uavs()
@ PrivateLinkage
Like Internal, but omit from symbol table.
Definition GlobalValue.h:61
LLVM_ABI void update(ArrayRef< uint8_t > Data)
Updates the hash for the byte stream provided.
Definition MD5.cpp:188
static LLVM_ABI void stringifyResult(MD5Result &Result, SmallVectorImpl< char > &Str)
Translates the bytes in Res to a hex string that is deposited into Str.
Definition MD5.cpp:290
LLVM_ABI void final(MD5Result &Result)
Finishes off the hash and puts the result in result.
Definition MD5.cpp:237
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition Pass.h:253
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
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition Analysis.h:118
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:28
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
char back() const
Get the last character in the string.
Definition StringRef.h:153
@ RootSignature
Definition Triple.h:415
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
Type * getType() const
All values are typed, get the type of this value.
Definition Value.h:257
Represents a version number in the form major[.minor[.subminor[.build]]].
const EntrySignature * get(const Function *F) const
LLVM_ABI bool isTyped() const
LLVM_ABI bool isStruct() const
dxil::ResourceKind getResourceKind() const
mcdxbc::RootSignatureDesc * getDescForFunction(const Function *F)
Wrapper pass for the legacy pass manager.
An efficient, type-erasing, non-owning reference to a callable.
LLVM_ABI void write(raw_ostream &OS, bool PadToDword=true)
Legacy validator versions through 1.6 require unpadded signature parts.
A raw_ostream that writes to an SmallVector or SmallString.
Pass manager infrastructure for declaring and invalidating analyses.
ResourceKind
The kind of resource for an SRV or UAV resource.
Definition DXILABI.h:44
LLVM_ABI void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
Definition Path.cpp:467
LLVM_ABI bool is_separator(char value, Style style=Style::native)
Check whether the given char is a path separator on the host OS.
Definition Path.cpp:618
constexpr bool IsBigEndianHost
This is an optimization pass for GlobalISel generic memory operations.
ArrayRef< CharT > arrayRefFromStringRef(StringRef Input)
Construct an array ref of bytes from a string ref.
static constexpr StringLiteral ModuleHashSectionName
Contains module hash.
LLVM_ABI void appendToCompilerUsed(Module &M, ArrayRef< GlobalValue * > Values)
Adds global values to the llvm.compiler.used list.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
ModulePass * createDXILContainerGlobalsLegacyPass()
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Definition MIRParser.h:39
static constexpr StringLiteral PdbFileNameSectionName
Contains PDB output file name.
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
Definition Error.cpp:177
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
std::optional< mcdxbc::SourceInfoBuilder > SourceInfo
Triple::EnvironmentType ShaderProfile
SmallVector< EntryProperties > EntryPropertyVec
LLVM_ABI void write(raw_ostream &OS) const
LLVM_ABI void setFilename(StringRef DebugFilename)
LLVM_ABI void write(raw_ostream &OS) const
dxbc::PSV::v3::RuntimeInfo BaseData
SmallVector< dxbc::PSV::v2::ResourceBindInfo > Resources
LLVM_ABI void finalize(Triple::EnvironmentType Stage, uint32_t Version=std::numeric_limits< uint32_t >::max())
LLVM_ABI void write(raw_ostream &OS, uint32_t Version=std::numeric_limits< uint32_t >::max()) const