From ba926a3fd35afe26e02871df1a4a7af7def840ce Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Fri, 15 Aug 2008 18:49:41 +0000 Subject: [PATCH] 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 --- lib/CodeGen/RegAllocLinearScan.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp index 3ab4b02668..c6f714a9cb 100644 --- a/lib/CodeGen/RegAllocLinearScan.cpp +++ b/lib/CodeGen/RegAllocLinearScan.cpp @@ -58,7 +58,7 @@ namespace { RALinScan() : MachineFunctionPass((intptr_t)&ID) {} typedef std::pair IntervalPtr; - typedef std::vector IntervalPtrs; + typedef SmallVector IntervalPtrs; private: /// RelatedRegClasses - This structure is built the first time a function is /// compiled, and keeps track of which register classes have registers that @@ -94,7 +94,7 @@ namespace { IntervalPtrs inactive_; typedef std::priority_queue, + SmallVector, greater_ptr > IntervalHeap; IntervalHeap unhandled_; std::auto_ptr prt_; @@ -322,6 +322,8 @@ void RALinScan::initIntervalSets() active_.empty() && inactive_.empty() && "interval sets should be empty on initialization"); + handled_.reserve(li_->getNumIntervals()); + for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i) { if (TargetRegisterInfo::isPhysicalRegister(i->second->reg)) { reginfo_->setPhysRegUsed(i->second->reg); -- 2.11.4.GIT