diff options
author | Misha Brukman <brukman+llvm@gmail.com> | 2004-06-29 23:38:26 +0000 |
---|---|---|
committer | Misha Brukman <brukman+llvm@gmail.com> | 2004-06-29 23:38:26 +0000 |
commit | cbcdb9c0a777f2f14784193e19454e5aacf28e2a (patch) | |
tree | 5ae03895336fb012ad4c0469e4f49178adae3bb5 | |
parent | 5fa2b028b85beebf8f5565315b2b66647d411968 (diff) |
Set up the prologue and epilogue to be more like the manual and GCC output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14502 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/PowerPC/PowerPCRegisterInfo.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/Target/PowerPC/PowerPCRegisterInfo.cpp b/lib/Target/PowerPC/PowerPCRegisterInfo.cpp index c7a1879e6d..f96aee32d2 100644 --- a/lib/Target/PowerPC/PowerPCRegisterInfo.cpp +++ b/lib/Target/PowerPC/PowerPCRegisterInfo.cpp @@ -202,7 +202,7 @@ 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::STW, 3).addReg(PPC32::R31).addSImm(-4) + MI = BuildMI(PPC32::STMW, 3).addReg(PPC32::R30).addSImm(-8) .addReg(PPC32::R1); MBB.insert(MBBI, MI); MI = BuildMI(PPC32::STW, 3).addReg(PPC32::R0).addSImm(8).addReg(PPC32::R1); @@ -214,7 +214,7 @@ void PowerPCRegisterInfo::emitPrologue(MachineFunction &MF) const { // adjust stack pointer: r1 -= numbytes if (NumBytes) { - MI = BuildMI(PPC32::STWU, 2, PPC32::R1).addImm(-NumBytes).addReg(PPC32::R1); + MI = BuildMI(PPC32::STWU, 2, PPC32::R1).addImm(-80).addReg(PPC32::R1); MBB.insert(MBBI, MI); } } @@ -230,21 +230,18 @@ void PowerPCRegisterInfo::emitEpilogue(MachineFunction &MF, // Get the number of bytes allocated from the FrameInfo... unsigned NumBytes = MFI->getStackSize(); - // Read old LR from stack into R0 - MI = BuildMI(PPC32::LWZ, 2, PPC32::R0).addSImm(8+NumBytes).addReg(PPC32::R1); + // Adjust stack pointer back + MI = BuildMI(PPC32::LWZ, 2, PPC32::R1).addImm(0).addReg(PPC32::R1); MBB.insert(MBBI, MI); - // Adjust stack pointer back: r1 += numbytes - if (NumBytes) { - MI = BuildMI(PPC32::ADDI, 2, PPC32::R1).addReg(PPC32::R1).addSImm(NumBytes); - MBB.insert(MBBI, MI); - } - // If we have calls, restore the LR value before we branch to it if (MFI->hasCalls()) { + // 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); MBB.insert(MBBI, MI); - MI = BuildMI(PPC32::LWZ, 2, PPC32::R31).addSImm(-4).addReg(PPC32::R1); + MI = BuildMI(PPC32::LMW, 2, PPC32::R30).addSImm(-8).addReg(PPC32::R1); MBB.insert(MBBI, MI); } } |