================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits