LLVM 20.0.0git
DXILTranslateMetadata.cpp
Go to the documentation of this file.
1//===- DXILTranslateMetadata.cpp - Pass to emit DXIL metadata -------------===//
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
10#include "DXILResource.h"
12#include "DXILShaderFlags.h"
13#include "DirectX.h"
15#include "llvm/ADT/Twine.h"
18#include "llvm/IR/BasicBlock.h"
19#include "llvm/IR/Constants.h"
22#include "llvm/IR/Function.h"
23#include "llvm/IR/IRBuilder.h"
24#include "llvm/IR/LLVMContext.h"
25#include "llvm/IR/MDBuilder.h"
26#include "llvm/IR/Metadata.h"
27#include "llvm/IR/Module.h"
29#include "llvm/Pass.h"
33#include <cstdint>
34
35using namespace llvm;
36using namespace llvm::dxil;
37
38namespace {
39/// A simple Wrapper DiagnosticInfo that generates Module-level diagnostic
40/// for TranslateMetadata pass
41class DiagnosticInfoTranslateMD : public DiagnosticInfo {
42private:
43 const Twine &Msg;
44 const Module &Mod;
45
46public:
47 /// \p M is the module for which the diagnostic is being emitted. \p Msg is
48 /// the message to show. Note that this class does not copy this message, so
49 /// this reference must be valid for the whole life time of the diagnostic.
50 DiagnosticInfoTranslateMD(const Module &M, const Twine &Msg,
52 : DiagnosticInfo(DK_Unsupported, Severity), Msg(Msg), Mod(M) {}
53
54 void print(DiagnosticPrinter &DP) const override {
55 DP << Mod.getName() << ": " << Msg << '\n';
56 }
57};
58
59enum class EntryPropsTag {
60 ShaderFlags = 0,
61 GSState,
62 DSState,
63 HSState,
64 NumThreads,
65 AutoBindingSpace,
66 RayPayloadSize,
67 RayAttribSize,
68 ShaderKind,
69 MSState,
70 ASStateTag,
71 WaveSize,
72 EntryRootSig,
73};
74
75} // namespace
76
79 const dxil::Resources &MDResources) {
80 LLVMContext &Context = M.getContext();
81
82 for (ResourceBindingInfo &RI : DBM)
83 if (!RI.hasSymbol())
84 RI.createSymbol(M, DRTM[RI.getHandleTy()].createElementStruct());
85
86 SmallVector<Metadata *> SRVs, UAVs, CBufs, Smps;
87 for (const ResourceBindingInfo &RI : DBM.srvs())
88 SRVs.push_back(RI.getAsMetadata(M, DRTM[RI.getHandleTy()]));
89 for (const ResourceBindingInfo &RI : DBM.uavs())
90 UAVs.push_back(RI.getAsMetadata(M, DRTM[RI.getHandleTy()]));
91 for (const ResourceBindingInfo &RI : DBM.cbuffers())
92 CBufs.push_back(RI.getAsMetadata(M, DRTM[RI.getHandleTy()]));
93 for (const ResourceBindingInfo &RI : DBM.samplers())
94 Smps.push_back(RI.getAsMetadata(M, DRTM[RI.getHandleTy()]));
95
96 Metadata *SRVMD = SRVs.empty() ? nullptr : MDNode::get(Context, SRVs);
97 Metadata *UAVMD = UAVs.empty() ? nullptr : MDNode::get(Context, UAVs);
98 Metadata *CBufMD = CBufs.empty() ? nullptr : MDNode::get(Context, CBufs);
99 Metadata *SmpMD = Smps.empty() ? nullptr : MDNode::get(Context, Smps);
100 bool HasResources = !DBM.empty();
101
102 if (MDResources.hasUAVs()) {
103 assert(!UAVMD && "Old and new UAV representations can't coexist");
104 UAVMD = MDResources.writeUAVs(M);
105 HasResources = true;
106 }
107
108 if (MDResources.hasCBuffers()) {
109 assert(!CBufMD && "Old and new cbuffer representations can't coexist");
110 CBufMD = MDResources.writeCBuffers(M);
111 HasResources = true;
112 }
113
114 if (!HasResources)
115 return nullptr;
116
117 NamedMDNode *ResourceMD = M.getOrInsertNamedMetadata("dx.resources");
118 ResourceMD->addOperand(
119 MDNode::get(M.getContext(), {SRVMD, UAVMD, CBufMD, SmpMD}));
120
121 return ResourceMD;
122}
123
125 switch (Env) {
126 case Triple::Pixel:
127 return "ps";
128 case Triple::Vertex:
129 return "vs";
130 case Triple::Geometry:
131 return "gs";
132 case Triple::Hull:
133 return "hs";
134 case Triple::Domain:
135 return "ds";
136 case Triple::Compute:
137 return "cs";
138 case Triple::Library:
139 return "lib";
140 case Triple::Mesh:
141 return "ms";
143 return "as";
144 default:
145 break;
146 }
147 llvm_unreachable("Unsupported environment for DXIL generation.");
148}
149
152}
153
158 ConstantInt::get(Type::getInt32Ty(Ctx), static_cast<int>(Tag))));
159 switch (Tag) {
160 case EntryPropsTag::ShaderFlags:
162 ConstantInt::get(Type::getInt64Ty(Ctx), Value)));
163 break;
164 case EntryPropsTag::ShaderKind:
166 ConstantInt::get(Type::getInt32Ty(Ctx), Value)));
167 break;
168 case EntryPropsTag::GSState:
169 case EntryPropsTag::DSState:
170 case EntryPropsTag::HSState:
171 case EntryPropsTag::NumThreads:
172 case EntryPropsTag::AutoBindingSpace:
173 case EntryPropsTag::RayPayloadSize:
174 case EntryPropsTag::RayAttribSize:
175 case EntryPropsTag::MSState:
176 case EntryPropsTag::ASStateTag:
177 case EntryPropsTag::WaveSize:
178 case EntryPropsTag::EntryRootSig:
179 llvm_unreachable("NYI: Unhandled entry property tag");
180 }
181 return MDVals;
182}
183
184static MDTuple *
186 const Triple::EnvironmentType ShaderProfile) {
188 LLVMContext &Ctx = EP.Entry->getContext();
189 if (EntryShaderFlags != 0)
190 MDVals.append(getTagValueAsMetadata(EntryPropsTag::ShaderFlags,
191 EntryShaderFlags, Ctx));
192
193 if (EP.Entry != nullptr) {
194 // FIXME: support more props.
195 // See https://github.com/llvm/llvm-project/issues/57948.
196 // Add shader kind for lib entries.
197 if (ShaderProfile == Triple::EnvironmentType::Library &&
198 EP.ShaderStage != Triple::EnvironmentType::Library)
199 MDVals.append(getTagValueAsMetadata(EntryPropsTag::ShaderKind,
200 getShaderStage(EP.ShaderStage), Ctx));
201
202 if (EP.ShaderStage == Triple::EnvironmentType::Compute) {
203 MDVals.emplace_back(ConstantAsMetadata::get(ConstantInt::get(
204 Type::getInt32Ty(Ctx), static_cast<int>(EntryPropsTag::NumThreads))));
205 Metadata *NumThreadVals[] = {ConstantAsMetadata::get(ConstantInt::get(
206 Type::getInt32Ty(Ctx), EP.NumThreadsX)),
207 ConstantAsMetadata::get(ConstantInt::get(
208 Type::getInt32Ty(Ctx), EP.NumThreadsY)),
209 ConstantAsMetadata::get(ConstantInt::get(
210 Type::getInt32Ty(Ctx), EP.NumThreadsZ))};
211 MDVals.emplace_back(MDNode::get(Ctx, NumThreadVals));
212 }
213 }
214 if (MDVals.empty())
215 return nullptr;
216 return MDNode::get(Ctx, MDVals);
217}
218
220 MDNode *Resources, MDTuple *Properties,
221 LLVMContext &Ctx) {
222 // Each entry point metadata record specifies:
223 // * reference to the entry point function global symbol
224 // * unmangled name
225 // * list of signatures
226 // * list of resources
227 // * list of tag-value pairs of shader capabilities and other properties
228 Metadata *MDVals[5];
229 MDVals[0] =
230 EntryFn ? ValueAsMetadata::get(const_cast<Function *>(EntryFn)) : nullptr;
231 MDVals[1] = MDString::get(Ctx, EntryFn ? EntryFn->getName() : "");
232 MDVals[2] = Signatures;
233 MDVals[3] = Resources;
234 MDVals[4] = Properties;
235 return MDNode::get(Ctx, MDVals);
236}
237
239 MDNode *MDResources,
240 const uint64_t EntryShaderFlags,
241 const Triple::EnvironmentType ShaderProfile) {
242 MDTuple *Properties =
243 getEntryPropAsMetadata(EP, EntryShaderFlags, ShaderProfile);
244 return constructEntryMetadata(EP.Entry, Signatures, MDResources, Properties,
245 EP.Entry->getContext());
246}
247
249 if (MMDI.ValidatorVersion.empty())
250 return;
251
252 LLVMContext &Ctx = M.getContext();
253 IRBuilder<> IRB(Ctx);
254 Metadata *MDVals[2];
255 MDVals[0] =
257 MDVals[1] = ConstantAsMetadata::get(
258 IRB.getInt32(MMDI.ValidatorVersion.getMinor().value_or(0)));
259 NamedMDNode *ValVerNode = M.getOrInsertNamedMetadata("dx.valver");
260 // Set validator version obtained from DXIL Metadata Analysis pass
261 ValVerNode->clearOperands();
262 ValVerNode->addOperand(MDNode::get(Ctx, MDVals));
263}
264
266 const ModuleMetadataInfo &MMDI) {
267 LLVMContext &Ctx = M.getContext();
268 IRBuilder<> IRB(Ctx);
269 Metadata *SMVals[3];
271 SMVals[0] = MDString::get(Ctx, getShortShaderStage(MMDI.ShaderProfile));
272 SMVals[1] = ConstantAsMetadata::get(IRB.getInt32(SM.getMajor()));
273 SMVals[2] = ConstantAsMetadata::get(IRB.getInt32(SM.getMinor().value_or(0)));
274 NamedMDNode *SMMDNode = M.getOrInsertNamedMetadata("dx.shaderModel");
275 SMMDNode->addOperand(MDNode::get(Ctx, SMVals));
276}
277
279 LLVMContext &Ctx = M.getContext();
280 IRBuilder<> IRB(Ctx);
281 VersionTuple DXILVer = MMDI.DXILVersion;
282 Metadata *DXILVals[2];
283 DXILVals[0] = ConstantAsMetadata::get(IRB.getInt32(DXILVer.getMajor()));
284 DXILVals[1] =
285 ConstantAsMetadata::get(IRB.getInt32(DXILVer.getMinor().value_or(0)));
286 NamedMDNode *DXILVerMDNode = M.getOrInsertNamedMetadata("dx.version");
287 DXILVerMDNode->addOperand(MDNode::get(Ctx, DXILVals));
288}
289
291 uint64_t ShaderFlags) {
292 LLVMContext &Ctx = M.getContext();
293 MDTuple *Properties = nullptr;
294 if (ShaderFlags != 0) {
296 MDVals.append(
297 getTagValueAsMetadata(EntryPropsTag::ShaderFlags, ShaderFlags, Ctx));
298 Properties = MDNode::get(Ctx, MDVals);
299 }
300 // Library has an entry metadata with resource table metadata and all other
301 // MDNodes as null.
302 return constructEntryMetadata(nullptr, nullptr, RMD, Properties, Ctx);
303}
304
305// TODO: We might need to refactor this to be more generic,
306// in case we need more metadata to be replaced.
308 for (Function &F : M) {
309 for (BasicBlock &BB : F) {
310 Instruction *BBTerminatorInst = BB.getTerminator();
311
312 MDNode *HlslControlFlowMD =
313 BBTerminatorInst->getMetadata("hlsl.controlflow.hint");
314
315 if (!HlslControlFlowMD)
316 continue;
317
318 assert(HlslControlFlowMD->getNumOperands() == 2 &&
319 "invalid operands for hlsl.controlflow.hint");
320
321 MDBuilder MDHelper(M.getContext());
322 ConstantInt *Op1 =
323 mdconst::extract<ConstantInt>(HlslControlFlowMD->getOperand(1));
324
326 ArrayRef<Metadata *>{MDHelper.createString("dx.controlflow.hints"),
327 MDHelper.createConstant(Op1)});
328
329 MDNode *MDNode = llvm::MDNode::get(M.getContext(), Vals);
330
331 BBTerminatorInst->setMetadata("dx.controlflow.hints", MDNode);
332 BBTerminatorInst->setMetadata("hlsl.controlflow.hint", nullptr);
333 }
334 }
335}
336
339 const Resources &MDResources,
340 const ModuleShaderFlags &ShaderFlags,
341 const ModuleMetadataInfo &MMDI) {
342 LLVMContext &Ctx = M.getContext();
343 IRBuilder<> IRB(Ctx);
344 SmallVector<MDNode *> EntryFnMDNodes;
345
346 emitValidatorVersionMD(M, MMDI);
348 emitDXILVersionTupleMD(M, MMDI);
349 NamedMDNode *NamedResourceMD =
350 emitResourceMetadata(M, DBM, DRTM, MDResources);
351 auto *ResourceMD =
352 (NamedResourceMD != nullptr) ? NamedResourceMD->getOperand(0) : nullptr;
353 // FIXME: Add support to construct Signatures
354 // See https://github.com/llvm/llvm-project/issues/57928
355 MDTuple *Signatures = nullptr;
356
357 if (MMDI.ShaderProfile == Triple::EnvironmentType::Library) {
358 // Get the combined shader flag mask of all functions in the library to be
359 // used as shader flags mask value associated with top-level library entry
360 // metadata.
361 uint64_t CombinedMask = ShaderFlags.getCombinedFlags();
362 EntryFnMDNodes.emplace_back(
363 emitTopLevelLibraryNode(M, ResourceMD, CombinedMask));
364 } else if (MMDI.EntryPropertyVec.size() > 1) {
365 M.getContext().diagnose(DiagnosticInfoTranslateMD(
366 M, "Non-library shader: One and only one entry expected"));
367 }
368
369 for (const EntryProperties &EntryProp : MMDI.EntryPropertyVec) {
370 const ComputedShaderFlags &EntrySFMask =
371 ShaderFlags.getFunctionFlags(EntryProp.Entry);
372
373 // If ShaderProfile is Library, mask is already consolidated in the
374 // top-level library node. Hence it is not emitted.
375 uint64_t EntryShaderFlags = 0;
376 if (MMDI.ShaderProfile != Triple::EnvironmentType::Library) {
377 EntryShaderFlags = EntrySFMask;
378 if (EntryProp.ShaderStage != MMDI.ShaderProfile) {
379 M.getContext().diagnose(DiagnosticInfoTranslateMD(
380 M,
381 "Shader stage '" +
383 "' for entry '" + Twine(EntryProp.Entry->getName()) +
384 "' different from specified target profile '" +
386 "'"))));
387 }
388 }
389 EntryFnMDNodes.emplace_back(emitEntryMD(EntryProp, Signatures, ResourceMD,
390 EntryShaderFlags,
391 MMDI.ShaderProfile));
392 }
393
394 NamedMDNode *EntryPointsNamedMD =
395 M.getOrInsertNamedMetadata("dx.entryPoints");
396 for (auto *Entry : EntryFnMDNodes)
397 EntryPointsNamedMD->addOperand(Entry);
398}
399
404 const dxil::Resources &MDResources = MAM.getResult<DXILResourceMDAnalysis>(M);
405 const ModuleShaderFlags &ShaderFlags = MAM.getResult<ShaderFlagsAnalysis>(M);
407
408 translateMetadata(M, DBM, DRTM, MDResources, ShaderFlags, MMDI);
410
411 return PreservedAnalyses::all();
412}
413
414namespace {
415class DXILTranslateMetadataLegacy : public ModulePass {
416public:
417 static char ID; // Pass identification, replacement for typeid
418 explicit DXILTranslateMetadataLegacy() : ModulePass(ID) {}
419
420 StringRef getPassName() const override { return "DXIL Translate Metadata"; }
421
422 void getAnalysisUsage(AnalysisUsage &AU) const override {
432 }
433
434 bool runOnModule(Module &M) override {
435 DXILBindingMap &DBM =
436 getAnalysis<DXILResourceBindingWrapperPass>().getBindingMap();
437 DXILResourceTypeMap &DRTM =
438 getAnalysis<DXILResourceTypeWrapperPass>().getResourceTypeMap();
439 const dxil::Resources &MDResources =
440 getAnalysis<DXILResourceMDWrapper>().getDXILResource();
441 const ModuleShaderFlags &ShaderFlags =
442 getAnalysis<ShaderFlagsAnalysisWrapper>().getShaderFlags();
444 getAnalysis<DXILMetadataAnalysisWrapperPass>().getModuleMetadata();
445
446 translateMetadata(M, DBM, DRTM, MDResources, ShaderFlags, MMDI);
448 return true;
449 }
450};
451
452} // namespace
453
454char DXILTranslateMetadataLegacy::ID = 0;
455
457 return new DXILTranslateMetadataLegacy();
458}
459
460INITIALIZE_PASS_BEGIN(DXILTranslateMetadataLegacy, "dxil-translate-metadata",
461 "DXIL Translate Metadata", false, false)
466INITIALIZE_PASS_END(DXILTranslateMetadataLegacy, "dxil-translate-metadata",
467 "DXIL Translate Metadata", false, false)
Add AMDGPU uniform metadata
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static void emitDXILVersionTupleMD(Module &M, const ModuleMetadataInfo &MMDI)
static MDTuple * getEntryPropAsMetadata(const EntryProperties &EP, uint64_t EntryShaderFlags, const Triple::EnvironmentType ShaderProfile)
static void translateMetadata(Module &M, DXILBindingMap &DBM, DXILResourceTypeMap &DRTM, const Resources &MDResources, const ModuleShaderFlags &ShaderFlags, const ModuleMetadataInfo &MMDI)
static void emitValidatorVersionMD(Module &M, const ModuleMetadataInfo &MMDI)
static MDTuple * emitTopLevelLibraryNode(Module &M, MDNode *RMD, uint64_t ShaderFlags)
static NamedMDNode * emitResourceMetadata(Module &M, DXILBindingMap &DBM, DXILResourceTypeMap &DRTM, const dxil::Resources &MDResources)
static SmallVector< Metadata * > getTagValueAsMetadata(EntryPropsTag Tag, uint64_t Value, LLVMContext &Ctx)
static StringRef getShortShaderStage(Triple::EnvironmentType Env)
static void translateBranchMetadata(Module &M)
static MDTuple * emitEntryMD(const EntryProperties &EP, MDTuple *Signatures, MDNode *MDResources, const uint64_t EntryShaderFlags, const Triple::EnvironmentType ShaderProfile)
static uint32_t getShaderStage(Triple::EnvironmentType Env)
MDTuple * constructEntryMetadata(const Function *EntryFn, MDTuple *Signatures, MDNode *Resources, MDTuple *Properties, LLVMContext &Ctx)
static void emitShaderModelVersionMD(Module &M, const ModuleMetadataInfo &MMDI)
Module.h This file contains the declarations for the Module class.
#define F(x, y, z)
Definition: MD5.cpp:55
This file contains the declarations for metadata subclasses.
if(auto Err=PB.parsePassPipeline(MPM, Passes)) return wrap(std MPM run * Mod
ModuleAnalysisManager MAM
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition: PassSupport.h:55
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:57
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:52
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
static const FuncProtoTy Signatures[]
Defines the llvm::VersionTuple class, which represents a version in the form major[....
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:253
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:410
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
LLVM Basic Block Representation.
Definition: BasicBlock.h:61
static ConstantAsMetadata * get(Constant *C)
Definition: Metadata.h:528
This is the shared class of boolean and integer constants.
Definition: Constants.h:83
iterator_range< iterator > cbuffers()
Definition: DXILResource.h:476
bool empty() const
Definition: DXILResource.h:442
iterator_range< iterator > srvs()
Definition: DXILResource.h:458
iterator_range< iterator > samplers()
Definition: DXILResource.h:487
iterator_range< iterator > uavs()
Definition: DXILResource.h:467
Analysis pass that exposes the DXILResource for a module.
The legacy pass manager's analysis pass to compute DXIL resource information.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &)
This is the base abstract class for diagnostic reporting in the backend.
virtual void print(DiagnosticPrinter &DP) const =0
Print using the given DP a user-friendly message.
Interface for custom diagnostic printing.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
Definition: Function.cpp:369
ConstantInt * getInt32(uint32_t C)
Get a constant 32-bit value.
Definition: IRBuilder.h:505
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition: IRBuilder.h:2704
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
Definition: Instruction.h:390
void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
Definition: Metadata.cpp:1679
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
ConstantAsMetadata * createConstant(Constant *C)
Return the given constant as metadata.
Definition: MDBuilder.cpp:24
MDString * createString(StringRef Str)
Return the given string as metadata.
Definition: MDBuilder.cpp:20
Metadata node.
Definition: Metadata.h:1069
const MDOperand & getOperand(unsigned I) const
Definition: Metadata.h:1430
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1545
unsigned getNumOperands() const
Return number of MDNode operands.
Definition: Metadata.h:1436
static MDString * get(LLVMContext &Context, StringRef Str)
Definition: Metadata.cpp:606
Tuple of metadata.
Definition: Metadata.h:1475
Root of the metadata hierarchy.
Definition: Metadata.h:62
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:251
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
A tuple of MDNodes.
Definition: Metadata.h:1733
MDNode * getOperand(unsigned i) const
Definition: Metadata.cpp:1425
void clearOperands()
Drop all references to this node's operands.
Definition: Metadata.cpp:1440
void addOperand(MDNode *M)
Definition: Metadata.cpp:1431
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: Analysis.h:117
bool empty() const
Definition: SmallVector.h:81
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:937
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:683
void push_back(const T &Elt)
Definition: SmallVector.h:413
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
@ Amplification
Definition: Triple.h:299
static StringRef getEnvironmentTypeName(EnvironmentType Kind)
Get the canonical name for the Kind environment.
Definition: Triple.cpp:327
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
static IntegerType * getInt32Ty(LLVMContext &C)
static IntegerType * getInt64Ty(LLVMContext &C)
static ValueAsMetadata * get(Value *V)
Definition: Metadata.cpp:501
LLVM Value Representation.
Definition: Value.h:74
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:309
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:29
unsigned getMajor() const
Retrieve the major version number.
Definition: VersionTuple.h:71
bool empty() const
Determine whether this version information is empty (e.g., all version components are zero).
Definition: VersionTuple.h:66
std::optional< unsigned > getMinor() const
Retrieve the minor version number, if provided.
Definition: VersionTuple.h:74
Metadata * writeUAVs(Module &M) const
bool hasUAVs() const
Definition: DXILResource.h:121
Metadata * writeCBuffers(Module &M) const
bool hasCBuffers() const
Definition: DXILResource.h:124
Wrapper pass for the legacy pass manager.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
ModulePass * createDXILTranslateMetadataLegacyPass()
Pass to emit metadata for DXIL.
@ DK_Unsupported
@ Mod
The access may modify the value stored in memory.
DiagnosticSeverity
Defines the different supported severity of a diagnostic.
@ DS_Error
Triple::EnvironmentType ShaderStage
Triple::EnvironmentType ShaderProfile
SmallVector< EntryProperties > EntryPropertyVec