- atEndOfBlock = true;
- MachineBasicBlock::iterator MI = MBB->getFirstTerminator();
- if (MI != MBB->end() && MI->getDesc().isReturn()) {
- // This is a return block, kill all virtual registers.
- DEBUG(dbgs() << "Killing live registers at end of return block.\n");
- for (LiveRegMap::iterator i = LiveVirtRegs.begin(), e = LiveVirtRegs.end();
- i != e; ++i)
- killVirtReg(i);
- } else {
- // This is a normal block, spill any dirty virtregs.
- DEBUG(dbgs() << "Spilling live registers at end of block.\n");
- for (LiveRegMap::iterator i = LiveVirtRegs.begin(), e = LiveVirtRegs.end();
- i != e; ++i)
- spillVirtReg(MI, i, true);
- }
- LiveVirtRegs.clear();
+ DEBUG(dbgs() << "Spilling live registers at end of block.\n");
+ spillAll(MBB->getFirstTerminator());