From: Owen Anderson Date: Tue, 20 Jul 2010 16:55:05 +0000 (+0000) Subject: Pull out r108755. After offline discussion with Chris, we're going to go a different... X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=2dcacabc713945f71bd5342d55bfad3f79ffc360 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 --- diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h index 09abe93e916..b0183513386 100644 --- a/include/llvm/PassSupport.h +++ b/include/llvm/PassSupport.h @@ -36,10 +36,6 @@ class TargetMachine; class PassInfo { public: typedef Pass* (*NormalCtor_t)(); - struct InterfaceInfo { - const PassInfo *interface; - const InterfaceInfo *next; - }; private: const char *const PassName; // Nice name for Pass @@ -48,7 +44,7 @@ private: const bool IsCFGOnlyPass; // Pass only looks at the CFG. const bool IsAnalysis; // True if an analysis pass. const bool IsAnalysisGroup; // True if an analysis group. - const InterfaceInfo *ItfImpl;// Interfaces implemented by this pass + std::vector ItfImpl;// Interfaces implemented by this pass NormalCtor_t NormalCtor; @@ -120,16 +116,13 @@ public: /// template. /// void addInterfaceImplemented(const PassInfo *ItfPI) { - InterfaceInfo *NewInfo = new InterfaceInfo(); - NewInfo->interface = ItfPI; - NewInfo->next = ItfImpl; - ItfImpl = NewInfo; + ItfImpl.push_back(ItfPI); } /// getInterfacesImplemented - Return a list of all of the analysis group /// interfaces implemented by this pass. /// - const InterfaceInfo *getInterfacesImplemented() const { + const std::vector &getInterfacesImplemented() const { return ItfImpl; } diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 4cf5501379c..296b0d13a71 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 &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 &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 &II = PI->getInterfacesImplemented(); + for (unsigned i = 0, e = II.size(); i != e; ++i) { std::map::iterator Pos = - AvailableAnalysis.find(II->interface); + AvailableAnalysis.find(II[i]); if (Pos != AvailableAnalysis.end() && Pos->second == P) AvailableAnalysis.erase(Pos); - II = II->next; } } }