[compiler-rt] [flang] [llvm] [AArch64] fix trampoline implementation: use X15 (PR #126743)

Jameson Nash via llvm-commits llvm-commits at lists.llvm.org
Tue May 13 14:44:36 PDT 2025


================
@@ -1,35 +1,26 @@
-; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+;; Testing that nest uses x15 on all calling conventions (except Arm64EC)
----------------
vtjnash wrote:

Okay, I looked more in detail for this. The `init.trampoline` cannot actually know which architecture is going to be correct, since that is up to the llvm caller's runtime to correctly use VirtualAlloc2 with MEM_EXTENDED_PARAMETER_EC_CODE instead of VirtualAlloc (https://learn.microsoft.com/en-us/windows/arm/arm64ec-abi#dynamically-generating-jit-compiling-arm64ec-code). But we might have a pretty hard time fitting the necessary exit thunk into 36 bytes if we put x86-64 code there, as well as being a performance penalty. So this current version seems still more correct and more preferable to me.

And if someone decides to call a nest function directly, without a trampoline, directly from x86-64 assembly or directly using x86-64 llvm IR, that should also work with this, since both platforms declare that nest is passed as R10/X4

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


More information about the llvm-commits mailing list