1 //===-- RegisterInfoPOSIX_ppc64le.cpp --------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===---------------------------------------------------------------------===//
13 #include "lldb/lldb-defines.h"
14 #include "llvm/Support/Compiler.h"
16 #include "RegisterInfoPOSIX_ppc64le.h"
18 // Include RegisterInfoPOSIX_ppc64le to declare our g_register_infos_ppc64le
19 #define DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
20 #include "RegisterInfos_ppc64le.h"
21 #undef DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
23 static const lldb_private::RegisterInfo *
24 GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch) {
25 switch (target_arch.GetMachine()) {
26 case llvm::Triple::ppc64le:
27 return g_register_infos_ppc64le;
29 assert(false && "Unhandled target architecture.");
35 GetRegisterInfoCount(const lldb_private::ArchSpec &target_arch) {
36 switch (target_arch.GetMachine()) {
37 case llvm::Triple::ppc64le:
38 return static_cast<uint32_t>(sizeof(g_register_infos_ppc64le) /
39 sizeof(g_register_infos_ppc64le[0]));
41 assert(false && "Unhandled target architecture.");
46 RegisterInfoPOSIX_ppc64le::RegisterInfoPOSIX_ppc64le(
47 const lldb_private::ArchSpec &target_arch)
48 : lldb_private::RegisterInfoInterface(target_arch),
49 m_register_info_p(GetRegisterInfoPtr(target_arch)),
50 m_register_info_count(GetRegisterInfoCount(target_arch)) {}
52 size_t RegisterInfoPOSIX_ppc64le::GetGPRSize() const {
56 const lldb_private::RegisterInfo *
57 RegisterInfoPOSIX_ppc64le::GetRegisterInfo() const {
58 return m_register_info_p;
61 uint32_t RegisterInfoPOSIX_ppc64le::GetRegisterCount() const {
62 return m_register_info_count;