Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Plugins / Process / Utility / RegisterContextPOSIX_arm64.cpp
blob50e25568f2ae012a0b5a2b9169a3fef5224a9de3
1 //===-- RegisterContextPOSIX_arm64.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_arm64.h"
25 using namespace lldb;
26 using namespace lldb_private;
28 bool RegisterContextPOSIX_arm64::IsGPR(unsigned reg) {
29 if (m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==
30 RegisterInfoPOSIX_arm64::GPRegSet)
31 return true;
32 return false;
35 bool RegisterContextPOSIX_arm64::IsFPR(unsigned reg) {
36 if (m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==
37 RegisterInfoPOSIX_arm64::FPRegSet)
38 return true;
39 return false;
42 bool RegisterContextPOSIX_arm64::IsSVE(unsigned reg) const {
43 return m_register_info_up->IsSVEReg(reg);
46 bool RegisterContextPOSIX_arm64::IsSME(unsigned reg) const {
47 return m_register_info_up->IsSMEReg(reg);
50 bool RegisterContextPOSIX_arm64::IsPAuth(unsigned reg) const {
51 return m_register_info_up->IsPAuthReg(reg);
54 bool RegisterContextPOSIX_arm64::IsTLS(unsigned reg) const {
55 return m_register_info_up->IsTLSReg(reg);
58 bool RegisterContextPOSIX_arm64::IsMTE(unsigned reg) const {
59 return m_register_info_up->IsMTEReg(reg);
62 RegisterContextPOSIX_arm64::RegisterContextPOSIX_arm64(
63 lldb_private::Thread &thread,
64 std::unique_ptr<RegisterInfoPOSIX_arm64> register_info)
65 : lldb_private::RegisterContext(thread, 0),
66 m_register_info_up(std::move(register_info)) {}
68 RegisterContextPOSIX_arm64::~RegisterContextPOSIX_arm64() = default;
70 void RegisterContextPOSIX_arm64::Invalidate() {}
72 void RegisterContextPOSIX_arm64::InvalidateAllRegisters() {}
74 unsigned RegisterContextPOSIX_arm64::GetRegisterOffset(unsigned reg) {
75 return m_register_info_up->GetRegisterInfo()[reg].byte_offset;
78 unsigned RegisterContextPOSIX_arm64::GetRegisterSize(unsigned reg) {
79 return m_register_info_up->GetRegisterInfo()[reg].byte_size;
82 size_t RegisterContextPOSIX_arm64::GetRegisterCount() {
83 return m_register_info_up->GetRegisterCount();
86 size_t RegisterContextPOSIX_arm64::GetGPRSize() {
87 return m_register_info_up->GetGPRSize();
90 const lldb_private::RegisterInfo *
91 RegisterContextPOSIX_arm64::GetRegisterInfo() {
92 // Commonly, this method is overridden and g_register_infos is copied and
93 // specialized. So, use GetRegisterInfo() rather than g_register_infos in
94 // this scope.
95 return m_register_info_up->GetRegisterInfo();
98 const lldb_private::RegisterInfo *
99 RegisterContextPOSIX_arm64::GetRegisterInfoAtIndex(size_t reg) {
100 if (reg < GetRegisterCount())
101 return &GetRegisterInfo()[reg];
103 return nullptr;
106 size_t RegisterContextPOSIX_arm64::GetRegisterSetCount() {
107 return m_register_info_up->GetRegisterSetCount();
110 const lldb_private::RegisterSet *
111 RegisterContextPOSIX_arm64::GetRegisterSet(size_t set) {
112 return m_register_info_up->GetRegisterSet(set);
115 const char *RegisterContextPOSIX_arm64::GetRegisterName(unsigned reg) {
116 if (reg < GetRegisterCount())
117 return GetRegisterInfo()[reg].name;
118 return nullptr;