diff options
author | Pedro Artigas <partigas@apple.com> | 2012-12-05 17:12:22 +0000 |
---|---|---|
committer | Pedro Artigas <partigas@apple.com> | 2012-12-05 17:12:22 +0000 |
commit | 41b98843e84b37423282ed9f639cf5c0957c76e1 (patch) | |
tree | 5e8da8335b336045103a59b59025662641e08990 /llvm/lib/VMCore/PassManager.cpp | |
parent | 55b6b6434e0c6772d68578534983f50fd9214909 (diff) | |
download | bcm5719-llvm-41b98843e84b37423282ed9f639cf5c0957c76e1.tar.gz bcm5719-llvm-41b98843e84b37423282ed9f639cf5c0957c76e1.zip |
- Added calls to doInitialization/doFinalization to immutable passes
- fixed ordering of calls to doFinalization to be the reverse of the pass run order due to potential dependencies
- fixed machine module info to operate in the doInitialization/doFinalization model, also fixes some FIXMEs
reviewed by Evan Cheng <evan.cheng@apple.com>
llvm-svn: 169391
Diffstat (limited to 'llvm/lib/VMCore/PassManager.cpp')
-rw-r--r-- | llvm/lib/VMCore/PassManager.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/PassManager.cpp b/llvm/lib/VMCore/PassManager.cpp index 875ab5cad7d..712b877501c 100644 --- a/llvm/lib/VMCore/PassManager.cpp +++ b/llvm/lib/VMCore/PassManager.cpp @@ -1333,7 +1333,7 @@ bool BBPassManager::doInitialization(Module &M) { bool BBPassManager::doFinalization(Module &M) { bool Changed = false; - for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) + for (int Index = getNumContainedPasses() - 1; Index >= 0; --Index) Changed |= getContainedPass(Index)->doFinalization(M); return Changed; @@ -1423,6 +1423,12 @@ bool FunctionPassManagerImpl::doInitialization(Module &M) { dumpArguments(); dumpPasses(); + SmallVectorImpl<ImmutablePass *>& IPV = getImmutablePasses(); + for (SmallVectorImpl<ImmutablePass *>::const_iterator I = IPV.begin(), + E = IPV.end(); I != E; ++I) { + Changed |= (*I)->doInitialization(M); + } + for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) Changed |= getContainedManager(Index)->doInitialization(M); @@ -1432,9 +1438,15 @@ bool FunctionPassManagerImpl::doInitialization(Module &M) { bool FunctionPassManagerImpl::doFinalization(Module &M) { bool Changed = false; - for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) + for (int Index = getNumContainedManagers() - 1; Index >= 0; --Index) Changed |= getContainedManager(Index)->doFinalization(M); + SmallVectorImpl<ImmutablePass *>& IPV = getImmutablePasses(); + for (SmallVectorImpl<ImmutablePass *>::const_iterator I = IPV.begin(), + E = IPV.end(); I != E; ++I) { + Changed |= (*I)->doFinalization(M); + } + return Changed; } @@ -1553,8 +1565,8 @@ bool FPPassManager::doInitialization(Module &M) { bool FPPassManager::doFinalization(Module &M) { bool Changed = false; - - for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) + + for (int Index = getNumContainedPasses() - 1; Index >= 0; --Index) Changed |= getContainedPass(Index)->doFinalization(M); return Changed; @@ -1611,7 +1623,7 @@ MPPassManager::runOnModule(Module &M) { } // Finalize module passes - for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) + for (int Index = getNumContainedPasses() - 1; Index >= 0; --Index) Changed |= getContainedPass(Index)->doFinalization(M); // Finalize on-the-fly passes @@ -1682,9 +1694,21 @@ bool PassManagerImpl::run(Module &M) { dumpArguments(); dumpPasses(); + SmallVectorImpl<ImmutablePass *>& IPV = getImmutablePasses(); + for (SmallVectorImpl<ImmutablePass *>::const_iterator I = IPV.begin(), + E = IPV.end(); I != E; ++I) { + Changed |= (*I)->doInitialization(M); + } + initializeAllAnalysisInfo(); for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) Changed |= getContainedManager(Index)->runOnModule(M); + + for (SmallVectorImpl<ImmutablePass *>::const_iterator I = IPV.begin(), + E = IPV.end(); I != E; ++I) { + Changed |= (*I)->doFinalization(M); + } + return Changed; } |