/// whether any of the passes modifies the module, and if so, return true.
bool runOnModule(Module &M);
+ using llvm::Pass::doInitialization;
+ using llvm::Pass::doFinalization;
+
/// doInitialization - Run all of the initializers for the module passes.
///
bool doInitialization();
/// whether any of the passes modifies the module, and if so, return true.
bool run(Module &M);
+ using llvm::Pass::doInitialization;
+ using llvm::Pass::doFinalization;
+
/// doInitialization - Run all of the initializers for the module passes.
///
bool doInitialization();
static ManagedStatic<sys::SmartMutex<true> > TimingInfoMutex;
class TimingInfo {
- DenseMap<AnalysisID, Timer*> TimingData;
+ DenseMap<Pass*, Timer*> TimingData;
TimerGroup TG;
public:
// Use 'create' member to get this.
~TimingInfo() {
// Delete all of the timers, which accumulate their info into the
// TimerGroup.
- for (DenseMap<AnalysisID, Timer*>::iterator I = TimingData.begin(),
+ for (DenseMap<Pass*, Timer*>::iterator I = TimingData.begin(),
E = TimingData.end(); I != E; ++I)
delete I->second;
// TimerGroup is deleted next, printing the report.
return 0;
sys::SmartScopedLock<true> Lock(*TimingInfoMutex);
- Timer *&T = TimingData[P->getPassID()];
+ Timer *&T = TimingData[P];
if (T == 0)
T = new Timer(P->getPassName(), TG);
return T;
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;
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);
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;
}
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;
}
// 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
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;
}