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 RUNTIME_VM_CONSTANTS_X64_H_ | 5 #ifndef RUNTIME_VM_CONSTANTS_X64_H_ |
6 #define RUNTIME_VM_CONSTANTS_X64_H_ | 6 #define RUNTIME_VM_CONSTANTS_X64_H_ |
7 | 7 |
8 namespace dart { | 8 namespace dart { |
9 | 9 |
10 enum Register { | 10 enum Register { |
(...skipping 10 matching lines...) Expand all Loading... |
21 R10 = 10, | 21 R10 = 10, |
22 R11 = 11, | 22 R11 = 11, |
23 R12 = 12, | 23 R12 = 12, |
24 R13 = 13, | 24 R13 = 13, |
25 R14 = 14, | 25 R14 = 14, |
26 R15 = 15, | 26 R15 = 15, |
27 kNumberOfCpuRegisters = 16, | 27 kNumberOfCpuRegisters = 16, |
28 kNoRegister = -1, // Signals an illegal register. | 28 kNoRegister = -1, // Signals an illegal register. |
29 }; | 29 }; |
30 | 30 |
31 | |
32 enum ByteRegister { | 31 enum ByteRegister { |
33 AL = 0, | 32 AL = 0, |
34 CL = 1, | 33 CL = 1, |
35 DL = 2, | 34 DL = 2, |
36 BL = 3, | 35 BL = 3, |
37 AH = 4, | 36 AH = 4, |
38 CH = 5, | 37 CH = 5, |
39 DH = 6, | 38 DH = 6, |
40 BH = 7, | 39 BH = 7, |
41 kNoByteRegister = -1 // Signals an illegal register. | 40 kNoByteRegister = -1 // Signals an illegal register. |
42 }; | 41 }; |
43 | 42 |
44 | |
45 enum XmmRegister { | 43 enum XmmRegister { |
46 XMM0 = 0, | 44 XMM0 = 0, |
47 XMM1 = 1, | 45 XMM1 = 1, |
48 XMM2 = 2, | 46 XMM2 = 2, |
49 XMM3 = 3, | 47 XMM3 = 3, |
50 XMM4 = 4, | 48 XMM4 = 4, |
51 XMM5 = 5, | 49 XMM5 = 5, |
52 XMM6 = 6, | 50 XMM6 = 6, |
53 XMM7 = 7, | 51 XMM7 = 7, |
54 XMM8 = 8, | 52 XMM8 = 8, |
55 XMM9 = 9, | 53 XMM9 = 9, |
56 XMM10 = 10, | 54 XMM10 = 10, |
57 XMM11 = 11, | 55 XMM11 = 11, |
58 XMM12 = 12, | 56 XMM12 = 12, |
59 XMM13 = 13, | 57 XMM13 = 13, |
60 XMM14 = 14, | 58 XMM14 = 14, |
61 XMM15 = 15, | 59 XMM15 = 15, |
62 kNumberOfXmmRegisters = 16, | 60 kNumberOfXmmRegisters = 16, |
63 kNoXmmRegister = -1 // Signals an illegal register. | 61 kNoXmmRegister = -1 // Signals an illegal register. |
64 }; | 62 }; |
65 | 63 |
66 | |
67 // Architecture independent aliases. | 64 // Architecture independent aliases. |
68 typedef XmmRegister FpuRegister; | 65 typedef XmmRegister FpuRegister; |
69 const FpuRegister FpuTMP = XMM0; | 66 const FpuRegister FpuTMP = XMM0; |
70 const int kNumberOfFpuRegisters = kNumberOfXmmRegisters; | 67 const int kNumberOfFpuRegisters = kNumberOfXmmRegisters; |
71 const FpuRegister kNoFpuRegister = kNoXmmRegister; | 68 const FpuRegister kNoFpuRegister = kNoXmmRegister; |
72 | 69 |
73 | |
74 enum RexBits { | 70 enum RexBits { |
75 REX_NONE = 0, | 71 REX_NONE = 0, |
76 REX_B = 1 << 0, | 72 REX_B = 1 << 0, |
77 REX_X = 1 << 1, | 73 REX_X = 1 << 1, |
78 REX_R = 1 << 2, | 74 REX_R = 1 << 2, |
79 REX_W = 1 << 3, | 75 REX_W = 1 << 3, |
80 REX_PREFIX = 1 << 6 | 76 REX_PREFIX = 1 << 6 |
81 }; | 77 }; |
82 | 78 |
83 | |
84 // Register aliases. | 79 // Register aliases. |
85 const Register TMP = R11; // Used as scratch register by the assembler. | 80 const Register TMP = R11; // Used as scratch register by the assembler. |
86 const Register TMP2 = kNoRegister; // No second assembler scratch register. | 81 const Register TMP2 = kNoRegister; // No second assembler scratch register. |
87 const Register CTX = R12; // Location of current context at method entry. | 82 const Register CTX = R12; // Location of current context at method entry. |
88 // Caches object pool pointer in generated code. | 83 // Caches object pool pointer in generated code. |
89 const Register PP = R15; | 84 const Register PP = R15; |
90 const Register SPREG = RSP; // Stack pointer register. | 85 const Register SPREG = RSP; // Stack pointer register. |
91 const Register FPREG = RBP; // Frame pointer register. | 86 const Register FPREG = RBP; // Frame pointer register. |
92 const Register ICREG = RBX; // IC data register. | 87 const Register ICREG = RBX; // IC data register. |
93 const Register ARGS_DESC_REG = R10; // Arguments descriptor register. | 88 const Register ARGS_DESC_REG = R10; // Arguments descriptor register. |
94 const Register CODE_REG = R12; | 89 const Register CODE_REG = R12; |
95 const Register THR = R14; // Caches current thread in generated code. | 90 const Register THR = R14; // Caches current thread in generated code. |
96 const Register CALLEE_SAVED_TEMP = RBX; | 91 const Register CALLEE_SAVED_TEMP = RBX; |
97 | 92 |
98 // Exception object is passed in this register to the catch handlers when an | 93 // Exception object is passed in this register to the catch handlers when an |
99 // exception is thrown. | 94 // exception is thrown. |
100 const Register kExceptionObjectReg = RAX; | 95 const Register kExceptionObjectReg = RAX; |
101 | 96 |
102 // Stack trace object is passed in this register to the catch handlers when | 97 // Stack trace object is passed in this register to the catch handlers when |
103 // an exception is thrown. | 98 // an exception is thrown. |
104 const Register kStackTraceObjectReg = RDX; | 99 const Register kStackTraceObjectReg = RDX; |
105 | 100 |
106 | |
107 typedef uint32_t RegList; | 101 typedef uint32_t RegList; |
108 const RegList kAllCpuRegistersList = 0xFFFF; | 102 const RegList kAllCpuRegistersList = 0xFFFF; |
109 | 103 |
110 const RegList kReservedCpuRegisters = | 104 const RegList kReservedCpuRegisters = |
111 (1 << SPREG) | (1 << FPREG) | (1 << TMP) | (1 << PP) | (1 << THR); | 105 (1 << SPREG) | (1 << FPREG) | (1 << TMP) | (1 << PP) | (1 << THR); |
112 // CPU registers available to Dart allocator. | 106 // CPU registers available to Dart allocator. |
113 const RegList kDartAvailableCpuRegs = | 107 const RegList kDartAvailableCpuRegs = |
114 kAllCpuRegistersList & ~kReservedCpuRegisters; | 108 kAllCpuRegistersList & ~kReservedCpuRegisters; |
115 | 109 |
116 | |
117 enum ScaleFactor { | 110 enum ScaleFactor { |
118 TIMES_1 = 0, | 111 TIMES_1 = 0, |
119 TIMES_2 = 1, | 112 TIMES_2 = 1, |
120 TIMES_4 = 2, | 113 TIMES_4 = 2, |
121 TIMES_8 = 3, | 114 TIMES_8 = 3, |
122 TIMES_16 = 4, | 115 TIMES_16 = 4, |
123 TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1 | 116 TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1 |
124 }; | 117 }; |
125 | 118 |
126 | |
127 enum Condition { | 119 enum Condition { |
128 OVERFLOW = 0, | 120 OVERFLOW = 0, |
129 NO_OVERFLOW = 1, | 121 NO_OVERFLOW = 1, |
130 BELOW = 2, | 122 BELOW = 2, |
131 ABOVE_EQUAL = 3, | 123 ABOVE_EQUAL = 3, |
132 EQUAL = 4, | 124 EQUAL = 4, |
133 NOT_EQUAL = 5, | 125 NOT_EQUAL = 5, |
134 BELOW_EQUAL = 6, | 126 BELOW_EQUAL = 6, |
135 ABOVE = 7, | 127 ABOVE = 7, |
136 SIGN = 8, | 128 SIGN = 8, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // to allocate or create instances of class Instr. | 218 // to allocate or create instances of class Instr. |
227 // Use the At(pc) function to create references to Instr. | 219 // Use the At(pc) function to create references to Instr. |
228 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } | 220 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } |
229 | 221 |
230 private: | 222 private: |
231 DISALLOW_ALLOCATION(); | 223 DISALLOW_ALLOCATION(); |
232 // We need to prevent the creation of instances of class Instr. | 224 // We need to prevent the creation of instances of class Instr. |
233 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 225 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
234 }; | 226 }; |
235 | 227 |
236 | |
237 // The largest multibyte nop we will emit. This could go up to 15 if it | 228 // The largest multibyte nop we will emit. This could go up to 15 if it |
238 // becomes important to us. | 229 // becomes important to us. |
239 const int MAX_NOP_SIZE = 8; | 230 const int MAX_NOP_SIZE = 8; |
240 | 231 |
241 } // namespace dart | 232 } // namespace dart |
242 | 233 |
243 #endif // RUNTIME_VM_CONSTANTS_X64_H_ | 234 #endif // RUNTIME_VM_CONSTANTS_X64_H_ |
OLD | NEW |