summaryrefslogtreecommitdiff
path: root/lib/VMCore/Pass.cpp
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-10-14 21:38:42 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-10-14 21:38:42 +0000
commit69c856aa6d42c2bf25730c04c24988658ec3ae24 (patch)
tree400cac7f0223c8318fd780835ccf0728a949ac63 /lib/VMCore/Pass.cpp
parent005e5e9a482674b648ff8595c65239efab9b6276 (diff)
downloadllvm-69c856aa6d42c2bf25730c04c24988658ec3ae24.tar.gz
llvm-69c856aa6d42c2bf25730c04c24988658ec3ae24.tar.bz2
llvm-69c856aa6d42c2bf25730c04c24988658ec3ae24.tar.xz
Enabling incremental bytecode loading in the JIT:
* FunctionPassManager ctor now takes in a ModuleProvider * run() materializes function before running passes on it git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9126 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Pass.cpp')
-rw-r--r--lib/VMCore/Pass.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp
index c9b97c879a..ddee390e50 100644
--- a/lib/VMCore/Pass.cpp
+++ b/lib/VMCore/Pass.cpp
@@ -9,6 +9,7 @@
#include "llvm/PassManager.h"
#include "PassManagerT.h" // PassManagerT implementation
#include "llvm/Module.h"
+#include "llvm/ModuleProvider.h"
#include "Support/STLExtras.h"
#include "Support/TypeInfo.h"
#include <set>
@@ -76,11 +77,17 @@ bool PassManager::run(Module &M) { return PM->run(M); }
// is a simple Pimpl class that wraps the PassManagerT template. It
// is like PassManager, but only deals in FunctionPasses.
//
-FunctionPassManager::FunctionPassManager() : PM(new PassManagerT<Function>()) {}
+FunctionPassManager::FunctionPassManager(ModuleProvider *P) :
+ PM(new PassManagerT<Function>()), MP(P) {}
FunctionPassManager::~FunctionPassManager() { delete PM; }
void FunctionPassManager::add(FunctionPass *P) { PM->add(P); }
void FunctionPassManager::add(ImmutablePass *IP) { PM->add(IP); }
-bool FunctionPassManager::run(Function &F) { return PM->run(F); }
+bool FunctionPassManager::run(Function &F) {
+ Function *mF = MP->getModule()->getNamedFunction(F.getName());
+ assert((&F == mF) && "ModuleProvider does not contain this function!");
+ MP->materializeFunction(&F);
+ return PM->run(F);
+}
//===----------------------------------------------------------------------===//
@@ -177,7 +184,7 @@ const char *Pass::getPassName() const {
return typeid(*this).name();
}
-// print - Print out the internal state of the pass. This is called by Analyse
+// print - Print out the internal state of the pass. This is called by Analyze
// to print out the contents of an analysis. Otherwise it is not necessary to
// implement this method.
//