summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/MathExtrasTest.cpp
diff options
context:
space:
mode:
authorMaksim Panchenko <maks@fb.com>2015-09-29 22:09:16 +0000
committerMaksim Panchenko <maks@fb.com>2015-09-29 22:09:16 +0000
commitcce239c45d6ef3865a017b5b3f935964e0348734 (patch)
tree29a79da4af017519ddc4ebd35d0f1659e086ee71 /llvm/unittests/Support/MathExtrasTest.cpp
parent4eed0114c5e30937f0e9ea6e744659be97c13428 (diff)
downloadbcm5719-llvm-cce239c45d6ef3865a017b5b3f935964e0348734.tar.gz
bcm5719-llvm-cce239c45d6ef3865a017b5b3f935964e0348734.zip
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 llvm-svn: 248832
Diffstat (limited to 'llvm/unittests/Support/MathExtrasTest.cpp')
-rw-r--r--llvm/unittests/Support/MathExtrasTest.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/unittests/Support/MathExtrasTest.cpp b/llvm/unittests/Support/MathExtrasTest.cpp
index 5c95b500dd4..8bd47e34c7e 100644
--- a/llvm/unittests/Support/MathExtrasTest.cpp
+++ b/llvm/unittests/Support/MathExtrasTest.cpp
@@ -183,6 +183,11 @@ TEST(MathExtras, RoundUpToAlignment) {
EXPECT_EQ(8u, RoundUpToAlignment(5, 8));
EXPECT_EQ(24u, RoundUpToAlignment(17, 8));
EXPECT_EQ(0u, RoundUpToAlignment(~0LL, 8));
+
+ EXPECT_EQ(7u, RoundUpToAlignment(5, 8, 7));
+ EXPECT_EQ(17u, RoundUpToAlignment(17, 8, 1));
+ EXPECT_EQ(3u, RoundUpToAlignment(~0LL, 8, 3));
+ EXPECT_EQ(552u, RoundUpToAlignment(321, 255, 42));
}
}
OpenPOWER on IntegriCloud