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