[llvm-dev] Automatically backing up and restoring x18 around function calls on AArch64?
Martin Storsjö via llvm-dev
llvm-dev at lists.llvm.org
Fri Apr 26 06:09:39 PDT 2019
On Fri, 26 Apr 2019, Tim Northover wrote:
> On Fri, 26 Apr 2019 at 13:58, Kristof Beyls via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>> Doesn't implementing "always back up and restore x18 on any call to any other function" boil down to having a PCS (procedure call standard) variation where x18 is caller saved?
> Not quite, that only requires the function to preserve it on return;
> Martin wants it preserved on any call into a windows function too. And
> possibly any call at all if he can't identify windows functions.
Yes, pretty much. There's a calling convention attribute that helps me
identify such functions, but it doesn't help much in practice; the correct
value of x18 needs to be brought along up until that point anyway.
>> Couldn't some functions on the windows/WINE side change the value of X18? In that case you'd want to see the new value of X18 after a function returns, not restore the value from before the function call?
> I believe it's some equivalent of TPIDR_EL0 (i.e. a thread control
> block). I'd be slightly concerned but hopeful it could be expected to
> remain constant.
Yes, it's exactly that - it's constant within one thread.
More information about the llvm-dev