[llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLocal.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Feb 16 22:09:02 PST 2004


Changes in directory llvm/lib/CodeGen:

RegAllocLocal.cpp updated: 1.47 -> 1.48

---
Log message:

Once we have a way to fold spill code reloads into instructions, we have a way to use it.  :)


---
Diffs of the changes:  (+17 -2)

Index: llvm/lib/CodeGen/RegAllocLocal.cpp
diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.47 llvm/lib/CodeGen/RegAllocLocal.cpp:1.48
--- llvm/lib/CodeGen/RegAllocLocal.cpp:1.47	Mon Feb 16 21:57:19 2004
+++ llvm/lib/CodeGen/RegAllocLocal.cpp	Mon Feb 16 22:08:37 2004
@@ -487,9 +487,24 @@
     return MI;
   }
 
-  unsigned PhysReg = getReg(MBB, MI, VirtReg);
-
+  // Otherwise, we need to fold it into the current instruction, or reload it.
+  // If we have registers available to hold the value, use them.
   const TargetRegisterClass *RC = MF->getSSARegMap()->getRegClass(VirtReg);
+  unsigned PhysReg = getFreeReg(RC);
+
+  if (PhysReg == 0) {  // No registers available...
+    /// If we can fold this spill into this instruction, do so now.
+    if (0) {
+      // TODO
+      return MI;
+    }
+
+    // It looks like we can't fold this virtual register load into this
+    // instruction.  Force some poor hapless value out of the register file to
+    // make room for the new register, and reload it.
+    PhysReg = getReg(MBB, MI, VirtReg);
+  }
+
   int FrameIndex = getStackSpaceFor(VirtReg, RC);
 
   markVirtRegModified(VirtReg, false);   // Note that this reg was just reloaded





More information about the llvm-commits mailing list