| 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 VM_CONSTANTS_ARM_H_ | 5 #ifndef VM_CONSTANTS_ARM_H_ |
| 6 #define VM_CONSTANTS_ARM_H_ | 6 #define VM_CONSTANTS_ARM_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 kShiftRegisterShift = 8, | 291 kShiftRegisterShift = 8, |
| 292 kShiftImmBits = 5, | 292 kShiftImmBits = 5, |
| 293 kShiftShift = 5, | 293 kShiftShift = 5, |
| 294 kShiftBits = 2, | 294 kShiftBits = 2, |
| 295 | 295 |
| 296 // Load/store instruction offset field encoding. | 296 // Load/store instruction offset field encoding. |
| 297 kOffset12Shift = 0, | 297 kOffset12Shift = 0, |
| 298 kOffset12Bits = 12, | 298 kOffset12Bits = 12, |
| 299 kOffset12Mask = 0x00000fff, | 299 kOffset12Mask = 0x00000fff, |
| 300 | 300 |
| 301 // Mul instruction register fields encodings. | 301 // Mul instruction register field encodings. |
| 302 kMulRdShift = 16, | 302 kMulRdShift = 16, |
| 303 kMulRdBits = 4, | 303 kMulRdBits = 4, |
| 304 kMulRnShift = 12, | 304 kMulRnShift = 12, |
| 305 kMulRnBits = 4, | 305 kMulRnBits = 4, |
| 306 | 306 |
| 307 // Div instruction register field encodings. |
| 308 kDivRdShift = 16, |
| 309 kDivRdBits = 4, |
| 310 kDivRmShift = 8, |
| 311 kDivRmBits = 4, |
| 312 kDivRnShift = 0, |
| 313 kDivRnBits = 4, |
| 314 |
| 315 // ldrex/strex register field encodings. |
| 316 kLdExRnShift = 16, |
| 317 kLdExRtShift = 12, |
| 318 kStrExRnShift = 16, |
| 319 kStrExRdShift = 12, |
| 320 kStrExRtShift = 0, |
| 321 |
| 307 // MRC instruction offset field encoding. | 322 // MRC instruction offset field encoding. |
| 308 kCRmShift = 0, | 323 kCRmShift = 0, |
| 309 kCRmBits = 4, | 324 kCRmBits = 4, |
| 310 kOpc2Shift = 5, | 325 kOpc2Shift = 5, |
| 311 kOpc2Bits = 3, | 326 kOpc2Bits = 3, |
| 312 kCoprocShift = 8, | 327 kCoprocShift = 8, |
| 313 kCoprocBits = 4, | 328 kCoprocBits = 4, |
| 314 kCRnShift = 16, | 329 kCRnShift = 16, |
| 315 kCRnBits = 4, | 330 kCRnBits = 4, |
| 316 kOpc1Shift = 21, | 331 kOpc1Shift = 21, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 return bit_cast<float, uint32_t>(imm32); | 457 return bit_cast<float, uint32_t>(imm32); |
| 443 } | 458 } |
| 444 | 459 |
| 445 // Field used in VFP double immediate move instruction | 460 // Field used in VFP double immediate move instruction |
| 446 inline double ImmDoubleField() const { | 461 inline double ImmDoubleField() const { |
| 447 uint64_t imm64 = (Bit(19)*(1LL << 63)) | (((1LL << 8) - Bit(18)) << 54) | | 462 uint64_t imm64 = (Bit(19)*(1LL << 63)) | (((1LL << 8) - Bit(18)) << 54) | |
| 448 (Bits(16, 2)*(1LL << 52)) | (Bits(0, 4)*(1LL << 48)); | 463 (Bits(16, 2)*(1LL << 52)) | (Bits(0, 4)*(1LL << 48)); |
| 449 return bit_cast<double, uint64_t>(imm64); | 464 return bit_cast<double, uint64_t>(imm64); |
| 450 } | 465 } |
| 451 | 466 |
| 467 inline Register DivRdField() const { |
| 468 return static_cast<Register>(Bits(kDivRdShift, kDivRdBits)); |
| 469 } |
| 470 inline Register DivRmField() const { |
| 471 return static_cast<Register>(Bits(kDivRmShift, kDivRmBits)); |
| 472 } |
| 473 inline Register DivRnField() const { |
| 474 return static_cast<Register>(Bits(kDivRnShift, kDivRnBits)); |
| 475 } |
| 476 |
| 452 // Test for data processing instructions of type 0 or 1. | 477 // Test for data processing instructions of type 0 or 1. |
| 453 // See "ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition", | 478 // See "ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition", |
| 454 // section A5.1 "ARM instruction set encoding". | 479 // section A5.1 "ARM instruction set encoding". |
| 455 inline bool IsDataProcessing() const { | 480 inline bool IsDataProcessing() const { |
| 456 ASSERT(ConditionField() != kSpecialCondition); | 481 ASSERT(ConditionField() != kSpecialCondition); |
| 457 ASSERT(Bits(26, 2) == 0); // Type 0 or 1. | 482 ASSERT(Bits(26, 2) == 0); // Type 0 or 1. |
| 458 return ((Bits(20, 5) & 0x19) != 0x10) && | 483 return ((Bits(20, 5) & 0x19) != 0x10) && |
| 459 ((Bit(25) == 1) || // Data processing immediate. | 484 ((Bit(25) == 1) || // Data processing immediate. |
| 460 (Bit(4) == 0) || // Data processing register. | 485 (Bit(4) == 0) || // Data processing register. |
| 461 (Bit(7) == 0)); // Data processing register-shifted register. | 486 (Bit(7) == 0)); // Data processing register-shifted register. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } | 592 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } |
| 568 | 593 |
| 569 private: | 594 private: |
| 570 DISALLOW_ALLOCATION(); | 595 DISALLOW_ALLOCATION(); |
| 571 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 596 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
| 572 }; | 597 }; |
| 573 | 598 |
| 574 } // namespace dart | 599 } // namespace dart |
| 575 | 600 |
| 576 #endif // VM_CONSTANTS_ARM_H_ | 601 #endif // VM_CONSTANTS_ARM_H_ |
| OLD | NEW |