[PATCH] D144633: AArch64: support compact unwind with swifterror parameters.

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 03:08:17 PST 2023


t.p.northover created this revision.
Herald added subscribers: hiraditya, kristof.beyls, mcrosier.
Herald added a project: All.
t.p.northover requested review of this revision.
Herald added a project: LLVM.

Swifterror parameters are essentially "inout" ones that are passed in x21. Because they're also returned they can't be restored in the epilogue and so must be removed from the callee-saved register list. Unfortunately this leads to a frame layout that compact unwind can't describe (it assumes that if x20 is saved then x21 always will be too).

This patch sort of adds it back into the CSR list, but in epilogues we discard the value by loading xzr instead of x21, which makes the frames look normal again as far as an unwinder is concerned (swifterror isn't live along the unwind path anyway so restoring it there is harmless). The regmask is intentionally left as-is (i.e. with x21 removed).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144633

Files:
  llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
  llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/swifterror.ll
  llvm/test/CodeGen/AArch64/swifterror.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144633.499788.patch
Type: text/x-patch
Size: 73610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230223/8b8830f8/attachment-0001.bin>


More information about the llvm-commits mailing list