[llvm] [DirectX] Infrastructure to collect shader flags for each function (PR #112967)
Damyan Pepper via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 28 16:39:20 PDT 2024
================
@@ -63,16 +115,53 @@ void ComputedShaderFlags::print(raw_ostream &OS) const {
OS << ";\n";
}
+void DXILModuleShaderFlagsInfo::print(raw_ostream &OS) const {
+ OS << "; Shader Flags mask for Module:\n";
+ ModuleFlags.print(OS);
+ for (auto SF : FuncShaderFlagsVec) {
+ OS << "; Shader Flags mask for Function: " << SF.first->getName() << "\n";
+ SF.second.print(OS);
+ }
+}
+
+const ComputedShaderFlags
+DXILModuleShaderFlagsInfo::getShaderFlagsMask(const Function *Func) const {
+ FuncShaderFlagsMask V{Func, {}};
+ auto Iter = llvm::lower_bound(FuncShaderFlagsVec, V, compareFuncSFPairs);
+ if (Iter == FuncShaderFlagsVec.end()) {
+ Func->getContext().diagnose(DiagnosticInfoShaderFlags(
+ *(Func->getParent()), "Shader Flags information of Function '" +
+ Twine(Func->getName()) + "' not found"));
+ }
+ if (Iter->first != Func) {
+ Func->getContext().diagnose(DiagnosticInfoShaderFlags(
+ *(Func->getParent()),
+ "Inconsistent Shader Flags information of Function '" +
+ Twine(Func->getName()) + "' retrieved"));
----------------
damyanp wrote:
I don't understand why this diagnostic exists? lower_bound is defined to return an iterator to a non-end element in the normal case when it isn't found, so this should really be exactly the same case as the one above.
https://github.com/llvm/llvm-project/pull/112967
More information about the llvm-commits
mailing list