Skip to content

Commit

Permalink
Added definitions for the remaining pure virtual members of the RiscO…
Browse files Browse the repository at this point in the history
…perators class for use by SymEvalSemantics.
  • Loading branch information
ssunny7 committed Jul 8, 2016
1 parent a8a83da commit f8ad50d
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 4 deletions.
61 changes: 61 additions & 0 deletions dataflowAPI/rose/semantics/SymEvalSemantics.C
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,65 @@ BaseSemantics::SValuePtr SymEvalSemantics::RiscOperators::signExtend(const BaseS
BaseSemantics::SValuePtr width_ = SymEvalSemantics::SValue::instance(64, newwidth);

return createBinaryAST(Dyninst::DataflowAPI::ROSEOperation::signExtendOp, a_, width_);
}

BaseSemantics::SValuePtr SymEvalSemantics::RiscOperators::add(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_) {
return createBinaryAST(Dyninst::DataflowAPI::ROSEOperation::addOp, a_, b_);
}

BaseSemantics::SValuePtr SymEvalSemantics::RiscOperators::addWithCarries(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_,
const BaseSemantics::SValuePtr &c_,
BaseSemantics::SValuePtr &carry_out) {

}

BaseSemantics::SValuePtr SymEvalSemantics::RiscOperators::negate(const BaseSemantics::SValuePtr &a_) {
return createUnaryAST(Dyninst::DataflowAPI::ROSEOperation::negateOp, a_);
}

BaseSemantics::SValuePtr SymEvalSemantics::RiscOperators::signedDivide(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_) {
return createBinaryAST(Dyninst::DataflowAPI::ROSEOperation::sDivOp, a_, b_);
}

BaseSemantics::SValuePtr SymEvalSemantics::RiscOperators::signedModulo(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_) {
return createBinaryAST(Dyninst::DataflowAPI::ROSEOperation::sModOp, a_, b_);
}

BaseSemantics::SValuePtr SymEvalSemantics::RiscOperators::signedMultiply(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_) {
return createBinaryAST(Dyninst::DataflowAPI::ROSEOperation::sMultOp, a_, b_);
}

BaseSemantics::SValuePtr SymEvalSemantics::RiscOperators::unsignedDivide(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_) {
return createBinaryAST(Dyninst::DataflowAPI::ROSEOperation::uDivOp, a_, b_);
}

BaseSemantics::SValuePtr SymEvalSemantics::RiscOperators::unsignedModulo(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_) {
return createBinaryAST(Dyninst::DataflowAPI::ROSEOperation::uModOp, a_, b_);
}

BaseSemantics::SValuePtr SymEvalSemantics::RiscOperators::unsignedMultiply(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_) {
return createBinaryAST(Dyninst::DataflowAPI::ROSEOperation::uMultOp, a_, b_);
}

//TODO: do we deal with byte ordering?
BaseSemantics::SValuePtr SymEvalSemantics::RiscOperators::readMemory(const RegisterDescriptor /*&segreg*/,
const BaseSemantics::SValuePtr &addr,
const BaseSemantics::SValuePtr &dflt,
const BaseSemantics::SValuePtr /*&cond*/) {
return currentState()->readMemory(address, dflt, this, this);
}

void SymEvalSemantics::RiscOperators::writeMemory(const RegisterDescriptor /*&segreg*/,
const BaseSemantics::SValuePtr &addr,
const BaseSemantics::SValuePtr &data,
const BaseSemantics::SValuePtr /*&cond*/) {
currentState()->writeMemory(addr, data, this);
}
29 changes: 25 additions & 4 deletions dataflowAPI/rose/semantics/SymEvalSemantics.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,33 @@ namespace rose {
virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_);
virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &a_);
virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_, size_t newwidth = 0);
virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_,
size_t newwidth = 0);
virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_);
virtual BaseSemantics::SValuePtr addWithCarries(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_,
const BaseSemantics::SValuePtr &c_,
BaseSemantics::SValuePtr &carry_out);
virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_);
virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_);
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_);
virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_);
virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_);
virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_);
virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &a_,
const BaseSemantics::SValuePtr &b_);

public:
virtual BaseSemantics::SValuePtr readRegister(const RegisterDescriptor &reg,
const BaseSemantics::SValuePtr &dflt);
virtual void writeRegister(const RegisterDescriptor &reg, const BaseSemantics::SValuePtr &a_);
virtual BaseSemantics::SValuePtr readMemory(const RegisterDescriptor &segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt,
const BaseSemantics::SValuePtr &cond);
virtual void writeMemory(const RegisterDescriptor &segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &data,
const BaseSemantics::SValuePtr &cond);

private:
Dyninst::AST::Ptr getUnaryAST(Dyninst::DataflowAPI::ROSEOperation::Op op,
Expand Down

0 comments on commit f8ad50d

Please sign in to comment.