[PATCH] D12681: Calling conventions for HHVM
Maksim Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 15:53:34 PDT 2015
maksfb created this revision.
maksfb added reviewers: joker.eph, sanjoy, cestes, reames, mcrosier, atrick.
maksfb added a subscriber: llvm-commits.
HHVM calling convention, hhvmcc, is used by HHVM JIT for calling
functions in translated cache. We currently support LLVM back end to
generate code for X86-64 and may support other architectures in the
In HHVM calling convention any GP register could be used to pass and
return values, with the exception of R12 which is reserved for
thread-local area and is callee-saved. Other than R12, we always
pass RBX and RBP as args, which are our virtual machine's stack pointer
and frame pointer respectively.
When we enter translation cache via hhvmcc function, we expect
the stack to be aligned at 16 bytes, i.e. skewed by 8 bytes as opposed
to standard ABI alignment. This affects stack object alignment and stack
adjustments for calls.
The second calling convention, hhvm_ccc, is used to call C++ helpers from
HHVM's translation cache. It is almost identical to standard C calling
convention with an exception that we pass our virtual machine's frame pointer
in RBP as the first argument to a function, and then use standard
registers/stack (RDI, RSI, etc.) for the rest of the arguments.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 24896 bytes
Desc: not available
More information about the llvm-commits