[llvm] [DX] Add support for program signatures (PR #67346)

Chris B via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 09:54:25 PDT 2023


================
@@ -232,6 +233,36 @@ class PSVRuntimeInfo {
   }
 };
 
+class Signature {
+  ViewArray<dxbc::ProgramSignatureElement> Parameters;
+  StringRef StringTable;
+
+public:
+  ViewArray<dxbc::ProgramSignatureElement>::iterator begin() const {
+    return Parameters.begin();
+  }
+
+  ViewArray<dxbc::ProgramSignatureElement>::iterator end() const {
+    return Parameters.end();
+  }
+
+  StringRef getName(uint32_t Idx) const {
+    if (Idx == 0)
+      return "";
----------------
llvm-beanz wrote:

This is a good catch, and a vestige from my first pass through. When I wrote this I was thinking that the string table was the same format as the other string tables in the file which follow unix convention starting with a null byte for empty strings.

It turns out, that's not the case here, these should never be 0 because the offsets are section based and the string table starts late in the section. I'll add proper error handling and tests for range checks on the name strings.

https://github.com/llvm/llvm-project/pull/67346


More information about the llvm-commits mailing list