[all-commits] [llvm/llvm-project] 082251: [AArch64] fix trampoline implementation: use X15 (...
Jameson Nash via All-commits
all-commits at lists.llvm.org
Wed Jun 11 18:49:22 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 082251bba4effea7f60191c6cbddacb3705c07db
https://github.com/llvm/llvm-project/commit/082251bba4effea7f60191c6cbddacb3705c07db
Author: Jameson Nash <vtjnash at gmail.com>
Date: 2025-06-11 (Wed, 11 Jun 2025)
Changed paths:
M compiler-rt/lib/builtins/README.txt
M compiler-rt/lib/builtins/trampoline_setup.c
M compiler-rt/test/builtins/Unit/trampoline_setup_test.c
M flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
M flang/test/Fir/boxproc.fir
M llvm/lib/Target/AArch64/AArch64CallingConvention.td
M llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
M llvm/lib/TargetParser/Triple.cpp
M llvm/test/CodeGen/AArch64/nest-register.ll
M llvm/test/CodeGen/AArch64/statepoint-call-lowering.ll
M llvm/test/CodeGen/AArch64/trampoline.ll
M llvm/test/CodeGen/AArch64/win64cc-x18.ll
M llvm/test/CodeGen/AArch64/zero-call-used-regs.ll
Log Message:
-----------
[AArch64] fix trampoline implementation: use X15 (#126743)
AAPCS64 reserves any of X9-X15 for a compiler to choose to use for this
purpose, and says not to use X16 or X18 like GCC (and the previous
implementation) chose to use. The X18 register may need to get used by
the kernel in some circumstances, as specified by the platform ABI, so
it is generally an unwise choice. Simply choosing a different register
fixes the problem of this being broken on any platform that actually
follows the platform ABI (which is all of them except EABI, if I am
reading this linux kernel bug correctly
https://lkml2.uits.iu.edu/hypermail/linux/kernel/2001.2/01502.html). As
a side benefit, also generate slightly better code and avoids needing
the compiler-rt to be present. I did that by following the XCore
implementation instead of PPC (although in hindsight, following the
RISCV might have been slightly more readable). That X18 is wrong to use
for this purpose has been known for many years (e.g.
https://www.mail-archive.com/gcc@gcc.gnu.org/msg76934.html) and also
known that fixing this to use one of the correct registers is not an ABI
break, since this only appears inside of a translation unit. Some of the
other temporary registers (e.g. X9) are already reserved inside llvm for
internal use as a generic temporary register in the prologue before
saving registers, while X15 was already used in rare cases as a scratch
register in the prologue as well, so I felt that seemed the most logical
choice to choose here.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list