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_X64_H_ | 5 #ifndef VM_CONSTANTS_X64_H_ |
6 #define VM_CONSTANTS_X64_H_ | 6 #define VM_CONSTANTS_X64_H_ |
7 | 7 |
8 namespace dart { | 8 namespace dart { |
9 | 9 |
10 enum Register { | 10 enum Register { |
11 kFirstFreeCpuRegister = 0, | |
12 RAX = 0, | 11 RAX = 0, |
13 RCX = 1, | 12 RCX = 1, |
14 RDX = 2, | 13 RDX = 2, |
15 RBX = 3, | 14 RBX = 3, |
16 RSP = 4, | 15 RSP = 4, |
17 RBP = 5, | 16 RBP = 5, |
18 RSI = 6, | 17 RSI = 6, |
19 RDI = 7, | 18 RDI = 7, |
20 R8 = 8, | 19 R8 = 8, |
21 R9 = 9, | 20 R9 = 9, |
22 R10 = 10, | 21 R10 = 10, |
23 R11 = 11, | 22 R11 = 11, |
24 R12 = 12, | 23 R12 = 12, |
25 R13 = 13, | 24 R13 = 13, |
26 R14 = 14, | 25 R14 = 14, |
27 R15 = 15, | 26 R15 = 15, |
28 kLastFreeCpuRegister = 15, | |
29 kNumberOfCpuRegisters = 16, | 27 kNumberOfCpuRegisters = 16, |
30 kNoRegister = -1 // Signals an illegal register. | 28 kNoRegister = -1, // Signals an illegal register. |
31 }; | 29 }; |
32 | 30 |
33 | 31 |
34 enum ByteRegister { | 32 enum ByteRegister { |
35 AL = 0, | 33 AL = 0, |
36 CL = 1, | 34 CL = 1, |
37 DL = 2, | 35 DL = 2, |
38 BL = 3, | 36 BL = 3, |
39 AH = 4, | 37 AH = 4, |
40 CH = 5, | 38 CH = 5, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 const Register CTX = R12; // Location of current context at method entry. | 87 const Register CTX = R12; // Location of current context at method entry. |
90 // Caches object pool pointer in generated code. | 88 // Caches object pool pointer in generated code. |
91 const Register PP = R15; | 89 const Register PP = R15; |
92 const Register SPREG = RSP; // Stack pointer register. | 90 const Register SPREG = RSP; // Stack pointer register. |
93 const Register FPREG = RBP; // Frame pointer register. | 91 const Register FPREG = RBP; // Frame pointer register. |
94 const Register ICREG = RBX; // IC data register. | 92 const Register ICREG = RBX; // IC data register. |
95 const Register ARGS_DESC_REG = R10; // Arguments descriptor register. | 93 const Register ARGS_DESC_REG = R10; // Arguments descriptor register. |
96 const Register CODE_REG = R12; | 94 const Register CODE_REG = R12; |
97 const Register THR = R14; // Caches current thread in generated code. | 95 const Register THR = R14; // Caches current thread in generated code. |
98 | 96 |
| 97 |
99 // Exception object is passed in this register to the catch handlers when an | 98 // Exception object is passed in this register to the catch handlers when an |
100 // exception is thrown. | 99 // exception is thrown. |
101 const Register kExceptionObjectReg = RAX; | 100 const Register kExceptionObjectReg = RAX; |
102 | 101 |
103 // Stack trace object is passed in this register to the catch handlers when | 102 // Stack trace object is passed in this register to the catch handlers when |
104 // an exception is thrown. | 103 // an exception is thrown. |
105 const Register kStackTraceObjectReg = RDX; | 104 const Register kStackTraceObjectReg = RDX; |
106 | 105 |
107 | 106 |
| 107 typedef uint32_t RegList; |
| 108 const RegList kAllCpuRegistersList = 0xFFFF; |
| 109 |
| 110 const RegList kReservedCpuRegisters = |
| 111 (1 << SPREG) | |
| 112 (1 << FPREG) | |
| 113 (1 << TMP) | |
| 114 (1 << PP) | |
| 115 (1 << THR); |
| 116 // CPU registers available to Dart allocator. |
| 117 const RegList kDartAvailableCpuRegs = |
| 118 kAllCpuRegistersList & ~kReservedCpuRegisters; |
| 119 |
| 120 |
108 enum ScaleFactor { | 121 enum ScaleFactor { |
109 TIMES_1 = 0, | 122 TIMES_1 = 0, |
110 TIMES_2 = 1, | 123 TIMES_2 = 1, |
111 TIMES_4 = 2, | 124 TIMES_4 = 2, |
112 TIMES_8 = 3, | 125 TIMES_8 = 3, |
113 TIMES_16 = 4, | 126 TIMES_16 = 4, |
114 TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1 | 127 TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1 |
115 }; | 128 }; |
116 | 129 |
117 | 130 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 }; | 236 }; |
224 | 237 |
225 | 238 |
226 // The largest multibyte nop we will emit. This could go up to 15 if it | 239 // The largest multibyte nop we will emit. This could go up to 15 if it |
227 // becomes important to us. | 240 // becomes important to us. |
228 const int MAX_NOP_SIZE = 8; | 241 const int MAX_NOP_SIZE = 8; |
229 | 242 |
230 } // namespace dart | 243 } // namespace dart |
231 | 244 |
232 #endif // VM_CONSTANTS_X64_H_ | 245 #endif // VM_CONSTANTS_X64_H_ |
OLD | NEW |