[llvm] [DXIL] Consume Metadata Analysis information in passes (PR #108034)
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 10 15:51:38 PDT 2024
================
@@ -65,18 +69,269 @@ static void emitResourceMetadata(Module &M, const DXILResourceMap &DRM,
MDNode::get(M.getContext(), {SRVMD, UAVMD, CBufMD, SmpMD}));
}
+static StringRef getShortShaderStage(Triple::EnvironmentType Env) {
+ switch (Env) {
+ case Triple::Pixel:
+ return "ps";
+ case Triple::Vertex:
+ return "vs";
+ case Triple::Geometry:
+ return "gs";
+ case Triple::Hull:
+ return "hs";
+ case Triple::Domain:
+ return "ds";
+ case Triple::Compute:
+ return "cs";
+ case Triple::Library:
+ return "lib";
+ case Triple::Mesh:
+ return "ms";
+ case Triple::Amplification:
+ return "as";
+ default:
+ break;
+ }
+ llvm_unreachable("Unsupported environment for DXIL generation.");
+ return "";
+}
+
+static uint32_t getShaderStage(Triple::EnvironmentType Env) {
+ return (uint32_t)Env - (uint32_t)llvm::Triple::Pixel;
+}
+
+struct ShaderEntryMDInfo : EntryProperties {
----------------
bogner wrote:
I think subclassing `EntryProperties` here makes this more complicated than necessary, and I'm not sure having a class for `ShaderEntryMDInfo` is really gaining much over a few static functions anyway. We only really have two methods in this struct that use anything from `EntryProperties`:
- constructEntryMetadata only needs a `Function *` and the metadata that's passed in.
- constructEntryPropMetadata could easily just take an `EntryProperties &` as a parameter.
https://github.com/llvm/llvm-project/pull/108034
More information about the llvm-commits
mailing list