From 1342f262e3a867571fb4003b6e2f5d5401f921f0 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Fri, 8 Dec 2006 22:57:48 +0000 Subject: [PATCH] Implement top level FunctionPassManager::run(Function &F) llvm-svn: 32381 --- lib/VMCore/PassManager.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 5c9da43b867..3207ef2a3f5 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -401,6 +401,7 @@ public: /// so, return true. bool runOnModule(Module &M); bool runOnFunction(Function &F); + bool run(Function &F); /// doInitialization - Run all of the initializers for the function passes. /// @@ -800,7 +801,7 @@ bool FunctionPassManager_New::run(Function &F) { cerr << "Error reading bytecode file: " << errstr << "\n"; abort(); } - return FPM->runOnFunction(F); + return FPM->run(F); } @@ -934,6 +935,19 @@ inline bool FunctionPassManagerImpl_New::doFinalization(Module &M) { return Changed; } +// Execute all the passes managed by this top level manager. +// Return true if any function is modified by a pass. +bool FunctionPassManagerImpl_New::run(Function &F) { + + bool Changed = false; + for (std::vector::iterator I = passManagersBegin(), + E = passManagersEnd(); I != E; ++I) { + FunctionPass *FP = dynamic_cast(*I); + Changed |= FP->runOnFunction(F); + } + return Changed; +} + //===----------------------------------------------------------------------===// // ModulePassManager implementation