forked from facebook/hhvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabi-ppc64.h
More file actions
107 lines (84 loc) · 3.86 KB
/
abi-ppc64.h
File metadata and controls
107 lines (84 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| (c) Copyright IBM Corporation 2015-2016 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_JIT_ABI_PPC64_H_
#define incl_HPHP_JIT_ABI_PPC64_H_
#include "hphp/runtime/vm/jit/phys-reg.h"
#include "hphp/runtime/vm/bytecode.h"
#include "hphp/ppc64-asm/asm-ppc64.h"
namespace HPHP { namespace jit {
struct Abi;
namespace ppc64 {
///////////////////////////////////////////////////////////////////////////////
/*
* Mirrors the API of abi.h.
*/
const Abi& abi(CodeKind kind = CodeKind::Trace);
constexpr PhysReg rvmfp() { return ppc64_asm::reg::r31; }
constexpr PhysReg rvmsp() { return ppc64_asm::reg::r29; }
constexpr PhysReg rvmtl() { return ppc64_asm::reg::r30; }
constexpr PhysReg rsp() { return ppc64_asm::reg::r27; }
// optional in function linkage/used in function prologues
constexpr PhysReg rfuncln() { return ppc64_asm::reg::r0; }
// optional in function linkage/function entry address at global entry point
constexpr PhysReg rfuncentry() { return ppc64_asm::reg::r12; }
// TOC ("Table of Contents")
// Section that combines the functions of the GOT and the small data section.
// GOT ("Global Offset Table")
// Section used to hold addresses for position independent code.
// The TOC section is accessed via the dedicated TOC pointer register, r2.
constexpr PhysReg rtoc() { return ppc64_asm::reg::r2; }
/*
* Thread pointer, used to access the thread local storage section.
*
* See ABI for more info, page 112, Chapter 3.7.2 "TLS Runtime Handling"
* https://members.openpowerfoundation.org/document/dl/576
*/
constexpr PhysReg rthreadptr() { return ppc64_asm::reg::r13; }
/*
* Return register 28, which has the value "1" (initialized in enterTCHelper).
*
* This is necessary for PPC64 since instructions like "inc" must update the CR
* depending on the instruction result, and instructions like "addi" (with
* immediate) do not set the CR.
*/
constexpr PhysReg rone() { return ppc64_asm::reg::r28; }
inline RegSet vm_regs_no_sp() { return rvmfp() | rvmtl(); }
inline RegSet vm_regs_with_sp() { return vm_regs_no_sp() | rvmsp(); }
constexpr PhysReg rret_data() { return ppc64_asm::reg::r3; }
constexpr PhysReg rret_type() { return ppc64_asm::reg::r4; }
PhysReg rret(size_t i = 0);
PhysReg rret_simd(size_t i);
constexpr PhysReg rret_indirect() { return ppc64_asm::reg::r3; };
PhysReg rarg(size_t i);
PhysReg rarg_simd(size_t i);
size_t num_arg_regs();
size_t num_arg_regs_simd();
constexpr PhysReg r_svcreq_req() { return ppc64_asm::reg::r3; }
constexpr PhysReg r_svcreq_stub() { return ppc64_asm::reg::r8; }
PhysReg r_svcreq_sf();
PhysReg r_svcreq_arg(size_t i);
///////////////////////////////////////////////////////////////////////////////
/*
* Scratch registers.
*
* rAsm: a general purpose temporary register
* rFasm: a floating point temporary register
*/
constexpr Reg64 rAsm = ppc64_asm::reg::r11;
constexpr RegXMM rFasm = ppc64_asm::reg::f15;
///////////////////////////////////////////////////////////////////////////////
}}}
#endif