| 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 RUNTIME_VM_CPU_ARM_H_ | 5 #ifndef RUNTIME_VM_CPU_ARM_H_ |
| 6 #define RUNTIME_VM_CPU_ARM_H_ | 6 #define RUNTIME_VM_CPU_ARM_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/simulator.h" | 9 #include "vm/simulator.h" |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 // TargetCPUFeatures gives CPU features for the architecture that we are | 13 // TargetCPUFeatures gives CPU features for the architecture that we are |
| 14 // generating code for. HostCPUFeatures gives the CPU features for the | 14 // generating code for. HostCPUFeatures gives the CPU features for the |
| 15 // architecture that we are actually running on. When the architectures | 15 // architecture that we are actually running on. When the architectures |
| 16 // are the same, TargetCPUFeatures will query HostCPUFeatures. When they are | 16 // are the same, TargetCPUFeatures will query HostCPUFeatures. When they are |
| 17 // different (i.e. we are running in a simulator), HostCPUFeatures will | 17 // different (i.e. we are running in a simulator), HostCPUFeatures will |
| 18 // additionally mock the options needed for the target architecture so that | 18 // additionally mock the options needed for the target architecture so that |
| 19 // they may be altered for testing. | 19 // they may be altered for testing. |
| 20 | 20 |
| 21 enum ARMVersion { | 21 enum ARMVersion { |
| 22 ARMv5TE, | 22 ARMv5TE, |
| 23 ARMv6, | 23 ARMv6, |
| 24 ARMv7, | 24 ARMv7, |
| 25 ARMvUnknown, | 25 ARMvUnknown, |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 class HostCPUFeatures: public AllStatic { | 28 class HostCPUFeatures : public AllStatic { |
| 29 public: | 29 public: |
| 30 static void InitOnce(); | 30 static void InitOnce(); |
| 31 static void Cleanup(); | 31 static void Cleanup(); |
| 32 static const char* hardware() { | 32 static const char* hardware() { |
| 33 DEBUG_ASSERT(initialized_); | 33 DEBUG_ASSERT(initialized_); |
| 34 return hardware_; | 34 return hardware_; |
| 35 } | 35 } |
| 36 static bool integer_division_supported() { | 36 static bool integer_division_supported() { |
| 37 DEBUG_ASSERT(initialized_); | 37 DEBUG_ASSERT(initialized_); |
| 38 return integer_division_supported_; | 38 return integer_division_supported_; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 static bool hardfp_supported_; | 85 static bool hardfp_supported_; |
| 86 static ARMVersion arm_version_; | 86 static ARMVersion arm_version_; |
| 87 static intptr_t store_pc_read_offset_; | 87 static intptr_t store_pc_read_offset_; |
| 88 #if defined(DEBUG) | 88 #if defined(DEBUG) |
| 89 static bool initialized_; | 89 static bool initialized_; |
| 90 #endif | 90 #endif |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 class TargetCPUFeatures : public AllStatic { | 93 class TargetCPUFeatures : public AllStatic { |
| 94 public: | 94 public: |
| 95 static void InitOnce() { | 95 static void InitOnce() { HostCPUFeatures::InitOnce(); } |
| 96 HostCPUFeatures::InitOnce(); | 96 static void Cleanup() { HostCPUFeatures::Cleanup(); } |
| 97 } | 97 static bool double_truncate_round_supported() { return false; } |
| 98 static void Cleanup() { | |
| 99 HostCPUFeatures::Cleanup(); | |
| 100 } | |
| 101 static bool double_truncate_round_supported() { | |
| 102 return false; | |
| 103 } | |
| 104 static bool integer_division_supported() { | 98 static bool integer_division_supported() { |
| 105 return HostCPUFeatures::integer_division_supported(); | 99 return HostCPUFeatures::integer_division_supported(); |
| 106 } | 100 } |
| 107 static bool vfp_supported() { | 101 static bool vfp_supported() { return HostCPUFeatures::vfp_supported(); } |
| 108 return HostCPUFeatures::vfp_supported(); | |
| 109 } | |
| 110 static bool can_divide() { | 102 static bool can_divide() { |
| 111 return integer_division_supported() || vfp_supported(); | 103 return integer_division_supported() || vfp_supported(); |
| 112 } | 104 } |
| 113 static bool neon_supported() { | 105 static bool neon_supported() { return HostCPUFeatures::neon_supported(); } |
| 114 return HostCPUFeatures::neon_supported(); | 106 static bool hardfp_supported() { return HostCPUFeatures::hardfp_supported(); } |
| 115 } | 107 static const char* hardware() { return HostCPUFeatures::hardware(); } |
| 116 static bool hardfp_supported() { | 108 static ARMVersion arm_version() { return HostCPUFeatures::arm_version(); } |
| 117 return HostCPUFeatures::hardfp_supported(); | |
| 118 } | |
| 119 static const char* hardware() { | |
| 120 return HostCPUFeatures::hardware(); | |
| 121 } | |
| 122 static ARMVersion arm_version() { | |
| 123 return HostCPUFeatures::arm_version(); | |
| 124 } | |
| 125 static intptr_t store_pc_read_offset() { | 109 static intptr_t store_pc_read_offset() { |
| 126 return HostCPUFeatures::store_pc_read_offset(); | 110 return HostCPUFeatures::store_pc_read_offset(); |
| 127 } | 111 } |
| 128 }; | 112 }; |
| 129 | 113 |
| 130 } // namespace dart | 114 } // namespace dart |
| 131 | 115 |
| 132 #endif // RUNTIME_VM_CPU_ARM_H_ | 116 #endif // RUNTIME_VM_CPU_ARM_H_ |
| OLD | NEW |