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