summaryrefslogtreecommitdiff
path: root/lib/VMCore/PassManager.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-07-19 21:44:48 +0000
committerOwen Anderson <resistor@mac.com>2010-07-19 21:44:48 +0000
commit7ee5d354938b231b1d01a76f686ee4dcbfa27600 (patch)
treeef0b19ff4fdd1a5225cbdfaa8c49b8d2ea007dfa /lib/VMCore/PassManager.cpp
parent4332792deb7cd4c43bcd9cda23fdbe01dcc90154 (diff)
downloadllvm-7ee5d354938b231b1d01a76f686ee4dcbfa27600.tar.gz
llvm-7ee5d354938b231b1d01a76f686ee4dcbfa27600.tar.bz2
llvm-7ee5d354938b231b1d01a76f686ee4dcbfa27600.tar.xz
Change the implemented interfaces list on PassInfo from a std::vector to a manually implemented
linked list. This is a little slower and involves more malloc'ing, but these lists are typically short, and it allows PassInfo to be entirely constant initializable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/PassManager.cpp')
-rw-r--r--lib/VMCore/PassManager.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp
index 296b0d13a7..4cf5501379 100644
--- a/lib/VMCore/PassManager.cpp
+++ b/lib/VMCore/PassManager.cpp
@@ -638,10 +638,14 @@ Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) {
// If Pass not found then check the interfaces implemented by Immutable Pass
if (!P) {
- const std::vector<const PassInfo*> &ImmPI =
- PI->getInterfacesImplemented();
- if (std::find(ImmPI.begin(), ImmPI.end(), AID) != ImmPI.end())
- P = *I;
+ const PassInfo::InterfaceInfo *ImmPI = PI->getInterfacesImplemented();
+ while (ImmPI) {
+ if (ImmPI->interface == AID) {
+ P = *I;
+ break;
+ } else
+ ImmPI = ImmPI->next;
+ }
}
}
@@ -731,9 +735,11 @@ void PMDataManager::recordAvailableAnalysis(Pass *P) {
//This pass is the current implementation of all of the interfaces it
//implements as well.
- const std::vector<const PassInfo*> &II = PI->getInterfacesImplemented();
- for (unsigned i = 0, e = II.size(); i != e; ++i)
- AvailableAnalysis[II[i]] = P;
+ const PassInfo::InterfaceInfo *II = PI->getInterfacesImplemented();
+ while (II) {
+ AvailableAnalysis[II->interface] = P;
+ II = II->next;
+ }
}
// Return true if P preserves high level analysis used by other
@@ -867,12 +873,13 @@ void PMDataManager::freePass(Pass *P, StringRef Msg,
// Remove all interfaces this pass implements, for which it is also
// listed as the available implementation.
- const std::vector<const PassInfo*> &II = PI->getInterfacesImplemented();
- for (unsigned i = 0, e = II.size(); i != e; ++i) {
+ const PassInfo::InterfaceInfo *II = PI->getInterfacesImplemented();
+ while (II) {
std::map<AnalysisID, Pass*>::iterator Pos =
- AvailableAnalysis.find(II[i]);
+ AvailableAnalysis.find(II->interface);
if (Pos != AvailableAnalysis.end() && Pos->second == P)
AvailableAnalysis.erase(Pos);
+ II = II->next;
}
}
}