[llvm] Xtensa] Implement windowed call ABI. (PR #130001)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 6 00:33:40 PST 2025
================
@@ -179,10 +264,22 @@ void XtensaFrameLowering::emitEpilogue(MachineFunction &MF,
"Unexpected callee-saved register restore instruction");
#endif
}
-
- BuildMI(MBB, I, DL, TII.get(Xtensa::OR), SP).addReg(FP).addReg(FP);
+ if (STI.isWinABI()) {
+ // 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);
+ }
----------------
arsenm wrote:
Invert condition and avoid comment only block
https://github.com/llvm/llvm-project/pull/130001
More information about the llvm-commits
mailing list