Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for MultiRegister (PR1733) #60

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions instructionAPI/statefull_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "InstructionDecoder.h"
#include "Operand.h"
#include "Register.h"
#include "MultiRegister.h"
#include "Visitor.h"

#include <array>
Expand All @@ -22,6 +23,7 @@ namespace di = Dyninst::InstructionAPI;

struct stateful_visitor : di::Visitor {
bool foundReg{};
bool foundMultiReg{};
bool foundImm{};
bool foundBin{};
bool foundDer{};
Expand All @@ -32,12 +34,15 @@ struct stateful_visitor : di::Visitor {

void visit(di::RegisterAST*) override { foundReg = true; }

void visit(di::MultiRegisterAST*) override { foundMultiReg = true; }

void visit(di::Dereference*) override { foundDer = true; }

// clang-format off
friend std::ostream& operator<<(std::ostream &os, stateful_visitor const& v) {
std::cout << std::boolalpha
<< " foundReg: " << v.foundReg << '\n'
<< " foundMultiReg: " << v.foundMultiReg << '\n'
<< " foundImm: " << v.foundImm << '\n'
<< " foundBin: " << v.foundBin << '\n'
<< " foundDer: " << v.foundDer << '\n';
Expand Down
6 changes: 6 additions & 0 deletions instructionAPI/stateless_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "InstructionDecoder.h"
#include "Operand.h"
#include "Register.h"
#include "MultiRegister.h"
#include "Visitor.h"

#include <array>
Expand Down Expand Up @@ -38,6 +39,11 @@ class printer : public di::Visitor {
void visit(di::RegisterAST* r) override {
std::cout << " Register '" << r->format(di::defaultStyle) << "'\n";
}

void visit(di::MultiRegisterAST* r) override {
std::cout << " MultiRegister '" << r->format(di::defaultStyle) << "'\n";
}

};

void print(di::Instruction const& insn) {
Expand Down
Loading