| 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/globals.h" | 8 #include "platform/globals.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 // We support both VFPv3-D16 and VFPv3-D32 profiles, but currently only one at | 13 // We support both VFPv3-D16 and VFPv3-D32 profiles, but currently only one at |
| 14 // a time. | 14 // a time. |
| 15 #if defined(__ARM_ARCH_7A__) | 15 #if defined(__ARM_ARCH_7A__) |
| 16 #define VFPv3_D32 | 16 #define VFPv3_D32 |
| 17 #elif defined(TARGET_ARCH_ARM) && !defined(HOST_ARCH_ARM) | 17 #elif defined(TARGET_ARCH_ARM) && !defined(HOST_ARCH_ARM) |
| 18 // If we're running in the simulator, use all 32. | 18 // If we're running in the simulator, use all 32. |
| 19 #define VFPv3_D32 | 19 #define VFPv3_D32 |
| 20 #else | 20 #else |
| 21 #define VFPv3_D16 | 21 #define VFPv3_D16 |
| 22 #endif | 22 #endif |
| 23 #if defined(VFPv3_D16) == defined(VFPv3_D32) | 23 #if defined(VFPv3_D16) == defined(VFPv3_D32) |
| 24 #error "Exactly one of VFPv3_D16 or VFPv3_D32 can be defined at a time." | 24 #error "Exactly one of VFPv3_D16 or VFPv3_D32 can be defined at a time." |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 | 27 |
| 28 // The Linux/Android ABI and the iOS ABI differ in their choice of frame |
| 29 // pointer, their treatment of R9, and the interproduceral stack alignment. |
| 30 |
| 31 // EABI (Linux, Android) |
| 32 // See "Procedure Call Standard for the ARM Architecture". |
| 33 // R0-R1: Argument / result / volatile |
| 34 // R2-R3: Argument / volatile |
| 35 // R4-R10: Preserved |
| 36 // R11: Frame pointer |
| 37 // R12: Volatile |
| 38 // R13: Stack pointer |
| 39 // R14: Link register |
| 40 // R15: Program counter |
| 41 // Stack alignment: 4 bytes always, 8 bytes at public interfaces |
| 42 |
| 43 // Linux (Debian armhf) and Android also differ in whether floating point |
| 44 // arguments are passed in registers. Linux uses hardfp and Android uses |
| 45 // softfp. See TargetCPUFeatures::hardfp_supported(). |
| 46 |
| 47 // iOS ABI |
| 48 // See "iOS ABI Function Call Guide" |
| 49 // R0-R1: Argument / result / volatile |
| 50 // R2-R3: Argument / volatile |
| 51 // R4-R6: Preserved |
| 52 // R7: Frame pointer |
| 53 // R8-R9: Preserved |
| 54 // R12: Volatile |
| 55 // R13: Stack pointer |
| 56 // R14: Link register |
| 57 // R15: Program counter |
| 58 // Stack alignment: 4 bytes always, 4 bytes at public interfaces |
| 59 |
| 60 // iOS passes floating point arguments in registers (hardfp) |
| 61 |
| 62 |
| 28 enum Register { | 63 enum Register { |
| 29 R0 = 0, | 64 R0 = 0, |
| 30 R1 = 1, | 65 R1 = 1, |
| 31 R2 = 2, | 66 R2 = 2, |
| 32 R3 = 3, | 67 R3 = 3, |
| 33 R4 = 4, | 68 R4 = 4, |
| 34 R5 = 5, // PP | 69 R5 = 5, // PP |
| 35 R6 = 6, // CTX | 70 R6 = 6, // CTX |
| 36 R7 = 7, // iOS FP | 71 R7 = 7, // iOS FP |
| 37 R8 = 8, | 72 R8 = 8, |
| 38 R9 = 9, | 73 R9 = 9, |
| 39 R10 = 10, // THR | 74 R10 = 10, // THR |
| 40 R11 = 11, // Linux FP | 75 R11 = 11, // Linux FP |
| 41 R12 = 12, // IP aka TMP | 76 R12 = 12, // IP aka TMP |
| 42 R13 = 13, // SP | 77 R13 = 13, // SP |
| 43 R14 = 14, // LR | 78 R14 = 14, // LR |
| 44 R15 = 15, // PC | 79 R15 = 15, // PC |
| 45 kNumberOfCpuRegisters = 16, | 80 kNumberOfCpuRegisters = 16, |
| 46 kNoRegister = -1, // Signals an illegal register. | 81 kNoRegister = -1, // Signals an illegal register. |
| 47 | 82 |
| 48 // Aliases. | 83 // Aliases. |
| 49 #if defined(TARGET_OS_MACOS) | 84 #if defined(TARGET_ABI_IOS) |
| 50 FP = R7, | 85 FP = R7, |
| 51 NOTFP = R11, | 86 NOTFP = R11, |
| 52 #else | 87 #elif defined(TARGET_ABI_EABI) |
| 53 FP = R11, | 88 FP = R11, |
| 54 NOTFP = R7, | 89 NOTFP = R7, |
| 90 #else |
| 91 #error Unknown ABI |
| 55 #endif | 92 #endif |
| 56 IP = R12, | 93 IP = R12, |
| 57 SP = R13, | 94 SP = R13, |
| 58 LR = R14, | 95 LR = R14, |
| 59 PC = R15, | 96 PC = R15, |
| 60 }; | 97 }; |
| 61 | 98 |
| 62 | 99 |
| 63 // Values for single-precision floating point registers. | 100 // Values for single-precision floating point registers. |
| 64 enum SRegister { | 101 enum SRegister { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 298 |
| 262 | 299 |
| 263 // List of registers used in load/store multiple. | 300 // List of registers used in load/store multiple. |
| 264 typedef uint16_t RegList; | 301 typedef uint16_t RegList; |
| 265 const RegList kAllCpuRegistersList = 0xFFFF; | 302 const RegList kAllCpuRegistersList = 0xFFFF; |
| 266 | 303 |
| 267 | 304 |
| 268 // C++ ABI call registers. | 305 // C++ ABI call registers. |
| 269 const RegList kAbiArgumentCpuRegs = | 306 const RegList kAbiArgumentCpuRegs = |
| 270 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3); | 307 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3); |
| 271 #if defined(TARGET_OS_MACOS) | 308 #if defined(TARGET_ABI_IOS) |
| 272 const RegList kAbiPreservedCpuRegs = | 309 const RegList kAbiPreservedCpuRegs = |
| 273 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R8) | | 310 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R8) | |
| 274 (1 << R10) | (1 << R11); | 311 (1 << R10) | (1 << R11); |
| 275 const int kAbiPreservedCpuRegCount = 6; | 312 const int kAbiPreservedCpuRegCount = 6; |
| 276 #else | 313 #elif defined(TARGET_ABI_EABI) |
| 277 const RegList kAbiPreservedCpuRegs = | 314 const RegList kAbiPreservedCpuRegs = |
| 278 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7) | | 315 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7) | |
| 279 (1 << R8) | (1 << R9) | (1 << R10); | 316 (1 << R8) | (1 << R9) | (1 << R10); |
| 280 const int kAbiPreservedCpuRegCount = 7; | 317 const int kAbiPreservedCpuRegCount = 7; |
| 318 #else |
| 319 #error Unknown ABI |
| 281 #endif | 320 #endif |
| 282 const QRegister kAbiFirstPreservedFpuReg = Q4; | 321 const QRegister kAbiFirstPreservedFpuReg = Q4; |
| 283 const QRegister kAbiLastPreservedFpuReg = Q7; | 322 const QRegister kAbiLastPreservedFpuReg = Q7; |
| 284 const int kAbiPreservedFpuRegCount = 4; | 323 const int kAbiPreservedFpuRegCount = 4; |
| 285 | 324 |
| 286 const RegList kReservedCpuRegisters = | 325 const RegList kReservedCpuRegisters = |
| 287 (1 << SPREG) | | 326 (1 << SPREG) | |
| 288 (1 << FPREG) | | 327 (1 << FPREG) | |
| 289 (1 << TMP) | | 328 (1 << TMP) | |
| 290 (1 << PP) | | 329 (1 << PP) | |
| 291 (1 << THR) | | 330 (1 << THR) | |
| 292 (1 << PC); | 331 (1 << PC); |
| 293 // CPU registers available to Dart allocator. | 332 // CPU registers available to Dart allocator. |
| 294 const RegList kDartAvailableCpuRegs = | 333 const RegList kDartAvailableCpuRegs = |
| 295 kAllCpuRegistersList & ~kReservedCpuRegisters; | 334 kAllCpuRegistersList & ~kReservedCpuRegisters; |
| 296 // Registers available to Dart that are not preserved by runtime calls. | 335 // Registers available to Dart that are not preserved by runtime calls. |
| 297 const RegList kDartVolatileCpuRegs = | 336 const RegList kDartVolatileCpuRegs = |
| 298 kDartAvailableCpuRegs & ~kAbiPreservedCpuRegs; | 337 kDartAvailableCpuRegs & ~kAbiPreservedCpuRegs; |
| 299 #if defined(TARGET_OS_MACOS) | 338 #if defined(TARGET_ABI_IOS) |
| 300 const int kDartVolatileCpuRegCount = 6; | 339 const int kDartVolatileCpuRegCount = 6; |
| 301 #else | 340 #elif defined(TARGET_ABI_EABI) |
| 302 const int kDartVolatileCpuRegCount = 5; | 341 const int kDartVolatileCpuRegCount = 5; |
| 303 #endif | 342 #endif |
| 304 const QRegister kDartFirstVolatileFpuReg = Q0; | 343 const QRegister kDartFirstVolatileFpuReg = Q0; |
| 305 const QRegister kDartLastVolatileFpuReg = Q3; | 344 const QRegister kDartLastVolatileFpuReg = Q3; |
| 306 const int kDartVolatileFpuRegCount = 4; | 345 const int kDartVolatileFpuRegCount = 4; |
| 307 | 346 |
| 308 | 347 |
| 309 // Values for the condition field as defined in section A3.2. | 348 // Values for the condition field as defined in section A3.2. |
| 310 enum Condition { | 349 enum Condition { |
| 311 kNoCondition = -1, | 350 kNoCondition = -1, |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } | 768 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } |
| 730 | 769 |
| 731 private: | 770 private: |
| 732 DISALLOW_ALLOCATION(); | 771 DISALLOW_ALLOCATION(); |
| 733 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 772 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
| 734 }; | 773 }; |
| 735 | 774 |
| 736 } // namespace dart | 775 } // namespace dart |
| 737 | 776 |
| 738 #endif // VM_CONSTANTS_ARM_H_ | 777 #endif // VM_CONSTANTS_ARM_H_ |
| OLD | NEW |