45 void addPipelineStateValidationInfo(
Module &M,
55 return "DXContainer Global Emitter";
71bool DXContainerGlobals::runOnModule(
Module &M) {
75 addSignature(M, Globals);
76 addPipelineStateValidationInfo(M, Globals);
82 uint64_t CombinedFeatureFlags = getAnalysis<ShaderFlagsAnalysisWrapper>()
88 ConstantInt::get(
M.getContext(),
APInt(64, CombinedFeatureFlags));
89 return buildContainerGlobal(M, FeatureFlagsConstant,
"dx.sfi0",
"SFI0");
94 cast<ConstantDataArray>(
M.getNamedGlobal(
"dx.dxil")->getInitializer());
96 Digest.
update(DXILConstant->getRawDataValues());
102 if (
M.debug_compile_units_begin() !=
M.debug_compile_units_end())
103 HashData.
Flags =
static_cast<uint32_t>(dxbc::HashFlags::IncludesSource);
105 memcpy(
reinterpret_cast<void *
>(&HashData.
Digest),
Result.data(), 16);
112 return buildContainerGlobal(M, ModuleConstant,
"dx.hash",
"HASH");
120 GV->setAlignment(
Align(4));
135void DXContainerGlobals::addSignature(
Module &M,
141 Globals.
emplace_back(buildSignature(M, InputSig,
"dx.isg1",
"ISG1"));
144 Globals.
emplace_back(buildSignature(M, OutputSig,
"dx.osg1",
"OSG1"));
149 getAnalysis<DXILResourceBindingWrapperPass>().getBindingMap();
151 getAnalysis<DXILResourceTypeWrapperPass>().getResourceTypeMap();
165 case dxil::ResourceKind::Sampler:
166 ResType = dxbc::PSV::ResourceType::Sampler;
168 case dxil::ResourceKind::CBuffer:
169 ResType = dxbc::PSV::ResourceType::CBV;
171 case dxil::ResourceKind::StructuredBuffer:
172 ResType = IsUAV ? dxbc::PSV::ResourceType::UAVStructured
173 : dxbc::PSV::ResourceType::SRVStructured;
175 ResType = dxbc::PSV::ResourceType::UAVStructuredWithCounter;
177 case dxil::ResourceKind::RTAccelerationStructure:
178 ResType = dxbc::PSV::ResourceType::SRVRaw;
180 case dxil::ResourceKind::RawBuffer:
181 ResType = IsUAV ? dxbc::PSV::ResourceType::UAVRaw
182 : dxbc::PSV::ResourceType::SRVRaw;
185 ResType = IsUAV ? dxbc::PSV::ResourceType::UAVTyped
186 : dxbc::PSV::ResourceType::SRVTyped;
189 BindInfo.
Type = ResType;
201void DXContainerGlobals::addPipelineStateValidationInfo(
210 getAnalysis<DXILMetadataAnalysisWrapperPass>().getModuleMetadata();
216 addResourcesForPSV(M, PSV);
243char DXContainerGlobals::ID = 0;
245 "DXContainer Global Emitter",
false,
true)
254 return new DXContainerGlobals();
This file contains the declarations for the subclasses of Constant, which represent the different fla...
dxil DXContainer Global Emitter
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)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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 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.
@ PrivateLinkage
Like Internal, but omit from symbol table.
void update(ArrayRef< uint8_t > Data)
Updates the hash for the byte stream provided.
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.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
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.
dxil::ResourceClass getResourceClass() const
dxil::ResourceKind getResourceKind() const
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.
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.
void appendToCompilerUsed(Module &M, ArrayRef< GlobalValue * > Values)
Adds global values to the llvm.compiler.used list.
void initializeDXContainerGlobalsPass(PassRegistry &)
Initializer for DXContainerGlobals pass.
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