-
- // Add prologue to the function...
- RegInfo->emitPrologue(*MF, NumBytesAllocated);
-}
-
-
-/// EmitEpilogue - Use the register info object to add a epilogue to the
-/// function and restore any callee saved registers we are responsible for.
-///
-void RegAllocSimple::EmitEpilogue(MachineBasicBlock &MBB) {
- // Insert instructions before the return.
- MachineBasicBlock::iterator I = MBB.end()-1;
-
- const unsigned *CSRegs = RegInfo->getCalleeSaveRegs();
- for (unsigned i = 0; CSRegs[i]; ++i) {
- const TargetRegisterClass *RegClass = RegInfo->getRegClass(CSRegs[i]);
- unsigned Offset = getStackSpaceFor(CSRegs[i], RegClass);
-
- RegInfo->loadRegOffset2Reg(MBB, I, CSRegs[i],RegInfo->getFramePointer(),
- -Offset, RegClass);
- --I; // Insert in reverse order
- ++NumReloaded;
- }
-
- RegInfo->emitEpilogue(MBB, NumBytesAllocated);