Fixed a bug where moves due to phis were being neglected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5019 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Misha Brukman
2002-12-13 12:33:31 +00:00
parent 84b7207df8
commit 0868667f78

View File

@@ -253,7 +253,7 @@ bool RegAllocSimple::runOnMachineFunction(MachineFunction &Fn) {
if (targetReg.isVirtualRegister()) { if (targetReg.isVirtualRegister()) {
physReg = getFreeReg(virtualReg); physReg = getFreeReg(virtualReg);
} else { } else {
physReg = targetReg.getAllocatedRegNum(); physReg = virtualReg;
} }
// Find the register class of the target register: should be the // Find the register class of the target register: should be the
@@ -293,9 +293,6 @@ bool RegAllocSimple::runOnMachineFunction(MachineFunction &Fn) {
++opI; ++opI;
// insert the move just before the return/branch
if (MII.isReturn(opMI->getOpcode()) || MII.isBranch(opMI->getOpcode()))
{
// Retrieve the constant value from this op, move it to target // Retrieve the constant value from this op, move it to target
// register of the phi // register of the phi
if (opVal.getType() == MachineOperand::MO_SignExtendedImmed || if (opVal.getType() == MachineOperand::MO_SignExtendedImmed ||
@@ -309,12 +306,11 @@ bool RegAllocSimple::runOnMachineFunction(MachineFunction &Fn) {
// Allocate a physical register and add a move in the BB // Allocate a physical register and add a move in the BB
unsigned opVirtualReg = (unsigned) opVal.getAllocatedRegNum(); unsigned opVirtualReg = (unsigned) opVal.getAllocatedRegNum();
unsigned opPhysReg; // = getFreeReg(opVirtualReg); unsigned opPhysReg; // = getFreeReg(opVirtualReg);
opI = moveUseToReg(opBlock, opI, opVirtualReg, opPhysReg); opI = moveUseToReg(opBlock, opI, opVirtualReg, physReg);
opI = RegInfo->moveReg2Reg(opBlock, opI, physReg, opPhysReg, //opI = RegInfo->moveReg2Reg(opBlock, opI, physReg, opPhysReg,
dataSize); // dataSize);
// Save that register value to the stack of the TARGET REG // Save that register value to the stack of the TARGET REG
saveVirtRegToStack(opBlock, opI, virtualReg, opPhysReg); saveVirtRegToStack(opBlock, opI, virtualReg, physReg);
}
} }
// make regs available to other instructions // make regs available to other instructions