[PATCH] D159536: [BOLT] Implement '--assume-abi' option for AArch64

Jiapeng Zhou via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 02:03:36 PDT 2023


Kepontry created this revision.
Kepontry added reviewers: yota9, rafauler, Amir, maksfb.
Kepontry added a project: bolt.
Herald added subscribers: treapster, ayermolo, kristof.beyls.
Herald added a project: All.
Kepontry requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

[BOLT] Implement '--assume-abi' option for AArch64

This patch implements the `getCalleeSavedRegs` function for AArch64,
addressing the issue where the "not implemented" error occurs when
both the `--assume-abi` option and options related to the
RegAnalysis Pass (e.g., `--indirect-call-promotion=all`) are enabled.

The `beConservative` function is utilized to determine the set of
used registers in cases where we have no prior information about
the function. When the `--assume-abi` option is enabled,
callee-saved registers should not be included in this set.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159536

Files:
  bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp


Index: bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
===================================================================
--- bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
+++ bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
@@ -443,6 +443,21 @@
     return true;
   }
 
+  void getCalleeSavedRegs(BitVector &Regs) const override {
+    Regs |= getAliases(AArch64::X19);
+    Regs |= getAliases(AArch64::X20);
+    Regs |= getAliases(AArch64::X21);
+    Regs |= getAliases(AArch64::X22);
+    Regs |= getAliases(AArch64::X23);
+    Regs |= getAliases(AArch64::X24);
+    Regs |= getAliases(AArch64::X25);
+    Regs |= getAliases(AArch64::X26);
+    Regs |= getAliases(AArch64::X27);
+    Regs |= getAliases(AArch64::X28);
+    Regs |= getAliases(AArch64::LR);
+    Regs |= getAliases(AArch64::FP);
+  }
+
   const MCExpr *getTargetExprFor(MCInst &Inst, const MCExpr *Expr,
                                  MCContext &Ctx,
                                  uint64_t RelType) const override {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159536.557162.patch
Type: text/x-patch
Size: 997 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230921/15fff1c6/attachment.bin>


More information about the llvm-commits mailing list