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