| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 R30 = 30, // LR | 45 R30 = 30, // LR |
| 46 R31 = 31, // ZR, SP | 46 R31 = 31, // ZR, SP |
| 47 kNumberOfCpuRegisters = 32, | 47 kNumberOfCpuRegisters = 32, |
| 48 kNoRegister = -1, | 48 kNoRegister = -1, |
| 49 | 49 |
| 50 // These registers both use the encoding R31, but to avoid mistakes we give | 50 // These registers both use the encoding R31, but to avoid mistakes we give |
| 51 // them different values, and then translate before encoding. | 51 // them different values, and then translate before encoding. |
| 52 SP = 32, | 52 SP = 32, |
| 53 ZR = 33, | 53 ZR = 33, |
| 54 | 54 |
| 55 // SPREG is used from architecture independent code. It is only ever passed to |
| 56 // Simulator::get_register(). Calls to get_register() from architecture |
| 57 // independent code don't include an R31Type, so if we were to define |
| 58 // SPREG to be R31, we wouldn't be able to distinguish from ZR. Therefore we |
| 59 // use another value, and check for it in get_register(). |
| 60 SPREG = 34, |
| 61 |
| 55 // Aliases. | 62 // Aliases. |
| 56 IP0 = R16, | 63 IP0 = R16, |
| 57 IP1 = R17, | 64 IP1 = R17, |
| 58 FP = R29, | 65 FP = R29, |
| 59 LR = R30, | 66 LR = R30, |
| 60 }; | 67 }; |
| 61 | 68 |
| 62 enum VRegister { | 69 enum VRegister { |
| 63 V0 = 0, | 70 V0 = 0, |
| 64 V1 = 1, | 71 V1 = 1, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 typedef VRegister FpuRegister; | 111 typedef VRegister FpuRegister; |
| 105 const FpuRegister FpuTMP = VTMP0; | 112 const FpuRegister FpuTMP = VTMP0; |
| 106 const int kNumberOfFpuRegisters = kNumberOfVRegisters; | 113 const int kNumberOfFpuRegisters = kNumberOfVRegisters; |
| 107 const FpuRegister kNoFpuRegister = kNoVRegister; | 114 const FpuRegister kNoFpuRegister = kNoVRegister; |
| 108 | 115 |
| 109 // Register aliases. | 116 // Register aliases. |
| 110 const Register TMP = R16; // Used as scratch register by assembler. | 117 const Register TMP = R16; // Used as scratch register by assembler. |
| 111 const Register TMP2 = R17; | 118 const Register TMP2 = R17; |
| 112 const Register CTX = R28; // Caches current context in generated code. | 119 const Register CTX = R28; // Caches current context in generated code. |
| 113 const Register PP = R27; // Caches object pool pointer in generated code. | 120 const Register PP = R27; // Caches object pool pointer in generated code. |
| 114 const Register SPREG = R31; // Stack pointer register. | |
| 115 const Register FPREG = FP; // Frame pointer register. | 121 const Register FPREG = FP; // Frame pointer register. |
| 116 const Register ICREG = R5; // IC data register. | 122 const Register ICREG = R5; // IC data register. |
| 117 | 123 |
| 118 // Exception object is passed in this register to the catch handlers when an | 124 // Exception object is passed in this register to the catch handlers when an |
| 119 // exception is thrown. | 125 // exception is thrown. |
| 120 const Register kExceptionObjectReg = R0; | 126 const Register kExceptionObjectReg = R0; |
| 121 | 127 |
| 122 // Stack trace object is passed in this register to the catch handlers when | 128 // Stack trace object is passed in this register to the catch handlers when |
| 123 // an exception is thrown. | 129 // an exception is thrown. |
| 124 const Register kStackTraceObjectReg = R1; | 130 const Register kStackTraceObjectReg = R1; |
| 125 | 131 |
| 126 // Masks, sizes, etc. | 132 // Masks, sizes, etc. |
| 127 const int kXRegSizeInBits = 64; | 133 const int kXRegSizeInBits = 64; |
| 128 const int kWRegSizeInBits = 32; | 134 const int kWRegSizeInBits = 32; |
| 129 const int64_t kXRegMask = 0xffffffffffffffffL; | 135 const int64_t kXRegMask = 0xffffffffffffffffL; |
| 130 const int64_t kWRegMask = 0x00000000ffffffffL; | 136 const int64_t kWRegMask = 0x00000000ffffffffL; |
| 131 | 137 |
| 132 // List of registers used in load/store multiple. | 138 // List of registers used in load/store multiple. |
| 133 typedef uint32_t RegList; | 139 typedef uint32_t RegList; |
| 134 const RegList kAllCpuRegistersList = 0xFFFF; | 140 const RegList kAllCpuRegistersList = 0xFFFF; |
| 135 | 141 |
| 136 | 142 |
| 137 // C++ ABI call registers. | 143 // C++ ABI call registers. |
| 138 const RegList kAbiArgumentCpuRegs = | 144 const RegList kAbiArgumentCpuRegs = |
| 139 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) | | 145 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) | |
| 140 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7); | 146 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7); |
| 141 const RegList kAbiPreservedCpuRegs = | 147 const RegList kAbiPreservedCpuRegs = |
| 142 (1 << R19) | (1 << R20) | (1 << R21) | (1 << R22) | | 148 (1 << R19) | (1 << R20) | (1 << R21) | (1 << R22) | |
| 143 (1 << R23) | (1 << R24) | (1 << R25) | (1 << R26) | | 149 (1 << R23) | (1 << R24) | (1 << R25) | (1 << R26) | |
| 144 (1 << R27) | (1 << R28) | (1 << R29); | 150 (1 << R27) | (1 << R28); |
| 145 const int kAbiPreservedCpuRegCount = 11; | 151 const int kAbiPreservedCpuRegCount = 10; |
| 146 const VRegister kAbiFirstPreservedFpuReg = V8; | 152 const VRegister kAbiFirstPreservedFpuReg = V8; |
| 147 const VRegister kAbiLastPreservedFpuReg = V15; | 153 const VRegister kAbiLastPreservedFpuReg = V15; |
| 148 const int kAbiPreservedFpuRegCount = 8; | 154 const int kAbiPreservedFpuRegCount = 8; |
| 149 | 155 |
| 150 // CPU registers available to Dart allocator. | 156 // CPU registers available to Dart allocator. |
| 151 const RegList kDartAvailableCpuRegs = | 157 const RegList kDartAvailableCpuRegs = |
| 152 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) | | 158 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) | |
| 153 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7) | | 159 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7) | |
| 154 (1 << R8) | (1 << R9) | (1 << R10) | (1 << R11) | | 160 (1 << R8) | (1 << R9) | (1 << R10) | (1 << R11) | |
| 155 (1 << R12) | (1 << R13) | (1 << R14) | (1 << R15) | | 161 (1 << R12) | (1 << R13) | (1 << R14) | (1 << R15) | |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 enum { | 584 enum { |
| 579 kInstrSize = 4, | 585 kInstrSize = 4, |
| 580 kInstrSizeLog2 = 2, | 586 kInstrSizeLog2 = 2, |
| 581 kPCReadOffset = 8 | 587 kPCReadOffset = 8 |
| 582 }; | 588 }; |
| 583 | 589 |
| 584 static const int32_t kNopInstruction = HINT; // hint #0 === nop. | 590 static const int32_t kNopInstruction = HINT; // hint #0 === nop. |
| 585 static const int32_t kBreakPointInstruction = // hlt #kImmExceptionIsDebug. | 591 static const int32_t kBreakPointInstruction = // hlt #kImmExceptionIsDebug. |
| 586 HLT | (kImmExceptionIsDebug << kImm16Shift); | 592 HLT | (kImmExceptionIsDebug << kImm16Shift); |
| 587 static const int kBreakPointInstructionSize = kInstrSize; | 593 static const int kBreakPointInstructionSize = kInstrSize; |
| 594 static const int32_t kRedirectInstruction = |
| 595 HLT | (kImmExceptionIsRedirectedCall << kImm16Shift); |
| 588 | 596 |
| 589 // Read one particular bit out of the instruction bits. | 597 // Read one particular bit out of the instruction bits. |
| 590 inline int Bit(int nr) const { | 598 inline int Bit(int nr) const { |
| 591 return (InstructionBits() >> nr) & 1; | 599 return (InstructionBits() >> nr) & 1; |
| 592 } | 600 } |
| 593 | 601 |
| 594 // Read a bit field out of the instruction bits. | 602 // Read a bit field out of the instruction bits. |
| 595 inline int Bits(int shift, int count) const { | 603 inline int Bits(int shift, int count) const { |
| 596 return (InstructionBits() >> shift) & ((1 << count) - 1); | 604 return (InstructionBits() >> shift) & ((1 << count) - 1); |
| 597 } | 605 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } | 799 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } |
| 792 | 800 |
| 793 private: | 801 private: |
| 794 DISALLOW_ALLOCATION(); | 802 DISALLOW_ALLOCATION(); |
| 795 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 803 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
| 796 }; | 804 }; |
| 797 | 805 |
| 798 } // namespace dart | 806 } // namespace dart |
| 799 | 807 |
| 800 #endif // VM_CONSTANTS_ARM64_H_ | 808 #endif // VM_CONSTANTS_ARM64_H_ |
| OLD | NEW |