20#define DEBUG_TYPE "dxil-metadata-analysis"
31 NamedMDNode *ValidatorVerNode = M.getNamedMetadata(
"dx.valver");
32 if (ValidatorVerNode) {
33 auto *ValVerMD = cast<MDNode>(ValidatorVerNode->
getOperand(0));
34 auto *MajorMD = mdconst::extract<ConstantInt>(ValVerMD->getOperand(0));
35 auto *MinorMD = mdconst::extract<ConstantInt>(ValVerMD->getOperand(1));
37 VersionTuple(MajorMD->getZExtValue(), MinorMD->getZExtValue());
41 for (
auto &
F : M.functions()) {
42 if (!
F.hasFnAttribute(
"hlsl.shader"))
47 Attribute EntryAttr =
F.getFnAttribute(
"hlsl.shader");
49 "Invalid value specified for HLSL function attribute hlsl.shader");
51 Triple T(
"",
"",
"", EntryProfile);
55 F.getFnAttribute(
"hlsl.numthreads").getValueAsString();
56 if (!NumThreadsStr.
empty()) {
58 NumThreadsStr.
split(NumThreadsVec,
',');
59 assert(NumThreadsVec.
size() == 3 &&
"Invalid numthreads specified");
62 llvm::to_integer(NumThreadsVec[0], EFP.
NumThreadsX, 10);
63 assert(
Success &&
"Failed to parse X component of numthreads");
65 assert(
Success &&
"Failed to parse Y component of numthreads");
67 assert(
Success &&
"Failed to parse Z component of numthreads");
77 OS <<
"Target Shader Stage : "
81 OS <<
" " << EP.Entry->getName() <<
"\n";
82 OS <<
" Function Shader Stage : "
84 OS <<
" NumThreads: " << EP.NumThreadsX <<
"," << EP.NumThreadsY <<
","
85 << EP.NumThreadsZ <<
"\n";
134 OS <<
"No module metadata info has been built!\n";
137 MetadataInfo->print(
dbgs());
140#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
146 "DXIL Module Metadata analysis",
false,
true)
This file implements a class to represent arbitrary precision integral constant values and operations...
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Module.h This file contains the declarations for the Module class.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A container for analyses that lazily runs them and caches their results.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
StringRef getValueAsString() const
Return the attribute's value as a string.
bool isValid() const
Return true if the attribute is any kind of attribute.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
A Module instance is used to store all the information related to an LLVM module.
MDNode * getOperand(unsigned i) const
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
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.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
constexpr bool empty() const
empty - Check if the string is empty.
Triple - Helper class for working with autoconf configuration names.
static StringRef getEnvironmentTypeName(EnvironmentType Kind)
Get the canonical name for the Kind environment.
Represents a version number in the form major[.minor[.subminor[.build]]].
std::string getAsString() const
Retrieve a string representation of the version number.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void initializeDXILMetadataAnalysisWrapperPassPass(PassRegistry &)
A special type used by analysis passes to provide an address that identifies that particular analysis...
Triple::EnvironmentType ShaderStage