Skip to content

Commit

Permalink
Add support for MultiRegister (PR1733)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbiiggppiigg committed Jul 15, 2024
1 parent 0cd46f5 commit 70fd6bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 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 @@ -25,6 +26,7 @@ struct stateful_visitor : di::Visitor {
bool foundImm{};
bool foundBin{};
bool foundDer{};
bool foundMultiReg{};

void visit(di::BinaryFunction*) override { foundBin = true; }

Expand All @@ -34,13 +36,17 @@ struct stateful_visitor : di::Visitor {

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

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


// clang-format off
friend std::ostream& operator<<(std::ostream &os, stateful_visitor const& v) {
std::cout << std::boolalpha
<< " foundReg: " << v.foundReg << '\n'
<< " foundImm: " << v.foundImm << '\n'
<< " foundBin: " << v.foundBin << '\n'
<< " foundDer: " << v.foundDer << '\n';
<< " foundDer: " << v.foundDer << '\n'
<< " foundMultiReg: " << v.foundMultiReg << '\n';
return os;
}

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

0 comments on commit 70fd6bc

Please sign in to comment.