llvm-project
e83183c2 - [ARM64EC] Fix vararg pointer in entry/exit thunks for 16-byte return value (#237817)

Commit
1 day ago
[ARM64EC] Fix vararg pointer in entry/exit thunks for 16-byte return value (#237817) When a function returns a 16-byte structure, in the x86-64 calling convention it is returned in memory with a hidden pointer, but in the ARM64EC calling convention it is returned in {X0,X1} so it does not have a hidden pointer. In this case the x86-64 function has one more argument, and up to at most three arguments can be passed in register -- X4 now points to the 4th argument, instead of the 5th as the old code mentioned. In the exit thunk, the reverse applies: The ARM64EC function does not pass a hidden pointer, but the x86-64 function expects one, causing the 4th argument (if any) to spill on the stack. This commit shifts arguments by one, pops one argument from the stack into an integer register, and adds X4 by 8 so it will point to the 5th argument as ARM64EC expects. Assisted-by: DeepSeek V4.1 Flash
Author
Parents
Loading