Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions llvm/lib/Target/Xtensa/XtensaFrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,13 @@ void XtensaFrameLowering::emitEpilogue(MachineFunction &MF,
for (unsigned i = 0; i < MFI.getCalleeSavedInfo().size(); ++i)
--I;
if (STI.isWinABI()) {
// Insert instruction "movsp $sp, $fp" at this location.
BuildMI(MBB, I, dl, TII.get(Xtensa::MOVSP), SP).addReg(FP);
// In most architectures, we need to explicitly restore the stack pointer
// before returning.
//
// For Xtensa Windowed Register option, it is not needed to explicitly
// restore the stack pointer. Reason being is that on function return,
// the window of the caller (including the old stack pointer) gets
// restored anyways.
} else {
BuildMI(MBB, I, dl, TII.get(Xtensa::OR), SP).addReg(FP).addReg(FP);
}
Expand Down