Clean up irgen.h a bit
[hiphop-php.git] / hphp / runtime / vm / jit / smashable-instr-arm.h
blobaf443f688a0b40486da348237bedfb5004799bda
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_SMASHABLE_INSTR_ARM_H_
18 #define incl_HPHP_JIT_SMASHABLE_INSTR_ARM_H_
20 #include "hphp/runtime/vm/jit/types.h"
21 #include "hphp/runtime/vm/jit/phys-reg.h"
23 #include "hphp/util/asm-x64.h"
24 #include "hphp/util/data-block.h"
26 namespace HPHP { namespace jit {
28 struct CGMeta;
30 namespace arm {
32 ///////////////////////////////////////////////////////////////////////////////
35 * Mirrors the API of smashable-instr.h.
39 * Number of instructions (each of which is four bytes) in the sequence, plus
40 * the size of the smashable immediate.
42 constexpr size_t smashableMovqLen() { return 2 * 4 + 8; }
43 constexpr size_t smashableCmpqLen() { return 0; }
44 constexpr size_t smashableCallLen() { return 3 * 4 + 8; }
45 constexpr size_t smashableJmpLen() { return 2 * 4 + 8; }
46 constexpr size_t smashableJccLen() { return 3 * 4 + 8; }
48 TCA emitSmashableMovq(CodeBlock& cb, CGMeta& fixups, uint64_t imm,
49 PhysReg d);
50 TCA emitSmashableCmpq(CodeBlock& cb, CGMeta& fixups, int32_t imm,
51 PhysReg r, int8_t disp);
52 TCA emitSmashableCall(CodeBlock& cb, CGMeta& fixups, TCA target);
53 TCA emitSmashableJmp(CodeBlock& cb, CGMeta& fixups, TCA target);
54 TCA emitSmashableJcc(CodeBlock& cb, CGMeta& fixups, TCA target,
55 ConditionCode cc);
56 std::pair<TCA,TCA>
57 emitSmashableJccAndJmp(CodeBlock& cb, CGMeta& fixups, TCA target,
58 ConditionCode cc);
60 void smashMovq(TCA inst, uint64_t imm);
61 void smashCmpq(TCA inst, uint32_t imm);
62 void smashCall(TCA inst, TCA target);
63 void smashJmp(TCA inst, TCA target);
64 void smashJcc(TCA inst, TCA target, ConditionCode cc = CC_None);
66 uint64_t smashableMovqImm(TCA inst);
67 uint32_t smashableCmpqImm(TCA inst);
68 TCA smashableCallTarget(TCA inst);
69 TCA smashableJmpTarget(TCA inst);
70 TCA smashableJccTarget(TCA inst);
71 ConditionCode smashableJccCond(TCA inst);
73 ///////////////////////////////////////////////////////////////////////////////
75 }}}
77 #endif