From 1f4a132599974d448cbaa4519006d38ce9b1bf16 Mon Sep 17 00:00:00 2001 From: Nate Begeman Date: Sun, 22 Aug 2004 08:09:17 +0000 Subject: [PATCH] Don't hard code the offset of the saved R31 in functions with frame pointers git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15990 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/PowerPC/PPCRegisterInfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Target/PowerPC/PPCRegisterInfo.cpp b/lib/Target/PowerPC/PPCRegisterInfo.cpp index c881c8281e9..b3a9da069ff 100644 --- a/lib/Target/PowerPC/PPCRegisterInfo.cpp +++ b/lib/Target/PowerPC/PPCRegisterInfo.cpp @@ -278,12 +278,13 @@ void PPC32RegisterInfo::emitEpilogue(MachineFunction &MF, // Get the number of bytes allocated from the FrameInfo... unsigned NumBytes = MFI->getStackSize(); + unsigned GPRSize = getSpillSize(PPC::R31); if (NumBytes != 0) { if (hasFP(MF)) { MI = BuildMI(PPC::OR, 2, PPC::R1).addReg(PPC::R31).addReg(PPC::R31); MBB.insert(MBBI, MI); - MI = BuildMI(PPC::LWZ, 2, PPC::R31).addSImm(4).addReg(PPC::R31); + MI = BuildMI(PPC::LWZ, 2, PPC::R31).addSImm(GPRSize).addReg(PPC::R31); MBB.insert(MBBI, MI); } MI = BuildMI(PPC::LWZ, 2, PPC::R1).addSImm(0).addReg(PPC::R1);