[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp

Misha Brukman brukman at cs.uiuc.edu
Tue Oct 14 16:39:02 PDT 2003


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.50 -> 1.51

---
Log message:

Enabling incremental bytecode loading in the JIT:
* FunctionPassManager ctor now takes in a ModuleProvider
* run() materializes function before running passes on it


---
Diffs of the changes:  (+10 -3)

Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.50 llvm/lib/VMCore/Pass.cpp:1.51
--- llvm/lib/VMCore/Pass.cpp:1.50	Mon Oct 13 00:33:01 2003
+++ llvm/lib/VMCore/Pass.cpp	Tue Oct 14 16:38:42 2003
@@ -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 @@
 // 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 @@
   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.
 //





More information about the llvm-commits mailing list