[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp
Devang Patel
dpatel at apple.com
Tue Nov 14 17:27:20 PST 2006
Changes in directory llvm/lib/VMCore:
PassManager.cpp updated: 1.29 -> 1.30
---
Log message:
Add doInitialization and doFinalization support in FunctionManager_New.
---
Diffs of the changes: (+52 -2)
PassManager.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 52 insertions(+), 2 deletions(-)
Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.29 llvm/lib/VMCore/PassManager.cpp:1.30
--- llvm/lib/VMCore/PassManager.cpp:1.29 Tue Nov 14 19:11:27 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Nov 14 19:27:05 2006
@@ -14,6 +14,7 @@
#include "llvm/PassManager.h"
#include "llvm/Module.h"
+#include "llvm/ModuleProvider.h"
#include <vector>
#include <map>
@@ -174,6 +175,13 @@
/// Return true IFF AnalysisID AID is currently available.
Pass *getAnalysisPassFromManager(AnalysisID AID);
+ /// doInitialization - Run all of the initializers for the function passes.
+ ///
+ bool doInitialization(Module &M);
+
+ /// doFinalization - Run all of the initializers for the function passes.
+ ///
+ bool doFinalization(Module &M);
private:
// Active Pass Managers
BasicBlockPassManager_New *activeBBPassManager;
@@ -355,8 +363,8 @@
// implementations it needs.
//
void CommonPassManagerImpl::initializeAnalysisImpl(Pass *P) {
- AnalysisUsage AnUsage;
- P->getAnalysisUsage(AnUsage);
+ AnalysisUsage AnUsage;
+ P->getAnalysisUsage(AnUsage);
for (std::vector<const PassInfo *>::const_iterator
I = AnUsage.getRequiredSet().begin(),
@@ -441,6 +449,18 @@
return FPM->runOnModule(M);
}
+/// doInitialization - Run all of the initializers for the function passes.
+///
+bool FunctionPassManager_New::doInitialization() {
+ return FPM->doInitialization(*MP->getModule());
+}
+
+/// doFinalization - Run all of the initializers for the function passes.
+///
+bool FunctionPassManager_New::doFinalization() {
+ return FPM->doFinalization(*MP->getModule());
+}
+
// FunctionPassManagerImpl_New implementation
// FunctionPassManager
@@ -517,6 +537,36 @@
return NULL;
}
+inline bool FunctionPassManagerImpl_New::doInitialization(Module &M) {
+ bool Changed = false;
+
+ for (std::vector<Pass *>::iterator itr = passVectorBegin(),
+ e = passVectorEnd(); itr != e; ++itr) {
+ Pass *P = *itr;
+
+ FunctionPass *FP = dynamic_cast<FunctionPass*>(P);
+ Changed |= FP->doInitialization(M);
+ }
+
+ return Changed;
+}
+
+inline bool FunctionPassManagerImpl_New::doFinalization(Module &M) {
+ bool Changed = false;
+
+ for (std::vector<Pass *>::iterator itr = passVectorBegin(),
+ e = passVectorEnd(); itr != e; ++itr) {
+ Pass *P = *itr;
+
+ FunctionPass *FP = dynamic_cast<FunctionPass*>(P);
+ Changed |= FP->doFinalization(M);
+ }
+
+
+ return Changed;
+}
+
+
// ModulePassManager implementation
/// Add P into pass vector if it is manageble. If P is a FunctionPass
More information about the llvm-commits
mailing list