23#define DEBUG_TYPE "dxil-metadata-analysis"
30 const Triple &TT = M.getTargetTriple();
34 NamedMDNode *ValidatorVerNode = M.getNamedMetadata(
"dx.valver");
35 if (ValidatorVerNode) {
40 VersionTuple(MajorMD->getZExtValue(), MinorMD->getZExtValue());
43 NamedMDNode *ContentsNode = M.getNamedMetadata(
"dx.source.contents");
44 NamedMDNode *ArgsNode = M.getNamedMetadata(
"dx.source.args");
45 if (ContentsNode && ArgsNode) {
53 ? dxbc::SourceInfo::Contents::CompressionType::Zlib
54 : dxbc::SourceInfo::Contents::CompressionType::None);
67 for (
auto &
F : M.functions()) {
68 if (!
F.hasFnAttribute(
"hlsl.shader"))
73 Attribute EntryAttr =
F.getFnAttribute(
"hlsl.shader");
75 "Invalid value specified for HLSL function attribute hlsl.shader");
77 Triple T(
"",
"",
"", EntryProfile);
82 F.getFnAttribute(
"hlsl.numthreads").getValueAsString();
83 if (!NumThreadsStr.
empty())
89 F.getFnAttribute(
"hlsl.wavesize").getValueAsString();
90 if (!WaveSizeStr.
empty())
101 OS <<
"DXIL Version : " <<
DXILVersion.getAsString() <<
"\n";
102 OS <<
"Target Shader Stage : "
106 OS <<
" " << EP.Entry->getName() <<
"\n";
107 OS <<
" Function Shader Stage : "
109 OS <<
" NumThreads: " << EP.NumThreadsX <<
"," << EP.NumThreadsY <<
","
110 << EP.NumThreadsZ <<
"\n";
156 OS <<
"No module metadata info has been built!\n";
159 MetadataInfo->print(
dbgs());
162#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
168 "DXIL Module Metadata analysis",
false,
true)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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)
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.
Functions, function parameters, and return types can have attributes to indicate how they should be t...
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
bool isValid() const
Return true if the attribute is any kind of attribute.
ArrayRef< MDOperand > operands() const
A Module instance is used to store all the information related to an LLVM module.
LLVM_ABI MDNode * getOperand(unsigned i) const
iterator_range< op_iterator > operands()
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.
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
Triple - Helper class for working with autoconf configuration names.
static LLVM_ABI StringRef getEnvironmentTypeName(EnvironmentType Kind)
Get the canonical name for the Kind environment.
The instances of the Type class are immutable: once they are created, they are never changed.
Represents a version number in the form major[.minor[.subminor[.build]]].
This class implements an extremely fast bulk output stream that can only output to a stream.
LLVM_ABI bool isAvailable()
LLVM_ABI void parseThreadCounts(StringRef Str, unsigned &Count1, unsigned &Count2, unsigned &Count3)
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract(Y &&MD)
Extract a Value from Metadata.
This is an optimization pass for GlobalISel generic memory operations.
const AnalysisOptions & getAnalysisOptions(const LLVMContext &C)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Triple::EnvironmentType ShaderStage