[llvm] [SystemZ][z/OS] Implement llvm.returnaddress for XPLINK (PR #89440)

Kai Nacke via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 22 06:33:44 PDT 2024


================
@@ -97,6 +106,11 @@ class SystemZELFFrameLowering : public SystemZFrameLowering {
     return usePackedStack(MF) ? SystemZMC::ELFCallFrameSize - 8 : 0;
   }
 
+  // Return the offset of the return address.
+  virtual int getReturnAddressOffset(MachineFunction &MF) const override {
+    return (usePackedStack(MF) ? -2 : 14) * getPointerSize();
----------------
redstar wrote:

That was my first approach. The expression is a bit clumsy, and it is needed twice (here, and for XPLINK), and therefore I refactored it into a new function. Then I realized that it should be used in other place, too, for example:

- https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp#L181
- https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp#L870
- https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp#L905
- https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp#L1031
- https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp#L1301

But this should be a follow-up PR.

https://github.com/llvm/llvm-project/pull/89440


More information about the llvm-commits mailing list