13#include "llvm/ADT/StringMap.h"
14#include "llvm/Support/Compiler.h"
18#define GPR_OFFSET(idx) ((idx) * sizeof(uint32_t))
19#define FPR_OFFSET(idx) ((idx) * sizeof(uint32_t))
21#define DECLARE_REGISTER_INFOS_RISCV32_STRUCT
23#undef DECLARE_REGISTER_INFOS_RISCV32_STRUCT
38 if (strcmp(set->
name,
"GPR") == 0)
48 if (strcmp(set->
name,
"FPR") == 0)
57 .registers<lldb_private::DynamicRegisterInfo::
58 reg_collection_const_range>()
67 uint32_t reg_index)
const {
68 for (
size_t set_index = 0; set_index <
m_dyn_reg_infos.GetNumRegisterSets();
87 std::vector<lldb_private::DynamicRegisterInfo::Register> regs) {
93 llvm::StringRef reg_name)
const {
98 llvm::ArrayRef<std::string> features,
100 cs_reg_infos.clear();
103 llvm::SmallVector<llvm::StringRef> normalized_features(features.begin(),
105 llvm::sort(normalized_features);
106 normalized_features.erase(llvm::unique(normalized_features),
107 normalized_features.end());
116 for (
auto &kind : csr.
kinds)
135 cs_reg_infos.push_back(csr);
142 for (
const auto &feature : normalized_features)
147 llvm::StringRef feature,
151 static const llvm::StringMap<llvm::ArrayRef<lldb_private::RegisterInfo>>
152 g_register_infos_riscv32_csr_patches = {
153 {
"default", llvm::ArrayRef(g_register_infos_riscv32_csr_patch)},
154 {
"xqci", llvm::ArrayRef(g_register_infos_riscv32_csr_xqci_patch)},
156 llvm::ArrayRef(g_register_infos_riscv32_csr_xqciint_patch)}};
158 auto it = g_register_infos_riscv32_csr_patches.find(feature);
159 if (it == g_register_infos_riscv32_csr_patches.end())
162 for (
const auto &csr : it->second) {
167 if (idx < cs_reg_infos.size())
168 cs_reg_infos[idx] = csr;
const size_t k_num_csr_registers
const lldb_private::RegisterSet * GetRegisterSet(size_t reg_set) const override
static void ConfigureCSRegInfos(llvm::StringRef feature, llvm::SmallVectorImpl< lldb_private::RegisterInfo > &cs_reg_infos)
Applies the CS register information patch set for a given feature.
const lldb_private::ArchSpec m_target_arch
RegisterInfoPOSIXDynamic_riscv32(const lldb_private::ArchSpec &target_arch)
size_t SetRegisterInfo(std::vector< lldb_private::DynamicRegisterInfo::Register > regs)
uint32_t GetRegisterCount() const override
const lldb_private::RegisterInfo * GetRegisterInfo() const override
size_t GetRegisterSetCount() const override
lldb_private::DynamicRegisterInfo m_dyn_reg_infos
size_t GetFPRSize() const override
size_t GetRegisterSetFromRegisterIndex(uint32_t reg_index) const override
static void BuildCSRegInfos(llvm::ArrayRef< std::string > features, llvm::SmallVectorImpl< lldb_private::RegisterInfo > &cs_reg_infos)
Builds CS register information entries for 32-bit RISC-V debug targets on the basis of the enabled IS...
size_t GetGPRSize() const override
An architecture specification class.
A uniqued constant string class.
const char * GetCString() const
Get the string value as a C string.
RegisterInfoAndSetInterface(const lldb_private::ArchSpec &target_arch)
#define LLDB_INVALID_REGNUM
A class that represents a running process on the host machine.
@ eEncodingUint
unsigned integer
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target
@ eRegisterKindLLDB
lldb's internal register numbers
@ eRegisterKindDWARF
the register numbers seen DWARF
@ eRegisterKindEHFrame
the register numbers seen in eh_frame
@ eRegisterKindProcessPlugin
num used by the process plugin - e.g.
Every register is described in detail including its name, alternate name (optional),...
lldb::Encoding encoding
Encoding of the register bits.
const char * alt_name
Alternate name of this register, can be NULL.
uint32_t * value_regs
List of registers (terminated with LLDB_INVALID_REGNUM).
uint32_t byte_offset
The byte offset in the register context data where this register's value is found.
uint32_t byte_size
Size in bytes of the register.
uint32_t kinds[lldb::kNumRegisterKinds]
Holds all of the various register numbers for all register kinds.
const RegisterType * register_type
If not nullptr, a type defined by XML descriptions.
const char * name
Name of this register, can't be NULL.
lldb::Format format
Default display format.
uint32_t * invalidate_regs
List of registers (terminated with LLDB_INVALID_REGNUM).
Registers are grouped into register sets.
size_t num_registers
The number of registers in REGISTERS array below.
const uint32_t * registers
An array of register indicies in this set.
const char * name
Name of this register set.