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