[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:55 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) {}
+};
+
+struct RootParametersContainer {
+ SmallVector<RootParameterInfo> ParametersInfo;
+
+ SmallVector<dxbc::RootConstants> Constants;
+ SmallVector<dxbc::RTS0::v2::RootDescriptor> Descriptors;
+
+ void addInfo(dxbc::RootParameterHeader H, size_t L) {
+ ParametersInfo.push_back(RootParameterInfo(H, L));
+ }
+
+ void addParameter(dxbc::RootParameterHeader H, dxbc::RootConstants C) {
+ addInfo(H, Constants.size());
+ Constants.push_back(C);
+ }
+
+ void addParameter(dxbc::RootParameterHeader H,
+ dxbc::RTS0::v2::RootDescriptor D) {
+ addInfo(H, Descriptors.size());
+ Descriptors.push_back(D);
+ }
----------------
bogner wrote:
Give all of these parameters actual names please
https://github.com/llvm/llvm-project/pull/137284
More information about the llvm-commits
mailing list