Convert several std::vectors over to SmallVector, and use reserve() as appropriate for cases where std::vector is still used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54820 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2008-08-15 18:49:41 +00:00
parent 0c5a560b03
commit cd1dcbd4fb

View File

@ -58,7 +58,7 @@ namespace {
RALinScan() : MachineFunctionPass((intptr_t)&ID) {} RALinScan() : MachineFunctionPass((intptr_t)&ID) {}
typedef std::pair<LiveInterval*, LiveInterval::iterator> IntervalPtr; typedef std::pair<LiveInterval*, LiveInterval::iterator> IntervalPtr;
typedef std::vector<IntervalPtr> IntervalPtrs; typedef SmallVector<IntervalPtr, 32> IntervalPtrs;
private: private:
/// RelatedRegClasses - This structure is built the first time a function is /// RelatedRegClasses - This structure is built the first time a function is
/// compiled, and keeps track of which register classes have registers that /// compiled, and keeps track of which register classes have registers that
@ -94,7 +94,7 @@ namespace {
IntervalPtrs inactive_; IntervalPtrs inactive_;
typedef std::priority_queue<LiveInterval*, typedef std::priority_queue<LiveInterval*,
std::vector<LiveInterval*>, SmallVector<LiveInterval*, 64>,
greater_ptr<LiveInterval> > IntervalHeap; greater_ptr<LiveInterval> > IntervalHeap;
IntervalHeap unhandled_; IntervalHeap unhandled_;
std::auto_ptr<PhysRegTracker> prt_; std::auto_ptr<PhysRegTracker> prt_;
@ -322,6 +322,8 @@ void RALinScan::initIntervalSets()
active_.empty() && inactive_.empty() && active_.empty() && inactive_.empty() &&
"interval sets should be empty on initialization"); "interval sets should be empty on initialization");
handled_.reserve(li_->getNumIntervals());
for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i) { for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i) {
if (TargetRegisterInfo::isPhysicalRegister(i->second->reg)) { if (TargetRegisterInfo::isPhysicalRegister(i->second->reg)) {
reginfo_->setPhysRegUsed(i->second->reg); reginfo_->setPhysRegUsed(i->second->reg);