1 // Copyright 2022 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_CODEGEN_PPC_REGLIST_PPC_H_ 6 #define V8_CODEGEN_PPC_REGLIST_PPC_H_ 7 8 #include "src/codegen/register-arch.h" 9 #include "src/codegen/reglist-base.h" 10 11 namespace v8 { 12 namespace internal { 13 14 using RegList = RegListBase<Register>; 15 using DoubleRegList = RegListBase<DoubleRegister>; 16 using Simd128RegList = RegListBase<Simd128Register>; 17 ASSERT_TRIVIALLY_COPYABLE(RegList); 18 ASSERT_TRIVIALLY_COPYABLE(DoubleRegList); 19 20 // Register list in load/store instructions 21 // Note that the bit values must match those used in actual instruction encoding 22 23 // Caller-saved/arguments registers 24 const RegList kJSCallerSaved = {r3, // a1 25 r4, // a2 26 r5, // a3 27 r6, // a4 28 r7, // a5 29 r8, // a6 30 r9, // a7 31 r10, // a8 32 r11}; 33 34 const int kNumJSCallerSaved = 9; 35 36 // Return the code of the n-th caller-saved register available to JavaScript 37 // e.g. JSCallerSavedReg(0) returns r0.code() == 0 38 int JSCallerSavedCode(int n); 39 40 // Callee-saved registers preserved when switching from C to JavaScript 41 const RegList kCalleeSaved = {r14, r15, r16, r17, r18, r19, r20, r21, r22, 42 r23, r24, r25, r26, r27, r28, r29, r30, fp}; 43 44 const int kNumCalleeSaved = 18; 45 46 const DoubleRegList kCallerSavedDoubles = {d0, d1, d2, d3, d4, d5, d6, 47 d7, d8, d9, d10, d11, d12, d13}; 48 49 const Simd128RegList kCallerSavedSimd128s = {v0, v1, v2, v3, v4, v5, v6, 50 v7, v8, v9, v10, v11, v12, v13}; 51 52 const int kNumCallerSavedDoubles = 14; 53 54 const DoubleRegList kCalleeSavedDoubles = {d14, d15, d16, d17, d18, d19, 55 d20, d21, d22, d23, d24, d25, 56 d26, d27, d28, d29, d30, d31}; 57 58 const int kNumCalleeSavedDoubles = 18; 59 60 } // namespace internal 61 } // namespace v8 62 63 #endif // V8_CODEGEN_PPC_REGLIST_PPC_H_ 64