]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp
MFV r329552: less v530.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / Process / Utility / RegisterInfoPOSIX_ppc64le.cpp
1 //===-- RegisterInfoPOSIX_ppc64le.cpp --------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===---------------------------------------------------------------------===//
9
10 #include <cassert>
11 #include <stddef.h>
12 #include <vector>
13
14 #include "lldb/lldb-defines.h"
15 #include "llvm/Support/Compiler.h"
16
17 #include "RegisterInfoPOSIX_ppc64le.h"
18
19 //-----------------------------------------------------------------------------
20 // Include RegisterInfoPOSIX_ppc64le to declare our g_register_infos_ppc64le
21 //-----------------------------------------------------------------------------
22 #define DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
23 #include "RegisterInfos_ppc64le.h"
24 #undef DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
25
26 static const lldb_private::RegisterInfo *
27 GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch) {
28   switch (target_arch.GetMachine()) {
29   case llvm::Triple::ppc64le:
30     return g_register_infos_ppc64le;
31   default:
32     assert(false && "Unhandled target architecture.");
33     return NULL;
34   }
35 }
36
37 static uint32_t
38 GetRegisterInfoCount(const lldb_private::ArchSpec &target_arch) {
39   switch (target_arch.GetMachine()) {
40   case llvm::Triple::ppc64le:
41     return static_cast<uint32_t>(sizeof(g_register_infos_ppc64le) /
42                                  sizeof(g_register_infos_ppc64le[0]));
43   default:
44     assert(false && "Unhandled target architecture.");
45     return 0;
46   }
47 }
48
49 RegisterInfoPOSIX_ppc64le::RegisterInfoPOSIX_ppc64le(
50     const lldb_private::ArchSpec &target_arch)
51     : lldb_private::RegisterInfoInterface(target_arch),
52       m_register_info_p(GetRegisterInfoPtr(target_arch)),
53       m_register_info_count(GetRegisterInfoCount(target_arch)) {}
54
55 size_t RegisterInfoPOSIX_ppc64le::GetGPRSize() const {
56   return sizeof(GPR);
57 }
58
59 const lldb_private::RegisterInfo *
60 RegisterInfoPOSIX_ppc64le::GetRegisterInfo() const {
61   return m_register_info_p;
62 }
63
64 uint32_t RegisterInfoPOSIX_ppc64le::GetRegisterCount() const {
65   return m_register_info_count;
66 }