OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_CONSTANTS_MIPS_H_ | 5 #ifndef VM_CONSTANTS_MIPS_H_ |
6 #define VM_CONSTANTS_MIPS_H_ | 6 #define VM_CONSTANTS_MIPS_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
11 | 11 |
12 enum Register { | 12 enum Register { |
13 R0 = 0, | 13 R0 = 0, |
14 R1 = 1, | 14 R1 = 1, // AT aka TMP |
15 kFirstFreeCpuRegister = 2, | |
16 R2 = 2, | 15 R2 = 2, |
17 R3 = 3, | 16 R3 = 3, |
18 R4 = 4, | 17 R4 = 4, |
19 R5 = 5, | 18 R5 = 5, |
20 R6 = 6, | 19 R6 = 6, |
21 R7 = 7, | 20 R7 = 7, |
22 R8 = 8, | 21 R8 = 8, |
23 R9 = 9, | 22 R9 = 9, |
24 R10 = 10, | 23 R10 = 10, |
25 R11 = 11, | 24 R11 = 11, |
26 R12 = 12, | 25 R12 = 12, |
27 R13 = 13, | 26 R13 = 13, |
28 R14 = 14, | 27 R14 = 14, |
29 R15 = 15, | 28 R15 = 15, |
30 R16 = 16, | 29 R16 = 16, |
31 R17 = 17, | 30 R17 = 17, |
32 R18 = 18, | 31 R18 = 18, |
33 R19 = 19, | 32 R19 = 19, // THR |
34 R20 = 20, | 33 R20 = 20, |
35 R21 = 21, | 34 R21 = 21, |
36 kLastFreeCpuRegister = 21, | 35 R22 = 22, // CTX |
37 R22 = 22, | 36 R23 = 23, // PP |
38 R23 = 23, | |
39 R24 = 24, | 37 R24 = 24, |
40 R25 = 25, | 38 R25 = 25, |
41 R26 = 26, | 39 R26 = 26, |
42 R27 = 27, | 40 R27 = 27, |
43 R28 = 28, | 41 R28 = 28, |
44 R29 = 29, | 42 R29 = 29, // SP |
45 R30 = 30, | 43 R30 = 30, // FP |
46 R31 = 31, | 44 R31 = 31, // RA |
47 kNumberOfCpuRegisters = 32, | 45 kNumberOfCpuRegisters = 32, |
48 IMM = 32, // Positive value is easier to encode than kNoRegister in bitfield. | 46 IMM = 32, // Positive value is easier to encode than kNoRegister in bitfield. |
49 kNoRegister = -1, | 47 kNoRegister = -1, // Signals an illegal register. |
| 48 |
50 | 49 |
51 // Register aliases. | 50 // Register aliases. |
52 ZR = R0, | 51 ZR = R0, |
53 AT = R1, | 52 AT = R1, |
54 | 53 |
55 V0 = R2, | 54 V0 = R2, |
56 V1 = R3, | 55 V1 = R3, |
57 | 56 |
58 A0 = R4, | 57 A0 = R4, |
59 A1 = R5, | 58 A1 = R5, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 const Register CTX = S6; // Location of current context at method entry. | 180 const Register CTX = S6; // Location of current context at method entry. |
182 const Register CODE_REG = S6; | 181 const Register CODE_REG = S6; |
183 const Register PP = S7; // Caches object pool pointer in generated code. | 182 const Register PP = S7; // Caches object pool pointer in generated code. |
184 const Register SPREG = SP; // Stack pointer register. | 183 const Register SPREG = SP; // Stack pointer register. |
185 const Register FPREG = FP; // Frame pointer register. | 184 const Register FPREG = FP; // Frame pointer register. |
186 const Register LRREG = RA; // Link register. | 185 const Register LRREG = RA; // Link register. |
187 const Register ICREG = S5; // IC data register. | 186 const Register ICREG = S5; // IC data register. |
188 const Register ARGS_DESC_REG = S4; | 187 const Register ARGS_DESC_REG = S4; |
189 const Register THR = S3; // Caches current thread in generated code. | 188 const Register THR = S3; // Caches current thread in generated code. |
190 | 189 |
| 190 |
191 // The code that generates a comparison can be far away from the code that | 191 // The code that generates a comparison can be far away from the code that |
192 // generates the branch that uses the result of that comparison. In this case, | 192 // generates the branch that uses the result of that comparison. In this case, |
193 // CMPRES1 and CMPRES2 are used for the results of the comparison. We need two | 193 // CMPRES1 and CMPRES2 are used for the results of the comparison. We need two |
194 // since TMP is clobbered by a far branch. | 194 // since TMP is clobbered by a far branch. |
195 const Register CMPRES1 = T8; | 195 const Register CMPRES1 = T8; |
196 const Register CMPRES2 = T9; | 196 const Register CMPRES2 = T9; |
197 | 197 |
198 // Exception object is passed in this register to the catch handlers when an | 198 // Exception object is passed in this register to the catch handlers when an |
199 // exception is thrown. | 199 // exception is thrown. |
200 const Register kExceptionObjectReg = V0; | 200 const Register kExceptionObjectReg = V0; |
201 | 201 |
202 // Stack trace object is passed in this register to the catch handlers when | 202 // Stack trace object is passed in this register to the catch handlers when |
203 // an exception is thrown. | 203 // an exception is thrown. |
204 const Register kStackTraceObjectReg = V1; | 204 const Register kStackTraceObjectReg = V1; |
205 | 205 |
206 | 206 |
207 typedef uint32_t RegList; | 207 typedef uint32_t RegList; |
208 const RegList kAllCpuRegistersList = 0xFFFFFFFF; | 208 const RegList kAllCpuRegistersList = 0xFFFFFFFF; |
209 | 209 |
210 | |
211 const RegList kAbiArgumentCpuRegs = | 210 const RegList kAbiArgumentCpuRegs = |
212 (1 << A0) | (1 << A1) | (1 << A2) | (1 << A3); | 211 (1 << A0) | (1 << A1) | (1 << A2) | (1 << A3); |
213 const RegList kAbiPreservedCpuRegs = | 212 const RegList kAbiPreservedCpuRegs = |
214 (1 << S0) | (1 << S1) | (1 << S2) | (1 << S3) | | 213 (1 << S0) | (1 << S1) | (1 << S2) | (1 << S3) | |
215 (1 << S4) | (1 << S5) | (1 << S6) | (1 << S7); | 214 (1 << S4) | (1 << S5) | (1 << S6) | (1 << S7); |
216 const int kAbiPreservedCpuRegCount = 8; | 215 const int kAbiPreservedCpuRegCount = 8; |
217 | 216 |
218 // FPU registers 20 - 31 are preserved across calls. | 217 // FPU registers 20 - 31 are preserved across calls. |
219 const FRegister kAbiFirstPreservedFpuReg = F20; | 218 const FRegister kAbiFirstPreservedFpuReg = F20; |
220 const FRegister kAbiLastPreservedFpuReg = | 219 const FRegister kAbiLastPreservedFpuReg = |
221 static_cast<FRegister>(kNumberOfFRegisters - 1); | 220 static_cast<FRegister>(kNumberOfFRegisters - 1); |
222 const int kAbiPreservedFpuRegCount = 12; | 221 const int kAbiPreservedFpuRegCount = 12; |
223 | 222 |
| 223 const RegList kReservedCpuRegisters = |
| 224 (1 << SPREG) | |
| 225 (1 << FPREG) | |
| 226 (1 << TMP) | |
| 227 (1 << PP) | |
| 228 (1 << THR) | |
| 229 (1 << CTX) | |
| 230 (1 << ZR) | |
| 231 (1 << CMPRES1) | |
| 232 (1 << CMPRES2) | |
| 233 (1 << K0) | |
| 234 (1 << K1) | |
| 235 (1 << GP) | |
| 236 (1 << RA); |
224 // CPU registers available to Dart allocator. | 237 // CPU registers available to Dart allocator. |
225 const RegList kDartAvailableCpuRegs = | 238 const RegList kDartAvailableCpuRegs = |
226 (1 << R2) | (1 << R3) | (1 << R4) | (1 << R5) | | 239 kAllCpuRegistersList & ~kReservedCpuRegisters; |
227 (1 << R6) | (1 << R7) | (1 << R8) | (1 << R9) | | 240 // Registers available to Dart that are not preserved by runtime calls. |
228 (1 << R10) | (1 << R11) | (1 << R12) | (1 << R13) | | |
229 (1 << R14) | (1 << R15) | (1 << R16) | (1 << R17) | | |
230 (1 << R18) | (1 << R19) | (1 << R20) | (1 << R21); | |
231 const RegList kDartVolatileCpuRegs = | 241 const RegList kDartVolatileCpuRegs = |
232 kDartAvailableCpuRegs & ~kAbiPreservedCpuRegs; | 242 kDartAvailableCpuRegs & ~kAbiPreservedCpuRegs; |
233 const int kDartVolatileCpuRegCount = 14; | 243 const int kDartVolatileCpuRegCount = 14; |
234 const Register kDartFirstVolatileCpuReg = R2; | 244 const Register kDartFirstVolatileCpuReg = R2; |
235 const Register kDartLastVolatileCpuReg = R15; | 245 const Register kDartLastVolatileCpuReg = R15; |
236 | 246 |
237 // FPU registers 0 - 19 are not preserved across calls. | 247 // FPU registers 0 - 19 are not preserved across calls. |
238 const FRegister kDartFirstVolatileFpuReg = F0; | 248 const FRegister kDartFirstVolatileFpuReg = F0; |
239 const FRegister kDartLastVolatileFpuReg = F19; | 249 const FRegister kDartLastVolatileFpuReg = F19; |
240 const int kDartVolatileFpuRegCount = 20; | 250 const int kDartVolatileFpuRegCount = 20; |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 #endif // defined(DEBUG) | 651 #endif // defined(DEBUG) |
642 | 652 |
643 private: | 653 private: |
644 DISALLOW_ALLOCATION(); | 654 DISALLOW_ALLOCATION(); |
645 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 655 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
646 }; | 656 }; |
647 | 657 |
648 } // namespace dart | 658 } // namespace dart |
649 | 659 |
650 #endif // VM_CONSTANTS_MIPS_H_ | 660 #endif // VM_CONSTANTS_MIPS_H_ |
OLD | NEW |