ossfuzz: Generate addmod and mulmod builtin functions

This commit is contained in:
Bhargava Shastry 2019-03-26 10:52:30 +01:00
parent bdbe1e55b3
commit 836c466f09
3 changed files with 32 additions and 0 deletions

View File

@ -272,6 +272,26 @@ void ProtoConverter::visit(UnaryOp const& _x)
m_output << ")";
}
void ProtoConverter::visit(TernaryOp const& _x)
{
switch (_x.op())
{
case TernaryOp::ADDM:
m_output << "addmod";
break;
case TernaryOp::MULM:
m_output << "mulmod";
break;
}
m_output << "(";
visit(_x.arg1());
m_output << ", ";
visit(_x.arg2());
m_output << ", ";
visit(_x.arg3());
m_output << ")";
}
void ProtoConverter::visit(AssignmentStatement const& _x)
{
visit(_x.ref_id());

View File

@ -63,6 +63,7 @@ private:
void visit(ForStmt const&);
void visit(CaseStmt const&);
void visit(SwitchStmt const&);
void visit(TernaryOp const&);
template <class T>
void visit(google::protobuf::RepeatedPtrField<T> const& _repeated_field);

View File

@ -111,6 +111,17 @@ message UnaryOp {
required Expression operand = 2;
}
message TernaryOp {
enum TOp {
ADDM = 0;
MULM = 1;
}
required TOp op = 1;
required Expression arg1 = 2;
required Expression arg2 = 3;
required Expression arg3 = 4;
}
message StoreFunc {
enum Storage {
MSTORE = 0;