25 case dxil::ResourceClass::SRV:
27 case dxil::ResourceClass::UAV:
29 case dxil::ResourceClass::CBuffer:
31 case dxil::ResourceClass::Sampler:
39 case dxil::ResourceClass::SRV:
41 case dxil::ResourceClass::UAV:
43 case dxil::ResourceClass::CBuffer:
45 case dxil::ResourceClass::Sampler:
54 case dxil::ElementType::I1:
56 case dxil::ElementType::I16:
58 case dxil::ElementType::U16:
60 case dxil::ElementType::I32:
62 case dxil::ElementType::U32:
64 case dxil::ElementType::I64:
66 case dxil::ElementType::U64:
68 case dxil::ElementType::F16:
70 case dxil::ElementType::F32:
72 case dxil::ElementType::F64:
74 case dxil::ElementType::SNormF16:
76 case dxil::ElementType::UNormF16:
78 case dxil::ElementType::SNormF32:
80 case dxil::ElementType::UNormF32:
82 case dxil::ElementType::SNormF64:
84 case dxil::ElementType::UNormF64:
86 case dxil::ElementType::PackedS8x32:
88 case dxil::ElementType::PackedU8x32:
90 case dxil::ElementType::Invalid:
103 case dxil::ResourceKind::Texture1D:
105 case dxil::ResourceKind::Texture2D:
107 case dxil::ResourceKind::Texture3D:
109 case dxil::ResourceKind::TextureCube:
111 case dxil::ResourceKind::Texture1DArray:
113 case dxil::ResourceKind::Texture2DArray:
115 case dxil::ResourceKind::TextureCubeArray:
117 case dxil::ResourceKind::TBuffer:
119 case dxil::ResourceKind::FeedbackTexture2D:
121 case dxil::ResourceKind::FeedbackTexture2DArray:
122 return "fbtex2darray";
123 case dxil::ResourceKind::Texture2DMS:
125 case dxil::ResourceKind::Texture2DMSArray:
127 case dxil::ResourceKind::Invalid:
128 case dxil::ResourceKind::NumEntries:
129 case dxil::ResourceKind::CBuffer:
130 case dxil::ResourceKind::RawBuffer:
131 case dxil::ResourceKind::Sampler:
132 case dxil::ResourceKind::StructuredBuffer:
133 case dxil::ResourceKind::TypedBuffer:
134 case dxil::ResourceKind::RTAccelerationStructure:
141struct FormatResourceDimension
151 if (Item.isMultiSample())
152 OS << Item.getMultiSampleCount();
159 else if (Item.getUAV().HasCounter)
174struct FormatBindingID
181 RC(RTI.getResourceClass()) {}
188struct FormatBindingLocation
195 RC(RTI.getResourceClass()) {}
198 const auto &Binding = Item.getBinding();
201 OS <<
",space" << Binding.Space;
205struct FormatBindingSize
212 if (
Size == std::numeric_limits<uint32_t>::max())
225 OS <<
";\n; Resource Bindings:\n;\n";
226 OS <<
formatv(
"; {0,-30} {1,10} {2,7} {3,11} {4,7} {5,14} {6,9}\n",
"Name",
227 "Type",
"Format",
"Dim",
"ID",
"HLSL Bind",
"Count");
229 "; {0,-+30} {1,-+10} {2,-+7} {3,-+11} {4,-+7} {5,-+14} {6,-+9}\n",
"",
"",
238 "Old and new cbuffer representations can't coexist");
239 assert((RC != dxil::ResourceClass::UAV || !MDResources.
hasUAVs()) &&
240 "Old and new UAV representations can't coexist");
245 FormatResourceDimension Dim(RTI);
246 FormatBindingID
ID(RBI, RTI);
247 FormatBindingLocation Bind(RBI, RTI);
248 FormatBindingSize Count(RBI);
249 OS <<
formatv(
"; {0,-30} {1,10} {2,7} {3,11} {4,7} {5,14} {6,9}\n",
Name,
250 Type, Format, Dim,
ID, Bind, Count);
285 return "DXIL Metadata Pretty Printer";
288 bool runOnModule(
Module &M)
override;
298char DXILPrettyPrinterLegacy::ID = 0;
300 "DXIL Metadata Pretty Printer",
true,
true)
307bool DXILPrettyPrinterLegacy::runOnModule(
Module &M) {
309 getAnalysis<DXILResourceBindingWrapperPass>().getBindingMap();
311 getAnalysis<DXILResourceTypeWrapperPass>().getResourceTypeMap();
312 dxil::Resources &Res = getAnalysis<DXILResourceMDWrapper>().getDXILResource();
318 return new DXILPrettyPrinterLegacy(
OS);
static void prettyPrintResources(raw_ostream &OS, const DXILBindingMap &DBM, DXILResourceTypeMap &DRTM, const dxil::Resources &MDResources)
static StringRef getTextureDimName(dxil::ResourceKind RK)
static StringRef getRCPrefix(dxil::ResourceClass RC)
static StringRef getFormatName(const dxil::ResourceTypeInfo &RI)
dxil pretty DXIL Metadata Pretty Printer
static StringRef getRCName(dxil::ResourceClass RC)
This header defines various interfaces for pass management in LLVM.
ModuleAnalysisManager MAM
#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())
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.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &)
Analysis pass that exposes the DXILResource for a module.
The legacy pass manager's analysis pass to compute DXIL resource information.
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.
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.
StringRef - Represent a constant reference to a string, i.e.
std::string upper() const
Convert the given ASCII string to uppercase.
The instances of the Type class are immutable: once they are created, they are never changed.
dxil::ResourceClass getResourceClass() const
TypedInfo getTyped() const
void printUAVs(raw_ostream &OS) const
void printCBuffers(raw_ostream &OS) const
This class implements an extremely fast bulk output stream that can only output to a stream.
#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.
ResourceKind
The kind of resource for an SRV or UAV resource.
@ RTAccelerationStructure
This is an optimization pass for GlobalISel generic memory operations.
void initializeDXILPrettyPrinterLegacyPass(PassRegistry &)
Initializer for DXILPrettyPrinter.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
ModulePass * createDXILPrettyPrinterLegacyPass(raw_ostream &OS)
Pass to pretty print DXIL metadata.
dxil::ElementType ElementTy