[llvm] [NFC] Refactoring MCDXBC to support out of order storage of root parameters (PR #137284)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Wed May 14 21:04:54 PDT 2025


================
@@ -15,12 +15,64 @@ namespace llvm {
 class raw_ostream;
 namespace mcdxbc {
 
-struct RootParameter {
+struct RootParameterInfo {
   dxbc::RootParameterHeader Header;
-  union {
-    dxbc::RootConstants Constants;
-    dxbc::RTS0::v2::RootDescriptor Descriptor;
-  };
+  size_t Location;
+
+  RootParameterInfo() = default;
+
+  RootParameterInfo(dxbc::RootParameterHeader H, size_t L)
+      : Header(H), Location(L) {}
----------------
bogner wrote:

Clearer to call these `Header` and `Location` rather than abbreviating here
```suggestion
  RootParameterInfo(dxbc::RootParameterHeader Header, size_t Location)
      : Header(Header), Location(Location) {}
```

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


More information about the llvm-commits mailing list