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 | d1abec365aa89a8497d9b615ccb4b21c72da9447 (patch) | |
tree | 5cd1325ae59c51774105c3c912264d945035ab1e /lib/VMCore | |
parent | 1e3b656be52e94c523d5fdb5a586a62ec59c3c51 (diff) | |
download | external_llvm-d1abec365aa89a8497d9b615ccb4b21c72da9447.zip external_llvm-d1abec365aa89a8497d9b615ccb4b21c72da9447.tar.gz external_llvm-d1abec365aa89a8497d9b615ccb4b21c72da9447.tar.bz2 |
- 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>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169391 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/PassManager.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 875ab5c..712b877 100644 --- a/lib/VMCore/PassManager.cpp +++ b/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; } |