| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 *m = code_ & 0x1; | 183 *m = code_ & 0x1; |
| 184 *vm = code_ >> 1; | 184 *vm = code_ >> 1; |
| 185 } | 185 } |
| 186 | 186 |
| 187 int code_; | 187 int code_; |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 | 190 |
| 191 // Double word VFP register. | 191 // Double word VFP register. |
| 192 struct DwVfpRegister { | 192 struct DwVfpRegister { |
| 193 static const int kNumRegisters = 16; | 193 static const int kNumRegisters = 32; // XXX |
| 194 // 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 |
| 195 // 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. |
| 196 // d14: 0.0 | 196 // d14: 0.0 |
| 197 // d15: scratch register. | 197 // d15: scratch register. |
| 198 static const int kNumReservedRegisters = 2; | 198 static const int kNumReservedRegisters = 2; |
| 199 static const int kNumAllocatableRegisters = kNumRegisters - | 199 static int NumAvailableRegisters() { |
| 200 kNumReservedRegisters; | 200 return 32; // XXX: 16 or 32, detected at runtime. |
| 201 } |
| 202 static int NumAllocatableRegisters() { |
| 203 return NumAvailableRegisters() - kNumReservedRegisters; |
| 204 } |
| 205 static DwVfpRegister FirstCalleeSavedReg() { return from_code(8); } |
| 206 static DwVfpRegister LastCalleeSavedReg() { |
| 207 return from_code(15); |
| 208 } |
| 209 static DwVfpRegister ZeroReg() { |
| 210 return from_code(14); |
| 211 } |
| 212 static DwVfpRegister ScratchReg() { |
| 213 return from_code(15); |
| 214 } |
| 215 static int NumCalleeSaved() { |
| 216 return LastCalleeSavedReg().code() - FirstCalleeSavedReg().code() + 1; |
| 217 } |
| 201 | 218 |
| 202 inline static int ToAllocationIndex(DwVfpRegister reg); | 219 inline static int ToAllocationIndex(DwVfpRegister reg); |
| 203 | 220 |
| 204 static DwVfpRegister FromAllocationIndex(int index) { | 221 static DwVfpRegister FromAllocationIndex(int index) { |
| 205 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 222 ASSERT(index >= 0 && index < NumAllocatableRegisters()); |
| 206 return from_code(index); | 223 if (index < ZeroReg().code()) |
| 224 return from_code(index); |
| 225 return from_code(index + kNumReservedRegisters); |
| 207 } | 226 } |
| 208 | 227 |
| 209 static const char* AllocationIndexToString(int index) { | 228 static const char* AllocationIndexToString(int index) { |
| 210 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 229 ASSERT(index >= 0 && index < NumAllocatableRegisters()); |
| 230 if (index >= ZeroReg().code()) |
| 231 index += kNumReservedRegisters; |
| 211 const char* const names[] = { | 232 const char* const names[] = { |
| 212 "d0", | 233 "d0", |
| 213 "d1", | 234 "d1", |
| 214 "d2", | 235 "d2", |
| 215 "d3", | 236 "d3", |
| 216 "d4", | 237 "d4", |
| 217 "d5", | 238 "d5", |
| 218 "d6", | 239 "d6", |
| 219 "d7", | 240 "d7", |
| 220 "d8", | 241 "d8", |
| 221 "d9", | 242 "d9", |
| 222 "d10", | 243 "d10", |
| 223 "d11", | 244 "d11", |
| 224 "d12", | 245 "d12", |
| 225 "d13" | 246 "d13", |
| 247 "d14", |
| 248 "d15", |
| 249 "d16", |
| 250 "d17", |
| 251 "d18", |
| 252 "d19", |
| 253 "d20", |
| 254 "d21", |
| 255 "d22", |
| 256 "d23", |
| 257 "d24", |
| 258 "d25", |
| 259 "d26", |
| 260 "d27", |
| 261 "d28", |
| 262 "d29", |
| 263 "d30", |
| 264 "d31" |
| 226 }; | 265 }; |
| 227 return names[index]; | 266 return names[index]; |
| 228 } | 267 } |
| 229 | 268 |
| 230 static DwVfpRegister from_code(int code) { | 269 static DwVfpRegister from_code(int code) { |
| 231 DwVfpRegister r = { code }; | 270 DwVfpRegister r = { code }; |
| 232 return r; | 271 return r; |
| 233 } | 272 } |
| 234 | 273 |
| 235 // Supporting d0 to d15, can be later extended to d31. | 274 bool is_valid() const { |
| 236 bool is_valid() const { return 0 <= code_ && code_ < 16; } | 275 return 0 <= code_ && code_ < NumAvailableRegisters(); |
| 276 } |
| 237 bool is(DwVfpRegister reg) const { return code_ == reg.code_; } | 277 bool is(DwVfpRegister reg) const { return code_ == reg.code_; } |
| 238 SwVfpRegister low() const { | 278 SwVfpRegister low() const { |
| 279 ASSERT(code_ < 16); |
| 239 SwVfpRegister reg; | 280 SwVfpRegister reg; |
| 240 reg.code_ = code_ * 2; | 281 reg.code_ = code_ * 2; |
| 241 | 282 |
| 242 ASSERT(reg.is_valid()); | 283 ASSERT(reg.is_valid()); |
| 243 return reg; | 284 return reg; |
| 244 } | 285 } |
| 245 SwVfpRegister high() const { | 286 SwVfpRegister high() const { |
| 287 ASSERT(code_ < 16); |
| 246 SwVfpRegister reg; | 288 SwVfpRegister reg; |
| 247 reg.code_ = (code_ * 2) + 1; | 289 reg.code_ = (code_ * 2) + 1; |
| 248 | 290 |
| 249 ASSERT(reg.is_valid()); | 291 ASSERT(reg.is_valid()); |
| 250 return reg; | 292 return reg; |
| 251 } | 293 } |
| 252 int code() const { | 294 int code() const { |
| 253 ASSERT(is_valid()); | 295 ASSERT(is_valid()); |
| 254 return code_; | 296 return code_; |
| 255 } | 297 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 const DwVfpRegister d6 = { 6 }; | 357 const DwVfpRegister d6 = { 6 }; |
| 316 const DwVfpRegister d7 = { 7 }; | 358 const DwVfpRegister d7 = { 7 }; |
| 317 const DwVfpRegister d8 = { 8 }; | 359 const DwVfpRegister d8 = { 8 }; |
| 318 const DwVfpRegister d9 = { 9 }; | 360 const DwVfpRegister d9 = { 9 }; |
| 319 const DwVfpRegister d10 = { 10 }; | 361 const DwVfpRegister d10 = { 10 }; |
| 320 const DwVfpRegister d11 = { 11 }; | 362 const DwVfpRegister d11 = { 11 }; |
| 321 const DwVfpRegister d12 = { 12 }; | 363 const DwVfpRegister d12 = { 12 }; |
| 322 const DwVfpRegister d13 = { 13 }; | 364 const DwVfpRegister d13 = { 13 }; |
| 323 const DwVfpRegister d14 = { 14 }; | 365 const DwVfpRegister d14 = { 14 }; |
| 324 const DwVfpRegister d15 = { 15 }; | 366 const DwVfpRegister d15 = { 15 }; |
| 325 | 367 const DwVfpRegister d16 = { 16 }; |
| 326 // Aliases for double registers. Defined using #define instead of | 368 const DwVfpRegister d17 = { 17 }; |
| 327 // "static const DwVfpRegister&" because Clang complains otherwise when a | 369 const DwVfpRegister d18 = { 18 }; |
| 328 // compilation unit that includes this header doesn't use the variables. | 370 const DwVfpRegister d19 = { 19 }; |
| 329 #define kFirstCalleeSavedDoubleReg d8 | 371 const DwVfpRegister d20 = { 20 }; |
| 330 #define kLastCalleeSavedDoubleReg d15 | 372 const DwVfpRegister d21 = { 21 }; |
| 331 #define kDoubleRegZero d14 | 373 const DwVfpRegister d22 = { 22 }; |
| 332 #define kScratchDoubleReg d15 | 374 const DwVfpRegister d23 = { 23 }; |
| 375 const DwVfpRegister d24 = { 24 }; |
| 376 const DwVfpRegister d25 = { 25 }; |
| 377 const DwVfpRegister d26 = { 26 }; |
| 378 const DwVfpRegister d27 = { 27 }; |
| 379 const DwVfpRegister d28 = { 28 }; |
| 380 const DwVfpRegister d29 = { 29 }; |
| 381 const DwVfpRegister d30 = { 30 }; |
| 382 const DwVfpRegister d31 = { 31 }; |
| 333 | 383 |
| 334 | 384 |
| 335 // Coprocessor register | 385 // Coprocessor register |
| 336 struct CRegister { | 386 struct CRegister { |
| 337 bool is_valid() const { return 0 <= code_ && code_ < 16; } | 387 bool is_valid() const { return 0 <= code_ && code_ < 16; } |
| 338 bool is(CRegister creg) const { return code_ == creg.code_; } | 388 bool is(CRegister creg) const { return code_ == creg.code_; } |
| 339 int code() const { | 389 int code() const { |
| 340 ASSERT(is_valid()); | 390 ASSERT(is_valid()); |
| 341 return code_; | 391 return code_; |
| 342 } | 392 } |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 LFlag l = Short, Condition cond = al); | 1037 LFlag l = Short, Condition cond = al); |
| 988 void ldc(Coprocessor coproc, CRegister crd, Register base, int option, | 1038 void ldc(Coprocessor coproc, CRegister crd, Register base, int option, |
| 989 LFlag l = Short, Condition cond = al); | 1039 LFlag l = Short, Condition cond = al); |
| 990 | 1040 |
| 991 void ldc2(Coprocessor coproc, CRegister crd, const MemOperand& src, | 1041 void ldc2(Coprocessor coproc, CRegister crd, const MemOperand& src, |
| 992 LFlag l = Short); // v5 and above | 1042 LFlag l = Short); // v5 and above |
| 993 void ldc2(Coprocessor coproc, CRegister crd, Register base, int option, | 1043 void ldc2(Coprocessor coproc, CRegister crd, Register base, int option, |
| 994 LFlag l = Short); // v5 and above | 1044 LFlag l = Short); // v5 and above |
| 995 | 1045 |
| 996 // Support for VFP. | 1046 // Support for VFP. |
| 997 // All these APIs support S0 to S31 and D0 to D15. | 1047 // All these APIs support S0 to S31 and D0 to D31. |
| 998 // Currently these APIs do not support extended D registers, i.e, D16 to D31. | |
| 999 // However, some simple modifications can allow | |
| 1000 // these APIs to support D16 to D31. | |
| 1001 | 1048 |
| 1002 void vldr(const DwVfpRegister dst, | 1049 void vldr(const DwVfpRegister dst, |
| 1003 const Register base, | 1050 const Register base, |
| 1004 int offset, | 1051 int offset, |
| 1005 const Condition cond = al); | 1052 const Condition cond = al); |
| 1006 void vldr(const DwVfpRegister dst, | 1053 void vldr(const DwVfpRegister dst, |
| 1007 const MemOperand& src, | 1054 const MemOperand& src, |
| 1008 const Condition cond = al); | 1055 const Condition cond = al); |
| 1009 | 1056 |
| 1010 void vldr(const SwVfpRegister dst, | 1057 void vldr(const SwVfpRegister dst, |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 public: | 1535 public: |
| 1489 explicit EnsureSpace(Assembler* assembler) { | 1536 explicit EnsureSpace(Assembler* assembler) { |
| 1490 assembler->CheckBuffer(); | 1537 assembler->CheckBuffer(); |
| 1491 } | 1538 } |
| 1492 }; | 1539 }; |
| 1493 | 1540 |
| 1494 | 1541 |
| 1495 } } // namespace v8::internal | 1542 } } // namespace v8::internal |
| 1496 | 1543 |
| 1497 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1544 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
| OLD | NEW |