[llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLocal.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Aug 4 19:50:02 PDT 2003
Changes in directory llvm/lib/CodeGen:
RegAllocLocal.cpp updated: 1.21 -> 1.22
---
Log message:
Revert previous change, and be really anal about what physical registers can do.
---
Diffs of the changes:
Index: llvm/lib/CodeGen/RegAllocLocal.cpp
diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.21 llvm/lib/CodeGen/RegAllocLocal.cpp:1.22
--- llvm/lib/CodeGen/RegAllocLocal.cpp:1.21 Mon Aug 4 18:42:37 2003
+++ llvm/lib/CodeGen/RegAllocLocal.cpp Mon Aug 4 19:49:09 2003
@@ -232,28 +232,25 @@
///
void RA::spillVirtReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &I,
unsigned VirtReg, unsigned PhysReg) {
-
- DEBUG(std::cerr << " Spilling register " << RegInfo->getName(PhysReg));
- if (VirtReg == 0) {
- DEBUG(std::cerr << " which corresponds to no vreg, "
- << "must be spurious physreg: ignoring (WARNING)\n");
- } else {
- DEBUG(std::cerr << " containing %reg" << VirtReg;
- if (!isVirtRegModified(VirtReg))
- std::cerr << " which has not been modified, so no store necessary!");
-
- // Otherwise, there is a virtual register corresponding to this physical
- // 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
- }
- Virt2PhysRegMap.erase(VirtReg); // VirtReg no longer available
+ assert((VirtReg || DisableKill) && "Spilling a physical register is illegal!"
+ " Must not have appropriate kill for the register or use exists beyond"
+ " the intended one.");
+ DEBUG(std::cerr << " Spilling register " << RegInfo->getName(PhysReg);
+ std::cerr << " containing %reg" << VirtReg;
+ if (!isVirtRegModified(VirtReg))
+ std::cerr << " which has not been modified, so no store necessary!");
+
+ // Otherwise, there is a virtual register corresponding to this physical
+ // 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
}
+ Virt2PhysRegMap.erase(VirtReg); // VirtReg no longer available
DEBUG(std::cerr << "\n");
removePhysReg(PhysReg);
@@ -510,12 +507,7 @@
if (PhysReg) {
DEBUG(std::cerr << " Last use of " << RegInfo->getName(PhysReg)
<< "[%reg" << VirtReg <<"], removing it from live set\n");
- // If the physical register was used, but there was no definition of
- // the physical register (we are reading garbage), Live Variables will
- // tell us that this is the last use of the register even though we
- // don't know of anything in the register. No need to remove it.
- if (VirtReg != PhysReg || PhysRegsUsed.count(PhysReg))
- removePhysReg(PhysReg);
+ removePhysReg(PhysReg);
}
}
}
More information about the llvm-commits
mailing list