HHVM calling conventions.
authorMaksim Panchenko <maks@fb.com>
Tue, 29 Sep 2015 22:09:16 +0000 (22:09 +0000)
committerMaksim Panchenko <maks@fb.com>
Tue, 29 Sep 2015 22:09:16 +0000 (22:09 +0000)
commit3b3752c898d041fcab9455581136ebc6de921610
tree246cb0b831eba0625ab2e3affc81777bc500084c
parent5518a74f1f5e3f75e41fb2378c927218f6146f7e
HHVM calling conventions.

HHVM calling convention, hhvmcc, is used by HHVM JIT for
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 function calls.

One extra 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 of first argument which is passed in RBP
(before we use RDI, RSI, etc.)

Differential Revision: http://reviews.llvm.org/D12681

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248832 91177308-0d34-0410-b5e6-96231b3b80d8
16 files changed:
include/llvm/IR/CallingConv.h
include/llvm/Support/MathExtras.h
include/llvm/Target/TargetFrameLowering.h
lib/AsmParser/LLLexer.cpp
lib/AsmParser/LLParser.cpp
lib/AsmParser/LLToken.h
lib/CodeGen/PrologEpilogInserter.cpp
lib/CodeGen/TargetFrameLoweringImpl.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 [new file with mode: 0644]
test/Feature/callingconventions.ll
unittests/Support/MathExtrasTest.cpp
utils/vim/syntax/llvm.vim