[llvm] [DirectX] Infrastructure to collect shader flags for each function (PR #112967)
S. Bharadwaj Yadavalli via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 6 11:51:20 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;
----------------
bharadwajy wrote:
> Can you point me to where `ModuleFlags` gets set?
[Individual flags](https://github.com/llvm/llvm-project/blob/f548d39c3c751446d124c08769080214680d53ba/llvm/include/llvm/BinaryFormat/DXContainerConstants.def#L57) constituting `ModuleFlags` are expected to be set in `computeFlags()` (which is changed to `DXILModuleShaderFlagsInfo::initialize(const Module &M)` in the latest change) as part of [support planned](https://github.com/llvm/llvm-project/issues/112044) to be added for those module level flags before walking the various functions of the module.
https://github.com/llvm/llvm-project/pull/112967
More information about the llvm-commits
mailing list