[PATCH] D150938: [AArch64] Introduce option to force placement of the frame record on top of the stack frame

Loïc Ottet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 19 00:31:57 PDT 2023


loicottet created this revision.
loicottet added a reviewer: t.p.northover.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
loicottet requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This option is needed for the LLVM backend for GraalVM Native Image, which needs the frame pointer to be located at a fixed distance from the top of the stack frame in order to be able to crawl the call stack. When it is set, it uses the Darwin behaviour on every target, which already enforces this frame record placement.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150938

Files:
  llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp


Index: llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
+++ llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
@@ -39,6 +39,11 @@
 #define GET_REGINFO_TARGET_DESC
 #include "AArch64GenRegisterInfo.inc"
 
+static cl::opt<bool>
+    FrameRecordOnTop("aarch64-frame-record-on-top",
+                     cl::desc("place the frame record on top of the frame"),
+                     cl::init(false), cl::Hidden);
+
 AArch64RegisterInfo::AArch64RegisterInfo(const Triple &TT)
     : AArch64GenRegisterInfo(AArch64::LR), TT(TT) {
   AArch64_MC::initLLVMToCVRegMapping(this);
@@ -120,6 +125,8 @@
     return CSR_AArch64_AAPCS_X18_SaveList;
   if (MF->getInfo<AArch64FunctionInfo>()->isSVECC())
     return CSR_AArch64_SVE_AAPCS_SaveList;
+  if (FrameRecordOnTop)
+    return CSR_Darwin_AArch64_AAPCS_SaveList;
   return CSR_AArch64_AAPCS_SaveList;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150938.523674.patch
Type: text/x-patch
Size: 962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230519/077c25f1/attachment.bin>


More information about the llvm-commits mailing list