Change the implemented interfaces list on PassInfo from a std::vector to a manually...
[oota-llvm.git] / lib / VMCore / PassManager.cpp
index a56938c1592e9fc24b4d29a89a5a34e4415da4ef..4cf5501379c95894497c8e922fb2da2740dc0bd4 100644 (file)
@@ -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;
     }
   }
 }
@@ -1147,6 +1154,11 @@ void PMDataManager::addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) {
   llvm_unreachable("Unable to schedule pass");
 }
 
+Pass *PMDataManager::getOnTheFlyPass(Pass *P, const PassInfo *PI, Function &F) {
+  assert(0 && "Unable to find on the fly pass");
+  return NULL;
+}
+
 // Destructor
 PMDataManager::~PMDataManager() {
   for (SmallVector<Pass *, 8>::iterator I = PassVector.begin(),