[llvm] [DirectX] Infrastructure to collect shader flags for each function (PR #112967)
Damyan Pepper via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 14 12:02:31 PST 2024
================
@@ -318,22 +314,38 @@ static void translateMetadata(Module &M, const DXILResourceMap &DRM,
// See https://github.com/llvm/llvm-project/issues/57928
MDTuple *Signatures = nullptr;
- if (MMDI.ShaderProfile == Triple::EnvironmentType::Library)
+ if (MMDI.ShaderProfile == Triple::EnvironmentType::Library) {
+ // Create a consolidated shader flag mask of all functions in the library
+ // to be used as shader flags mask value associated with top-level library
+ // entry metadata.
+ uint64_t ConsolidatedMask = ShaderFlags.getModuleFlags();
+ for (const auto &FunFlags : ShaderFlags.getFunctionFlags()) {
+ ConsolidatedMask |= FunFlags.second;
+ }
----------------
damyanp wrote:
I disagree - but it's up to you whether or not you take this feedback. `DXILModuleShaderFlagsInfo` is a reasonably good abstraction to be working with, but the moment you expose all of its members via accessors that are then exclusively used to calculate other values you're breaking that abstraction. If this is the way that the class is intended to be used then you might as well remove all the encapsulation and make the members public, and just use const-ness as a strong hint not to modify the member variables.
https://github.com/llvm/llvm-project/pull/112967
More information about the llvm-commits
mailing list