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 { |
11 RAX = 0, | 11 RAX = 0, |
12 RCX = 1, | 12 RCX = 1, |
13 RDX = 2, | 13 RDX = 2, |
14 RBX = 3, | 14 RBX = 3, |
15 RSP = 4, | 15 RSP = 4, |
16 RBP = 5, | 16 RBP = 5, |
17 RSI = 6, | 17 RSI = 6, |
18 RDI = 7, | 18 RDI = 7, |
19 R8 = 8, | 19 R8 = 8, |
20 R9 = 9, | 20 R9 = 9, |
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 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 | 66 |
67 // Architecture independent aliases. | 67 // Architecture independent aliases. |
68 typedef XmmRegister FpuRegister; | 68 typedef XmmRegister FpuRegister; |
69 const FpuRegister FpuTMP = XMM0; | 69 const FpuRegister FpuTMP = XMM0; |
70 const int kNumberOfFpuRegisters = kNumberOfXmmRegisters; | 70 const int kNumberOfFpuRegisters = kNumberOfXmmRegisters; |
71 const FpuRegister kNoFpuRegister = kNoXmmRegister; | 71 const FpuRegister kNoFpuRegister = kNoXmmRegister; |
72 | 72 |
73 | 73 |
74 enum RexBits { | 74 enum RexBits { |
75 REX_NONE = 0, | 75 REX_NONE = 0, |
76 REX_B = 1 << 0, | 76 REX_B = 1 << 0, |
77 REX_X = 1 << 1, | 77 REX_X = 1 << 1, |
78 REX_R = 1 << 2, | 78 REX_R = 1 << 2, |
79 REX_W = 1 << 3, | 79 REX_W = 1 << 3, |
80 REX_PREFIX = 1 << 6 | 80 REX_PREFIX = 1 << 6 |
81 }; | 81 }; |
82 | 82 |
83 | 83 |
84 // Register aliases. | 84 // Register aliases. |
85 const Register TMP = R11; // Used as scratch register by the assembler. | 85 const Register TMP = R11; // Used as scratch register by the assembler. |
86 const Register TMP2 = kNoRegister; // No second assembler scratch register. | 86 const Register TMP2 = kNoRegister; // No second assembler scratch register. |
87 const Register CTX = R12; // Location of current context at method entry. | 87 const Register CTX = R12; // Location of current context at method entry. |
88 // Caches object pool pointer in generated code. | 88 // Caches object pool pointer in generated code. |
89 const Register PP = R15; | 89 const Register PP = R15; |
90 const Register SPREG = RSP; // Stack pointer register. | 90 const Register SPREG = RSP; // Stack pointer register. |
91 const Register FPREG = RBP; // Frame pointer register. | 91 const Register FPREG = RBP; // Frame pointer register. |
92 const Register ICREG = RBX; // IC data register. | 92 const Register ICREG = RBX; // IC data register. |
93 const Register ARGS_DESC_REG = R10; // Arguments descriptor register. | 93 const Register ARGS_DESC_REG = R10; // Arguments descriptor register. |
94 const Register CODE_REG = R12; | 94 const Register CODE_REG = R12; |
95 const Register THR = R14; // Caches current thread in generated code. | 95 const Register THR = R14; // Caches current thread in generated code. |
96 const Register CALLEE_SAVED_TEMP = RBX; | 96 const Register CALLEE_SAVED_TEMP = RBX; |
97 | 97 |
98 // 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 |
99 // exception is thrown. | 99 // exception is thrown. |
100 const Register kExceptionObjectReg = RAX; | 100 const Register kExceptionObjectReg = RAX; |
101 | 101 |
102 // 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 |
103 // an exception is thrown. | 103 // an exception is thrown. |
104 const Register kStackTraceObjectReg = RDX; | 104 const Register kStackTraceObjectReg = RDX; |
105 | 105 |
106 | 106 |
107 typedef uint32_t RegList; | 107 typedef uint32_t RegList; |
108 const RegList kAllCpuRegistersList = 0xFFFF; | 108 const RegList kAllCpuRegistersList = 0xFFFF; |
109 | 109 |
110 const RegList kReservedCpuRegisters = | 110 const RegList kReservedCpuRegisters = |
111 (1 << SPREG) | | 111 (1 << SPREG) | (1 << FPREG) | (1 << TMP) | (1 << PP) | (1 << THR); |
112 (1 << FPREG) | | |
113 (1 << TMP) | | |
114 (1 << PP) | | |
115 (1 << THR); | |
116 // CPU registers available to Dart allocator. | 112 // CPU registers available to Dart allocator. |
117 const RegList kDartAvailableCpuRegs = | 113 const RegList kDartAvailableCpuRegs = |
118 kAllCpuRegistersList & ~kReservedCpuRegisters; | 114 kAllCpuRegistersList & ~kReservedCpuRegisters; |
119 | 115 |
120 | 116 |
121 enum ScaleFactor { | 117 enum ScaleFactor { |
122 TIMES_1 = 0, | 118 TIMES_1 = 0, |
123 TIMES_2 = 1, | 119 TIMES_2 = 1, |
124 TIMES_4 = 2, | 120 TIMES_4 = 2, |
125 TIMES_8 = 3, | 121 TIMES_8 = 3, |
126 TIMES_16 = 4, | 122 TIMES_16 = 4, |
127 TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1 | 123 TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1 |
128 }; | 124 }; |
129 | 125 |
130 | 126 |
131 enum Condition { | 127 enum Condition { |
132 OVERFLOW = 0, | 128 OVERFLOW = 0, |
133 NO_OVERFLOW = 1, | 129 NO_OVERFLOW = 1, |
134 BELOW = 2, | 130 BELOW = 2, |
135 ABOVE_EQUAL = 3, | 131 ABOVE_EQUAL = 3, |
136 EQUAL = 4, | 132 EQUAL = 4, |
137 NOT_EQUAL = 5, | 133 NOT_EQUAL = 5, |
138 BELOW_EQUAL = 6, | 134 BELOW_EQUAL = 6, |
139 ABOVE = 7, | 135 ABOVE = 7, |
140 SIGN = 8, | 136 SIGN = 8, |
141 NOT_SIGN = 9, | 137 NOT_SIGN = 9, |
142 PARITY_EVEN = 10, | 138 PARITY_EVEN = 10, |
143 PARITY_ODD = 11, | 139 PARITY_ODD = 11, |
144 LESS = 12, | 140 LESS = 12, |
145 GREATER_EQUAL = 13, | 141 GREATER_EQUAL = 13, |
146 LESS_EQUAL = 14, | 142 LESS_EQUAL = 14, |
147 GREATER = 15, | 143 GREATER = 15, |
148 | 144 |
149 ZERO = EQUAL, | 145 ZERO = EQUAL, |
150 NOT_ZERO = NOT_EQUAL, | 146 NOT_ZERO = NOT_EQUAL, |
151 NEGATIVE = SIGN, | 147 NEGATIVE = SIGN, |
152 POSITIVE = NOT_SIGN, | 148 POSITIVE = NOT_SIGN, |
153 CARRY = BELOW, | 149 CARRY = BELOW, |
154 NOT_CARRY = ABOVE_EQUAL | 150 NOT_CARRY = ABOVE_EQUAL |
155 }; | 151 }; |
156 | 152 |
157 #define R(reg) (1 << (reg)) | 153 #define R(reg) (1 << (reg)) |
158 | 154 |
159 #if defined(_WIN64) | 155 #if defined(_WIN64) |
160 class CallingConventions { | 156 class CallingConventions { |
161 public: | 157 public: |
162 static const Register kArg1Reg = RCX; | 158 static const Register kArg1Reg = RCX; |
163 static const Register kArg2Reg = RDX; | 159 static const Register kArg2Reg = RDX; |
164 static const Register kArg3Reg = R8; | 160 static const Register kArg3Reg = R8; |
(...skipping 21 matching lines...) Expand all Loading... |
186 class CallingConventions { | 182 class CallingConventions { |
187 public: | 183 public: |
188 static const Register kArg1Reg = RDI; | 184 static const Register kArg1Reg = RDI; |
189 static const Register kArg2Reg = RSI; | 185 static const Register kArg2Reg = RSI; |
190 static const Register kArg3Reg = RDX; | 186 static const Register kArg3Reg = RDX; |
191 static const Register kArg4Reg = RCX; | 187 static const Register kArg4Reg = RCX; |
192 static const Register kArg5Reg = R8; | 188 static const Register kArg5Reg = R8; |
193 static const Register kArg6Reg = R9; | 189 static const Register kArg6Reg = R9; |
194 static const intptr_t kShadowSpaceBytes = 0; | 190 static const intptr_t kShadowSpaceBytes = 0; |
195 | 191 |
196 static const intptr_t kVolatileCpuRegisters = | 192 static const intptr_t kVolatileCpuRegisters = R(RAX) | R(RCX) | R(RDX) | |
197 R(RAX) | R(RCX) | R(RDX) | R(RSI) | R(RDI) | | 193 R(RSI) | R(RDI) | R(R8) | |
198 R(R8) | R(R9) | R(R10) | R(R11); | 194 R(R9) | R(R10) | R(R11); |
199 | 195 |
200 static const intptr_t kVolatileXmmRegisters = | 196 static const intptr_t kVolatileXmmRegisters = |
201 R(XMM0) | R(XMM1) | R(XMM2) | R(XMM3) | R(XMM4) | | 197 R(XMM0) | R(XMM1) | R(XMM2) | R(XMM3) | R(XMM4) | R(XMM5) | R(XMM6) | |
202 R(XMM5) | R(XMM6) | R(XMM7) | R(XMM8) | R(XMM9) | | 198 R(XMM7) | R(XMM8) | R(XMM9) | R(XMM10) | R(XMM11) | R(XMM12) | R(XMM13) | |
203 R(XMM10) | R(XMM11) | R(XMM12) | R(XMM13) | R(XMM14) | R(XMM15); | 199 R(XMM14) | R(XMM15); |
204 | 200 |
205 static const intptr_t kCalleeSaveCpuRegisters = | 201 static const intptr_t kCalleeSaveCpuRegisters = |
206 R(RBX) | R(R12) | R(R13) | R(R14) | R(R15); | 202 R(RBX) | R(R12) | R(R13) | R(R14) | R(R15); |
207 | 203 |
208 static const intptr_t kCalleeSaveXmmRegisters = 0; | 204 static const intptr_t kCalleeSaveXmmRegisters = 0; |
209 }; | 205 }; |
210 #endif | 206 #endif |
211 | 207 |
212 #undef R | 208 #undef R |
213 | 209 |
(...skipping 22 matching lines...) Expand all Loading... |
236 }; | 232 }; |
237 | 233 |
238 | 234 |
239 // The largest multibyte nop we will emit. This could go up to 15 if it | 235 // The largest multibyte nop we will emit. This could go up to 15 if it |
240 // becomes important to us. | 236 // becomes important to us. |
241 const int MAX_NOP_SIZE = 8; | 237 const int MAX_NOP_SIZE = 8; |
242 | 238 |
243 } // namespace dart | 239 } // namespace dart |
244 | 240 |
245 #endif // RUNTIME_VM_CONSTANTS_X64_H_ | 241 #endif // RUNTIME_VM_CONSTANTS_X64_H_ |
OLD | NEW |