[llvm-dev] Automatically backing up and restoring x18 around function calls on AArch64?
Martin Storsjö via llvm-dev
llvm-dev at lists.llvm.org
Mon Apr 29 23:04:27 PDT 2019
On Mon, 29 Apr 2019, Reid Kleckner wrote:
> I am reminded of the ms_abi / sysv_abi attribute annotations. Would it be
> possible to leverage those to insert the appropriate spills and fills? So,
> anything annotated ms_abi is presumably an entry point into the SysV side of
> things, so any explicitly ms_abi annotated function would add X18 as a CSR.
It's not a complete solution at least; that would take care of backing up
and restoring, but it wouldn't enforce consistency while in SysV land. If
the Wine function first does a glibc call, then goes on to call a user
provided callback function, X18 is clobbered at this point. The suggested
idea was to try to maintain X18 intact as far as possible while within
Wine itself as well.
That said, having the compiler automatically back up and restore X18 in
the functions marked ms_abi would probably be nicer than my current hack
to enforce this in Wine by the use of relay hooks, with the same results.
I could actually try to give that a shot.
More information about the llvm-dev