9#ifndef LLDB_UTILITY_REGISTERTYPEFLAGS_H
10#define LLDB_UTILITY_REGISTERTYPEFLAGS_H
17#include "llvm/ADT/StringSet.h"
68 Field(std::string name,
unsigned start,
unsigned end);
71 Field(std::string name,
unsigned start,
unsigned end,
75 Field(std::string name,
unsigned bit_position);
90 static uint64_t
GetMaxValue(
unsigned start,
unsigned end);
93 uint64_t
GetValue(uint64_t register_value)
const {
137 const std::vector<Field> &fields);
142 void SetFields(
const std::vector<Field> &fields);
146 std::string
DumpEnums(uint32_t max_width)
const;
158 ret |= field.GetValue(value) << shift;
159 shift += field.GetSizeInBits();
175 std::string
AsTable(uint32_t max_width)
const;
std::vector< Enumerator > Enumerators
const Enumerators & GetEnumerators() const
RegisterTypeEnum(std::string id, const Enumerators &enumerators)
virtual void ToXMLElement(Stream &strm, const RegisterType *user=nullptr) const override
Output the register type as an XML element.
static bool classof(const RegisterType *register_type)
Enumerators m_enumerators
void DumpToLog(Log *log) const
const std::string & GetName() const
unsigned PaddingDistance(const Field &other) const
Return the number of bits between this field and the other, that are not covered by either field.
const RegisterTypeEnum * m_enum_type
unsigned GetStart() const
void DumpToLog(Log *log) const
unsigned m_start
Start/end bit positions.
bool Overlaps(const Field &other) const
unsigned GetSizeInBits() const
Get size of the field in bits. Will always be at least 1.
uint64_t GetMaxValue() const
The maximum unsigned value that could be contained in this field.
bool operator==(const Field &rhs) const
uint64_t GetValue(uint64_t register_value) const
Extract value of the field from a whole register value.
void ToXMLElement(Stream &strm) const
bool operator<(const Field &rhs) const
uint64_t GetMask() const
A mask that covers all bits of the field.
Field(std::string name, unsigned start, unsigned end)
Where start is the least significant bit and end is the most significant bit.
const RegisterTypeEnum * GetEnum() const
std::string DumpEnums(uint32_t max_width) const
Make a string where each line contains the name of a field that has enum values, and lists what those...
std::vector< Field > m_fields
void SetFields(const std::vector< Field > &fields)
Replace all the fields with the new set of fields.
std::string AsTable(uint32_t max_width) const
Produce a text table showing the layout of all the fields.
T ReverseFieldOrder(T value) const
virtual void ToXMLElement(Stream &strm, const RegisterType *user=nullptr) const override
Output the register type as an XML element.
const std::vector< Field > & GetFields() const
RegisterTypeFlags(std::string id, unsigned size, const std::vector< Field > &fields)
This assumes that:
const unsigned m_size
Size in bytes.
void DumpToLog(Log *log) const
static bool classof(const RegisterType *register_type)
RegisterTypeKind getKind() const
RegisterType(RegisterTypeKind kind, std::string id)
A stream class that can stream formatted output to a file.
A class that represents a running process on the host machine.
void ToXMLElement(Stream &strm) const
Enumerator(uint64_t value, std::string name)
void DumpToLog(Log *log) const