OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 V(xmm7) \ | 176 V(xmm7) \ |
177 V(xmm8) \ | 177 V(xmm8) \ |
178 V(xmm9) \ | 178 V(xmm9) \ |
179 V(xmm10) \ | 179 V(xmm10) \ |
180 V(xmm11) \ | 180 V(xmm11) \ |
181 V(xmm12) \ | 181 V(xmm12) \ |
182 V(xmm13) \ | 182 V(xmm13) \ |
183 V(xmm14) \ | 183 V(xmm14) \ |
184 V(xmm15) | 184 V(xmm15) |
185 | 185 |
| 186 #define FLOAT_REGISTERS DOUBLE_REGISTERS |
| 187 |
186 #define ALLOCATABLE_DOUBLE_REGISTERS(V) \ | 188 #define ALLOCATABLE_DOUBLE_REGISTERS(V) \ |
187 V(xmm1) \ | 189 V(xmm1) \ |
188 V(xmm2) \ | 190 V(xmm2) \ |
189 V(xmm3) \ | 191 V(xmm3) \ |
190 V(xmm4) \ | 192 V(xmm4) \ |
191 V(xmm5) \ | 193 V(xmm5) \ |
192 V(xmm6) \ | 194 V(xmm6) \ |
193 V(xmm7) \ | 195 V(xmm7) \ |
194 V(xmm8) \ | 196 V(xmm8) \ |
195 V(xmm9) \ | 197 V(xmm9) \ |
196 V(xmm10) \ | 198 V(xmm10) \ |
197 V(xmm11) \ | 199 V(xmm11) \ |
198 V(xmm12) \ | 200 V(xmm12) \ |
199 V(xmm13) \ | 201 V(xmm13) \ |
200 V(xmm14) \ | 202 V(xmm14) \ |
201 V(xmm15) | 203 V(xmm15) |
202 | 204 |
203 | 205 struct XMMRegister { |
204 struct DoubleRegister { | |
205 enum Code { | 206 enum Code { |
206 #define REGISTER_CODE(R) kCode_##R, | 207 #define REGISTER_CODE(R) kCode_##R, |
207 DOUBLE_REGISTERS(REGISTER_CODE) | 208 DOUBLE_REGISTERS(REGISTER_CODE) |
208 #undef REGISTER_CODE | 209 #undef REGISTER_CODE |
209 kAfterLast, | 210 kAfterLast, |
210 kCode_no_reg = -1 | 211 kCode_no_reg = -1 |
211 }; | 212 }; |
212 | 213 |
213 static const int kMaxNumRegisters = Code::kAfterLast; | 214 static const int kMaxNumRegisters = Code::kAfterLast; |
214 | 215 |
215 static DoubleRegister from_code(int code) { | 216 static XMMRegister from_code(int code) { |
216 DoubleRegister result = {code}; | 217 XMMRegister result = {code}; |
217 return result; | 218 return result; |
218 } | 219 } |
219 | 220 |
220 const char* ToString(); | 221 const char* ToString(); |
221 bool IsAllocatable() const; | 222 bool IsAllocatable() const; |
222 bool is_valid() const { return 0 <= reg_code && reg_code < kMaxNumRegisters; } | 223 bool is_valid() const { return 0 <= reg_code && reg_code < kMaxNumRegisters; } |
223 bool is(DoubleRegister reg) const { return reg_code == reg.reg_code; } | 224 bool is(XMMRegister reg) const { return reg_code == reg.reg_code; } |
224 int code() const { | 225 int code() const { |
225 DCHECK(is_valid()); | 226 DCHECK(is_valid()); |
226 return reg_code; | 227 return reg_code; |
227 } | 228 } |
228 | 229 |
229 // Return the high bit of the register code as a 0 or 1. Used often | 230 // Return the high bit of the register code as a 0 or 1. Used often |
230 // when constructing the REX prefix byte. | 231 // when constructing the REX prefix byte. |
231 int high_bit() const { return reg_code >> 3; } | 232 int high_bit() const { return reg_code >> 3; } |
232 // Return the 3 low bits of the register code. Used when encoding registers | 233 // Return the 3 low bits of the register code. Used when encoding registers |
233 // in modR/M, SIB, and opcode bytes. | 234 // in modR/M, SIB, and opcode bytes. |
234 int low_bits() const { return reg_code & 0x7; } | 235 int low_bits() const { return reg_code & 0x7; } |
235 | 236 |
236 // Unfortunately we can't make this private in a struct when initializing | 237 // Unfortunately we can't make this private in a struct when initializing |
237 // by assignment. | 238 // by assignment. |
238 int reg_code; | 239 int reg_code; |
239 }; | 240 }; |
240 | 241 |
| 242 typedef XMMRegister FloatRegister; |
| 243 |
| 244 typedef XMMRegister DoubleRegister; |
| 245 |
| 246 typedef XMMRegister Simd128Register; |
241 | 247 |
242 #define DECLARE_REGISTER(R) \ | 248 #define DECLARE_REGISTER(R) \ |
243 const DoubleRegister R = {DoubleRegister::kCode_##R}; | 249 const DoubleRegister R = {DoubleRegister::kCode_##R}; |
244 DOUBLE_REGISTERS(DECLARE_REGISTER) | 250 DOUBLE_REGISTERS(DECLARE_REGISTER) |
245 #undef DECLARE_REGISTER | 251 #undef DECLARE_REGISTER |
246 const DoubleRegister no_double_reg = {DoubleRegister::kCode_no_reg}; | 252 const DoubleRegister no_double_reg = {DoubleRegister::kCode_no_reg}; |
247 | 253 |
248 | |
249 typedef DoubleRegister XMMRegister; | |
250 | |
251 typedef DoubleRegister Simd128Register; | |
252 | |
253 enum Condition { | 254 enum Condition { |
254 // any value < 0 is considered no_condition | 255 // any value < 0 is considered no_condition |
255 no_condition = -1, | 256 no_condition = -1, |
256 | 257 |
257 overflow = 0, | 258 overflow = 0, |
258 no_overflow = 1, | 259 no_overflow = 1, |
259 below = 2, | 260 below = 2, |
260 above_equal = 3, | 261 above_equal = 3, |
261 equal = 4, | 262 equal = 4, |
262 not_equal = 5, | 263 not_equal = 5, |
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2231 Assembler* assembler_; | 2232 Assembler* assembler_; |
2232 #ifdef DEBUG | 2233 #ifdef DEBUG |
2233 int space_before_; | 2234 int space_before_; |
2234 #endif | 2235 #endif |
2235 }; | 2236 }; |
2236 | 2237 |
2237 } // namespace internal | 2238 } // namespace internal |
2238 } // namespace v8 | 2239 } // namespace v8 |
2239 | 2240 |
2240 #endif // V8_X64_ASSEMBLER_X64_H_ | 2241 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |