• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_WASM_BASELINE_LIFTOFF_ASSEMBLER_DEFS_H_
6 #define V8_WASM_BASELINE_LIFTOFF_ASSEMBLER_DEFS_H_
7 
8 #include "src/assembler-arch.h"
9 #include "src/reglist.h"
10 
11 namespace v8 {
12 namespace internal {
13 namespace wasm {
14 
15 #if V8_TARGET_ARCH_IA32
16 
17 constexpr RegList kLiftoffAssemblerGpCacheRegs =
18     Register::ListOf<eax, ecx, edx, ebx, esi, edi>();
19 
20 // Omit xmm7, which is the kScratchDoubleReg.
21 constexpr RegList kLiftoffAssemblerFpCacheRegs =
22     DoubleRegister::ListOf<xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6>();
23 
24 constexpr Register kNoParamRegister = edi;
25 
26 #elif V8_TARGET_ARCH_X64
27 
28 constexpr RegList kLiftoffAssemblerGpCacheRegs =
29     Register::ListOf<rax, rcx, rdx, rbx, rsi, rdi>();
30 
31 constexpr RegList kLiftoffAssemblerFpCacheRegs =
32     DoubleRegister::ListOf<xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7>();
33 
34 constexpr Register kNoParamRegister = r8;
35 
36 #elif V8_TARGET_ARCH_MIPS
37 
38 constexpr RegList kLiftoffAssemblerGpCacheRegs =
39     Register::ListOf<a0, a1, a2, a3, t0, t1, t2, t3, t4, t5, t6, s7, v0, v1>();
40 
41 constexpr RegList kLiftoffAssemblerFpCacheRegs =
42     DoubleRegister::ListOf<f0, f2, f4, f6, f8, f10, f12, f14, f16, f18, f20,
43                            f22, f24>();
44 
45 constexpr Register kNoParamRegister = t0;
46 
47 #elif V8_TARGET_ARCH_MIPS64
48 
49 constexpr RegList kLiftoffAssemblerGpCacheRegs =
50     Register::ListOf<a0, a1, a2, a3, a4, a5, a6, a7, t0, t1, t2, s7, v0, v1>();
51 
52 constexpr RegList kLiftoffAssemblerFpCacheRegs =
53     DoubleRegister::ListOf<f0, f2, f4, f6, f8, f10, f12, f14, f16, f18, f20,
54                            f22, f24, f26>();
55 
56 constexpr Register kNoParamRegister = t0;
57 
58 #elif V8_TARGET_ARCH_ARM64
59 
60 // x16: ip0, x17: ip1, x26: root, x27: cp, x29: fp, x30: lr, x31: xzr.
61 constexpr RegList kLiftoffAssemblerGpCacheRegs =
62     CPURegister::ListOf<x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12,
63                         x13, x14, x15, x18, x19, x20, x21, x22, x23, x24, x25,
64                         x28>();
65 
66 // d15: fp_zero, d30-d31: macro-assembler scratch V Registers.
67 constexpr RegList kLiftoffAssemblerFpCacheRegs =
68     CPURegister::ListOf<d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12,
69                         d13, d14, d16, d17, d18, d19, d20, d21, d22, d23, d24,
70                         d25, d26, d27, d28, d29>();
71 
72 constexpr Register kNoParamRegister = x28;
73 
74 #else
75 
76 constexpr RegList kLiftoffAssemblerGpCacheRegs = 0xff;
77 
78 constexpr RegList kLiftoffAssemblerFpCacheRegs = 0xff;
79 
80 // This should be an allocatable, general purpose register
81 // that is not used for parameters, see {wasm-linkage.cc}.
82 constexpr Register kNoParamRegister = Register::no_reg();
83 
84 #endif
85 
86 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64
87 
88 constexpr Condition kEqual = equal;
89 constexpr Condition kUnequal = not_equal;
90 constexpr Condition kSignedLessThan = less;
91 constexpr Condition kSignedLessEqual = less_equal;
92 constexpr Condition kSignedGreaterThan = greater;
93 constexpr Condition kSignedGreaterEqual = greater_equal;
94 constexpr Condition kUnsignedLessThan = below;
95 constexpr Condition kUnsignedLessEqual = below_equal;
96 constexpr Condition kUnsignedGreaterThan = above;
97 constexpr Condition kUnsignedGreaterEqual = above_equal;
98 
99 #elif V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64
100 
101 constexpr Condition kEqual = eq;
102 constexpr Condition kUnequal = ne;
103 constexpr Condition kSignedLessThan = lt;
104 constexpr Condition kSignedLessEqual = le;
105 constexpr Condition kSignedGreaterThan = gt;
106 constexpr Condition kSignedGreaterEqual = ge;
107 constexpr Condition kUnsignedLessThan = ult;
108 constexpr Condition kUnsignedLessEqual = ule;
109 constexpr Condition kUnsignedGreaterThan = ugt;
110 constexpr Condition kUnsignedGreaterEqual = uge;
111 
112 #elif V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64
113 
114 constexpr Condition kEqual = eq;
115 constexpr Condition kUnequal = ne;
116 constexpr Condition kSignedLessThan = lt;
117 constexpr Condition kSignedLessEqual = le;
118 constexpr Condition kSignedGreaterThan = gt;
119 constexpr Condition kSignedGreaterEqual = ge;
120 constexpr Condition kUnsignedLessThan = lo;
121 constexpr Condition kUnsignedLessEqual = ls;
122 constexpr Condition kUnsignedGreaterThan = hi;
123 constexpr Condition kUnsignedGreaterEqual = hs;
124 
125 #else
126 
127 // On unimplemented platforms, just make this compile.
128 constexpr Condition kEqual = static_cast<Condition>(0);
129 constexpr Condition kUnequal = static_cast<Condition>(0);
130 constexpr Condition kSignedLessThan = static_cast<Condition>(0);
131 constexpr Condition kSignedLessEqual = static_cast<Condition>(0);
132 constexpr Condition kSignedGreaterThan = static_cast<Condition>(0);
133 constexpr Condition kSignedGreaterEqual = static_cast<Condition>(0);
134 constexpr Condition kUnsignedLessThan = static_cast<Condition>(0);
135 constexpr Condition kUnsignedLessEqual = static_cast<Condition>(0);
136 constexpr Condition kUnsignedGreaterThan = static_cast<Condition>(0);
137 constexpr Condition kUnsignedGreaterEqual = static_cast<Condition>(0);
138 
139 #endif
140 
141 }  // namespace wasm
142 }  // namespace internal
143 }  // namespace v8
144 
145 #endif  // V8_WASM_BASELINE_LIFTOFF_ASSEMBLER_DEFS_H_
146