[llvm] [DirectX] Infrastructure to collect shader flags for each function (PR #112967)
Damyan Pepper via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 5 16:57:27 PST 2024
================
@@ -63,17 +114,63 @@ void ComputedShaderFlags::print(raw_ostream &OS) const {
OS << ";\n";
}
+/// Insert the pair <Func, FlagMask> into the sorted vector
+/// FunctionFlags. The insertion is expected to be in-order and hence
+/// is done at the end of the already sorted list.
+void DXILModuleShaderFlagsInfo::insertInorderFunctionFlags(
+ const Function *Func, ComputedShaderFlags FlagMask) {
+ FunctionFlags.push_back({Func, FlagMask});
+}
+
+const SmallVector<std::pair<Function const *, ComputedShaderFlags>> &
+DXILModuleShaderFlagsInfo::getFunctionFlags() const {
+ return FunctionFlags;
+}
+
+const ComputedShaderFlags &DXILModuleShaderFlagsInfo::getModuleFlags() const {
+ return ModuleFlags;
+}
+
+Expected<const ComputedShaderFlags &>
+DXILModuleShaderFlagsInfo::getShaderFlagsMask(const Function *Func) const {
+ std::pair<Function const *, ComputedShaderFlags> V{Func, {}};
+ const auto *Iter = llvm::lower_bound(FunctionFlags, V);
----------------
damyanp wrote:
Does this really return a pointer? I'd expect it to return an instance of an iterator as a value type.
https://github.com/llvm/llvm-project/pull/112967
More information about the llvm-commits
mailing list