[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:04:38 PST 2024


================
@@ -60,21 +61,47 @@ struct ComputedShaderFlags {
     return FeatureFlags;
   }
 
-  static ComputedShaderFlags computeFlags(Module &M);
+  uint64_t getModuleFlags() const {
+    uint64_t ModuleFlags = 0;
+#define DXIL_MODULE_FLAG(DxilModuleBit, FlagName, Str)                         \
+  ModuleFlags |= FlagName ? getMask(DxilModuleBit) : 0ull;
+#include "llvm/BinaryFormat/DXContainerConstants.def"
+    return ModuleFlags;
+  }
+
   void print(raw_ostream &OS = dbgs()) const;
   LLVM_DUMP_METHOD void dump() const { print(); }
 };
 
+struct DXILModuleShaderFlagsInfo {
+  Expected<const ComputedShaderFlags &>
+  getShaderFlagsMask(const Function *Func) const;
+  bool hasShaderFlagsMask(const Function *Func) const;
+  const ComputedShaderFlags &getModuleFlags() const;
+  const SmallVector<std::pair<Function const *, ComputedShaderFlags>> &
+  getFunctionFlags() const;
+  void insertInorderFunctionFlags(const Function *, ComputedShaderFlags);
+
+private:
+  // Shader Flag mask representing module-level properties. These are
+  // represented using the macro DXIL_MODULE_FLAG
+  ComputedShaderFlags ModuleFlags;
----------------
damyanp wrote:

So there's no code that uses it currently and nothing testing that it is correctly factored in to any aggregated values? I don't think we should be checking in untested code.

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


More information about the llvm-commits mailing list