[llvm-commits] [llvm] r54820 - /llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp

Owen Anderson resistor at mac.com
Fri Aug 15 11:49:41 PDT 2008


Author: resistor
Date: Fri Aug 15 13:49:41 2008
New Revision: 54820

URL: http://llvm.org/viewvc/llvm-project?rev=54820&view=rev
Log:
Convert several std::vectors over to SmallVector, and use reserve() as appropriate for cases where std::vector is still used.

Modified:
    llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp

Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=54820&r1=54819&r2=54820&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Fri Aug 15 13:49:41 2008
@@ -58,7 +58,7 @@
     RALinScan() : MachineFunctionPass((intptr_t)&ID) {}
 
     typedef std::pair<LiveInterval*, LiveInterval::iterator> IntervalPtr;
-    typedef std::vector<IntervalPtr> IntervalPtrs;
+    typedef SmallVector<IntervalPtr, 32> 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 @@
     IntervalPtrs inactive_;
 
     typedef std::priority_queue<LiveInterval*,
-                                std::vector<LiveInterval*>,
+                                SmallVector<LiveInterval*, 64>,
                                 greater_ptr<LiveInterval> > IntervalHeap;
     IntervalHeap unhandled_;
     std::auto_ptr<PhysRegTracker> prt_;
@@ -322,6 +322,8 @@
          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);





More information about the llvm-commits mailing list