| 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 |
| 307 // MRC instruction offset field encoding. | 315 // MRC instruction offset field encoding. |
| 308 kCRmShift = 0, | 316 kCRmShift = 0, |
| 309 kCRmBits = 4, | 317 kCRmBits = 4, |
| 310 kOpc2Shift = 5, | 318 kOpc2Shift = 5, |
| 311 kOpc2Bits = 3, | 319 kOpc2Bits = 3, |
| 312 kCoprocShift = 8, | 320 kCoprocShift = 8, |
| 313 kCoprocBits = 4, | 321 kCoprocBits = 4, |
| 314 kCRnShift = 16, | 322 kCRnShift = 16, |
| 315 kCRnBits = 4, | 323 kCRnBits = 4, |
| 316 kOpc1Shift = 21, | 324 kOpc1Shift = 21, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 return bit_cast<float, uint32_t>(imm32); | 450 return bit_cast<float, uint32_t>(imm32); |
| 443 } | 451 } |
| 444 | 452 |
| 445 // Field used in VFP double immediate move instruction | 453 // Field used in VFP double immediate move instruction |
| 446 inline double ImmDoubleField() const { | 454 inline double ImmDoubleField() const { |
| 447 uint64_t imm64 = (Bit(19)*(1LL << 63)) | (((1LL << 8) - Bit(18)) << 54) | | 455 uint64_t imm64 = (Bit(19)*(1LL << 63)) | (((1LL << 8) - Bit(18)) << 54) | |
| 448 (Bits(16, 2)*(1LL << 52)) | (Bits(0, 4)*(1LL << 48)); | 456 (Bits(16, 2)*(1LL << 52)) | (Bits(0, 4)*(1LL << 48)); |
| 449 return bit_cast<double, uint64_t>(imm64); | 457 return bit_cast<double, uint64_t>(imm64); |
| 450 } | 458 } |
| 451 | 459 |
| 460 inline Register DivRdField() const { |
| 461 return static_cast<Register>(Bits(kDivRdShift, kDivRdBits)); |
| 462 } |
| 463 inline Register DivRmField() const { |
| 464 return static_cast<Register>(Bits(kDivRmShift, kDivRmBits)); |
| 465 } |
| 466 inline Register DivRnField() const { |
| 467 return static_cast<Register>(Bits(kDivRnShift, kDivRnBits)); |
| 468 } |
| 469 |
| 452 // Test for data processing instructions of type 0 or 1. | 470 // Test for data processing instructions of type 0 or 1. |
| 453 // See "ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition", | 471 // See "ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition", |
| 454 // section A5.1 "ARM instruction set encoding". | 472 // section A5.1 "ARM instruction set encoding". |
| 455 inline bool IsDataProcessing() const { | 473 inline bool IsDataProcessing() const { |
| 456 ASSERT(ConditionField() != kSpecialCondition); | 474 ASSERT(ConditionField() != kSpecialCondition); |
| 457 ASSERT(Bits(26, 2) == 0); // Type 0 or 1. | 475 ASSERT(Bits(26, 2) == 0); // Type 0 or 1. |
| 458 return ((Bits(20, 5) & 0x19) != 0x10) && | 476 return ((Bits(20, 5) & 0x19) != 0x10) && |
| 459 ((Bit(25) == 1) || // Data processing immediate. | 477 ((Bit(25) == 1) || // Data processing immediate. |
| 460 (Bit(4) == 0) || // Data processing register. | 478 (Bit(4) == 0) || // Data processing register. |
| 461 (Bit(7) == 0)); // Data processing register-shifted register. | 479 (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); } | 585 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } |
| 568 | 586 |
| 569 private: | 587 private: |
| 570 DISALLOW_ALLOCATION(); | 588 DISALLOW_ALLOCATION(); |
| 571 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 589 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
| 572 }; | 590 }; |
| 573 | 591 |
| 574 } // namespace dart | 592 } // namespace dart |
| 575 | 593 |
| 576 #endif // VM_CONSTANTS_ARM_H_ | 594 #endif // VM_CONSTANTS_ARM_H_ |
| OLD | NEW |