[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
future.

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.


http://reviews.llvm.org/D12681

Files:
  include/llvm/IR/CallingConv.h
  include/llvm/Support/MathExtras.h
  lib/AsmParser/LLLexer.cpp
  lib/AsmParser/LLParser.cpp
  lib/AsmParser/LLToken.h
  lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
  lib/CodeGen/PrologEpilogInserter.cpp
  lib/IR/AsmWriter.cpp
  lib/Target/X86/X86CallingConv.td
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86RegisterInfo.cpp
  test/CodeGen/X86/hhvm-cc.ll
  test/Feature/callingconventions.ll
  utils/vim/syntax/llvm.vim

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12681.34060.patch
Type: text/x-patch
Size: 24896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150907/2547bf7c/attachment.bin>


More information about the llvm-commits mailing list