| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64_H_ | 5 #ifndef VM_CONSTANTS_ARM64_H_ |
| 6 #define VM_CONSTANTS_ARM64_H_ | 6 #define VM_CONSTANTS_ARM64_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 | 137 |
| 138 // C++ ABI call registers. | 138 // C++ ABI call registers. |
| 139 const RegList kAbiArgumentCpuRegs = | 139 const RegList kAbiArgumentCpuRegs = |
| 140 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) | | 140 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) | |
| 141 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7); | 141 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7); |
| 142 const RegList kAbiPreservedCpuRegs = | 142 const RegList kAbiPreservedCpuRegs = |
| 143 (1 << R19) | (1 << R20) | (1 << R21) | (1 << R22) | | 143 (1 << R19) | (1 << R20) | (1 << R21) | (1 << R22) | |
| 144 (1 << R23) | (1 << R24) | (1 << R25) | (1 << R26) | | 144 (1 << R23) | (1 << R24) | (1 << R25) | (1 << R26) | |
| 145 (1 << R27) | (1 << R28); | 145 (1 << R27) | (1 << R28); |
| 146 const Register kAbiFirstPreservedCpuReg = R19; |
| 147 const Register kAbiLastPreservedCpuReg = R28; |
| 146 const int kAbiPreservedCpuRegCount = 10; | 148 const int kAbiPreservedCpuRegCount = 10; |
| 147 const VRegister kAbiFirstPreservedFpuReg = V8; | 149 const VRegister kAbiFirstPreservedFpuReg = V8; |
| 148 const VRegister kAbiLastPreservedFpuReg = V15; | 150 const VRegister kAbiLastPreservedFpuReg = V15; |
| 149 const int kAbiPreservedFpuRegCount = 8; | 151 const int kAbiPreservedFpuRegCount = 8; |
| 150 | 152 |
| 151 // CPU registers available to Dart allocator. | 153 // CPU registers available to Dart allocator. |
| 152 const RegList kDartAvailableCpuRegs = | 154 const RegList kDartAvailableCpuRegs = |
| 153 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) | | 155 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) | |
| 154 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7) | | 156 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7) | |
| 155 (1 << R8) | (1 << R9) | (1 << R10) | (1 << R11) | | 157 (1 << R8) | (1 << R9) | (1 << R10) | (1 << R11) | |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 LoadStoreFixed = B27, | 254 LoadStoreFixed = B27, |
| 253 | 255 |
| 254 DPRegisterMask = 0x0e000000, | 256 DPRegisterMask = 0x0e000000, |
| 255 DPRegisterFixed = B27 | B25, | 257 DPRegisterFixed = B27 | B25, |
| 256 | 258 |
| 257 DPSimd1Mask = 0x1e000000, | 259 DPSimd1Mask = 0x1e000000, |
| 258 DPSimd1Fixed = B27 | B26 | B25, | 260 DPSimd1Fixed = B27 | B26 | B25, |
| 259 | 261 |
| 260 DPSimd2Mask = 0x1e000000, | 262 DPSimd2Mask = 0x1e000000, |
| 261 DPSimd2Fixed = B28 | DPSimd1Fixed, | 263 DPSimd2Fixed = B28 | DPSimd1Fixed, |
| 264 |
| 265 FPMask = 0x5e000000, |
| 266 FPFixed = B28 | B27 | B26 | B25, |
| 262 }; | 267 }; |
| 263 | 268 |
| 264 // C3.2.1 | 269 // C3.2.1 |
| 265 enum CompareAndBranchOp { | 270 enum CompareAndBranchOp { |
| 266 CompareAndBranchMask = 0x7e000000, | 271 CompareAndBranchMask = 0x7e000000, |
| 267 CompareAndBranchFixed = CompareBranchFixed | B29, | 272 CompareAndBranchFixed = CompareBranchFixed | B29, |
| 268 CBZ = CompareBranchFixed, | 273 CBZ = CompareBranchFixed, |
| 269 CBNZ = CompareBranchFixed | B24, | 274 CBNZ = CompareBranchFixed | B24, |
| 270 }; | 275 }; |
| 271 | 276 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 AND = LogicalShiftFixed, | 411 AND = LogicalShiftFixed, |
| 407 BIC = LogicalShiftFixed | B21, | 412 BIC = LogicalShiftFixed | B21, |
| 408 ORR = LogicalShiftFixed | B29, | 413 ORR = LogicalShiftFixed | B29, |
| 409 ORN = LogicalShiftFixed | B29 | B21, | 414 ORN = LogicalShiftFixed | B29 | B21, |
| 410 EOR = LogicalShiftFixed | B30, | 415 EOR = LogicalShiftFixed | B30, |
| 411 EON = LogicalShiftFixed | B30 | B21, | 416 EON = LogicalShiftFixed | B30 | B21, |
| 412 ANDS = LogicalShiftFixed | B30 | B29, | 417 ANDS = LogicalShiftFixed | B30 | B29, |
| 413 BICS = LogicalShiftFixed | B30 | B29 | B21, | 418 BICS = LogicalShiftFixed | B30 | B29 | B21, |
| 414 }; | 419 }; |
| 415 | 420 |
| 421 // C3.6.28 |
| 422 enum FPImmOp { |
| 423 FPImmMask = 0x5f201c00, |
| 424 FPImmFixed = FPFixed | B21 | B12, |
| 425 FMOVSI = FPImmFixed, |
| 426 FMOVDI = FPImmFixed | B22, |
| 427 }; |
| 428 |
| 429 // C3.6.29 |
| 430 enum FPIntCvtOp { |
| 431 FPIntCvtMask = 0x5f20fc00, |
| 432 FPIntCvtFixed = FPFixed | B21, |
| 433 FMOVRD = FPIntCvtFixed | B31 | B22 | B18 | B17, |
| 434 FMOVDR = FPIntCvtFixed | B31 | B22 | B18 | B17 | B16, |
| 435 }; |
| 436 |
| 437 |
| 416 #define APPLY_OP_LIST(_V) \ | 438 #define APPLY_OP_LIST(_V) \ |
| 417 _V(DPImmediate) \ | 439 _V(DPImmediate) \ |
| 418 _V(CompareBranch) \ | 440 _V(CompareBranch) \ |
| 419 _V(LoadStore) \ | 441 _V(LoadStore) \ |
| 420 _V(DPRegister) \ | 442 _V(DPRegister) \ |
| 421 _V(DPSimd1) \ | 443 _V(DPSimd1) \ |
| 422 _V(DPSimd2) \ | 444 _V(DPSimd2) \ |
| 445 _V(FP) \ |
| 423 _V(CompareAndBranch) \ | 446 _V(CompareAndBranch) \ |
| 424 _V(ConditionalBranch) \ | 447 _V(ConditionalBranch) \ |
| 425 _V(ExceptionGen) \ | 448 _V(ExceptionGen) \ |
| 426 _V(System) \ | 449 _V(System) \ |
| 427 _V(TestAndBranch) \ | 450 _V(TestAndBranch) \ |
| 428 _V(UnconditionalBranch) \ | 451 _V(UnconditionalBranch) \ |
| 429 _V(UnconditionalBranchReg) \ | 452 _V(UnconditionalBranchReg) \ |
| 430 _V(LoadStoreReg) \ | 453 _V(LoadStoreReg) \ |
| 431 _V(LoadRegLiteral) \ | 454 _V(LoadRegLiteral) \ |
| 432 _V(AddSubImm) \ | 455 _V(AddSubImm) \ |
| 433 _V(LogicalImm) \ | 456 _V(LogicalImm) \ |
| 434 _V(MoveWide) \ | 457 _V(MoveWide) \ |
| 435 _V(PCRel) \ | 458 _V(PCRel) \ |
| 436 _V(AddSubShiftExt) \ | 459 _V(AddSubShiftExt) \ |
| 437 _V(ConditionalSelect) \ | 460 _V(ConditionalSelect) \ |
| 438 _V(MiscDP2Source) \ | 461 _V(MiscDP2Source) \ |
| 439 _V(MiscDP3Source) \ | 462 _V(MiscDP3Source) \ |
| 440 _V(LogicalShift) \ | 463 _V(LogicalShift) \ |
| 464 _V(FPImm) \ |
| 465 _V(FPIntCvt) \ |
| 441 | 466 |
| 442 | 467 |
| 443 enum Shift { | 468 enum Shift { |
| 444 kNoShift = -1, | 469 kNoShift = -1, |
| 445 LSL = 0, // Logical shift left | 470 LSL = 0, // Logical shift left |
| 446 LSR = 1, // Logical shift right | 471 LSR = 1, // Logical shift right |
| 447 ASR = 2, // Arithmetic shift right | 472 ASR = 2, // Arithmetic shift right |
| 448 ROR = 3, // Rotate right | 473 ROR = 3, // Rotate right |
| 449 kMaxShift = 4, | 474 kMaxShift = 4, |
| 450 }; | 475 }; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 kRdBits = 5, | 512 kRdBits = 5, |
| 488 kRnShift = 5, | 513 kRnShift = 5, |
| 489 kRnBits = 5, | 514 kRnBits = 5, |
| 490 kRaShift = 10, | 515 kRaShift = 10, |
| 491 kRaBits = 5, | 516 kRaBits = 5, |
| 492 kRmShift = 16, | 517 kRmShift = 16, |
| 493 kRmBits = 5, | 518 kRmBits = 5, |
| 494 kRtShift = 0, | 519 kRtShift = 0, |
| 495 kRtBits = 5, | 520 kRtBits = 5, |
| 496 | 521 |
| 522 // V Registers. |
| 523 kVdShift = 0, |
| 524 kVdBits = 5, |
| 525 kVnShift = 5, |
| 526 kVnBits = 5, |
| 527 |
| 497 // Immediates. | 528 // Immediates. |
| 498 kImm3Shift = 10, | 529 kImm3Shift = 10, |
| 499 kImm3Bits = 3, | 530 kImm3Bits = 3, |
| 500 kImm6Shift = 10, | 531 kImm6Shift = 10, |
| 501 kImm6Bits = 6, | 532 kImm6Bits = 6, |
| 533 kImm8Shift = 13, |
| 534 kImm8Bits = 8, |
| 502 kImm9Shift = 12, | 535 kImm9Shift = 12, |
| 503 kImm9Bits = 9, | 536 kImm9Bits = 9, |
| 504 kImm12Shift = 10, | 537 kImm12Shift = 10, |
| 505 kImm12Bits = 12, | 538 kImm12Bits = 12, |
| 506 kImm12ShiftShift = 22, | 539 kImm12ShiftShift = 22, |
| 507 kImm12ShiftBits = 2, | 540 kImm12ShiftBits = 2, |
| 508 kImm14Shift = 5, | 541 kImm14Shift = 5, |
| 509 kImm14Bits = 14, | 542 kImm14Bits = 14, |
| 510 kImm16Shift = 5, | 543 kImm16Shift = 5, |
| 511 kImm16Bits = 16, | 544 kImm16Bits = 16, |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 Bits(kRdShift, kRdBits)); } | 681 Bits(kRdShift, kRdBits)); } |
| 649 inline Register RnField() const { return static_cast<Register>( | 682 inline Register RnField() const { return static_cast<Register>( |
| 650 Bits(kRnShift, kRnBits)); } | 683 Bits(kRnShift, kRnBits)); } |
| 651 inline Register RaField() const { return static_cast<Register>( | 684 inline Register RaField() const { return static_cast<Register>( |
| 652 Bits(kRaShift, kRaBits)); } | 685 Bits(kRaShift, kRaBits)); } |
| 653 inline Register RmField() const { return static_cast<Register>( | 686 inline Register RmField() const { return static_cast<Register>( |
| 654 Bits(kRmShift, kRmBits)); } | 687 Bits(kRmShift, kRmBits)); } |
| 655 inline Register RtField() const { return static_cast<Register>( | 688 inline Register RtField() const { return static_cast<Register>( |
| 656 Bits(kRtShift, kRtBits)); } | 689 Bits(kRtShift, kRtBits)); } |
| 657 | 690 |
| 691 inline VRegister VdField() const { return static_cast<VRegister>( |
| 692 Bits(kVdShift, kVdBits)); } |
| 693 inline VRegister VnField() const { return static_cast<VRegister>( |
| 694 Bits(kVnShift, kVnBits)); } |
| 695 |
| 658 // Immediates | 696 // Immediates |
| 659 inline int Imm3Field() const { return Bits(kImm3Shift, kImm3Bits); } | 697 inline int Imm3Field() const { return Bits(kImm3Shift, kImm3Bits); } |
| 660 inline int Imm6Field() const { return Bits(kImm6Shift, kImm6Bits); } | 698 inline int Imm6Field() const { return Bits(kImm6Shift, kImm6Bits); } |
| 661 | 699 inline int Imm8Field() const { return Bits(kImm8Shift, kImm8Bits); } |
| 662 inline int Imm9Field() const { return Bits(kImm9Shift, kImm9Bits); } | 700 inline int Imm9Field() const { return Bits(kImm9Shift, kImm9Bits); } |
| 663 // Sign-extended Imm9Field() | 701 // Sign-extended Imm9Field() |
| 664 inline int64_t SImm9Field() const { | 702 inline int64_t SImm9Field() const { |
| 665 return (static_cast<int32_t>(Imm9Field()) << 23) >> 23; } | 703 return (static_cast<int32_t>(Imm9Field()) << 23) >> 23; } |
| 666 | 704 |
| 667 inline int Imm12Field() const { return Bits(kImm12Shift, kImm12Bits); } | 705 inline int Imm12Field() const { return Bits(kImm12Shift, kImm12Bits); } |
| 668 inline int Imm12ShiftField() const { | 706 inline int Imm12ShiftField() const { |
| 669 return Bits(kImm12ShiftShift, kImm12ShiftBits); } | 707 return Bits(kImm12ShiftShift, kImm12ShiftBits); } |
| 670 | 708 |
| 671 inline int Imm16Field() const { return Bits(kImm16Shift, kImm16Bits); } | 709 inline int Imm16Field() const { return Bits(kImm16Shift, kImm16Bits); } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 return RepeatBitsAcrossReg(reg_size, | 833 return RepeatBitsAcrossReg(reg_size, |
| 796 RotateRight(bits, imm_r & mask, width), | 834 RotateRight(bits, imm_r & mask, width), |
| 797 width); | 835 width); |
| 798 } | 836 } |
| 799 } | 837 } |
| 800 } | 838 } |
| 801 UNREACHABLE(); | 839 UNREACHABLE(); |
| 802 return 0; | 840 return 0; |
| 803 } | 841 } |
| 804 | 842 |
| 843 static int64_t VFPExpandImm(uint8_t imm8) { |
| 844 const int64_t sign = |
| 845 static_cast<int64_t>((imm8 & 0x80) >> 7) << 63; |
| 846 const int64_t hi_exp = |
| 847 static_cast<int64_t>(!((imm8 & 0x40) >> 6)) << 62; |
| 848 const int64_t mid_exp = |
| 849 (((imm8 & 0x40) >> 6) == 0) ? 0 : (0xffLL << 54); |
| 850 const int64_t low_exp = |
| 851 static_cast<int64_t>((imm8 & 0x30) >> 4) << 52; |
| 852 const int64_t frac = |
| 853 static_cast<int64_t>(imm8 & 0x0f) << 48; |
| 854 return sign | hi_exp | mid_exp | low_exp | frac; |
| 855 } |
| 856 |
| 805 // Instructions are read out of a code stream. The only way to get a | 857 // Instructions are read out of a code stream. The only way to get a |
| 806 // reference to an instruction is to convert a pointer. There is no way | 858 // reference to an instruction is to convert a pointer. There is no way |
| 807 // to allocate or create instances of class Instr. | 859 // to allocate or create instances of class Instr. |
| 808 // Use the At(pc) function to create references to Instr. | 860 // Use the At(pc) function to create references to Instr. |
| 809 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } | 861 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } |
| 810 | 862 |
| 811 private: | 863 private: |
| 812 DISALLOW_ALLOCATION(); | 864 DISALLOW_ALLOCATION(); |
| 813 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 865 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
| 814 }; | 866 }; |
| 815 | 867 |
| 816 } // namespace dart | 868 } // namespace dart |
| 817 | 869 |
| 818 #endif // VM_CONSTANTS_ARM64_H_ | 870 #endif // VM_CONSTANTS_ARM64_H_ |
| OLD | NEW |