• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_RISCV64_REGLIST_RISCV64_H_
6 #define V8_CODEGEN_RISCV64_REGLIST_RISCV64_H_
7 
8 #include "src/codegen/register-arch.h"
9 #include "src/codegen/reglist-base.h"
10 #include "src/codegen/riscv64/constants-riscv64.h"
11 
12 namespace v8 {
13 namespace internal {
14 
15 using RegList = RegListBase<Register>;
16 using DoubleRegList = RegListBase<DoubleRegister>;
17 ASSERT_TRIVIALLY_COPYABLE(RegList);
18 ASSERT_TRIVIALLY_COPYABLE(DoubleRegList);
19 
20 const RegList kJSCallerSaved = {t0, t1, t2, a0, a1, a2, a3, a4, a5, a6, a7, t4};
21 
22 const int kNumJSCallerSaved = 12;
23 
24 // Callee-saved registers preserved when switching from C to JavaScript.
25 const RegList kCalleeSaved = {fp,    // fp/s0
26                               s1,    // s1
27                               s2,    // s2
28                               s3,    // s3 scratch register
29                               s4,    // s4 scratch register 2
30                               s5,    // s5
31                               s6,    // s6 (roots in Javascript code)
32                               s7,    // s7 (cp in Javascript code)
33                               s8,    // s8
34                               s9,    // s9
35                               s10,   // s10
36                               s11};  // s11
37 
38 const int kNumCalleeSaved = 12;
39 
40 const DoubleRegList kCalleeSavedFPU = {fs0, fs1, fs2, fs3, fs4,  fs5,
41                                        fs6, fs7, fs8, fs9, fs10, fs11};
42 
43 const int kNumCalleeSavedFPU = kCalleeSavedFPU.Count();
44 
45 const DoubleRegList kCallerSavedFPU = {ft0, ft1, ft2, ft3, ft4,  ft5, ft6,
46                                        ft7, fa0, fa1, fa2, fa3,  fa4, fa5,
47                                        fa6, fa7, ft8, ft9, ft10, ft11};
48 
49 const int kNumCallerSavedFPU = kCallerSavedFPU.Count();
50 
51 // Number of registers for which space is reserved in safepoints. Must be a
52 // multiple of 8.
53 const int kNumSafepointRegisters = 32;
54 
55 // Define the list of registers actually saved at safepoints.
56 // Note that the number of saved registers may be smaller than the reserved
57 // space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
58 const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved;
59 const int kNumSafepointSavedRegisters = kNumJSCallerSaved + kNumCalleeSaved;
60 
61 }  // namespace internal
62 }  // namespace v8
63 
64 #endif  // V8_CODEGEN_RISCV64_REGLIST_RISCV64_H_
65