[llvm] [DirectX][NFC] Refactoring DirectX backend to not use `llvm::to_underlying` in switch cases. (PR #151032)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 15 11:46:56 PDT 2025


https://github.com/bogner requested changes to this pull request.

As is, this mostly just shuffles the problem around. All of this would be much simpler if we just use the correct enum types in the data structures.

So, in DXContainerRootSignature.h:
```c++
struct RootParameterInfo {
  dxbc::RootParameterType Type;
  dxbc::ShaderVisibility Visibility;
  uint32_t Offset;
  size_t Location;

  RootParameterInfo() = default;
  RootParameterInfo(dxbc::RootParameterType Type,
                    dxbc::ShaderVisibility Visibility, uint32_t Offset,
                    size_t Location)
      : Type(Type), Visibility(Visibility), Offset(Offset), Location(Location) {
  }
};
```

and similarly in DXContainerYAML.h:
```c++
struct RootParameterHeaderYaml {
  dxbc::RootParameterType Type;
  dxbc::ShaderVisibility Visibility;
  uint32_t Offset;
};
```

If you make those changes, then the rest of this should fall nicely into place.

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


More information about the llvm-commits mailing list