[llvm-dev] Automatically backing up and restoring x18 around function calls on AArch64?
Martin Storsjö via llvm-dev
llvm-dev at lists.llvm.org
Tue Apr 30 13:49:41 PDT 2019
On Tue, 30 Apr 2019, James Y Knight wrote:
> Anyhow, this "workaround" seems like the correct solution, IMO. You have two
> slightly-incompatible ABIs, and using an adapter between the two seems
> entirely reasonable. As long as this adapter code is either written in asm,
> or compiled with -ffixed-x18, you can be sure that the x18 won't be
> overwritten by the compiler inside the adapter function.
Actually - theoretically - isn't the compiler free to insert calls to e.g.
memset/memcpy even the original code didn't contain it? And if those
functions come from outside of Wine, they could clobber it. So in that
case, the only fully safe way is doing the register setup and handover to
other ABI code in the same assembler piece. In practice though it's
probably not an issue.
More information about the llvm-dev