summaryrefslogtreecommitdiffstats
path: root/lib/VMCore/PassManager.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-07-20 16:55:05 +0000
committerOwen Anderson <resistor@mac.com>2010-07-20 16:55:05 +0000
commit2dcacabc713945f71bd5342d55bfad3f79ffc360 (patch)
treea191819a942bfb00591497160ac437140a322692 /lib/VMCore/PassManager.cpp
parenteb4152c192ad226a1dee825f1433277e1851edbc (diff)
downloadexternal_llvm-2dcacabc713945f71bd5342d55bfad3f79ffc360.zip
external_llvm-2dcacabc713945f71bd5342d55bfad3f79ffc360.tar.gz
external_llvm-2dcacabc713945f71bd5342d55bfad3f79ffc360.tar.bz2
Pull out r108755. After offline discussion with Chris, we're going to go a different direction with this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108856 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/PassManager.cpp')
-rw-r--r--lib/VMCore/PassManager.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp
index 4cf5501..296b0d1 100644
--- a/lib/VMCore/PassManager.cpp
+++ b/lib/VMCore/PassManager.cpp
@@ -638,14 +638,10 @@ Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) {
// If Pass not found then check the interfaces implemented by Immutable Pass
if (!P) {
- const PassInfo::InterfaceInfo *ImmPI = PI->getInterfacesImplemented();
- while (ImmPI) {
- if (ImmPI->interface == AID) {
- P = *I;
- break;
- } else
- ImmPI = ImmPI->next;
- }
+ const std::vector<const PassInfo*> &ImmPI =
+ PI->getInterfacesImplemented();
+ if (std::find(ImmPI.begin(), ImmPI.end(), AID) != ImmPI.end())
+ P = *I;
}
}
@@ -735,11 +731,9 @@ void PMDataManager::recordAvailableAnalysis(Pass *P) {
//This pass is the current implementation of all of the interfaces it
//implements as well.
- const PassInfo::InterfaceInfo *II = PI->getInterfacesImplemented();
- while (II) {
- AvailableAnalysis[II->interface] = P;
- II = II->next;
- }
+ const std::vector<const PassInfo*> &II = PI->getInterfacesImplemented();
+ for (unsigned i = 0, e = II.size(); i != e; ++i)
+ AvailableAnalysis[II[i]] = P;
}
// Return true if P preserves high level analysis used by other
@@ -873,13 +867,12 @@ void PMDataManager::freePass(Pass *P, StringRef Msg,
// Remove all interfaces this pass implements, for which it is also
// listed as the available implementation.
- const PassInfo::InterfaceInfo *II = PI->getInterfacesImplemented();
- while (II) {
+ const std::vector<const PassInfo*> &II = PI->getInterfacesImplemented();
+ for (unsigned i = 0, e = II.size(); i != e; ++i) {
std::map<AnalysisID, Pass*>::iterator Pos =
- AvailableAnalysis.find(II->interface);
+ AvailableAnalysis.find(II[i]);
if (Pos != AvailableAnalysis.end() && Pos->second == P)
AvailableAnalysis.erase(Pos);
- II = II->next;
}
}
}