diff options
author | Dylan McKay <me@dylanmckay.io> | 2017-05-02 01:57:48 +0000 |
---|---|---|
committer | Dylan McKay <me@dylanmckay.io> | 2017-05-02 01:57:48 +0000 |
commit | 28355efdada8c8a4f9829d388d413c4745168874 (patch) | |
tree | d266ff6cdc92788aec3b34644a7047973dd77efe /llvm/lib | |
parent | b89c27f5150e104b8aed1b866456e2e4dc2296a3 (diff) | |
download | bcm5719-llvm-28355efdada8c8a4f9829d388d413c4745168874.tar.gz bcm5719-llvm-28355efdada8c8a4f9829d388d413c4745168874.zip |
[AVR] Save/restore the frame pointer for all functions
A recent commit I made made it so that we only did this for signal or
interrupt handlers. This broke normal functions.
llvm-svn: 301893
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/AVR/AVRFrameLowering.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/llvm/lib/Target/AVR/AVRFrameLowering.cpp b/llvm/lib/Target/AVR/AVRFrameLowering.cpp index 3c37a1a9989..25232d2e47e 100644 --- a/llvm/lib/Target/AVR/AVRFrameLowering.cpp +++ b/llvm/lib/Target/AVR/AVRFrameLowering.cpp @@ -66,18 +66,17 @@ void AVRFrameLowering::emitPrologue(MachineFunction &MF, .setMIFlag(MachineInstr::FrameSetup); } + // Save the frame pointer if we have one. + if (HasFP) { + BuildMI(MBB, MBBI, DL, TII.get(AVR::PUSHWRr)) + .addReg(AVR::R29R28, RegState::Kill) + .setMIFlag(MachineInstr::FrameSetup); + } + // Emit special prologue code to save R1, R0 and SREG in interrupt/signal // handlers before saving any other registers. if (CallConv == CallingConv::AVR_INTR || CallConv == CallingConv::AVR_SIGNAL) { - - // Save the frame pointer if we have one. - if (HasFP) { - BuildMI(MBB, MBBI, DL, TII.get(AVR::PUSHWRr)) - .addReg(AVR::R29R28, RegState::Kill) - .setMIFlag(MachineInstr::FrameSetup); - } - BuildMI(MBB, MBBI, DL, TII.get(AVR::PUSHWRr)) .addReg(AVR::R1R0, RegState::Kill) .setMIFlag(MachineInstr::FrameSetup); @@ -173,11 +172,11 @@ void AVRFrameLowering::emitEpilogue(MachineFunction &MF, .addImm(0x3f) .addReg(AVR::R0, RegState::Kill); BuildMI(MBB, MBBI, DL, TII.get(AVR::POPWRd), AVR::R1R0); - - if (hasFP(MF)) - BuildMI(MBB, MBBI, DL, TII.get(AVR::POPWRd), AVR::R29R28); } + if (hasFP(MF)) + BuildMI(MBB, MBBI, DL, TII.get(AVR::POPWRd), AVR::R29R28); + // Early exit if there is no need to restore the frame pointer. if (!FrameSize) { return; |