5#ifndef V8_CODEGEN_ARM64_REGISTER_ARM64_H_
6#define V8_CODEGEN_ARM64_REGISTER_ARM64_H_
18#define GENERAL_REGISTER_CODE_LIST(R) \
19 R(0) R(1) R(2) R(3) R(4) R(5) R(6) R(7) \
20 R(8) R(9) R(10) R(11) R(12) R(13) R(14) R(15) \
21 R(16) R(17) R(18) R(19) R(20) R(21) R(22) R(23) \
22 R(24) R(25) R(26) R(27) R(28) R(29) R(30) R(31)
24#define GENERAL_REGISTERS(R) \
25 R(x0) R(x1) R(x2) R(x3) R(x4) R(x5) R(x6) R(x7) \
26 R(x8) R(x9) R(x10) R(x11) R(x12) R(x13) R(x14) R(x15) \
27 R(x16) R(x17) R(x18) R(x19) R(x20) R(x21) R(x22) R(x23) \
28 R(x24) R(x25) R(x26) R(x27) R(x28) R(x29) R(x30) R(x31)
32#define ALWAYS_ALLOCATABLE_GENERAL_REGISTERS(R) \
33 R(x0) R(x1) R(x2) R(x3) R(x4) R(x5) R(x6) R(x7) \
34 R(x8) R(x9) R(x10) R(x11) R(x12) R(x13) R(x14) R(x15) \
35 R(x19) R(x20) R(x21) R(x22) R(x23) R(x24) R(x25) \
38#ifdef V8_COMPRESS_POINTERS
39#define MAYBE_ALLOCATABLE_GENERAL_REGISTERS(R)
41#define MAYBE_ALLOCATABLE_GENERAL_REGISTERS(R) R(x28)
44#define ALLOCATABLE_GENERAL_REGISTERS(V) \
45 ALWAYS_ALLOCATABLE_GENERAL_REGISTERS(V) \
46 MAYBE_ALLOCATABLE_GENERAL_REGISTERS(V)
48#define FLOAT_REGISTERS(V) \
49 V(s0) V(s1) V(s2) V(s3) V(s4) V(s5) V(s6) V(s7) \
50 V(s8) V(s9) V(s10) V(s11) V(s12) V(s13) V(s14) V(s15) \
51 V(s16) V(s17) V(s18) V(s19) V(s20) V(s21) V(s22) V(s23) \
52 V(s24) V(s25) V(s26) V(s27) V(s28) V(s29) V(s30) V(s31)
54#define DOUBLE_REGISTERS(R) \
55 R(d0) R(d1) R(d2) R(d3) R(d4) R(d5) R(d6) R(d7) \
56 R(d8) R(d9) R(d10) R(d11) R(d12) R(d13) R(d14) R(d15) \
57 R(d16) R(d17) R(d18) R(d19) R(d20) R(d21) R(d22) R(d23) \
58 R(d24) R(d25) R(d26) R(d27) R(d28) R(d29) R(d30) R(d31)
60#define SIMD128_REGISTERS(V) \
61 V(q0) V(q1) V(q2) V(q3) V(q4) V(q5) V(q6) V(q7) \
62 V(q8) V(q9) V(q10) V(q11) V(q12) V(q13) V(q14) V(q15) \
63 V(q16) V(q17) V(q18) V(q19) V(q20) V(q21) V(q22) V(q23) \
64 V(q24) V(q25) V(q26) V(q27) V(q28) V(q29) V(q30) V(q31)
66#define VECTOR_REGISTERS(V) \
67 V(v0) V(v1) V(v2) V(v3) V(v4) V(v5) V(v6) V(v7) \
68 V(v8) V(v9) V(v10) V(v11) V(v12) V(v13) V(v14) V(v15) \
69 V(v16) V(v17) V(v18) V(v19) V(v20) V(v21) V(v22) V(v23) \
70 V(v24) V(v25) V(v26) V(v27) V(v28) V(v29) V(v30) V(v31)
74#define ALLOCATABLE_DOUBLE_REGISTERS(R) \
75 R(d0) R(d1) R(d2) R(d3) R(d4) R(d5) R(d6) R(d7) \
76 R(d8) R(d9) R(d10) R(d11) R(d12) R(d13) R(d14) R(d16) \
77 R(d17) R(d18) R(d19) R(d20) R(d21) R(d22) R(d23) R(d24) \
78 R(d25) R(d26) R(d27) R(d28)
80#define MAGLEV_SCRATCH_DOUBLE_REGISTERS(R) \
91#define REGISTER_CODE(R) kRegCode_##R,
205#if defined(V8_OS_WIN) && !defined(__clang__)
233 return type ==
kNoRegister && code == 0 && size == 0;
239 "CPURegister can efficiently be passed by value");
266static_assert(
sizeof(Register) <=
sizeof(int),
267 "Register can efficiently be passed by value");
270template <
typename RegT>
273 source = RegT::no_reg();
280 constexpr int kStackFrameAlignment = 16;
282 return argument_count & alignment_mask;
289#define REGISTER_CODE(R) kDoubleCode_##R,
462static_assert(
sizeof(
VRegister) <=
sizeof(int),
463 "VRegister can efficiently be passed by value");
474#define DEFINE_REGISTER(register_class, name, ...) \
475 constexpr register_class name = register_class::Create(__VA_ARGS__)
476#define ALIAS_REGISTER(register_class, alias, name) \
477 constexpr register_class alias = name
479#define DEFINE_REGISTERS(N) \
480 DEFINE_REGISTER(Register, w##N, N, kWRegSizeInBits); \
481 DEFINE_REGISTER(Register, x##N, N, kXRegSizeInBits);
483#undef DEFINE_REGISTERS
488#define DEFINE_VREGISTERS(N) \
489 DEFINE_REGISTER(VRegister, b##N, N, kBRegSizeInBits); \
490 DEFINE_REGISTER(VRegister, h##N, N, kHRegSizeInBits); \
491 DEFINE_REGISTER(VRegister, s##N, N, kSRegSizeInBits); \
492 DEFINE_REGISTER(VRegister, d##N, N, kDRegSizeInBits); \
493 DEFINE_REGISTER(VRegister, q##N, N, kQRegSizeInBits); \
494 DEFINE_REGISTER(VRegister, v##N, N, kQRegSizeInBits);
496#undef DEFINE_VREGISTERS
498#undef DEFINE_REGISTER
511#ifdef V8_COMPRESS_POINTERS
static constexpr bool IsValidRegister(int code, int size)
constexpr bool operator!=(const CPURegister &other) const
static constexpr bool IsValidVRegister(int code, int size)
constexpr bool IsEven() const
friend class RegisterBase
bool IsFPRegister() const
static constexpr bool IsNone(int code, int size, RegisterType type)
constexpr CPURegister(int code, int size, RegisterType type)
constexpr bool operator==(const CPURegister &other) const
RegisterType type() const
static constexpr CPURegister Create(int code, int size, RegisterType type)
static constexpr bool IsValid(int code, int size, RegisterType type)
static constexpr CPURegister no_reg()
constexpr bool Aliases(const CPURegister &other) const
bool IsSameSizeAndType(const CPURegister &other) const
constexpr bool is_valid() const
constexpr bool operator==(const RegisterBase< SubType, kAfterLastRegister > &other) const
static constexpr int8_t kCode_no_reg
constexpr int8_t code() const
static constexpr Register from_code(int code)
constexpr Register(const CPURegister &r)
static Register WRegFromCode(unsigned code)
static Register XRegFromCode(unsigned code)
static const char * GetSpecialRegisterName(int code)
constexpr Register(int code)
static constexpr Register Create(int code, int size)
static constexpr Register no_reg()
static VRegister HRegFromCode(unsigned code)
static constexpr VRegister Create(int code, int size, int lane_count=1)
static constexpr VRegister no_reg()
VRegister Format(VectorFormat f) const
static VRegister VRegFromCode(unsigned code)
static VRegister BRegFromCode(unsigned code)
unsigned LaneSizeInBits() const
static constexpr int kMaxNumRegisters
static VRegister QRegFromCode(unsigned code)
static VRegister DRegFromCode(unsigned code)
bool IsSameFormat(const VRegister &other) const
unsigned LaneSizeInBytes() const
static constexpr VRegister from_code(int code)
constexpr VRegister(const CPURegister &r, int lane_count)
static VRegister Create(int reg_code, VectorFormat format)
static VRegister SRegFromCode(unsigned code)
static constexpr bool IsValidLaneCount(int lane_count)
ZoneVector< RpoNumber > & result
InstructionOperand source
constexpr bool IsPowerOfTwo(T value)
constexpr Register no_reg
V8_EXPORT_PRIVATE bool AreConsecutive(const CPURegister ®1, const CPURegister ®2, const CPURegister ®3=NoReg, const CPURegister ®4=NoReg)
constexpr Register kRootRegister
VectorFormat ScalarFormatFromLaneSize(int lanesize)
constexpr NEONFormatField NEON_8B
constexpr NEONFormatField NEON_16B
VectorFormat VectorFormatHalfLanes(VectorFormat vform)
constexpr AliasingKind kFPAliasing
constexpr Register kRuntimeCallFunctionRegister
constexpr NEONScalarFormatField NEON_H
V8_EXPORT_PRIVATE int LaneCountFromFormat(VectorFormat vform)
constexpr int kFPRegisterPassedArguments
constexpr NEONFormatField NEON_2S
V8_EXPORT_PRIVATE unsigned RegisterSizeInBitsFromFormat(VectorFormat vform)
constexpr Register kRuntimeCallArgvRegister
constexpr NEONFormatField NEON_1D
constexpr Register kJavaScriptCallTargetRegister
constexpr int kWRegSizeInBits
constexpr int kNumberOfRegisters
bool AreEven(const CPURegister ®1, const CPURegister ®2, const CPURegister ®3=NoReg, const CPURegister ®4=NoReg, const CPURegister ®5=NoReg, const CPURegister ®6=NoReg, const CPURegister ®7=NoReg, const CPURegister ®8=NoReg)
int64_t MinIntFromFormat(VectorFormat vform)
uint64_t MaxUintFromFormat(VectorFormat vform)
constexpr DwVfpRegister no_dreg
int LaneSizeInBytesLog2FromFormat(VectorFormat vform)
constexpr NEONFormatField NEON_4H
constexpr Register kJavaScriptCallArgCountRegister
constexpr Register kInterpreterAccumulatorRegister
static const int kRegisterPassedArguments
constexpr NEONFormatField NEON_8H
int MaxLaneCountFromFormat(VectorFormat vform)
constexpr int kSystemPointerSize
constexpr DoubleRegister kFPReturnRegister0
constexpr Register kReturnRegister1
int64_t MaxIntFromFormat(VectorFormat vform)
constexpr NEONScalarFormatField NEONScalar
VectorFormat VectorFormatHalfWidth(VectorFormat vform)
constexpr Register kReturnRegister0
constexpr int kBRegSizeInBits
V8_EXPORT_PRIVATE bool IsVectorFormat(VectorFormat vform)
constexpr Register kWasmImplicitArgRegister
constexpr Register kContextRegister
V8_EXPORT_PRIVATE bool AreAliased(const CPURegister ®1, const CPURegister ®2, const CPURegister ®3=NoReg, const CPURegister ®4=NoReg, const CPURegister ®5=NoReg, const CPURegister ®6=NoReg, const CPURegister ®7=NoReg, const CPURegister ®8=NoReg)
constexpr Register kRuntimeCallArgCountRegister
constexpr NEONFormatField NEON_4S
constexpr VRegister NoVReg
constexpr Register kInterpreterDispatchTableRegister
bool AreSameFormat(const Register ®1, const Register ®2, const Register ®3=NoReg, const Register ®4=NoReg)
constexpr Register kAllocateSizeRegister
unsigned LaneSizeInBitsFromFormat(VectorFormat vform)
constexpr Register kWasmTrapHandlerFaultAddressRegister
constexpr Register kSimulatorHltArgument
constexpr Register kJavaScriptCallExtraArg1Register
constexpr NEONScalarFormatField NEON_D
constexpr Register kJavaScriptCallCodeStartRegister
constexpr CPURegister NoCPUReg
constexpr Register kPtrComprCageBaseRegister
VectorFormat VectorFormatDoubleLanes(VectorFormat vform)
constexpr Register kReturnRegister2
Register ReassignRegister(Register &source)
constexpr Register kWasmCompileLazyFuncIndexRegister
constexpr NEONFormatField NEON_2D
constexpr int kXRegSizeInBits
constexpr NEONScalarFormatField NEON_S
constexpr int kNumberOfVRegisters
constexpr int kSPRegInternalCode
constexpr int kSRegSizeInBits
VectorFormat VectorFormatDoubleWidth(VectorFormat vform)
constexpr Register kStackPointerRegister
constexpr int ArgumentPaddingSlots(int argument_count)
constexpr NEONScalarFormatField NEON_B
constexpr int kQRegSizeInBits
constexpr Register kCArgRegs[]
int LaneSizeInBytesFromFormat(VectorFormat vform)
constexpr bool kSimdMaskRegisters
VectorFormat VectorFormatHalfWidthDoubleLanes(VectorFormat vform)
V8_EXPORT_PRIVATE bool AreSameSizeAndType(const CPURegister ®1, const CPURegister ®2=NoCPUReg, const CPURegister ®3=NoCPUReg, const CPURegister ®4=NoCPUReg, const CPURegister ®5=NoCPUReg, const CPURegister ®6=NoCPUReg, const CPURegister ®7=NoCPUReg, const CPURegister ®8=NoCPUReg)
constexpr Register kJavaScriptCallDispatchHandleRegister
constexpr Register kInterpreterBytecodeOffsetRegister
unsigned RegisterSizeInBytesFromFormat(VectorFormat vform)
constexpr Register kJavaScriptCallNewTargetRegister
constexpr Register kJSFunctionRegister
constexpr int kHRegSizeInBits
VectorFormat VectorFormatFillQ(int laneSize)
VectorFormat ScalarFormatFromFormat(VectorFormat vform)
constexpr Register kInterpreterBytecodeArrayRegister
constexpr Register padreg
constexpr int kDRegSizeInBits
#define GENERAL_REGISTER_CODE_LIST(R)
#define DEFINE_REGISTER(register_class, name,...)
#define DEFINE_VREGISTERS(N)
#define VECTOR_REGISTERS(V)
#define DEFINE_REGISTERS(N)
#define ALIAS_REGISTER(register_class, alias, name)
#define GENERAL_REGISTERS(V)
#define DOUBLE_REGISTERS(V)
#define DEFINE_REGISTER_NAMES(RegType, LIST)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
#define ASSERT_TRIVIALLY_COPYABLE(T)
#define V8_EXPORT_PRIVATE