diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2013-11-23 00:38:42 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2013-11-23 00:38:42 +0000 |
commit | b88831b204bcc1645097dafee64efa2b6a91df2d (patch) | |
tree | 2323e483a8524cb8b208e0e043b851910b4f82e2 /lib/IR/PassManager.cpp | |
parent | 43d67d01e2e32c51ec974e4f5c67343c6bf524a1 (diff) | |
download | llvm-b88831b204bcc1645097dafee64efa2b6a91df2d.tar.gz llvm-b88831b204bcc1645097dafee64efa2b6a91df2d.tar.bz2 llvm-b88831b204bcc1645097dafee64efa2b6a91df2d.tar.xz |
[PM] Add support to the analysis managers to query explicitly for cached
results.
This is the last piece of infrastructure needed to effectively support
querying *up* the analysis layers. The next step will be to introduce
a proxy which provides access to those layers with appropriate use of
const to direct queries to the safe interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195525 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/PassManager.cpp')
-rw-r--r-- | lib/IR/PassManager.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/IR/PassManager.cpp b/lib/IR/PassManager.cpp index 76210a31ed..bbfc304e6d 100644 --- a/lib/IR/PassManager.cpp +++ b/lib/IR/PassManager.cpp @@ -53,6 +53,12 @@ ModuleAnalysisManager::getResultImpl(void *PassID, Module *M) { return *RI->second; } +const detail::AnalysisResultConcept<Module *> * +ModuleAnalysisManager::getCachedResultImpl(void *PassID, Module *M) const { + ModuleAnalysisResultMapT::const_iterator RI = ModuleAnalysisResults.find(PassID); + return RI == ModuleAnalysisResults.end() ? 0 : &*RI->second; +} + void ModuleAnalysisManager::invalidateImpl(void *PassID, Module *M) { ModuleAnalysisResults.erase(PassID); } @@ -122,6 +128,13 @@ FunctionAnalysisManager::getResultImpl(void *PassID, Function *F) { return *RI->second->second; } +const detail::AnalysisResultConcept<Function *> * +FunctionAnalysisManager::getCachedResultImpl(void *PassID, Function *F) const { + FunctionAnalysisResultMapT::const_iterator RI = + FunctionAnalysisResults.find(std::make_pair(PassID, F)); + return RI == FunctionAnalysisResults.end() ? 0 : &*RI->second->second; +} + void FunctionAnalysisManager::invalidateImpl(void *PassID, Function *F) { FunctionAnalysisResultMapT::iterator RI = FunctionAnalysisResults.find(std::make_pair(PassID, F)); |