[clang] [llvm] [HLSL][RootSignature] Add metadata generation for descriptor tables (PR #139633)
Justin Bogner via cfe-commits
cfe-commits at lists.llvm.org
Thu May 15 11:14:35 PDT 2025
================
@@ -160,6 +163,65 @@ void dumpRootElements(raw_ostream &OS, ArrayRef<RootElement> Elements) {
OS << "}";
}
+MDNode *MetadataBuilder::BuildRootSignature() {
+ for (const RootElement &Element : Elements) {
+ MDNode *ElementMD = nullptr;
+ if (const auto &Clause = std::get_if<DescriptorTableClause>(&Element))
+ ElementMD = BuildDescriptorTableClause(*Clause);
+ if (const auto &Table = std::get_if<DescriptorTable>(&Element))
+ ElementMD = BuildDescriptorTable(*Table);
+
+ // FIXME(#126586): remove once all RootElemnt variants are handled in a
+ // visit or otherwise
+ assert(ElementMD != nullptr &&
+ "Constructed an unhandled root element type.");
+
+ GeneratedMetadata.push_back(ElementMD);
+ }
+
+ return MDNode::get(Ctx, GeneratedMetadata);
+}
+
+MDNode *MetadataBuilder::BuildDescriptorTable(const DescriptorTable &Table) {
+ IRBuilder<> B(Ctx);
----------------
bogner wrote:
`B` is not a good name for an `IRBuilder` (despite that it does seem to be used a fair amount). `IRB` and `Builder` are both more common names for these, and I definitely lean towards the latter.
https://github.com/llvm/llvm-project/pull/139633
More information about the cfe-commits
mailing list