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"
17#include "DirectX.h"
21#include "llvm/ADT/StringRef.h"
25#include "llvm/CodeGen/Passes.h"
26#include "llvm/IR/Analysis.h"
27#include "llvm/IR/Constants.h"
28#include "llvm/IR/Module.h"
29#include "llvm/IR/PassManager.h"
34#include "llvm/Pass.h"
36#include "llvm/Support/MD5.h"
37#include "llvm/Support/Path.h"
40#include <cstdint>
41
42using namespace llvm;
43using namespace llvm::dxil;
44using namespace llvm::mcdxbc;
45
47 "dx-Zss", cl::desc("Compute Shader Hash considering source information"));
48
49cl::opt<bool> dxil::PdbInPrivate("dx-pdb-in-private",
50 cl::desc("Store PDB in private user data"));
51
52namespace {
53class DXILContainerGlobalsLegacy : public ModulePass {
54public:
55 static char ID; // Pass identification, replacement for typeid
56 DXILContainerGlobalsLegacy() : ModulePass(ID) {}
57
58 StringRef getPassName() const override {
59 return "DXContainer Global Emitter";
60 }
61
62 bool runOnModule(Module &M) override;
63
64 void getAnalysisUsage(AnalysisUsage &AU) const override {
65 AU.setPreservesAll();
66 AU.addRequired<ShaderFlagsAnalysisWrapper>();
67 AU.addRequired<RootSignatureAnalysisWrapper>();
68 AU.addRequired<SignatureAnalysisWrapper>();
69 AU.addRequired<DXILMetadataAnalysisWrapperPass>();
70 AU.addRequired<DXILResourceTypeWrapperPass>();
71 AU.addRequired<DXILResourceWrapperPass>();
72 }
73};
74
75} // namespace
76
78 StringRef Name,
80 auto *GV = new llvm::GlobalVariable(
81 M, Content->getType(), true, GlobalValue::PrivateLinkage, Content, Name);
82 GV->setSection(SectionName);
83 GV->setAlignment(Align(4));
84 return GV;
85}
86
87static GlobalVariable *
89 function_ref<const ModuleShaderFlags &()> GetShaderFlags) {
90 uint64_t CombinedFeatureFlags =
91 GetShaderFlags().getCombinedFlags().getFeatureFlags();
92
93 Constant *FeatureFlagsConstant =
94 ConstantInt::get(M.getContext(), APInt(64, CombinedFeatureFlags));
95 return buildContainerGlobal(M, FeatureFlagsConstant, "dx.sfi0", "SFI0");
96}
97
99 StringRef SectionData, StringRef MetadataName,
101 Constant *SectionConstant = ConstantDataArray::getString(
102 M.getContext(), SectionData, /*AddNull*/ false);
103 Globals.emplace_back(
104 buildContainerGlobal(M, SectionConstant, MetadataName, SectionName));
105}
106
109 ConstantDataArray *DXILConstant;
110 MD5 Digest;
111 dxbc::ShaderHash HashData = {0, {0}};
112
114 if (auto *ILDB = M.getNamedGlobal("dx.ildb")) {
115 DXILConstant = cast<ConstantDataArray>(ILDB->getInitializer());
116 HashData.Flags = static_cast<uint32_t>(dxbc::HashFlags::IncludesSource);
117 } else {
118 reportFatalUsageError("/Zss requires debug info (/Zi or /Zs)");
119 }
120 } else {
121 DXILConstant =
122 cast<ConstantDataArray>(M.getNamedGlobal("dx.dxil")->getInitializer());
123 }
124
125 Digest.update(DXILConstant->getRawDataValues());
126 MD5::MD5Result MD5 = Digest.final();
127
128 memcpy(reinterpret_cast<void *>(&HashData.Digest), MD5.data(), 16);
130 HashData.swapBytes();
131 StringRef Data(reinterpret_cast<char *>(&HashData), sizeof(dxbc::ShaderHash));
132
133 Constant *ModuleConstant =
135 Globals.emplace_back(
136 buildContainerGlobal(M, ModuleConstant, "dx.hash", "HASH"));
137
138 if (M.debug_compile_units().empty())
139 return;
140
141 SmallString<40> DebugNameStr;
142 Digest.stringifyResult(MD5, DebugNameStr);
143 DebugNameStr += ".pdb";
144 if (!PdbDebugPath.empty() || PdbInPrivate) {
145 if (!PdbDebugPath.empty()) {
146 StringRef DebugFile = PdbDebugPath.getValue();
147 SmallString<256> AbsoluteDebugName;
148 if (sys::path::is_separator(DebugFile.back())) {
149 // If PDB output path was specified as a directory, put the MD5.pdb file
150 // there.
151 AbsoluteDebugName = DebugFile;
152 sys::path::append(AbsoluteDebugName, DebugNameStr);
153 } else {
154 // Otherwise, use PDB output path as a user-provided PDB file name.
155 DebugNameStr = DebugFile;
156 AbsoluteDebugName = DebugNameStr;
157 }
158
159 // Pass PDB name to DXContainerPDBPass via PDBNAME section.
160 addSection(M, Globals, AbsoluteDebugName, "dx.pdb.name",
162 }
163
164 // Pass module hash to DXContainerPDBPass.
165 Globals.emplace_back(buildContainerGlobal(
166 M, ConstantDataArray::get(M.getContext(), ArrayRef(HashData.Digest)),
167 "dx.pdb.hash", ModuleHashSectionName));
168 }
169
170 // Emit ILDN part in debug info mode.
172 DebugName.setFilename(DebugNameStr);
173 SmallString<64> ILDNData;
174 raw_svector_ostream OS(ILDNData);
175 DebugName.write(OS);
176 addSection(M, Globals, ILDNData, "dx.ildn", "ILDN");
177}
178
181 const dxil::ModuleMetadataInfo &MMI) {
185 bool Legacy = !V.empty() && V != VersionTuple(0, 0) && V < VersionTuple(1, 7);
186 Sig.write(OS, /*PadToDword=*/!Legacy);
188 ConstantDataArray::getString(M.getContext(), Data, /*AddNull*/ false);
189 return buildContainerGlobal(M, Constant, Name, SectionName);
190}
191
192static void
194 function_ref<dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo,
195 function_ref<const ModuleSignatureInfo &()> GetSignatureInfo) {
196 const ModuleMetadataInfo &MMI = GetModuleMetadataInfo();
197 const ModuleSignatureInfo &Signatures = GetSignatureInfo();
198 Signature InputSig, OutputSig;
199 if (MMI.ShaderProfile != Triple::Library && MMI.EntryPropertyVec.size() == 1)
200 if (const auto *Sig = Signatures.get(MMI.EntryPropertyVec[0].Entry))
201 Sig->buildSignatures(InputSig, OutputSig, MMI.ValidatorVersion);
202
203 Globals.emplace_back(buildSignature(M, InputSig, "dx.isg1", "ISG1", MMI));
204 Globals.emplace_back(buildSignature(M, OutputSig, "dx.osg1", "OSG1", MMI));
205}
206
209 function_ref<dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo,
210 function_ref<RootSignatureBindingInfo &()> GetRootSignatureBindingInfo) {
211
212 dxil::ModuleMetadataInfo &MMI = GetModuleMetadataInfo();
213
214 // Root Signature in Library don't compile to DXContainer.
216 return;
217
218 RootSignatureBindingInfo &RSA = GetRootSignatureBindingInfo();
219 const Function *EntryFunction = nullptr;
220
222 assert(MMI.EntryPropertyVec.size() == 1);
223 EntryFunction = MMI.EntryPropertyVec[0].Entry;
224 }
225
226 const mcdxbc::RootSignatureDesc *RS = RSA.getDescForFunction(EntryFunction);
227 if (!RS)
228 return;
229
232
233 RS->write(OS);
234
235 addSection(M, Globals, Data, "dx.rts0", "RTS0");
236}
237
238static void
240 function_ref<DXILResourceMap &()> GetResourceMap,
241 function_ref<DXILResourceTypeMap &()> GetResourceTypeMap) {
242 const DXILResourceMap &DRM = GetResourceMap();
243 DXILResourceTypeMap &DRTM = GetResourceTypeMap();
244
245 auto MakeBinding = [](const dxil::ResourceInfo::ResourceBinding &Binding,
247 const dxil::ResourceKind Kind,
248 const dxbc::PSV::ResourceFlags Flags =
251 BindInfo.Type = Type;
252 BindInfo.LowerBound = Binding.LowerBound;
253 assert((Binding.Size == 0 ||
254 (uint64_t)Binding.LowerBound + Binding.Size - 1 <= UINT32_MAX) &&
255 "Resource range is too large");
256 BindInfo.UpperBound = (Binding.Size == 0)
257 ? UINT32_MAX
258 : Binding.LowerBound + Binding.Size - 1;
259 BindInfo.Space = Binding.Space;
260 BindInfo.Kind = static_cast<dxbc::PSV::ResourceKind>(Kind);
261 BindInfo.Flags = Flags;
262 return BindInfo;
263 };
264
265 for (const dxil::ResourceInfo &RI : DRM.cbuffers()) {
266 if (!RI.hasBinding())
267 continue;
268 const dxil::ResourceInfo::ResourceBinding &Binding = RI.getBinding();
269 PSV.Resources.push_back(MakeBinding(Binding, dxbc::PSV::ResourceType::CBV,
271 }
272 for (const dxil::ResourceInfo &RI : DRM.samplers()) {
273 if (!RI.hasBinding())
274 continue;
275 const dxil::ResourceInfo::ResourceBinding &Binding = RI.getBinding();
276 PSV.Resources.push_back(MakeBinding(Binding,
277 dxbc::PSV::ResourceType::Sampler,
279 }
280 for (const dxil::ResourceInfo &RI : DRM.srvs()) {
281 if (!RI.hasBinding())
282 continue;
283 const dxil::ResourceInfo::ResourceBinding &Binding = RI.getBinding();
284
285 dxil::ResourceTypeInfo &TypeInfo = DRTM[RI.getHandleTy()];
287 if (TypeInfo.isStruct())
288 ResType = dxbc::PSV::ResourceType::SRVStructured;
289 else if (TypeInfo.isTyped())
290 ResType = dxbc::PSV::ResourceType::SRVTyped;
291 else
292 ResType = dxbc::PSV::ResourceType::SRVRaw;
293
294 PSV.Resources.push_back(
295 MakeBinding(Binding, ResType, TypeInfo.getResourceKind()));
296 }
297 for (const dxil::ResourceInfo &RI : DRM.uavs()) {
298 if (!RI.hasBinding())
299 continue;
300 const dxil::ResourceInfo::ResourceBinding &Binding = RI.getBinding();
301
302 dxil::ResourceTypeInfo &TypeInfo = DRTM[RI.getHandleTy()];
304 if (RI.hasCounter())
305 ResType = dxbc::PSV::ResourceType::UAVStructuredWithCounter;
306 else if (TypeInfo.isStruct())
307 ResType = dxbc::PSV::ResourceType::UAVStructured;
308 else if (TypeInfo.isTyped())
309 ResType = dxbc::PSV::ResourceType::UAVTyped;
310 else
311 ResType = dxbc::PSV::ResourceType::UAVRaw;
312
314 Flags.Bits.UsedByAtomic64 = RI.HasAtomic64Use;
315
316 PSV.Resources.push_back(
317 MakeBinding(Binding, ResType, TypeInfo.getResourceKind(), Flags));
318 }
319}
320
323 function_ref<dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo,
324 function_ref<DXILResourceMap &()> GetResourceMap,
325 function_ref<DXILResourceTypeMap &()> GetResourceTypeMap,
326 function_ref<const ModuleShaderFlags &()> GetModuleShaderFlags,
327 function_ref<const ModuleSignatureInfo &()> GetModuleSignatureInfo) {
330 PSVRuntimeInfo PSV;
332 PSV.BaseData.MaximumWaveLaneCount = std::numeric_limits<uint32_t>::max();
333
334 dxil::ModuleMetadataInfo &MMI = GetModuleMetadataInfo();
335 assert(MMI.EntryPropertyVec.size() == 1 ||
339 static_cast<uint8_t>(MMI.ShaderProfile - Triple::Pixel);
340
341 addResourcesForPSV(M, PSV, GetResourceMap, GetResourceTypeMap);
342 unsigned PSVVersion = 3;
343 if (MMI.ShaderProfile != Triple::Library &&
344 MMI.EntryPropertyVec.size() == 1) {
345 const Function *Entry = MMI.EntryPropertyVec[0].Entry;
346 bool UsesViewID = GetModuleShaderFlags().getFunctionFlags(Entry).ViewID;
347 PSV.BaseData.UsesViewID = UsesViewID;
348 const ModuleSignatureInfo &Signatures = GetModuleSignatureInfo();
349 if (const auto *Sig = Signatures.get(Entry)) {
350 Sig->updatePSV(PSV, MMI.ValidatorVersion, UsesViewID);
351 // Preserve the existing empty-signature path, and select an ABI version
352 // compatible with the validator for graphics signature data.
354 if ((!Sig->Inputs.empty() || !Sig->Outputs.empty()) && !V.empty() &&
355 V != VersionTuple(0, 0))
356 PSVVersion = V < VersionTuple(1, 1) ? 0
357 : V < VersionTuple(1, 6) ? 1
358 : V < VersionTuple(1, 8) ? 2
359 : 3;
360 }
361 }
362
363 // Hardcoded values here to unblock loading the shader into D3D.
364 //
365 // TODO: Lots more stuff to do here!
366 //
367 // See issue https://github.com/llvm/llvm-project/issues/96674.
368 switch (MMI.ShaderProfile) {
369 case Triple::Compute:
370 PSV.BaseData.NumThreadsX = MMI.EntryPropertyVec[0].NumThreadsX;
371 PSV.BaseData.NumThreadsY = MMI.EntryPropertyVec[0].NumThreadsY;
372 PSV.BaseData.NumThreadsZ = MMI.EntryPropertyVec[0].NumThreadsZ;
373 if (MMI.EntryPropertyVec[0].WaveSizeMin) {
374 PSV.BaseData.MinimumWaveLaneCount = MMI.EntryPropertyVec[0].WaveSizeMin;
376 MMI.EntryPropertyVec[0].WaveSizeMax
377 ? MMI.EntryPropertyVec[0].WaveSizeMax
378 : MMI.EntryPropertyVec[0].WaveSizeMin;
379 }
380 break;
381 default:
382 break;
383 }
384
385 if (MMI.ShaderProfile != Triple::Library &&
387 PSV.EntryName = MMI.EntryPropertyVec[0].Entry->getName();
388
389 PSV.finalize(MMI.ShaderProfile, PSVVersion);
390 PSV.write(OS, PSVVersion);
391 addSection(M, Globals, Data, "dx.psv0", "PSV0");
392}
393
395 if (M.debug_compile_units().empty())
396 return;
397
402 addSection(M, Globals, Data, "dx.vers", "VERS");
403}
404
405static void addSourceInfo(
407 function_ref<dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo) {
408 dxil::ModuleMetadataInfo &MMI = GetModuleMetadataInfo();
409
411 return;
412
413 MMI.SourceInfo->computeEntries();
414 MMI.SourceInfo->finalize();
417 MMI.SourceInfo->write(OS);
418 addSection(M, Globals, Data, "dx.srci", "SRCI");
419}
420
422 Module &M, function_ref<dxil::ModuleMetadataInfo &()> GetModuleMetadataInfo,
423 function_ref<DXILResourceMap &()> GetResourceMap,
424 function_ref<DXILResourceTypeMap &()> GetResourceTypeMap,
425 function_ref<const ModuleShaderFlags &()> GetModuleShaderFlags,
426 function_ref<const ModuleSignatureInfo &()> GetModuleSignatureInfo,
427 function_ref<RootSignatureBindingInfo &()> GetRootSignatureBindingInfo) {
429 Globals.push_back(getFeatureFlags(M, GetModuleShaderFlags));
431 addSignature(M, Globals, GetModuleMetadataInfo, GetModuleSignatureInfo);
432 addRootSignature(M, Globals, GetModuleMetadataInfo,
433 GetRootSignatureBindingInfo);
434 addPipelineStateValidationInfo(M, Globals, GetModuleMetadataInfo,
435 GetResourceMap, GetResourceTypeMap,
436 GetModuleShaderFlags, GetModuleSignatureInfo);
437 addCompilerVersion(M, Globals);
438 addSourceInfo(M, Globals, GetModuleMetadataInfo);
439 appendToCompilerUsed(M, Globals);
440 return true;
441}
442
443bool DXILContainerGlobalsLegacy::runOnModule(Module &M) {
445 M,
446 [&]() -> ModuleMetadataInfo & {
447 return getAnalysis<DXILMetadataAnalysisWrapperPass>()
448 .getModuleMetadata();
449 },
450 [&]() -> DXILResourceMap & {
451 return getAnalysis<DXILResourceWrapperPass>().getResourceMap();
452 },
453 [&]() -> DXILResourceTypeMap & {
454 return getAnalysis<DXILResourceTypeWrapperPass>().getResourceTypeMap();
455 },
456 [&]() -> const ModuleShaderFlags & {
457 return getAnalysis<ShaderFlagsAnalysisWrapper>().getShaderFlags();
458 },
459 [&]() -> const ModuleSignatureInfo & {
460 return getAnalysis<SignatureAnalysisWrapper>().getSignatureInfo();
461 },
462 [&]() -> RootSignatureBindingInfo & {
463 return getAnalysis<RootSignatureAnalysisWrapper>().getRSInfo();
464 });
465}
466
470 M,
471 [&]() -> ModuleMetadataInfo & {
472 return MAM.getResult<DXILMetadataAnalysis>(M);
473 },
474 [&]() -> DXILResourceMap & {
475 return MAM.getResult<DXILResourceAnalysis>(M);
476 },
477 [&]() -> DXILResourceTypeMap & {
478 return MAM.getResult<DXILResourceTypeAnalysis>(M);
479 },
480 [&]() -> const ModuleShaderFlags & {
481 return MAM.getResult<ShaderFlagsAnalysis>(M);
482 },
483 [&]() -> const ModuleSignatureInfo & {
484 return MAM.getResult<SignatureAnalysis>(M);
485 },
486 [&]() -> RootSignatureBindingInfo & {
487 return MAM.getResult<RootSignatureAnalysis>(M);
488 });
489 return PreservedAnalyses::all();
490}
491
492char DXILContainerGlobalsLegacy::ID = 0;
493INITIALIZE_PASS_BEGIN(DXILContainerGlobalsLegacy, "dxil-container-globals",
494 "DXContainer Global Emitter", false, true)
500INITIALIZE_PASS_END(DXILContainerGlobalsLegacy, "dxil-container-globals",
501 "DXContainer Global Emitter", false, true)
502
504 return new DXILContainerGlobalsLegacy();
505}
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 cl::opt< bool > ShaderHashDependsOnSource("dx-Zss", cl::desc("Compute Shader Hash considering source information"))
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
This file provides a bitcode writing pass.
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:286
LLVM_ABI void final(MD5Result &Result)
Finishes off the hash and puts the result in result.
Definition MD5.cpp:233
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:26
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:413
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
cl::opt< std::string > PdbDebugPath
cl::opt< bool > PdbInPrivate
cl::opt< bool > SourceInDebugModule
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