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

Chris Lattner lattner at cs.uiuc.edu
Mon Aug 4 18:43:01 PDT 2003


Changes in directory llvm/lib/CodeGen:

RegAllocLocal.cpp updated: 1.20 -> 1.21

---
Log message:

Don't bother calculating info unless its needed.  May reduce number of stack slots created.


---
Diffs of the changes:

Index: llvm/lib/CodeGen/RegAllocLocal.cpp
diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.20 llvm/lib/CodeGen/RegAllocLocal.cpp:1.21
--- llvm/lib/CodeGen/RegAllocLocal.cpp:1.20	Mon Aug  4 18:36:39 2003
+++ llvm/lib/CodeGen/RegAllocLocal.cpp	Mon Aug  4 18:42:37 2003
@@ -238,10 +238,6 @@
     DEBUG(std::cerr << " which corresponds to no vreg, "
                     << "must be spurious physreg: ignoring (WARNING)\n");
   } else {
-    // FIXME: move this into the conditional??
-    const TargetRegisterClass *RC = MF->getSSARegMap()->getRegClass(VirtReg);
-    int FrameIndex = getStackSpaceFor(VirtReg, RC);
-
     DEBUG(std::cerr << " containing %reg" << VirtReg;
           if (!isVirtRegModified(VirtReg))
            std::cerr << " which has not been modified, so no store necessary!");
@@ -250,6 +246,8 @@
     // register.  We only need to spill it into its stack slot if it has been
     // modified.
     if (isVirtRegModified(VirtReg)) {
+      const TargetRegisterClass *RC = MF->getSSARegMap()->getRegClass(VirtReg);
+      int FrameIndex = getStackSpaceFor(VirtReg, RC);
       DEBUG(std::cerr << " to stack slot #" << FrameIndex);
       RegInfo->storeRegToStackSlot(MBB, I, PhysReg, FrameIndex, RC);
       ++NumSpilled;   // Update statistics





More information about the llvm-commits mailing list