OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/cpuinfo.h" | 10 #include "vm/cpuinfo.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // Before ARMv6, that is only for ARMv5TE, unaligned accesses will cause a | 49 // Before ARMv6, that is only for ARMv5TE, unaligned accesses will cause a |
50 // crash. This includes the ldrd and strd instructions, which must use addresses | 50 // crash. This includes the ldrd and strd instructions, which must use addresses |
51 // that are 8-byte aligned. Since we don't always guarantee that for our uses | 51 // that are 8-byte aligned. Since we don't always guarantee that for our uses |
52 // of ldrd and strd, these instructions are emulated with two load or store | 52 // of ldrd and strd, these instructions are emulated with two load or store |
53 // instructions on ARMv5TE. On ARMv6 and on, we assume that the kernel is | 53 // instructions on ARMv5TE. On ARMv6 and on, we assume that the kernel is |
54 // set up to fixup unaligned accesses. This can be verified by checking | 54 // set up to fixup unaligned accesses. This can be verified by checking |
55 // /proc/cpu/alignment on modern Linux systems. | 55 // /proc/cpu/alignment on modern Linux systems. |
56 | 56 |
57 namespace dart { | 57 namespace dart { |
58 | 58 |
59 // TODO(zra): Add a target for ARMv6. | |
60 #if defined(TARGET_ARCH_ARM_5TE) | 59 #if defined(TARGET_ARCH_ARM_5TE) |
61 DEFINE_FLAG(bool, use_vfp, false, "Use vfp instructions if supported"); | 60 DEFINE_FLAG(bool, use_vfp, false, "Use vfp instructions if supported"); |
62 DEFINE_FLAG(bool, use_neon, false, "Use neon instructions if supported"); | 61 DEFINE_FLAG(bool, use_neon, false, "Use neon instructions if supported"); |
63 DEFINE_FLAG(bool, use_integer_division, false, | 62 DEFINE_FLAG(bool, use_integer_division, false, |
64 "Use integer division instruction if supported"); | 63 "Use integer division instruction if supported"); |
| 64 #elif defined(TARGET_ARCH_ARM_6) |
| 65 DEFINE_FLAG(bool, use_vfp, true, "Use vfp instructions if supported"); |
| 66 DEFINE_FLAG(bool, use_neon, false, "Use neon instructions if supported"); |
| 67 DEFINE_FLAG(bool, use_integer_division, false, |
| 68 "Use integer division instruction if supported"); |
65 #else | 69 #else |
66 DEFINE_FLAG(bool, use_vfp, true, "Use vfp instructions if supported"); | 70 DEFINE_FLAG(bool, use_vfp, true, "Use vfp instructions if supported"); |
67 DEFINE_FLAG(bool, use_neon, true, "Use neon instructions if supported"); | 71 DEFINE_FLAG(bool, use_neon, true, "Use neon instructions if supported"); |
68 DEFINE_FLAG(bool, use_integer_division, true, | 72 DEFINE_FLAG(bool, use_integer_division, true, |
69 "Use integer division instruction if supported"); | 73 "Use integer division instruction if supported"); |
70 #endif | 74 #endif |
71 | 75 |
72 #if defined(USING_SIMULATOR) | 76 #if defined(USING_SIMULATOR) |
73 #if defined(TARGET_ARCH_ARM_5TE) | 77 #if defined(TARGET_ARCH_ARM_5TE) |
74 DEFINE_FLAG(bool, sim_use_hardfp, false, "Use the softfp ABI."); | 78 DEFINE_FLAG(bool, sim_use_hardfp, false, "Use the softfp ABI."); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } | 239 } |
236 | 240 |
237 #else | 241 #else |
238 | 242 |
239 void HostCPUFeatures::InitOnce() { | 243 void HostCPUFeatures::InitOnce() { |
240 CpuInfo::InitOnce(); | 244 CpuInfo::InitOnce(); |
241 hardware_ = CpuInfo::GetCpuModel(); | 245 hardware_ = CpuInfo::GetCpuModel(); |
242 | 246 |
243 #if defined(TARGET_ARCH_ARM_5TE) | 247 #if defined(TARGET_ARCH_ARM_5TE) |
244 arm_version_ = ARMv5TE; | 248 arm_version_ = ARMv5TE; |
| 249 #elif defined(TARGET_ARCH_ARM_6) |
| 250 arm_version_ = ARMv6; |
245 #else | 251 #else |
246 arm_version_ = ARMv7; | 252 arm_version_ = ARMv7; |
247 #endif | 253 #endif |
248 | 254 |
249 integer_division_supported_ = FLAG_use_integer_division; | 255 integer_division_supported_ = FLAG_use_integer_division; |
250 vfp_supported_ = FLAG_use_vfp; | 256 vfp_supported_ = FLAG_use_vfp; |
251 neon_supported_ = FLAG_use_vfp && FLAG_use_neon; | 257 neon_supported_ = FLAG_use_vfp && FLAG_use_neon; |
252 hardfp_supported_ = FLAG_sim_use_hardfp; | 258 hardfp_supported_ = FLAG_sim_use_hardfp; |
253 #if defined(DEBUG) | 259 #if defined(DEBUG) |
254 initialized_ = true; | 260 initialized_ = true; |
255 #endif | 261 #endif |
256 } | 262 } |
257 | 263 |
258 | 264 |
259 void HostCPUFeatures::Cleanup() { | 265 void HostCPUFeatures::Cleanup() { |
260 DEBUG_ASSERT(initialized_); | 266 DEBUG_ASSERT(initialized_); |
261 #if defined(DEBUG) | 267 #if defined(DEBUG) |
262 initialized_ = false; | 268 initialized_ = false; |
263 #endif | 269 #endif |
264 ASSERT(hardware_ != NULL); | 270 ASSERT(hardware_ != NULL); |
265 free(const_cast<char*>(hardware_)); | 271 free(const_cast<char*>(hardware_)); |
266 hardware_ = NULL; | 272 hardware_ = NULL; |
267 CpuInfo::Cleanup(); | 273 CpuInfo::Cleanup(); |
268 } | 274 } |
269 #endif // !defined(USING_SIMULATOR) | 275 #endif // !defined(USING_SIMULATOR) |
270 | 276 |
271 } // namespace dart | 277 } // namespace dart |
272 | 278 |
273 #endif // defined TARGET_ARCH_ARM | 279 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |