Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Plugins / Process / Utility / RegisterContextPOSIX_arm.cpp
blob684176bccdf0c15b47037f099bf0280c0fa7477f
1 //===-- RegisterContextPOSIX_arm.cpp --------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #include <cerrno>
10 #include <cstdint>
11 #include <cstring>
13 #include "lldb/Target/Process.h"
14 #include "lldb/Target/Target.h"
15 #include "lldb/Target/Thread.h"
16 #include "lldb/Utility/DataBufferHeap.h"
17 #include "lldb/Utility/DataExtractor.h"
18 #include "lldb/Utility/Endian.h"
19 #include "lldb/Utility/RegisterValue.h"
20 #include "lldb/Utility/Scalar.h"
21 #include "llvm/Support/Compiler.h"
23 #include "RegisterContextPOSIX_arm.h"
25 using namespace lldb;
26 using namespace lldb_private;
28 bool RegisterContextPOSIX_arm::IsGPR(unsigned reg) {
29 if (m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==
30 RegisterInfoPOSIX_arm::GPRegSet)
31 return true;
32 return false;
35 bool RegisterContextPOSIX_arm::IsFPR(unsigned reg) {
36 if (m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==
37 RegisterInfoPOSIX_arm::FPRegSet)
38 return true;
39 return false;
42 RegisterContextPOSIX_arm::RegisterContextPOSIX_arm(
43 lldb_private::Thread &thread,
44 std::unique_ptr<RegisterInfoPOSIX_arm> register_info)
45 : lldb_private::RegisterContext(thread, 0),
46 m_register_info_up(std::move(register_info)) {}
48 RegisterContextPOSIX_arm::~RegisterContextPOSIX_arm() = default;
50 void RegisterContextPOSIX_arm::Invalidate() {}
52 void RegisterContextPOSIX_arm::InvalidateAllRegisters() {}
54 unsigned RegisterContextPOSIX_arm::GetRegisterOffset(unsigned reg) {
55 return m_register_info_up->GetRegisterInfo()[reg].byte_offset;
58 unsigned RegisterContextPOSIX_arm::GetRegisterSize(unsigned reg) {
59 return m_register_info_up->GetRegisterInfo()[reg].byte_size;
62 size_t RegisterContextPOSIX_arm::GetRegisterCount() {
63 return m_register_info_up->GetRegisterCount();
66 size_t RegisterContextPOSIX_arm::GetGPRSize() {
67 return m_register_info_up->GetGPRSize();
70 const lldb_private::RegisterInfo *RegisterContextPOSIX_arm::GetRegisterInfo() {
71 // Commonly, this method is overridden and g_register_infos is copied and
72 // specialized. So, use GetRegisterInfo() rather than g_register_infos in
73 // this scope.
74 return m_register_info_up->GetRegisterInfo();
77 const lldb_private::RegisterInfo *
78 RegisterContextPOSIX_arm::GetRegisterInfoAtIndex(size_t reg) {
79 if (reg < GetRegisterCount())
80 return &GetRegisterInfo()[reg];
82 return nullptr;
85 size_t RegisterContextPOSIX_arm::GetRegisterSetCount() {
86 return m_register_info_up->GetRegisterSetCount();
89 const lldb_private::RegisterSet *
90 RegisterContextPOSIX_arm::GetRegisterSet(size_t set) {
91 return m_register_info_up->GetRegisterSet(set);
94 const char *RegisterContextPOSIX_arm::GetRegisterName(unsigned reg) {
95 if (reg < GetRegisterCount())
96 return GetRegisterInfo()[reg].name;
97 return nullptr;