From 78766ff67cb9222a2dd5e2cda2e1488b5288a79d Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Tue, 12 Aug 2008 15:44:31 +0000 Subject: [PATCH] Use SmallVector instead of std::vector git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54685 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/PassManagers.h | 12 ++++++------ lib/VMCore/PassManager.cpp | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/llvm/PassManagers.h b/include/llvm/PassManagers.h index ff06024ed47..f8e1308c235 100644 --- a/include/llvm/PassManagers.h +++ b/include/llvm/PassManagers.h @@ -186,7 +186,7 @@ public: ImmutablePasses.push_back(P); } - inline std::vector& getImmutablePasses() { + inline SmallVector& getImmutablePasses() { return ImmutablePasses; } @@ -212,13 +212,13 @@ public: protected: /// Collection of pass managers - std::vector PassManagers; + SmallVector PassManagers; private: /// Collection of pass managers that are not directly maintained /// by this pass manager - std::vector IndirectPassManagers; + SmallVector IndirectPassManagers; // Map to keep track of last user of the analysis pass. // LastUser->second is the last user of Lastuser->first. @@ -230,7 +230,7 @@ private: DenseMap > InversedLastUser; /// Immutable passes are managed by top level manager. - std::vector ImmutablePasses; + SmallVector ImmutablePasses; DenseMap AnUsageMap; }; @@ -350,7 +350,7 @@ protected: PMTopLevelManager *TPM; // Collection of pass that are managed by this manager - std::vector PassVector; + SmallVector PassVector; // Collection of Analysis provided by Parent pass manager and // used by current pass manager. At at time there can not be more @@ -369,7 +369,7 @@ private: // Collection of higher level analysis used by the pass managed by // this manager. - std::vector HigherLevelAnalysis; + SmallVector HigherLevelAnalysis; unsigned Depth; }; diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index ed0dde03a18..68a856a4d51 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -491,18 +491,18 @@ Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) { Pass *P = NULL; // Check pass managers - for (std::vector::iterator I = PassManagers.begin(), + for (SmallVector::iterator I = PassManagers.begin(), E = PassManagers.end(); P == NULL && I != E; ++I) { PMDataManager *PMD = *I; P = PMD->findAnalysisPass(AID, false); } // Check other pass managers - for (std::vector::iterator I = IndirectPassManagers.begin(), + for (SmallVector::iterator I = IndirectPassManagers.begin(), E = IndirectPassManagers.end(); P == NULL && I != E; ++I) P = (*I)->findAnalysisPass(AID, false); - for (std::vector::iterator I = ImmutablePasses.begin(), + for (SmallVector::iterator I = ImmutablePasses.begin(), E = ImmutablePasses.end(); P == NULL && I != E; ++I) { const PassInfo *PI = (*I)->getPassInfo(); if (PI == AID) @@ -535,7 +535,7 @@ void PMTopLevelManager::dumpPasses() const { // (sometimes indirectly), but there's no inheritance relationship // between PMDataManager and Pass, so we have to dynamic_cast to get // from a PMDataManager* to a Pass*. - for (std::vector::const_iterator I = PassManagers.begin(), + for (SmallVector::const_iterator I = PassManagers.begin(), E = PassManagers.end(); I != E; ++I) dynamic_cast(*I)->dumpPassStructure(1); } @@ -546,7 +546,7 @@ void PMTopLevelManager::dumpArguments() const { return; cerr << "Pass Arguments: "; - for (std::vector::const_iterator I = PassManagers.begin(), + for (SmallVector::const_iterator I = PassManagers.begin(), E = PassManagers.end(); I != E; ++I) { PMDataManager *PMD = *I; PMD->dumpPassArguments(); @@ -556,14 +556,14 @@ void PMTopLevelManager::dumpArguments() const { void PMTopLevelManager::initializeAllAnalysisInfo() { - for (std::vector::iterator I = PassManagers.begin(), + for (SmallVector::iterator I = PassManagers.begin(), E = PassManagers.end(); I != E; ++I) { PMDataManager *PMD = *I; PMD->initializeAnalysisInfo(); } // Initailize other pass managers - for (std::vector::iterator I = IndirectPassManagers.begin(), + for (SmallVector::iterator I = IndirectPassManagers.begin(), E = IndirectPassManagers.end(); I != E; ++I) (*I)->initializeAnalysisInfo(); @@ -583,11 +583,11 @@ void PMTopLevelManager::initializeAllAnalysisInfo() { /// Destructor PMTopLevelManager::~PMTopLevelManager() { - for (std::vector::iterator I = PassManagers.begin(), + for (SmallVector::iterator I = PassManagers.begin(), E = PassManagers.end(); I != E; ++I) delete *I; - for (std::vector::iterator + for (SmallVector::iterator I = ImmutablePasses.begin(), E = ImmutablePasses.end(); I != E; ++I) delete *I; @@ -626,7 +626,7 @@ bool PMDataManager::preserveHigherLevelAnalysis(Pass *P) { return true; const AnalysisUsage::VectorType &PreservedSet = AnUsage->getPreservedSet(); - for (std::vector::iterator I = HigherLevelAnalysis.begin(), + for (SmallVector::iterator I = HigherLevelAnalysis.begin(), E = HigherLevelAnalysis.end(); I != E; ++I) { Pass *P1 = *I; if (!dynamic_cast(P1) && @@ -940,7 +940,7 @@ void PMDataManager::dumpLastUses(Pass *P, unsigned Offset) const{ } void PMDataManager::dumpPassArguments() const { - for(std::vector::const_iterator I = PassVector.begin(), + for(SmallVector::const_iterator I = PassVector.begin(), E = PassVector.end(); I != E; ++I) { if (PMDataManager *PMD = dynamic_cast(*I)) PMD->dumpPassArguments(); @@ -1054,7 +1054,7 @@ void PMDataManager::addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) { // Destructor PMDataManager::~PMDataManager() { - for (std::vector::iterator I = PassVector.begin(), + for (SmallVector::iterator I = PassVector.begin(), E = PassVector.end(); I != E; ++I) delete *I;