Clean up irgen.h a bit
[hiphop-php.git] / hphp / runtime / vm / jit / align-internal.h
blob0396b5e10ad948604feddcad182653e80ed2a408
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2016 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_JIT_ALIGN_INTERNAL_H_
18 #define incl_HPHP_JIT_ALIGN_INTERNAL_H_
20 #include "hphp/runtime/vm/jit/alignment.h"
21 #include "hphp/runtime/vm/jit/cg-meta.h"
22 #include "hphp/runtime/vm/jit/types.h"
24 #include "hphp/util/data-block.h"
26 namespace HPHP { namespace jit {
28 ///////////////////////////////////////////////////////////////////////////////
30 template <class AImpl>
31 bool is_aligned(TCA frontier, Alignment alignment);
33 template <class AImpl>
34 void align(CodeBlock& cb, CGMeta* meta,
35 Alignment alignment, AlignContext context);
38 * Used in align-*.cpp to generate an AlignInfo table within an arch namespace.
40 #define DECLARE_ALIGN_TABLE(table) \
41 constexpr AlignInfo table[] = { \
42 { cache_line_size(), cache_line_size(), 0 }, /* CacheLine */ \
43 { cache_line_size(), cache_line_size() / 2, 0 }, /* CacheLineRoundUp */ \
44 { kJmpTargetAlign, kJmpTargetAlign, 0 }, /* JmpTarget */ \
45 { cache_line_size(), smashableMovqLen(), kSmashMovqImmOff }, \
46 { cache_line_size(), smashableCmpqLen(), kSmashCmpqImmOff }, \
47 { cache_line_size(), smashableCallLen(), 0 }, \
48 { cache_line_size(), smashableJmpLen(), 0 }, \
49 { cache_line_size(), smashableJccLen(), 0 }, \
51 * Three entries for SmashJccAndJmp, one for each half and one for both
52 * together. The implementation below relies on this being the last
53 */ \
54 { cache_line_size(), smashableJccLen(), 0 }, \
55 { cache_line_size(), smashableJccLen() + \
56 smashableJmpLen(), smashableJccLen() }, \
57 { cache_line_size(), smashableJccLen() + \
58 smashableJmpLen(), 0 } \
61 #define DEFINE_ALIGN_TABLE(table) \
62 constexpr AlignInfo table[kNumAlignments + 2]
65 ///////////////////////////////////////////////////////////////////////////////
69 #include "hphp/runtime/vm/jit/align-internal-inl.h"
71 #endif