Make sure to notice that explicit physregs are used in the function

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21084 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-04-04 21:35:34 +00:00
parent c3e2db407e
commit 886dd9136f

View File

@ -157,31 +157,34 @@ bool SimpleSpiller::runOnMachineFunction(MachineFunction &MF,
MachineInstr &MI = *MII; MachineInstr &MI = *MII;
for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
MachineOperand &MO = MI.getOperand(i); MachineOperand &MO = MI.getOperand(i);
if (MO.isRegister() && MO.getReg() && if (MO.isRegister() && MO.getReg())
MRegisterInfo::isVirtualRegister(MO.getReg())) { if (MRegisterInfo::isVirtualRegister(MO.getReg())) {
unsigned VirtReg = MO.getReg(); unsigned VirtReg = MO.getReg();
unsigned PhysReg = VRM.getPhys(VirtReg); unsigned PhysReg = VRM.getPhys(VirtReg);
if (VRM.hasStackSlot(VirtReg)) { if (VRM.hasStackSlot(VirtReg)) {
int StackSlot = VRM.getStackSlot(VirtReg); int StackSlot = VRM.getStackSlot(VirtReg);
if (MO.isUse() && if (MO.isUse() &&
std::find(LoadedRegs.begin(), LoadedRegs.end(), VirtReg) std::find(LoadedRegs.begin(), LoadedRegs.end(), VirtReg)
== LoadedRegs.end()) { == LoadedRegs.end()) {
MRI.loadRegFromStackSlot(MBB, &MI, PhysReg, StackSlot); MRI.loadRegFromStackSlot(MBB, &MI, PhysReg, StackSlot);
LoadedRegs.push_back(VirtReg); LoadedRegs.push_back(VirtReg);
++NumLoads; ++NumLoads;
DEBUG(std::cerr << '\t' << *prior(MII)); DEBUG(std::cerr << '\t' << *prior(MII));
} }
if (MO.isDef()) { if (MO.isDef()) {
MRI.storeRegToStackSlot(MBB, next(MII), PhysReg, StackSlot); MRI.storeRegToStackSlot(MBB, next(MII), PhysReg, StackSlot);
++NumStores; ++NumStores;
}
} }
PhysRegsUsed[PhysReg] = true;
MI.SetMachineOperandReg(i, PhysReg);
} else {
PhysRegsUsed[MO.getReg()] = true;
} }
PhysRegsUsed[PhysReg] = true;
MI.SetMachineOperandReg(i, PhysReg);
}
} }
DEBUG(std::cerr << '\t' << MI); DEBUG(std::cerr << '\t' << MI);
LoadedRegs.clear(); LoadedRegs.clear();
} }
@ -312,7 +315,10 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, const VirtRegMap &VRM) {
for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
MachineOperand &MO = MI.getOperand(i); MachineOperand &MO = MI.getOperand(i);
if (MO.isRegister() && MO.getReg() && if (MO.isRegister() && MO.getReg() &&
MRegisterInfo::isVirtualRegister(MO.getReg())) { MRegisterInfo::isPhysicalRegister(MO.getReg()))
PhysRegsUsed[MO.getReg()] = true;
else if (MO.isRegister() && MO.getReg() &&
MRegisterInfo::isVirtualRegister(MO.getReg())) {
unsigned VirtReg = MO.getReg(); unsigned VirtReg = MO.getReg();
if (!VRM.hasStackSlot(VirtReg)) { if (!VRM.hasStackSlot(VirtReg)) {