Flutter Engine
The Flutter Engine
cpu_riscv.h
Go to the documentation of this file.
1// Copyright (c) 2021, 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_RISCV_H_
6#define RUNTIME_VM_CPU_RISCV_H_
7
8#if !defined(RUNTIME_VM_CPU_H_)
9#error Do not include cpu_riscv.h directly; use cpu.h instead.
10#endif
11
12#include "vm/allocation.h"
13#include "vm/simulator.h"
14
15namespace dart {
16
17// TargetCPUFeatures gives CPU features for the architecture that we are
18// generating code for. HostCPUFeatures gives the CPU features for the
19// architecture that we are actually running on. When the architectures
20// are the same, TargetCPUFeatures will query HostCPUFeatures. When they are
21// different (i.e. we are running in a simulator), HostCPUFeatures will
22// additionally mock the options needed for the target architecture so that
23// they may be altered for testing.
24
25class HostCPUFeatures : public AllStatic {
26 public:
27 static void Init();
28 static void Cleanup();
29 static const char* hardware() {
30 DEBUG_ASSERT(initialized_);
31 return hardware_;
32 }
33
34 private:
35 static const char* hardware_;
36#if defined(DEBUG)
37 static bool initialized_;
38#endif
39};
40
41class TargetCPUFeatures : public AllStatic {
42 public:
43 static void Init() { HostCPUFeatures::Init(); }
44 static void Cleanup() { HostCPUFeatures::Cleanup(); }
45 static const char* hardware() { return HostCPUFeatures::hardware(); }
46 static bool double_truncate_round_supported() { return false; }
47};
48
49} // namespace dart
50
51#endif // RUNTIME_VM_CPU_RISCV_H_
#define DEBUG_ASSERT(cond)
Definition: assert.h:321
static const char * hardware()
Definition: cpu_riscv.h:29
static void Init()
static void Cleanup()
static void Init()
Definition: cpu_riscv.h:43
static bool double_truncate_round_supported()
Definition: cpu_riscv.h:46
static void Cleanup()
Definition: cpu_riscv.h:44
static const char * hardware()
Definition: cpu_riscv.h:45
Definition: dart_vm.cc:33