xref: /openbsd-src/gnu/llvm/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
1*be691f3bSpatrick //===-- ArchitectureAArch64.cpp -------------------------------------------===//
2*be691f3bSpatrick //
3*be691f3bSpatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*be691f3bSpatrick // See https://llvm.org/LICENSE.txt for license information.
5*be691f3bSpatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*be691f3bSpatrick //
7*be691f3bSpatrick //===----------------------------------------------------------------------===//
8*be691f3bSpatrick 
9*be691f3bSpatrick #include "Plugins/Architecture/AArch64/ArchitectureAArch64.h"
10*be691f3bSpatrick #include "lldb/Core/PluginManager.h"
11*be691f3bSpatrick #include "lldb/Utility/ArchSpec.h"
12*be691f3bSpatrick 
13*be691f3bSpatrick using namespace lldb_private;
14*be691f3bSpatrick using namespace lldb;
15*be691f3bSpatrick 
LLDB_PLUGIN_DEFINE(ArchitectureAArch64)16*be691f3bSpatrick LLDB_PLUGIN_DEFINE(ArchitectureAArch64)
17*be691f3bSpatrick 
18*be691f3bSpatrick void ArchitectureAArch64::Initialize() {
19*be691f3bSpatrick   PluginManager::RegisterPlugin(GetPluginNameStatic(),
20*be691f3bSpatrick                                 "AArch64-specific algorithms",
21*be691f3bSpatrick                                 &ArchitectureAArch64::Create);
22*be691f3bSpatrick }
23*be691f3bSpatrick 
Terminate()24*be691f3bSpatrick void ArchitectureAArch64::Terminate() {
25*be691f3bSpatrick   PluginManager::UnregisterPlugin(&ArchitectureAArch64::Create);
26*be691f3bSpatrick }
27*be691f3bSpatrick 
28*be691f3bSpatrick std::unique_ptr<Architecture>
Create(const ArchSpec & arch)29*be691f3bSpatrick ArchitectureAArch64::Create(const ArchSpec &arch) {
30*be691f3bSpatrick   auto machine = arch.GetMachine();
31*be691f3bSpatrick   if (machine != llvm::Triple::aarch64 && machine != llvm::Triple::aarch64_be &&
32*be691f3bSpatrick       machine != llvm::Triple::aarch64_32) {
33*be691f3bSpatrick     return nullptr;
34*be691f3bSpatrick   }
35*be691f3bSpatrick   return std::unique_ptr<Architecture>(new ArchitectureAArch64());
36*be691f3bSpatrick }
37