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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 *m = code_ & 0x1; | 160 *m = code_ & 0x1; |
161 *vm = code_ >> 1; | 161 *vm = code_ >> 1; |
162 } | 162 } |
163 | 163 |
164 int code_; | 164 int code_; |
165 }; | 165 }; |
166 | 166 |
167 | 167 |
168 // Double word VFP register. | 168 // Double word VFP register. |
169 struct DwVfpRegister { | 169 struct DwVfpRegister { |
| 170 // d0 has been excluded from allocation. This is following ia32 |
| 171 // where xmm0 is excluded. This should be revisited. |
| 172 // Currently d0 is used as a scratch register. |
| 173 // d1 has also been excluded from allocation to be used as a scratch |
| 174 // register as well. |
170 static const int kNumRegisters = 16; | 175 static const int kNumRegisters = 16; |
171 // A few double registers are reserved: one as a scratch register and one to | 176 static const int kNumAllocatableRegisters = 15; |
172 // hold 0.0, that does not fit in the immediate field of vmov instructions. | |
173 // d14: 0.0 | |
174 // d15: scratch register. | |
175 static const int kNumReservedRegisters = 2; | |
176 static const int kNumAllocatableRegisters = kNumRegisters - | |
177 kNumReservedRegisters; | |
178 | 177 |
179 static int ToAllocationIndex(DwVfpRegister reg) { | 178 static int ToAllocationIndex(DwVfpRegister reg) { |
180 ASSERT(reg.code() != 0); | 179 ASSERT(reg.code() != 0); |
181 return reg.code() - 1; | 180 return reg.code() - 1; |
182 } | 181 } |
183 | 182 |
184 static DwVfpRegister FromAllocationIndex(int index) { | 183 static DwVfpRegister FromAllocationIndex(int index) { |
185 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 184 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
186 return from_code(index + 1); | 185 return from_code(index + 1); |
187 } | 186 } |
188 | 187 |
189 static const char* AllocationIndexToString(int index) { | 188 static const char* AllocationIndexToString(int index) { |
190 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 189 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
191 const char* const names[] = { | 190 const char* const names[] = { |
192 "d0", | |
193 "d1", | 191 "d1", |
194 "d2", | 192 "d2", |
195 "d3", | 193 "d3", |
196 "d4", | 194 "d4", |
197 "d5", | 195 "d5", |
198 "d6", | 196 "d6", |
199 "d7", | 197 "d7", |
200 "d8", | 198 "d8", |
201 "d9", | 199 "d9", |
202 "d10", | 200 "d10", |
203 "d11", | 201 "d11", |
204 "d12", | 202 "d12", |
205 "d13" | 203 "d13", |
| 204 "d14", |
| 205 "d15" |
206 }; | 206 }; |
207 return names[index]; | 207 return names[index]; |
208 } | 208 } |
209 | 209 |
210 static DwVfpRegister from_code(int code) { | 210 static DwVfpRegister from_code(int code) { |
211 DwVfpRegister r = { code }; | 211 DwVfpRegister r = { code }; |
212 return r; | 212 return r; |
213 } | 213 } |
214 | 214 |
215 // Supporting d0 to d15, can be later extended to d31. | 215 // Supporting d0 to d15, can be later extended to d31. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 const DwVfpRegister d10 = { 10 }; | 299 const DwVfpRegister d10 = { 10 }; |
300 const DwVfpRegister d11 = { 11 }; | 300 const DwVfpRegister d11 = { 11 }; |
301 const DwVfpRegister d12 = { 12 }; | 301 const DwVfpRegister d12 = { 12 }; |
302 const DwVfpRegister d13 = { 13 }; | 302 const DwVfpRegister d13 = { 13 }; |
303 const DwVfpRegister d14 = { 14 }; | 303 const DwVfpRegister d14 = { 14 }; |
304 const DwVfpRegister d15 = { 15 }; | 304 const DwVfpRegister d15 = { 15 }; |
305 | 305 |
306 // Aliases for double registers. | 306 // Aliases for double registers. |
307 const DwVfpRegister kFirstCalleeSavedDoubleReg = d8; | 307 const DwVfpRegister kFirstCalleeSavedDoubleReg = d8; |
308 const DwVfpRegister kLastCalleeSavedDoubleReg = d15; | 308 const DwVfpRegister kLastCalleeSavedDoubleReg = d15; |
309 const DwVfpRegister kDoubleRegZero = d14; | |
310 | 309 |
311 | 310 |
312 // Coprocessor register | 311 // Coprocessor register |
313 struct CRegister { | 312 struct CRegister { |
314 bool is_valid() const { return 0 <= code_ && code_ < 16; } | 313 bool is_valid() const { return 0 <= code_ && code_ < 16; } |
315 bool is(CRegister creg) const { return code_ == creg.code_; } | 314 bool is(CRegister creg) const { return code_ == creg.code_; } |
316 int code() const { | 315 int code() const { |
317 ASSERT(is_valid()); | 316 ASSERT(is_valid()); |
318 return code_; | 317 return code_; |
319 } | 318 } |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 public: | 1397 public: |
1399 explicit EnsureSpace(Assembler* assembler) { | 1398 explicit EnsureSpace(Assembler* assembler) { |
1400 assembler->CheckBuffer(); | 1399 assembler->CheckBuffer(); |
1401 } | 1400 } |
1402 }; | 1401 }; |
1403 | 1402 |
1404 | 1403 |
1405 } } // namespace v8::internal | 1404 } } // namespace v8::internal |
1406 | 1405 |
1407 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1406 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |