// Copyright 2017 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_WASM_BASELINE_LIFTOFF_ASSEMBLER_DEFS_H_ #define V8_WASM_BASELINE_LIFTOFF_ASSEMBLER_DEFS_H_ #include "src/assembler-arch.h" #include "src/reglist.h" namespace v8 { namespace internal { namespace wasm { #if V8_TARGET_ARCH_IA32 constexpr RegList kLiftoffAssemblerGpCacheRegs = Register::ListOf(); // Omit xmm7, which is the kScratchDoubleReg. constexpr RegList kLiftoffAssemblerFpCacheRegs = DoubleRegister::ListOf(); constexpr Register kNoParamRegister = edi; #elif V8_TARGET_ARCH_X64 constexpr RegList kLiftoffAssemblerGpCacheRegs = Register::ListOf(); constexpr RegList kLiftoffAssemblerFpCacheRegs = DoubleRegister::ListOf(); constexpr Register kNoParamRegister = r8; #elif V8_TARGET_ARCH_MIPS constexpr RegList kLiftoffAssemblerGpCacheRegs = Register::ListOf(); constexpr RegList kLiftoffAssemblerFpCacheRegs = DoubleRegister::ListOf(); constexpr Register kNoParamRegister = t0; #elif V8_TARGET_ARCH_MIPS64 constexpr RegList kLiftoffAssemblerGpCacheRegs = Register::ListOf(); constexpr RegList kLiftoffAssemblerFpCacheRegs = DoubleRegister::ListOf(); constexpr Register kNoParamRegister = t0; #elif V8_TARGET_ARCH_ARM64 // x16: ip0, x17: ip1, x26: root, x27: cp, x29: fp, x30: lr, x31: xzr. constexpr RegList kLiftoffAssemblerGpCacheRegs = CPURegister::ListOf(); // d15: fp_zero, d30-d31: macro-assembler scratch V Registers. constexpr RegList kLiftoffAssemblerFpCacheRegs = CPURegister::ListOf(); constexpr Register kNoParamRegister = x28; #else constexpr RegList kLiftoffAssemblerGpCacheRegs = 0xff; constexpr RegList kLiftoffAssemblerFpCacheRegs = 0xff; // This should be an allocatable, general purpose register // that is not used for parameters, see {wasm-linkage.cc}. constexpr Register kNoParamRegister = Register::no_reg(); #endif #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 constexpr Condition kEqual = equal; constexpr Condition kUnequal = not_equal; constexpr Condition kSignedLessThan = less; constexpr Condition kSignedLessEqual = less_equal; constexpr Condition kSignedGreaterThan = greater; constexpr Condition kSignedGreaterEqual = greater_equal; constexpr Condition kUnsignedLessThan = below; constexpr Condition kUnsignedLessEqual = below_equal; constexpr Condition kUnsignedGreaterThan = above; constexpr Condition kUnsignedGreaterEqual = above_equal; #elif V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 constexpr Condition kEqual = eq; constexpr Condition kUnequal = ne; constexpr Condition kSignedLessThan = lt; constexpr Condition kSignedLessEqual = le; constexpr Condition kSignedGreaterThan = gt; constexpr Condition kSignedGreaterEqual = ge; constexpr Condition kUnsignedLessThan = ult; constexpr Condition kUnsignedLessEqual = ule; constexpr Condition kUnsignedGreaterThan = ugt; constexpr Condition kUnsignedGreaterEqual = uge; #elif V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 constexpr Condition kEqual = eq; constexpr Condition kUnequal = ne; constexpr Condition kSignedLessThan = lt; constexpr Condition kSignedLessEqual = le; constexpr Condition kSignedGreaterThan = gt; constexpr Condition kSignedGreaterEqual = ge; constexpr Condition kUnsignedLessThan = lo; constexpr Condition kUnsignedLessEqual = ls; constexpr Condition kUnsignedGreaterThan = hi; constexpr Condition kUnsignedGreaterEqual = hs; #else // On unimplemented platforms, just make this compile. constexpr Condition kEqual = static_cast(0); constexpr Condition kUnequal = static_cast(0); constexpr Condition kSignedLessThan = static_cast(0); constexpr Condition kSignedLessEqual = static_cast(0); constexpr Condition kSignedGreaterThan = static_cast(0); constexpr Condition kSignedGreaterEqual = static_cast(0); constexpr Condition kUnsignedLessThan = static_cast(0); constexpr Condition kUnsignedLessEqual = static_cast(0); constexpr Condition kUnsignedGreaterThan = static_cast(0); constexpr Condition kUnsignedGreaterEqual = static_cast(0); #endif } // namespace wasm } // namespace internal } // namespace v8 #endif // V8_WASM_BASELINE_LIFTOFF_ASSEMBLER_DEFS_H_