[PATCH] D33562: MachineLICM: Add new condition for hoisting of caller preserved registers
Kyle Butt via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 30 10:18:53 PDT 2017
iteratee added a comment.
In https://reviews.llvm.org/D33562#766989, @nemanjai wrote:
> > You talk about a call instruction? Is X2 saved and restored in the called function? Then it's just a CSR and should not be mentioned in the clobber list so no problem with my proposal above.
>
> But it is the caller that saves and restores it, not the callee. The sequence is essentially this (all in the caller of course):
>
> - Save X2 to it's stack slot
> - Update X2 prior to the call
> - Call the function through a pointer
> - Restore X2 immediately after the call
But all of that occurs via the linker.
X2 is saved by a trampoline if necessary, and restored in the nop slot if necessary.
As far as the surrounding code is concerned, the trampoline is the callee, (the nop slot may be considered part of the trampoline.)
Treating X2 as callee saved makes perfect sense as far as llvm is concerned.
https://reviews.llvm.org/D33562
More information about the llvm-commits
mailing list