[llvm-commits] [llvm] r112728 - /llvm/trunk/lib/CodeGen/RegAllocFast.cpp

Jim Grosbach grosbach at apple.com
Wed Sep 1 12:28:42 PDT 2010


Author: grosbach
Date: Wed Sep  1 14:28:41 2010
New Revision: 112728

URL: http://llvm.org/viewvc/llvm-project?rev=112728&view=rev
Log:
The register allocator shouldn't consider allocating reserved registers.


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

Modified: llvm/trunk/lib/CodeGen/RegAllocFast.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocFast.cpp?rev=112728&r1=112727&r2=112728&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocFast.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocFast.cpp Wed Sep  1 14:28:41 2010
@@ -113,6 +113,9 @@
     // Allocatable - vector of allocatable physical registers.
     BitVector Allocatable;
 
+    // Reserved - vector of reserved physical registers.
+    BitVector Reserved;
+
     // SkippedInstrs - Descriptors of instructions whose clobber list was
     // ignored because all registers were spilled. It is still necessary to
     // mark all the clobbered registers as used by the function.
@@ -709,7 +712,7 @@
   }
 
   // Restore UsedInInstr to a state usable for allocating normal virtual uses.
-  UsedInInstr.reset();
+  UsedInInstr = Reserved;
   for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
     MachineOperand &MO = MI->getOperand(i);
     if (!MO.isReg() || (MO.isDef() && !MO.isEarlyClobber())) continue;
@@ -835,7 +838,7 @@
     }
 
     // Track registers used by instruction.
-    UsedInInstr.reset();
+    UsedInInstr = Reserved;
 
     // First scan.
     // Mark physreg uses and early clobbers as used.
@@ -913,7 +916,7 @@
 
     // Track registers defined by instruction - early clobbers and tied uses at
     // this point.
-    UsedInInstr.reset();
+    UsedInInstr = Reserved;
     if (hasEarlyClobbers) {
       for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
         MachineOperand &MO = MI->getOperand(i);
@@ -1011,6 +1014,7 @@
 
   UsedInInstr.resize(TRI->getNumRegs());
   Allocatable = TRI->getAllocatableSet(*MF);
+  Reserved = TRI->getReservedRegs(*MF);
 
   // initialize the virtual->physical register map to have a 'null'
   // mapping for all virtual registers





More information about the llvm-commits mailing list