From 2c8cdc6c1ad78179fecfe67e7e0e250a4053c714 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 9 Aug 2006 13:15:47 +0000 Subject: [PATCH] fix the loading of the link register in emitepilogue git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29580 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMRegisterInfo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Target/ARM/ARMRegisterInfo.cpp b/lib/Target/ARM/ARMRegisterInfo.cpp index 67d0b7c801a..9c607691eaa 100644 --- a/lib/Target/ARM/ARMRegisterInfo.cpp +++ b/lib/Target/ARM/ARMRegisterInfo.cpp @@ -129,6 +129,8 @@ void ARMRegisterInfo::emitPrologue(MachineFunction &MF) const { // entry to the current function. This eliminates the need for add/sub // brackets around call sites. NumBytes += MFI->getMaxCallFrameSize(); + } else { + NumBytes += 4; } MFI->setStackSize(NumBytes); @@ -149,7 +151,7 @@ void ARMRegisterInfo::emitEpilogue(MachineFunction &MF, int NumBytes = (int) MFI->getStackSize(); //ldr lr, [sp] - BuildMI(MBB, MBBI, ARM::ldr, 2, ARM::R14).addImm(0).addReg(ARM::R13); + BuildMI(MBB, MBBI, ARM::ldr, 2, ARM::R14).addImm(NumBytes - 4).addReg(ARM::R13); //add sp, sp, #NumBytes BuildMI(MBB, MBBI, ARM::addri, 2, ARM::R13).addReg(ARM::R13).addImm(NumBytes); }