Add explicit doInitialization/doFinalization methods instead of making
authorChris Lattner <sabre@nondot.org>
Mon, 4 Sep 2006 04:07:39 +0000 (04:07 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 4 Sep 2006 04:07:39 +0000 (04:07 +0000)
the FunctionPassManager redo this for each function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30079 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/PassManager.h
lib/VMCore/Pass.cpp

index 47b49adeb8594640746eb57ec6ae5e3023652910..7d4a2df6d15220e48a068e94f1f1f7b8d10befcb 100644 (file)
@@ -70,11 +70,19 @@ public:
   ///
   void add(ImmutablePass *IP);
 
+  /// doInitialization - Run all of the initializers for the function passes.
+  ///
+  bool doInitialization();
+  
   /// run - Execute all of the passes scheduled for execution.  Keep
   /// track of whether any of the passes modifies the function, and if
   /// so, return true.
   ///
   bool run(Function &F);
+  
+  /// doFinalization - Run all of the initializers for the function passes.
+  ///
+  bool doFinalization();
 };
 
 } // End llvm namespace
index a06f08464d34d602ede5a0fad978116d1d81cfac..cf7e1c05a728f4359e3a267dca494d3b9ccf973c 100644 (file)
@@ -94,13 +94,26 @@ FunctionPassManager::FunctionPassManager(ModuleProvider *P) :
 FunctionPassManager::~FunctionPassManager() { delete PM; }
 void FunctionPassManager::add(FunctionPass *P) { PM->add(P); }
 void FunctionPassManager::add(ImmutablePass *IP) { PM->add(IP); }
+
+/// doInitialization - Run all of the initializers for the function passes.
+///
+bool FunctionPassManager::doInitialization() {
+  return PM->doInitialization(*MP->getModule());
+}
+
 bool FunctionPassManager::run(Function &F) {
   std::string errstr;
   if (MP->materializeFunction(&F, &errstr)) {
     std::cerr << "Error reading bytecode file: " << errstr << "\n";
     abort();
   }
-  return PM->run(F);
+  return PM->runOnFunction(F);
+}
+
+/// doFinalization - Run all of the initializers for the function passes.
+///
+bool FunctionPassManager::doFinalization() {
+  return PM->doFinalization(*MP->getModule());
 }