brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · 3306fb2 Raw
93 lines · cpp
1//===-- RegisterContextPOSIX_loongarch64.cpp --------------------*- C++ -*-===//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-exception6//7//===----------------------------------------------------------------------===//8 9#include "lldb/Target/Process.h"10#include "lldb/Target/Target.h"11#include "lldb/Target/Thread.h"12#include "lldb/Utility/DataBufferHeap.h"13#include "lldb/Utility/DataExtractor.h"14#include "lldb/Utility/Endian.h"15#include "lldb/Utility/RegisterValue.h"16#include "lldb/Utility/Scalar.h"17#include "llvm/Support/Compiler.h"18 19#include "RegisterContextPOSIX_loongarch64.h"20 21using namespace lldb;22using namespace lldb_private;23 24RegisterContextPOSIX_loongarch64::RegisterContextPOSIX_loongarch64(25    lldb_private::Thread &thread,26    std::unique_ptr<RegisterInfoPOSIX_loongarch64> register_info)27    : lldb_private::RegisterContext(thread, 0),28      m_register_info_up(std::move(register_info)) {}29 30RegisterContextPOSIX_loongarch64::~RegisterContextPOSIX_loongarch64() = default;31 32void RegisterContextPOSIX_loongarch64::invalidate() {}33 34void RegisterContextPOSIX_loongarch64::InvalidateAllRegisters() {}35 36size_t RegisterContextPOSIX_loongarch64::GetRegisterCount() {37  return m_register_info_up->GetRegisterCount();38}39 40size_t RegisterContextPOSIX_loongarch64::GetGPRSize() {41  return m_register_info_up->GetGPRSize();42}43 44unsigned RegisterContextPOSIX_loongarch64::GetRegisterSize(unsigned int reg) {45  return m_register_info_up->GetRegisterInfo()[reg].byte_size;46}47 48unsigned RegisterContextPOSIX_loongarch64::GetRegisterOffset(unsigned int reg) {49  return m_register_info_up->GetRegisterInfo()[reg].byte_offset;50}51 52const lldb_private::RegisterInfo *53RegisterContextPOSIX_loongarch64::GetRegisterInfoAtIndex(size_t reg) {54  if (reg < GetRegisterCount())55    return &GetRegisterInfo()[reg];56 57  return nullptr;58}59 60size_t RegisterContextPOSIX_loongarch64::GetRegisterSetCount() {61  return m_register_info_up->GetRegisterSetCount();62}63 64const lldb_private::RegisterSet *65RegisterContextPOSIX_loongarch64::GetRegisterSet(size_t set) {66  return m_register_info_up->GetRegisterSet(set);67}68 69const lldb_private::RegisterInfo *70RegisterContextPOSIX_loongarch64::GetRegisterInfo() {71  return m_register_info_up->GetRegisterInfo();72}73 74bool RegisterContextPOSIX_loongarch64::IsGPR(unsigned int reg) {75  return m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==76         RegisterInfoPOSIX_loongarch64::GPRegSet;77}78 79bool RegisterContextPOSIX_loongarch64::IsFPR(unsigned int reg) {80  return m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==81         RegisterInfoPOSIX_loongarch64::FPRegSet;82}83 84bool RegisterContextPOSIX_loongarch64::IsLSX(unsigned int reg) {85  return m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==86         RegisterInfoPOSIX_loongarch64::LSXRegSet;87}88 89bool RegisterContextPOSIX_loongarch64::IsLASX(unsigned int reg) {90  return m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==91         RegisterInfoPOSIX_loongarch64::LASXRegSet;92}93