13#include "llvm/ADT/StringExtras.h"
14#include "llvm/Support/Casting.h"
15#include "llvm/Support/raw_ostream.h"
31 std::unordered_set<std::string> &previously_emitted,
34 if (!previously_emitted.insert(
GetID()).second)
39 dep->ToXML(strm, previously_emitted,
this);
47 llvm::raw_string_ostream escape_strm(escaped);
48 llvm::printHTMLEscaped(value, escape_strm);
55 std::optional<uint64_t> byte_size)
70 assert(
m_count &&
"Vector element count cannot be zero");
75 std::optional<uint64_t> element_size =
m_element_type->GetByteSize();
77 *element_size > std::numeric_limits<uint64_t>::max() /
m_count)
83 if (!byte_size || byte_size %
m_count)
86 uint64_t element_byte_size = byte_size /
m_count;
87 if (std::optional<uint64_t> fixed_size =
m_element_type->GetByteSize())
88 return *fixed_size == element_byte_size;
89 if (
const auto *vector = llvm::dyn_cast<RegisterTypeVector>(
m_element_type))
90 return vector->IsByteSizeCompatible(element_byte_size);
95 LLDB_LOG(log,
"ID: \"{0}\" Element type: \"{1}\" Count: {2}",
GetID().c_str(),
102 strm <<
"<vector id=\"";
104 strm <<
"\" type=\"";
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
static std::atomic< uint64_t > g_next_register_type_uid
void ToXMLElement(Stream &strm, const RegisterType *user=nullptr) const override
Output the register type as an XML element.
RegisterTypeBuiltin(std::string id, lldb::Encoding encoding, lldb::Format format, std::optional< uint64_t > byte_size)
A missing byte size means the size depends on the target.
const lldb::Encoding m_encoding
const lldb::Format m_format
const std::optional< uint64_t > m_byte_size
void ToXML(Stream &strm, std::unordered_set< std::string > &previously_emitted, const RegisterType *user=nullptr) const override
Output XML that describes this type, to be inserted into a target XML file.
RegisterTypeVector(std::string id, const RegisterType *element_type, uint32_t count)
void DumpToLog(Log *log) const
bool IsByteSizeCompatible(uint64_t byte_size) const
void ToXMLElement(Stream &strm, const RegisterType *user=nullptr) const override
Output the register type as an XML element.
std::optional< uint64_t > GetByteSize() const override
Return this type's fixed size in bytes, if it has one.
const RegisterType * m_element_type
RegisterType(RegisterTypeKind kind, std::string id)
virtual void ToXMLElement(Stream &strm, const RegisterType *user=nullptr) const =0
Output the register type as an XML element.
const std::string & GetID() const
const RegisterTypeKind m_kind
std::vector< const RegisterType * > m_dependencies
void SetDependencies(std::vector< const RegisterType * > dependencies)
static void PrintXMLAttributeValue(Stream &strm, llvm::StringRef value)
Print a string escaped for use as an XML attribute value.
virtual void ToXML(Stream &strm, std::unordered_set< std::string > &previously_emitted, const RegisterType *user=nullptr) const
Output XML that describes this type, to be inserted into a target XML file.
@ eRegisterTypeKindBuiltin
@ eRegisterTypeKindVector
A stream class that can stream formatted output to a file.
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
A class that represents a running process on the host machine.
Format
Display format definitions.
Encoding
Register encoding definitions.