1010#define LLVM_CODEGEN_LIBCALLLOWERINGINFO_H
1111
1212#include " llvm/ADT/DenseMap.h"
13+ #include " llvm/Analysis/RuntimeLibcallInfo.h"
1314#include " llvm/IR/RuntimeLibcalls.h"
1415#include " llvm/Pass.h"
1516
1617namespace llvm {
17-
18+ class RuntimeLibraryInfoWrapper ;
1819class TargetSubtargetInfo ;
1920class TargetMachine ;
2021
@@ -97,6 +98,8 @@ class LibcallLoweringModuleAnalysisResult {
9798 LoweringMap.clear ();
9899 }
99100
101+ operator bool () const { return RTLCI != nullptr ; }
102+
100103 LLVM_ABI bool invalidate (Module &, const PreservedAnalyses &,
101104 ModuleAnalysisManager::Invalidator &);
102105
@@ -122,21 +125,24 @@ class LibcallLoweringModuleAnalysis
122125
123126class LLVM_ABI LibcallLoweringInfoWrapper : public ImmutablePass {
124127 LibcallLoweringModuleAnalysisResult Result;
128+ RuntimeLibraryInfoWrapper *RuntimeLibcallsWrapper = nullptr ;
125129
126130public:
127131 static char ID;
128132 LibcallLoweringInfoWrapper ();
129133
130134 const LibcallLoweringInfo &
131- getLibcallLowering (const TargetSubtargetInfo &Subtarget) const {
132- return Result .getLibcallLowering (Subtarget);
135+ getLibcallLowering (const Module &M, const TargetSubtargetInfo &Subtarget) {
136+ return getResult (M) .getLibcallLowering (Subtarget);
133137 }
134138
135- const LibcallLoweringModuleAnalysisResult &getResult () const {
139+ const LibcallLoweringModuleAnalysisResult &getResult (const Module &M) {
140+ if (!Result)
141+ Result.init (&RuntimeLibcallsWrapper->getRTLCI (M));
136142 return Result;
137143 }
138144
139- bool doInitialization (Module &M ) override ;
145+ void initializePass ( ) override ;
140146 void getAnalysisUsage (AnalysisUsage &AU) const override ;
141147 void releaseMemory () override ;
142148};
0 commit comments