4ast wrote:

both archs have:
  callq   foo
  addq    $32, %rsp
after the call,
and arm64 does 'sub  sp, sp, #48' before the call.
while x86 does implicit rsp adjustment via push before the call.
Should we do r12 -= const before the call and corresponding r12 += const after?
That will help JIT a bit.
Then both arg-in and arg-out will be accessed via [r12 + 0], [r12 + 8] which 
has its pros and cons.
Consider the case when 7th incoming arg needs to be passed as 7th outgoing.
With the current patch the compiler can emit it as:
r1 = *(u64 *)(r12 + 16)
*(u64 *)(r12 - 8) = r1

with explicit r12 adjustment:
r1 = *(u64 *)(r12 + 16)
r12 += 16
*(u64 *)(r12 +16) = r1

but without explicit r12 adjustment JIT would need to insert it somewhere, and 
if the sequence is:
r1 = *(u64 *)(r12 + 16)
*(u64 *)(r12 - 8) = r1
r1 = *(u64 *)(r12 + 8)
*(u64 *)(r12 - 16) = r1

there is no place for JIT to insert it unless it maps r12 with positive offset 
to, say, %rsp,
and r12 with negative offset as %rbp ?
the might be other gotchas with and without explicit r12. Something to think 
through.


https://github.com/llvm/llvm-project/pull/189060
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to