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 | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // doing certain constant folds, which may significantly reduce the | 64 // doing certain constant folds, which may significantly reduce the |
65 // code generated for some assembly instructions (because they boil down | 65 // code generated for some assembly instructions (because they boil down |
66 // to a few constants). If this is a problem, we could change the code | 66 // to a few constants). If this is a problem, we could change the code |
67 // such that we use an enum in optimized mode, and the struct in debug | 67 // such that we use an enum in optimized mode, and the struct in debug |
68 // mode. This way we get the compile-time error checking in debug mode | 68 // mode. This way we get the compile-time error checking in debug mode |
69 // and best performance in optimized code. | 69 // and best performance in optimized code. |
70 | 70 |
71 // Core register | 71 // Core register |
72 struct Register { | 72 struct Register { |
73 static const int kNumRegisters = 16; | 73 static const int kNumRegisters = 16; |
74 static const int kMaxNumAllocatableRegisters = 8; | 74 static const int kNumAllocatableRegisters = 8; |
75 static const int kSizeInBytes = 4; | 75 static const int kSizeInBytes = 4; |
76 static const int kGPRsPerNonVFP2Double = 2; | |
77 | |
78 inline static int NumAllocatableRegisters(); | |
79 | 76 |
80 static int ToAllocationIndex(Register reg) { | 77 static int ToAllocationIndex(Register reg) { |
81 ASSERT(reg.code() < kMaxNumAllocatableRegisters); | 78 ASSERT(reg.code() < kNumAllocatableRegisters); |
82 return reg.code(); | 79 return reg.code(); |
83 } | 80 } |
84 | 81 |
85 static Register FromAllocationIndex(int index) { | 82 static Register FromAllocationIndex(int index) { |
86 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); | 83 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
87 return from_code(index); | 84 return from_code(index); |
88 } | 85 } |
89 | 86 |
90 static const char* AllocationIndexToString(int index) { | 87 static const char* AllocationIndexToString(int index) { |
91 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); | 88 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
92 const char* const names[] = { | 89 const char* const names[] = { |
93 "r0", | 90 "r0", |
94 "r1", | 91 "r1", |
95 "r2", | 92 "r2", |
96 "r3", | 93 "r3", |
97 "r4", | 94 "r4", |
98 "r5", | 95 "r5", |
99 "r6", | 96 "r6", |
100 "r7", | 97 "r7", |
101 }; | 98 }; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Used as lithium codegen scratch register. | 158 // Used as lithium codegen scratch register. |
162 const Register r9 = { kRegister_r9_Code }; | 159 const Register r9 = { kRegister_r9_Code }; |
163 // Used as roots register. | 160 // Used as roots register. |
164 const Register r10 = { kRegister_r10_Code }; | 161 const Register r10 = { kRegister_r10_Code }; |
165 const Register fp = { kRegister_fp_Code }; | 162 const Register fp = { kRegister_fp_Code }; |
166 const Register ip = { kRegister_ip_Code }; | 163 const Register ip = { kRegister_ip_Code }; |
167 const Register sp = { kRegister_sp_Code }; | 164 const Register sp = { kRegister_sp_Code }; |
168 const Register lr = { kRegister_lr_Code }; | 165 const Register lr = { kRegister_lr_Code }; |
169 const Register pc = { kRegister_pc_Code }; | 166 const Register pc = { kRegister_pc_Code }; |
170 | 167 |
| 168 |
171 // Single word VFP register. | 169 // Single word VFP register. |
172 struct SwVfpRegister { | 170 struct SwVfpRegister { |
173 bool is_valid() const { return 0 <= code_ && code_ < 32; } | 171 bool is_valid() const { return 0 <= code_ && code_ < 32; } |
174 bool is(SwVfpRegister reg) const { return code_ == reg.code_; } | 172 bool is(SwVfpRegister reg) const { return code_ == reg.code_; } |
175 int code() const { | 173 int code() const { |
176 ASSERT(is_valid()); | 174 ASSERT(is_valid()); |
177 return code_; | 175 return code_; |
178 } | 176 } |
179 int bit() const { | 177 int bit() const { |
180 ASSERT(is_valid()); | 178 ASSERT(is_valid()); |
(...skipping 10 matching lines...) Expand all Loading... |
191 | 189 |
192 | 190 |
193 // Double word VFP register. | 191 // Double word VFP register. |
194 struct DwVfpRegister { | 192 struct DwVfpRegister { |
195 static const int kNumRegisters = 16; | 193 static const int kNumRegisters = 16; |
196 // A few double registers are reserved: one as a scratch register and one to | 194 // A few double registers are reserved: one as a scratch register and one to |
197 // hold 0.0, that does not fit in the immediate field of vmov instructions. | 195 // hold 0.0, that does not fit in the immediate field of vmov instructions. |
198 // d14: 0.0 | 196 // d14: 0.0 |
199 // d15: scratch register. | 197 // d15: scratch register. |
200 static const int kNumReservedRegisters = 2; | 198 static const int kNumReservedRegisters = 2; |
201 static const int kMaxNumAllocatableRegisters = kNumRegisters - | 199 static const int kNumAllocatableRegisters = kNumRegisters - |
202 kNumReservedRegisters; | 200 kNumReservedRegisters; |
203 | 201 |
204 inline static int NumRegisters(); | |
205 inline static int NumAllocatableRegisters(); | |
206 inline static int ToAllocationIndex(DwVfpRegister reg); | 202 inline static int ToAllocationIndex(DwVfpRegister reg); |
207 static const char* AllocationIndexToString(int index); | |
208 | 203 |
209 static DwVfpRegister FromAllocationIndex(int index) { | 204 static DwVfpRegister FromAllocationIndex(int index) { |
210 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); | 205 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
211 return from_code(index); | 206 return from_code(index); |
212 } | 207 } |
213 | 208 |
| 209 static const char* AllocationIndexToString(int index) { |
| 210 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
| 211 const char* const names[] = { |
| 212 "d0", |
| 213 "d1", |
| 214 "d2", |
| 215 "d3", |
| 216 "d4", |
| 217 "d5", |
| 218 "d6", |
| 219 "d7", |
| 220 "d8", |
| 221 "d9", |
| 222 "d10", |
| 223 "d11", |
| 224 "d12", |
| 225 "d13" |
| 226 }; |
| 227 return names[index]; |
| 228 } |
| 229 |
214 static DwVfpRegister from_code(int code) { | 230 static DwVfpRegister from_code(int code) { |
215 DwVfpRegister r = { code }; | 231 DwVfpRegister r = { code }; |
216 return r; | 232 return r; |
217 } | 233 } |
218 | 234 |
219 // Supporting d0 to d15, can be later extended to d31. | 235 // Supporting d0 to d15, can be later extended to d31. |
220 bool is_valid() const { return 0 <= code_ && code_ < 16; } | 236 bool is_valid() const { return 0 <= code_ && code_ < 16; } |
221 bool is(DwVfpRegister reg) const { return code_ == reg.code_; } | 237 bool is(DwVfpRegister reg) const { return code_ == reg.code_; } |
222 SwVfpRegister low() const { | 238 SwVfpRegister low() const { |
223 SwVfpRegister reg; | 239 SwVfpRegister reg; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 const DwVfpRegister d7 = { 7 }; | 316 const DwVfpRegister d7 = { 7 }; |
301 const DwVfpRegister d8 = { 8 }; | 317 const DwVfpRegister d8 = { 8 }; |
302 const DwVfpRegister d9 = { 9 }; | 318 const DwVfpRegister d9 = { 9 }; |
303 const DwVfpRegister d10 = { 10 }; | 319 const DwVfpRegister d10 = { 10 }; |
304 const DwVfpRegister d11 = { 11 }; | 320 const DwVfpRegister d11 = { 11 }; |
305 const DwVfpRegister d12 = { 12 }; | 321 const DwVfpRegister d12 = { 12 }; |
306 const DwVfpRegister d13 = { 13 }; | 322 const DwVfpRegister d13 = { 13 }; |
307 const DwVfpRegister d14 = { 14 }; | 323 const DwVfpRegister d14 = { 14 }; |
308 const DwVfpRegister d15 = { 15 }; | 324 const DwVfpRegister d15 = { 15 }; |
309 | 325 |
310 const Register sfpd_lo = { kRegister_r6_Code }; | |
311 const Register sfpd_hi = { kRegister_r7_Code }; | |
312 | |
313 // Aliases for double registers. Defined using #define instead of | 326 // Aliases for double registers. Defined using #define instead of |
314 // "static const DwVfpRegister&" because Clang complains otherwise when a | 327 // "static const DwVfpRegister&" because Clang complains otherwise when a |
315 // compilation unit that includes this header doesn't use the variables. | 328 // compilation unit that includes this header doesn't use the variables. |
316 #define kFirstCalleeSavedDoubleReg d8 | 329 #define kFirstCalleeSavedDoubleReg d8 |
317 #define kLastCalleeSavedDoubleReg d15 | 330 #define kLastCalleeSavedDoubleReg d15 |
318 #define kDoubleRegZero d14 | 331 #define kDoubleRegZero d14 |
319 #define kScratchDoubleReg d15 | 332 #define kScratchDoubleReg d15 |
320 | 333 |
321 | 334 |
322 // Coprocessor register | 335 // Coprocessor register |
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 public: | 1488 public: |
1476 explicit EnsureSpace(Assembler* assembler) { | 1489 explicit EnsureSpace(Assembler* assembler) { |
1477 assembler->CheckBuffer(); | 1490 assembler->CheckBuffer(); |
1478 } | 1491 } |
1479 }; | 1492 }; |
1480 | 1493 |
1481 | 1494 |
1482 } } // namespace v8::internal | 1495 } } // namespace v8::internal |
1483 | 1496 |
1484 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1497 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |