121 return "fbtex2darray";
140struct FormatResourceDimension
142 FormatResourceDimension(
const dxil::ResourceTypeInfo &RI,
bool HasCounter)
143 : llvm::FormatAdapter<
const dxil::ResourceTypeInfo &>(RI),
144 HasCounter(HasCounter) {}
148 void format(llvm::raw_ostream &OS, StringRef Style)
override {
153 if (Item.isMultiSample())
154 OS << Item.getMultiSampleCount();
157 case dxil::ResourceKind::RawBuffer:
158 case dxil::ResourceKind::StructuredBuffer:
166 case dxil::ResourceKind::TypedBuffer:
169 case dxil::ResourceKind::CBuffer:
172 case dxil::ResourceKind::RTAccelerationStructure:
179struct FormatBindingID
183 explicit FormatBindingID(
const dxil::ResourceInfo &RI,
184 const dxil::ResourceTypeInfo &RTI)
185 : llvm::FormatAdapter<
const dxil::ResourceInfo &>(RI),
186 RC(RTI.getResourceClass()) {}
188 void format(llvm::raw_ostream &OS, StringRef Style)
override {
193struct FormatBindingLocation
197 explicit FormatBindingLocation(
const dxil::ResourceInfo &RI,
198 const dxil::ResourceTypeInfo &RTI)
199 : llvm::FormatAdapter<
const dxil::ResourceInfo &>(RI),
200 RC(RTI.getResourceClass()) {}
202 void format(llvm::raw_ostream &OS, StringRef Style)
override {
203 const auto &
Binding = Item.getBinding();
206 OS <<
",space" <<
Binding.Space;
210struct FormatBindingSize
212 explicit FormatBindingSize(
const dxil::ResourceInfo &RI)
213 : llvm::FormatAdapter<
const dxil::ResourceInfo &>(RI) {}
215 void format(llvm::raw_ostream &OS, StringRef Style)
override {
216 uint32_t
Size = Item.getBinding().Size;
217 if (
Size == std::numeric_limits<uint32_t>::max())
229 OS <<
";\n; Resource Bindings:\n;\n";
230 OS <<
formatv(
"; {0,-30} {1,10} {2,7} {3,11} {4,7} {5,14} {6,9}\n",
"Name",
231 "Type",
"Format",
"Dim",
"ID",
"HLSL Bind",
"Count");
233 "; {0,-+30} {1,-+10} {2,-+7} {3,-+11} {4,-+7} {5,-+14} {6,-+9}\n",
"",
"",
244 FormatResourceDimension Dim(RTI, RI.hasCounter());
245 FormatBindingID
ID(RI, RTI);
246 FormatBindingLocation Bind(RI, RTI);
247 FormatBindingSize
Count(RI);
248 OS <<
formatv(
"; {0,-30} {1,10} {2,7} {3,11} {4,7} {5,14} {6,9}\n", Name,
272 return "DXIL Metadata Pretty Printer";
275 bool runOnModule(
Module &M)
override;
276 void getAnalysisUsage(AnalysisUsage &AU)
const override {
284char DXILPrettyPrinterLegacy::ID = 0;
286 "DXIL Metadata Pretty Printer",
true,
true)
292bool DXILPrettyPrinterLegacy::runOnModule(
Module &M) {
294 getAnalysis<DXILResourceWrapperPass>().getResourceMap();
296 getAnalysis<DXILResourceTypeWrapperPass>().getResourceTypeMap();
302 return new DXILPrettyPrinterLegacy(OS);
static StringRef getTextureDimName(dxil::ResourceKind RK)
static void prettyPrintResources(raw_ostream &OS, const DXILResourceMap &DRM, DXILResourceTypeMap &DRTM)
static StringRef getRCPrefix(dxil::ResourceClass RC)
static StringRef getFormatName(const dxil::ResourceTypeInfo &RI)
static StringRef getRCName(dxil::ResourceClass RC)
DXIL Resource Implicit Binding
This header defines various interfaces for pass management in LLVM.
Machine Check Debug Module
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)
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &)
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.
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.
LLVM_ABI 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
LLVM_ABI bool isSampler() const
LLVM_ABI bool isTyped() const
LLVM_ABI bool isCBuffer() const
LLVM_ABI TypedInfo getTyped() const
LLVM_ABI bool isStruct() 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.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
FunctionAddr VTableAddr Count
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
ModulePass * createDXILPrettyPrinterLegacyPass(raw_ostream &OS)
Pass to pretty print DXIL metadata.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
dxil::ElementType ElementTy