[llvm] [AArch64] Skip over shadow space for ARM64EC entry thunk variadic calls (PR #80994)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 12 09:55:18 PST 2024
https://github.com/efriedma-quic commented:
In general, I attempted to keep the meaning of IR inside the thunks as close as possible to "normal" IR: following the same semantics, just with a slightly exotic calling convention. So someone who doesn't understand the rules here can just ignore the calling convention stuff, and understand what the IR is doing.
Here, you're violating that rule: you're making a vararg function argument passing work the wrong way. Outside of musttail calls, vararg lists don't normally get forwarded from the caller to the callee. The vararg list of a call consists of arguments explicitly passed beyond the end of the fixed argument list.
I see two ways to solve this:
- We try to add some way to model "vararg list forwarding" to LLVM IR. This doesn't currently exist, so a bit complicated to add.
- We don't model the caller or the callee as "varargs"; instead, we pass x4 and x5 explicitly. Basically, add "inreg" markings (or something like that) to the arguments representing x4 and x5, then mess with CC_AArch64_Arm64EC_Thunk using CCIfInReg to pass those values in registers instead of memory.
https://github.com/llvm/llvm-project/pull/80994
More information about the llvm-commits
mailing list