OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64_H_ | 5 #ifndef VM_CONSTANTS_ARM64_H_ |
6 #define VM_CONSTANTS_ARM64_H_ | 6 #define VM_CONSTANTS_ARM64_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 kFirstFreeCpuRegister = 0, | 13 kFirstFreeCpuRegister = 0, |
14 R0 = 0, | 14 R0 = 0, |
15 R1 = 1, | 15 R1 = 1, |
16 R2 = 2, | 16 R2 = 2, |
17 R3 = 3, | 17 R3 = 3, |
18 R4 = 4, | 18 R4 = 4, |
19 R5 = 5, | 19 R5 = 5, |
20 R6 = 6, | 20 R6 = 6, |
21 R7 = 7, | 21 R7 = 7, |
22 R8 = 8, | 22 R8 = 8, |
23 R9 = 9, | 23 R9 = 9, |
24 R10 = 10, | 24 R10 = 10, |
25 R11 = 11, | 25 R11 = 11, |
26 R12 = 12, | 26 R12 = 12, |
27 R13 = 13, | 27 R13 = 13, |
28 R14 = 14, | 28 R14 = 14, |
29 R15 = 15, | 29 R15 = 15, |
30 R16 = 16, | 30 R16 = 16, // IP0 aka TMP |
31 R17 = 17, | 31 R17 = 17, // IP1 aka TMP2 |
32 R18 = 18, | 32 R18 = 18, |
33 R19 = 19, | 33 R19 = 19, |
34 R20 = 20, | 34 R20 = 20, |
35 R21 = 21, | 35 R21 = 21, |
36 R22 = 22, | 36 R22 = 22, |
37 R23 = 23, | 37 R23 = 23, |
38 R24 = 24, | 38 R24 = 24, |
39 kLastFreeCpuRegister = 24, | 39 R25 = 25, |
40 R25 = 25, // IP0 | 40 R26 = 26, |
41 R26 = 26, // IP1 | 41 kLastFreeCpuRegister = 26, |
42 R27 = 27, // PP | 42 R27 = 27, // PP |
43 R28 = 28, // CTX | 43 R28 = 28, // CTX |
44 R29 = 29, // FP | 44 R29 = 29, // FP |
45 R30 = 30, // LR | 45 R30 = 30, // LR |
46 R31 = 31, // ZR, SP | 46 R31 = 31, // ZR, SP |
47 kNumberOfCpuRegisters = 32, | 47 kNumberOfCpuRegisters = 32, |
48 kNoRegister = -1, | 48 kNoRegister = -1, |
49 | 49 |
50 // These registers both use the encoding R31, but to avoid mistakes we give | 50 // These registers both use the encoding R31, but to avoid mistakes we give |
51 // them different values, and then translate before encoding. | 51 // them different values, and then translate before encoding. |
52 SP = 32, | 52 SP = 32, |
53 ZR = 33, | 53 ZR = 33, |
54 | 54 |
55 // Aliases. | 55 // Aliases. |
56 IP0 = R25, | 56 IP0 = R16, |
57 IP1 = R26, | 57 IP1 = R17, |
58 FP = R29, | 58 FP = R29, |
59 LR = R30, | 59 LR = R30, |
60 }; | 60 }; |
61 | 61 |
62 enum VRegister { | 62 enum VRegister { |
63 V0 = 0, | 63 V0 = 0, |
64 V1 = 1, | 64 V1 = 1, |
65 V2 = 2, | 65 V2 = 2, |
66 V3 = 3, | 66 V3 = 3, |
67 V4 = 4, | 67 V4 = 4, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const VRegister VTMP0 = V30; | 100 const VRegister VTMP0 = V30; |
101 const VRegister VTMP1 = V31; | 101 const VRegister VTMP1 = V31; |
102 | 102 |
103 // Architecture independent aliases. | 103 // Architecture independent aliases. |
104 typedef VRegister FpuRegister; | 104 typedef VRegister FpuRegister; |
105 const FpuRegister FpuTMP = VTMP0; | 105 const FpuRegister FpuTMP = VTMP0; |
106 const int kNumberOfFpuRegisters = kNumberOfVRegisters; | 106 const int kNumberOfFpuRegisters = kNumberOfVRegisters; |
107 const FpuRegister kNoFpuRegister = kNoVRegister; | 107 const FpuRegister kNoFpuRegister = kNoVRegister; |
108 | 108 |
109 // Register aliases. | 109 // Register aliases. |
110 const Register TMP = R25; // Used as scratch register by assembler. | 110 const Register TMP = R16; // Used as scratch register by assembler. |
111 const Register TMP0 = R25; | 111 const Register TMP2 = R17; |
112 const Register TMP1 = R26; | |
113 const Register CTX = R27; // Caches current context in generated code. | 112 const Register CTX = R27; // Caches current context in generated code. |
114 const Register PP = R26; // Caches object pool pointer in generated code. | 113 const Register PP = R26; // Caches object pool pointer in generated code. |
115 const Register SPREG = R31; // Stack pointer register. | 114 const Register SPREG = R31; // Stack pointer register. |
116 const Register FPREG = FP; // Frame pointer register. | 115 const Register FPREG = FP; // Frame pointer register. |
117 const Register ICREG = R5; // IC data register. | 116 const Register ICREG = R5; // IC data register. |
118 | 117 |
119 // Exception object is passed in this register to the catch handlers when an | 118 // Exception object is passed in this register to the catch handlers when an |
120 // exception is thrown. | 119 // exception is thrown. |
121 const Register kExceptionObjectReg = R0; | 120 const Register kExceptionObjectReg = R0; |
122 | 121 |
(...skipping 24 matching lines...) Expand all Loading... |
147 const VRegister kAbiFirstPreservedFpuReg = V8; | 146 const VRegister kAbiFirstPreservedFpuReg = V8; |
148 const VRegister kAbiLastPreservedFpuReg = V15; | 147 const VRegister kAbiLastPreservedFpuReg = V15; |
149 const int kAbiPreservedFpuRegCount = 8; | 148 const int kAbiPreservedFpuRegCount = 8; |
150 | 149 |
151 // CPU registers available to Dart allocator. | 150 // CPU registers available to Dart allocator. |
152 const RegList kDartAvailableCpuRegs = | 151 const RegList kDartAvailableCpuRegs = |
153 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) | | 152 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) | |
154 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7) | | 153 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7) | |
155 (1 << R8) | (1 << R9) | (1 << R10) | (1 << R11) | | 154 (1 << R8) | (1 << R9) | (1 << R10) | (1 << R11) | |
156 (1 << R12) | (1 << R13) | (1 << R14) | (1 << R15) | | 155 (1 << R12) | (1 << R13) | (1 << R14) | (1 << R15) | |
157 (1 << R16) | (1 << R17) | (1 << R18) | (1 << R19) | | 156 (1 << R18) | (1 << R19) | (1 << R20) | (1 << R21) | |
158 (1 << R20) | (1 << R21) | (1 << R22) | (1 << R23) | | 157 (1 << R22) | (1 << R23) | (1 << R24) | (1 << R25) | |
159 (1 << R24); | 158 (1 << R26); |
160 | 159 |
161 // Registers available to Dart that are not preserved by runtime calls. | 160 // Registers available to Dart that are not preserved by runtime calls. |
162 const RegList kDartVolatileCpuRegs = | 161 const RegList kDartVolatileCpuRegs = |
163 kDartAvailableCpuRegs & ~kAbiPreservedCpuRegs; | 162 kDartAvailableCpuRegs & ~kAbiPreservedCpuRegs; |
164 const int kDartVolatileCpuRegCount = 19; | 163 const int kDartVolatileCpuRegCount = 17; |
165 const VRegister kDartFirstVolatileFpuReg = V0; | 164 const VRegister kDartFirstVolatileFpuReg = V0; |
166 const VRegister kDartLastVolatileFpuReg = V7; | 165 const VRegister kDartLastVolatileFpuReg = V7; |
167 const int kDartVolatileFpuRegCount = 8; | 166 const int kDartVolatileFpuRegCount = 8; |
168 | 167 |
169 static inline Register ConcreteRegister(Register r) { | 168 static inline Register ConcreteRegister(Register r) { |
170 return ((r == ZR) || (r == SP)) ? R31 : r; | 169 return ((r == ZR) || (r == SP)) ? R31 : r; |
171 } | 170 } |
172 | 171 |
173 // Values for the condition field as defined in section A3.2. | 172 // Values for the condition field as defined in section A3.2. |
174 enum Condition { | 173 enum Condition { |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } | 763 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } |
765 | 764 |
766 private: | 765 private: |
767 DISALLOW_ALLOCATION(); | 766 DISALLOW_ALLOCATION(); |
768 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 767 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
769 }; | 768 }; |
770 | 769 |
771 } // namespace dart | 770 } // namespace dart |
772 | 771 |
773 #endif // VM_CONSTANTS_ARM64_H_ | 772 #endif // VM_CONSTANTS_ARM64_H_ |
OLD | NEW |