Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
cpu_arm.h
Go to the documentation of this 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
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_CPU_ARM_H_
6#define RUNTIME_VM_CPU_ARM_H_
7
8#if !defined(RUNTIME_VM_CPU_H_)
9#error Do not include cpu_arm.h directly; use cpu.h instead.
10#endif
11
12#include "vm/allocation.h"
13#include "vm/flags.h"
14#include "vm/simulator.h"
15
16namespace dart {
17
18// TargetCPUFeatures gives CPU features for the architecture that we are
19// generating code for. HostCPUFeatures gives the CPU features for the
20// architecture that we are actually running on. When the architectures
21// are the same, TargetCPUFeatures will query HostCPUFeatures. When they are
22// different (i.e. we are running in a simulator), HostCPUFeatures will
23// additionally mock the options needed for the target architecture so that
24// they may be altered for testing.
25
26class HostCPUFeatures : public AllStatic {
27 public:
28 static void Init();
29 static void Cleanup();
30 static const char* hardware() {
31 DEBUG_ASSERT(initialized_);
32 return hardware_;
33 }
35 DEBUG_ASSERT(initialized_);
36 return integer_division_supported_ && !FLAG_target_unknown_cpu;
37 }
38 static bool neon_supported() {
39 DEBUG_ASSERT(initialized_);
40 return neon_supported_;
41 }
42 static bool hardfp_supported() {
43 DEBUG_ASSERT(initialized_);
44 return hardfp_supported_;
45 }
46
47#if !defined(HOST_ARCH_ARM)
48 static void set_integer_division_supported(bool supported) {
49 DEBUG_ASSERT(initialized_);
50 integer_division_supported_ = supported;
51 }
52 static void set_neon_supported(bool supported) {
53 DEBUG_ASSERT(initialized_);
54 neon_supported_ = supported;
55 }
56#endif // !defined(HOST_ARCH_ARM)
57
58 private:
59 static const char* hardware_;
60 static bool integer_division_supported_;
61 static bool neon_supported_;
62 static bool hardfp_supported_;
63#if defined(DEBUG)
64 static bool initialized_;
65#endif
66};
67
69 public:
70 static void Init() { HostCPUFeatures::Init(); }
71 static void Cleanup() { HostCPUFeatures::Cleanup(); }
72 static bool double_truncate_round_supported() { return false; }
78 static const char* hardware() { return HostCPUFeatures::hardware(); }
79};
80
81} // namespace dart
82
83#endif // RUNTIME_VM_CPU_ARM_H_
#define DEBUG_ASSERT(cond)
Definition assert.h:321
static bool integer_division_supported()
Definition cpu_arm.h:34
static const char * hardware()
Definition cpu_arm.h:30
static void Init()
static void set_integer_division_supported(bool supported)
Definition cpu_arm.h:48
static bool neon_supported()
Definition cpu_arm.h:38
static bool hardfp_supported()
Definition cpu_arm.h:42
static void set_neon_supported(bool supported)
Definition cpu_arm.h:52
static void Cleanup()
static bool hardfp_supported()
Definition cpu_arm.h:77
static bool neon_supported()
Definition cpu_arm.h:76
static void Init()
Definition cpu_arm.h:70
static bool double_truncate_round_supported()
Definition cpu_arm.h:72
static bool integer_division_supported()
Definition cpu_arm.h:73
static void Cleanup()
Definition cpu_arm.h:71
static const char * hardware()
Definition cpu_arm.h:78