[llvm] [DirectX] Infrastructure to collect shader flags for each function (PR #112967)
S. Bharadwaj Yadavalli via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 22 13:14:44 PST 2024
================
@@ -60,21 +62,54 @@ 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 merge(const uint64_t IVal) {
+#define SHADER_FEATURE_FLAG(FeatureBit, DxilModuleBit, FlagName, Str) \
+ FlagName |= (IVal & getMask(DxilModuleBit));
+#define DXIL_MODULE_FLAG(DxilModuleBit, FlagName, Str) \
+ FlagName |= (IVal & getMask(DxilModuleBit));
+#include "llvm/BinaryFormat/DXContainerConstants.def"
+ return;
+ }
+
void print(raw_ostream &OS = dbgs()) const;
LLVM_DUMP_METHOD void dump() const { print(); }
};
+struct DXILModuleShaderFlagsInfo {
+ DXILModuleShaderFlagsInfo(const Module &);
+ Expected<const ComputedShaderFlags &>
+ getShaderFlagsMask(const Function *) const;
+ const ComputedShaderFlags getCombinedFlags() const;
+
+private:
+ /// Vector of Function-Shader Flag mask pairs representing properties of each
+ /// of the functions in the module. Shader Flags of each function represent
+ /// both module-level and function-level flags
----------------
bharadwajy wrote:
> Worth noting that this is a sorted vector.
Updated comment accordingly.
https://github.com/llvm/llvm-project/pull/112967
More information about the llvm-commits
mailing list