/// Collect passes whose last user is P
void collectLastUses(std::vector<Pass *> &LastUses, Pass *P);
- // Walk LastUser map and create inverted map. This should be done
- // after all passes are added and before running first pass.
- void collectInvertedLU();
-
/// Find the pass that implements Analysis AID. Search immutable
/// passes and all pass managers. If desired pass is not found
/// then return NULL.
// Map to keep track of last user of the analysis pass.
// LastUser->second is the last user of Lastuser->first.
std::map<Pass *, Pass *> LastUser;
- std::map<Pass *, std::vector <Pass *> > InvertedLU;
/// Immutable passes are managed by top level manager.
std::vector<ImmutablePass *> ImmutablePasses;
}
}
-// Walk LastUser map and create inverted map. This should be done
-// after all passes are added and before running first pass.
-void PMTopLevelManager::collectInvertedLU() {
- for (std::map<Pass *, Pass *>::iterator LUI = LastUser.begin(),
- LUE = LastUser.end(); LUI != LUE; ++LUI)
- InvertedLU[LUI->second].push_back(LUI->first);
-}
-
/// Collect passes whose last user is P
void PMTopLevelManager::collectLastUses(std::vector<Pass *> &LastUses,
Pass *P) {
- std::vector<Pass *>&LU = InvertedLU[P];
- LastUses.insert(LastUses.end(), LU.begin(), LU.end());
+ for (std::map<Pass *, Pass *>::iterator LUI = LastUser.begin(),
+ LUE = LastUser.end(); LUI != LUE; ++LUI)
+ if (LUI->second == P)
+ LastUses.push_back(LUI->first);
}
/// Schedule pass P for execution. Make sure that passes required by
dumpArguments();
dumpPasses();
- // Collect inverted map of LastUsers. This improves speed of
- // collectLastUses().
- TPM->collectInvertedLU();
initializeAllAnalysisInfo();
for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) {
FPPassManager *FP = getContainedManager(Index);
dumpArguments();
dumpPasses();
- // Collect inverted map of LastUsers. This improves speed of
- // collectLastUses().
- TPM->collectInvertedLU();
initializeAllAnalysisInfo();
for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) {
MPPassManager *MP = getContainedManager(Index);