[clang] [llvm] CodeGen: Add LibcallLoweringInfo analysis pass (PR #168622)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 25 11:02:23 PST 2025
================
@@ -73,6 +77,70 @@ class LibcallLoweringInfo {
}
};
+/// Record a mapping from subtarget to LibcallLoweringInfo.
+class LibcallLoweringModuleAnalysisResult {
+private:
+ using LibcallLoweringMap =
+ DenseMap<const TargetSubtargetInfo *, LibcallLoweringInfo>;
+ mutable LibcallLoweringMap LoweringMap;
+ const RTLIB::RuntimeLibcallsInfo *RTLCI = nullptr;
+
+public:
+ LibcallLoweringModuleAnalysisResult() = default;
+ LibcallLoweringModuleAnalysisResult(RTLIB::RuntimeLibcallsInfo &RTLCI)
+ : RTLCI(&RTLCI) {}
+
+ void init(const RTLIB::RuntimeLibcallsInfo *RT) { RTLCI = RT; }
+
+ void clear() {
+ RTLCI = nullptr;
+ LoweringMap.clear();
+ }
+
+ LLVM_ABI bool invalidate(Module &, const PreservedAnalyses &,
+ ModuleAnalysisManager::Invalidator &);
+
+ const LibcallLoweringInfo &
+ getLibcallLowering(const TargetSubtargetInfo &Subtarget) const {
+ return LoweringMap.try_emplace(&Subtarget, *RTLCI, Subtarget).first->second;
+ }
+};
+
+class LibcallLoweringModuleAnalysis
+ : public AnalysisInfoMixin<LibcallLoweringModuleAnalysis> {
+private:
+ friend AnalysisInfoMixin<LibcallLoweringModuleAnalysis>;
+ LLVM_ABI static AnalysisKey Key;
----------------
arsenm wrote:
Copied from TargetLibraryAnalysis
https://github.com/llvm/llvm-project/pull/168622
More information about the llvm-commits
mailing list