49 void addPipelineStateValidationInfo(
Module &M,
57 return "DXContainer Global Emitter";
74bool DXContainerGlobals::runOnModule(
Module &M) {
78 addSignature(M, Globals);
79 addRootSignature(M, Globals);
80 addPipelineStateValidationInfo(M, Globals);
86 uint64_t CombinedFeatureFlags = getAnalysis<ShaderFlagsAnalysisWrapper>()
92 ConstantInt::get(
M.getContext(),
APInt(64, CombinedFeatureFlags));
93 return buildContainerGlobal(M, FeatureFlagsConstant,
"dx.sfi0",
"SFI0");
98 cast<ConstantDataArray>(
M.getNamedGlobal(
"dx.dxil")->getInitializer());
100 Digest.
update(DXILConstant->getRawDataValues());
106 if (!
M.debug_compile_units().empty())
107 HashData.
Flags =
static_cast<uint32_t>(dxbc::HashFlags::IncludesSource);
109 memcpy(
reinterpret_cast<void *
>(&HashData.
Digest),
Result.data(), 16);
116 return buildContainerGlobal(M, ModuleConstant,
"dx.hash",
"HASH");
124 GV->setAlignment(
Align(4));
139void DXContainerGlobals::addSignature(
Module &M,
145 Globals.
emplace_back(buildSignature(M, InputSig,
"dx.isg1",
"ISG1"));
148 Globals.
emplace_back(buildSignature(M, OutputSig,
"dx.osg1",
"OSG1"));
151void DXContainerGlobals::addRootSignature(
Module &M,
155 getAnalysis<DXILMetadataAnalysisWrapperPass>().getModuleMetadata();
163 auto &RSA = getAnalysis<RootSignatureAnalysisWrapper>().getRSInfo();
182 getAnalysis<DXILResourceWrapperPass>().getResourceMap();
184 getAnalysis<DXILResourceTypeWrapperPass>().getResourceTypeMap();
202 PSV.
Resources.push_back(MakeBinding(Binding, dxbc::PSV::ResourceType::CBV,
203 dxil::ResourceKind::CBuffer));
207 PSV.
Resources.push_back(MakeBinding(Binding,
208 dxbc::PSV::ResourceType::Sampler,
209 dxil::ResourceKind::Sampler));
217 ResType = dxbc::PSV::ResourceType::SRVStructured;
219 ResType = dxbc::PSV::ResourceType::SRVTyped;
221 ResType = dxbc::PSV::ResourceType::SRVRaw;
232 ResType = dxbc::PSV::ResourceType::UAVStructuredWithCounter;
234 ResType = dxbc::PSV::ResourceType::UAVStructured;
236 ResType = dxbc::PSV::ResourceType::UAVTyped;
238 ResType = dxbc::PSV::ResourceType::UAVRaw;
250void DXContainerGlobals::addPipelineStateValidationInfo(
259 getAnalysis<DXILMetadataAnalysisWrapperPass>().getModuleMetadata();
265 addResourcesForPSV(M, PSV);
292char DXContainerGlobals::ID = 0;
294 "DXContainer Global Emitter",
false,
true)
303 return new DXContainerGlobals();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
dxil DXContainer Global Emitter
DXIL Resource Implicit Binding
Module.h This file contains the declarations for the Module class.
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
This file defines the SmallVector class.
Class for arbitrary precision integers.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
static LLVM_ABI Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)
This method constructs a CDS and initializes it with a text string.
static Constant * get(LLVMContext &Context, ArrayRef< ElementTy > Elts)
get() constructor - Return a constant with array type with an element count and element type matching...
This is an important base class in LLVM.
iterator_range< iterator > samplers()
iterator_range< iterator > srvs()
iterator_range< iterator > cbuffers()
iterator_range< iterator > uavs()
@ PrivateLinkage
Like Internal, but omit from symbol table.
LLVM_ABI void update(ArrayRef< uint8_t > Data)
Updates the hash for the byte stream provided.
LLVM_ABI void final(MD5Result &Result)
Finishes off the hash and puts the result in result.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
A Module instance is used to store all the information related to an LLVM module.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM_ABI bool isTyped() const
LLVM_ABI bool isStruct() const
dxil::ResourceKind getResourceKind() const
Wrapper pass for the legacy pass manager.
Wrapper pass for the legacy pass manager.
void write(raw_ostream &OS)
A raw_ostream that writes to an SmallVector or SmallString.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
ResourceKind
The kind of resource for an SRV or UAV resource.
constexpr bool IsBigEndianHost
This is an optimization pass for GlobalISel generic memory operations.
ModulePass * createDXContainerGlobalsPass()
Pass for generating DXContainer part globals.
@ Global
Append to llvm.global_dtors.
LLVM_ABI void appendToCompilerUsed(Module &M, ArrayRef< GlobalValue * > Values)
Adds global values to the llvm.compiler.used list.
This struct is a compact representation of a valid (non-zero power of two) alignment.
uint32_t MaximumWaveLaneCount
uint32_t MinimumWaveLaneCount
dxbc::PSV::v3::RuntimeInfo BaseData
llvm::StringRef EntryName
SmallVector< dxbc::PSV::v2::ResourceBindInfo > Resources
void finalize(Triple::EnvironmentType Stage)
void write(raw_ostream &OS, uint32_t Version=std::numeric_limits< uint32_t >::max()) const
LLVM_ABI void write(raw_ostream &OS) const