return; // Early exit if no caller saved registers are modified!
unsigned NumFixedSpillSlots;
- std::pair<unsigned,int> *FixedSpillSlots =
+ const std::pair<unsigned,int> *FixedSpillSlots =
TFI->getCalleeSaveSpillSlots(NumFixedSpillSlots);
// Now that we know which registers need to be saved and restored, allocate
// stack slots for them.
for (unsigned i = 0, e = RegsToSave.size(); i != e; ++i) {
unsigned Reg = RegsToSave[i];
- int FrameIdx;
- const TargetRegisterClass *RC = RegInfo->getRegClass(Reg);
// Check to see if this physreg must be spilled to a particular stack slot
// on this target.
- std::pair<unsigned,int> *FixedSlot = FixedSpillSlots;
+ const std::pair<unsigned,int> *FixedSlot = FixedSpillSlots;
while (FixedSlot != FixedSpillSlots+NumFixedSpillSlots &&
FixedSlot->first != Reg)
++FixedSlot;
+ int FrameIdx;
if (FixedSlot == FixedSpillSlots+NumFixedSpillSlots) {
// Nope, just spill it anywhere convenient.
- FrameIdx = FFI->CreateStackObject(RC);
+ FrameIdx = FFI->CreateStackObject(RegInfo->getSpillSize(Reg)/8,
+ RegInfo->getSpillAlignment(Reg)/8);
} else {
// Spill it to the stack where we must.
- FrameIdx = FFI->CreateFixedObject(RC->getSize(), FixedSlot->second);
+ FrameIdx = FFI->CreateFixedObject(RegInfo->getSpillSize(Reg)/8,
+ FixedSlot->second);
}
StackSlots.push_back(FrameIdx);
}
MachineBasicBlock *MBB = Fn.begin();
MachineBasicBlock::iterator I = MBB->begin();
for (unsigned i = 0, e = RegsToSave.size(); i != e; ++i) {
- const TargetRegisterClass *RC = RegInfo->getRegClass(RegsToSave[i]);
-
- // Insert the spill to the stack frame...
- RegInfo->storeRegToStackSlot(*MBB, I, RegsToSave[i], StackSlots[i], RC);
+ // Insert the spill to the stack frame.
+ RegInfo->storeRegToStackSlot(*MBB, I, RegsToSave[i], StackSlots[i]);
}
// Add code to restore the callee-save registers in each exiting block.
I = MBB->end(); --I;
for (unsigned i = 0, e = RegsToSave.size(); i != e; ++i) {
- const TargetRegisterClass *RC = RegInfo->getRegClass(RegsToSave[i]);
- RegInfo->loadRegFromStackSlot(*MBB, I, RegsToSave[i],StackSlots[i], RC);
+ RegInfo->loadRegFromStackSlot(*MBB, I, RegsToSave[i],StackSlots[i]);
--I; // Insert in reverse order
}
}
if (I->getOperand(i).isFrameIndex()) {
// If this instruction has a FrameIndex operand, we need to use that
// target machine register info object to eliminate it.
- MRI.eliminateFrameIndex(Fn, I);
+ MRI.eliminateFrameIndex(I);
break;
}
}