aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2004-07-16 20:55:20 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2004-07-16 20:55:20 +0000
commitaf7f28cdacc68cf155869752a690e03e8675fe7e (patch)
tree264541a8eac891967f3f559f09b91f483ae01a63
parentbe15f67af735a81f028679b495243f2dceb3d59d (diff)
* Store all non-volatile int registers R13-31 on the stack, restore on exit
* Fix comment formatting git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14900 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/PowerPC/PowerPCRegisterInfo.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/Target/PowerPC/PowerPCRegisterInfo.cpp b/lib/Target/PowerPC/PowerPCRegisterInfo.cpp
index 711de459c4..8e97e5ecea 100644
--- a/lib/Target/PowerPC/PowerPCRegisterInfo.cpp
+++ b/lib/Target/PowerPC/PowerPCRegisterInfo.cpp
@@ -112,9 +112,9 @@ void PowerPCRegisterInfo::
eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
MachineBasicBlock::iterator I) const {
if (hasFP(MF)) {
- // If we have a frame pointer, turn the adjcallstackdown instruction into a
- // 'sub r1, r1, <amt>' and the adjcallstackup instruction into
- // 'add r1, r1, <amt>'
+ // If we have a frame pointer, convert as follows:
+ // adjcallstackdown instruction => 'sub r1, r1, <amt>' and
+ // adjcallstackup instruction => 'add r1, r1, <amt>'
MachineInstr *Old = I;
int Amount = Old->getOperand(0).getImmedValue();
if (Amount != 0) {
@@ -196,9 +196,9 @@ void PowerPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
//
NumBytes += MFI->getMaxCallFrameSize() +
24 /* Predefined PowerPC link area */ +
- // FIXME: must calculate #int regs actually spilled
- 12*4 /* Spilled int regs */ +
- // FIXME: must calculate #fp regs actually spilled
+ // FIXME: must calculate #non-volatile int regs actually spilled
+ 19*4 /* Spilled int regs */ +
+ // FIXME: must calculate #non-volatile fp regs actually spilled
0*8 /* Spilled fp regs */;
// Round the size to a multiple of the alignment (don't forget the 4 byte
@@ -209,7 +209,8 @@ void PowerPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
// Store the incoming LR so it is preserved across calls
MI = BuildMI(PPC32::MFLR, 0, PPC32::R0);
MBB.insert(MBBI, MI);
- MI = BuildMI(PPC32::STMW, 3).addReg(PPC32::R30).addSImm(-8)
+ // FIXME: store only CLOBBERED registers in R[13-31]
+ MI = BuildMI(PPC32::STMW, 3).addReg(PPC32::R13).addSImm(-76)
.addReg(PPC32::R1);
MBB.insert(MBBI, MI);
MI = BuildMI(PPC32::STW, 3).addReg(PPC32::R0).addSImm(8).addReg(PPC32::R1);
@@ -249,9 +250,10 @@ void PowerPCRegisterInfo::emitEpilogue(MachineFunction &MF,
// Read old LR from stack into R0
MI = BuildMI(PPC32::LWZ, 2, PPC32::R0).addSImm(8).addReg(PPC32::R1);
MBB.insert(MBBI, MI);
- MI = BuildMI(PPC32::MTLR, 1).addReg(PPC32::R0);
+ // FIXME: restore only SAVED registers in R[13-31]
+ MI = BuildMI(PPC32::LMW, 2, PPC32::R13).addSImm(-76).addReg(PPC32::R1);
MBB.insert(MBBI, MI);
- MI = BuildMI(PPC32::LMW, 2, PPC32::R30).addSImm(-8).addReg(PPC32::R1);
+ MI = BuildMI(PPC32::MTLR, 1).addReg(PPC32::R0);
MBB.insert(MBBI, MI);
}
}