[llvm] [SystemZ] Support builtin_{frame,return}_address() with non-zero argument (PR #69405)

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 18 05:23:24 PDT 2023


================
@@ -3641,9 +3649,18 @@ SDValue SystemZTargetLowering::lowerRETURNADDR(SDValue Op,
   unsigned Depth = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();
   EVT PtrVT = getPointerTy(DAG.getDataLayout());
 
-  // FIXME The frontend should detect this case.
   if (Depth > 0) {
-    report_fatal_error("Unsupported stack frame traversal count");
+    // FIXME The frontend should detect this case.
+    if (!MF.getFunction().hasFnAttribute("backchain"))
+      report_fatal_error("Unsupported stack frame traversal count");
+
+    SDValue FrameAddr = lowerFRAMEADDR(Op, DAG);
+    int Offset = (MF.getFunction().hasFnAttribute("packed-stack") ? -2 : 14) *
----------------
uweigand wrote:

This should better use `TFL->usePackedStack()` to cover all cases.

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


More information about the llvm-commits mailing list