15#include "llvm/ADT/DenseMap.h"
17#include "llvm/ADT/StringExtras.h"
18#include "llvm/DebugInfo/CodeView/CodeView.h"
19#include "llvm/DebugInfo/CodeView/EnumTables.h"
20#include "llvm/Support/ScopedPrinter.h"
28 llvm::codeview::CPUType cpu_type;
30 case llvm::Triple::ArchType::aarch64:
31 cpu_type = llvm::codeview::CPUType::ARM64;
35 cpu_type = llvm::codeview::CPUType::X64;
39 llvm::ArrayRef<llvm::EnumEntry<uint16_t>> register_names =
40 llvm::codeview::getRegisterNames(cpu_type);
41 auto it = llvm::find_if(
43 [®_name](
const llvm::EnumEntry<uint16_t> ®ister_entry) {
44 return reg_name.compare_insensitive(register_entry.Name) == 0;
47 if (it == register_names.end())
50 auto reg_id =
static_cast<llvm::codeview::RegisterId
>(it->Value);
55 llvm::StringRef register_name,
56 llvm::Triple::ArchType arch_type,
57 llvm::BumpPtrAllocator &alloc) {
58 std::vector<std::pair<llvm::StringRef, Node *>> parsed =
61 for (
auto it = parsed.begin(), end = parsed.end(); it != end; ++it) {
66 for (const auto &pair : llvm::make_range(parsed.begin(), it)) {
67 if (pair.first == symbol.GetName())
77 return MakeNode<RegisterNode>(alloc, reg_num);
82 if (it->first == register_name) {
92 llvm::StringRef program, llvm::StringRef register_name,
93 llvm::Triple::ArchType arch_type,
Stream &stream) {
94 llvm::BumpPtrAllocator node_alloc;
95 Node *target_program =
97 if (target_program ==
nullptr) {
101 ToDWARF(*target_program, stream);
static uint32_t ResolveLLDBRegisterNum(llvm::StringRef reg_name, llvm::Triple::ArchType arch_type)
static Node * ResolveFPOProgram(llvm::StringRef program, llvm::StringRef register_name, llvm::Triple::ArchType arch_type, llvm::BumpPtrAllocator &alloc)
A stream class that can stream formatted output to a file.
The base class for all nodes in the parsed postfix tree.
A node representing a symbolic reference to a named entity.
llvm::StringRef GetName() const
#define LLDB_INVALID_REGNUM
bool TranslateFPOProgramToDWARFExpression(llvm::StringRef program, llvm::StringRef register_name, llvm::Triple::ArchType arch_type, lldb_private::Stream &stream)
uint32_t GetLLDBRegisterNumber(llvm::Triple::ArchType arch_type, llvm::codeview::RegisterId register_id)
void ToDWARF(Node &node, Stream &stream)
Serialize the given expression tree as DWARF.
bool ResolveSymbols(Node *&node, llvm::function_ref< Node *(SymbolNode &symbol)> replacer)
A utility function for "resolving" SymbolNodes.
std::vector< std::pair< llvm::StringRef, Node * > > ParseFPOProgram(llvm::StringRef prog, llvm::BumpPtrAllocator &alloc)
A class that represents a running process on the host machine.