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_ARM_H_ | 5 #ifndef VM_CONSTANTS_ARM_H_ |
6 #define VM_CONSTANTS_ARM_H_ | 6 #define VM_CONSTANTS_ARM_H_ |
7 | 7 |
8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 // We support both VFPv3-D16 and VFPv3-D32 profiles, but currently only one at | 13 // We support both VFPv3-D16 and VFPv3-D32 profiles, but currently only one at |
14 // a time. | 14 // a time. |
15 #if defined(__ARM_ARCH_7A__) | 15 #if defined(__ARM_ARCH_7A__) |
16 #define VFPv3_D32 | 16 #define VFPv3_D32 |
17 #elif defined(TARGET_ARCH_ARM) && !defined(HOST_ARCH_ARM) | 17 #elif defined(TARGET_ARCH_ARM) && !defined(HOST_ARCH_ARM) |
18 // If we're running in the simulator, use all 32. | 18 // If we're running in the simulator, use all 32. |
19 #define VFPv3_D32 | 19 #define VFPv3_D32 |
20 #else | 20 #else |
21 #define VFPv3_D16 | 21 #define VFPv3_D16 |
22 #endif | 22 #endif |
23 #if defined(VFPv3_D16) == defined(VFPv3_D32) | 23 #if defined(VFPv3_D16) == defined(VFPv3_D32) |
24 #error "Exactly one of VFPv3_D16 or VFPv3_D32 can be defined at a time." | 24 #error "Exactly one of VFPv3_D16 or VFPv3_D32 can be defined at a time." |
25 #endif | 25 #endif |
26 | 26 |
27 | 27 |
28 enum Register { | 28 enum Register { |
29 kNoRegister = -1, | |
30 kFirstFreeCpuRegister = 0, | |
31 R0 = 0, | 29 R0 = 0, |
32 R1 = 1, | 30 R1 = 1, |
33 R2 = 2, | 31 R2 = 2, |
34 R3 = 3, | 32 R3 = 3, |
35 R4 = 4, | 33 R4 = 4, |
36 R5 = 5, | 34 R5 = 5, |
37 R6 = 6, | 35 R6 = 6, |
38 R7 = 7, | 36 R7 = 7, |
39 R8 = 8, | 37 R8 = 8, // THR |
40 R9 = 9, | 38 R9 = 9, // PP |
41 R10 = 10, | 39 R10 = 10, // CTX |
42 R11 = 11, | 40 R11 = 11, // FP |
43 R12 = 12, | 41 R12 = 12, // IP aka TMP |
44 R13 = 13, | 42 R13 = 13, // SP |
45 R14 = 14, | 43 R14 = 14, // LR |
46 kLastFreeCpuRegister = 14, | 44 R15 = 15, // PC |
47 R15 = 15, | 45 kNumberOfCpuRegisters = 16, |
| 46 kNoRegister = -1, // Signals an illegal register. |
| 47 |
| 48 // Aliases. |
48 FP = R11, | 49 FP = R11, |
49 IP = R12, | 50 IP = R12, |
50 SP = R13, | 51 SP = R13, |
51 LR = R14, | 52 LR = R14, |
52 PC = R15, | 53 PC = R15, |
53 kNumberOfCpuRegisters = 16, | |
54 }; | 54 }; |
55 | 55 |
56 | 56 |
57 // Values for single-precision floating point registers. | 57 // Values for single-precision floating point registers. |
58 enum SRegister { | 58 enum SRegister { |
59 kNoSRegister = -1, | 59 kNoSRegister = -1, |
60 S0 = 0, | 60 S0 = 0, |
61 S1 = 1, | 61 S1 = 1, |
62 S2 = 2, | 62 S2 = 2, |
63 S3 = 3, | 63 S3 = 3, |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 const RegList kAbiArgumentCpuRegs = | 262 const RegList kAbiArgumentCpuRegs = |
263 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3); | 263 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3); |
264 const RegList kAbiPreservedCpuRegs = | 264 const RegList kAbiPreservedCpuRegs = |
265 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7) | | 265 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7) | |
266 (1 << R8) | (1 << R9) | (1 << R10); | 266 (1 << R8) | (1 << R9) | (1 << R10); |
267 const int kAbiPreservedCpuRegCount = 7; | 267 const int kAbiPreservedCpuRegCount = 7; |
268 const QRegister kAbiFirstPreservedFpuReg = Q4; | 268 const QRegister kAbiFirstPreservedFpuReg = Q4; |
269 const QRegister kAbiLastPreservedFpuReg = Q7; | 269 const QRegister kAbiLastPreservedFpuReg = Q7; |
270 const int kAbiPreservedFpuRegCount = 4; | 270 const int kAbiPreservedFpuRegCount = 4; |
271 | 271 |
| 272 const RegList kReservedCpuRegisters = |
| 273 (1 << SPREG) | |
| 274 (1 << FPREG) | |
| 275 (1 << TMP) | |
| 276 (1 << PP) | |
| 277 (1 << THR) | |
| 278 (1 << PC); |
272 // CPU registers available to Dart allocator. | 279 // CPU registers available to Dart allocator. |
273 const RegList kDartAvailableCpuRegs = | 280 const RegList kDartAvailableCpuRegs = |
274 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) | | 281 kAllCpuRegistersList & ~kReservedCpuRegisters; |
275 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7) | | |
276 (1 << R8) | (1 << R14); | |
277 | |
278 // Registers available to Dart that are not preserved by runtime calls. | 282 // Registers available to Dart that are not preserved by runtime calls. |
279 const RegList kDartVolatileCpuRegs = | 283 const RegList kDartVolatileCpuRegs = |
280 kDartAvailableCpuRegs & ~kAbiPreservedCpuRegs; | 284 kDartAvailableCpuRegs & ~kAbiPreservedCpuRegs; |
281 const int kDartVolatileCpuRegCount = 5; | 285 const int kDartVolatileCpuRegCount = 5; |
282 const QRegister kDartFirstVolatileFpuReg = Q0; | 286 const QRegister kDartFirstVolatileFpuReg = Q0; |
283 const QRegister kDartLastVolatileFpuReg = Q3; | 287 const QRegister kDartLastVolatileFpuReg = Q3; |
284 const int kDartVolatileFpuRegCount = 4; | 288 const int kDartVolatileFpuRegCount = 4; |
285 | 289 |
286 | 290 |
287 // Values for the condition field as defined in section A3.2. | 291 // Values for the condition field as defined in section A3.2. |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } | 711 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } |
708 | 712 |
709 private: | 713 private: |
710 DISALLOW_ALLOCATION(); | 714 DISALLOW_ALLOCATION(); |
711 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 715 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
712 }; | 716 }; |
713 | 717 |
714 } // namespace dart | 718 } // namespace dart |
715 | 719 |
716 #endif // VM_CONSTANTS_ARM_H_ | 720 #endif // VM_CONSTANTS_ARM_H_ |
OLD | NEW |