Skip to content

Commit

Permalink
[fix]
Browse files Browse the repository at this point in the history
  • Loading branch information
misonijnik committed Feb 20, 2024
1 parent 591e020 commit 753eaee
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 7 deletions.
7 changes: 0 additions & 7 deletions lib/Solver/BitwuzlaBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,13 +537,6 @@ Term BitwuzlaBuilder::constructActual(ref<Expr> e, int *width_out) {
Term left = construct(ce->getLeft(), width_out);
Term right = construct(ce->getRight(), width_out);
Term eq = eqExpr(left, right);
unsigned numKids = ce->getNumKids();
std::vector<Term> term_args;
term_args.reserve(numKids);

for (unsigned i = 0; i < numKids; ++i) {
term_args.push_back(construct(ce->getKid(i), 0));
}

*width_out = ce->getWidth();
return iteExpr(eq, left, null);
Expand Down
13 changes: 13 additions & 0 deletions lib/Solver/MetaSMTBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,19 @@ MetaSMTBuilder<SolverContext>::constructActual(ref<Expr> e, int *width_out) {
break;
}

case Expr::Convol: {
ConvolExpr *ce = cast<ConvolExpr>(e);

*width_out = ce->getWidth();
res = evaluate(
_solver,
metaSMT::logic::Ite(
construct(EqExpr::create(ce->getLeft(), ce->getRight()), 0),
construct(ce->getLeft(), width_out),
construct(ConstantExpr::create(0, ce->getWidth()), width_out)));
break;
}

case Expr::Concat: {
ConcatExpr *ce = cast<ConcatExpr>(e);
assert(ce);
Expand Down
11 changes: 11 additions & 0 deletions lib/Solver/STPBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,17 @@ ExprHandle STPBuilder::constructActual(ref<Expr> e, int *width_out) {
return res;
}

case Expr::Convol: {
ConvolExpr *ce = cast<ConvolExpr>(e);
ExprHandle null = construct(ConstantExpr::create(0, ce->getWidth()));
ExprHandle left = construct(ce->getLeft(), width_out);
ExprHandle right = construct(ce->getRight(), width_out);
ExprHandle eq = eqExpr(left, right);

*width_out = ce->getWidth();
return vc_iteExpr(vc, eq, left, null);
}

case Expr::Extract: {
ExtractExpr *ee = cast<ExtractExpr>(e);
ExprHandle src = construct(ee->expr, width_out);
Expand Down
12 changes: 12 additions & 0 deletions lib/Solver/Z3BitvectorBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "Z3Builder.h"
#include "klee/Config/config.h"

#ifdef ENABLE_Z3
Expand Down Expand Up @@ -339,6 +340,17 @@ Z3ASTHandle Z3BitvectorBuilder::constructActual(ref<Expr> e, int *width_out) {
return iteExpr(cond, tExpr, fExpr);
}

case Expr::Convol: {
ConvolExpr *ce = cast<ConvolExpr>(e);
Z3ASTHandle null = construct(ConstantExpr::create(0, ce->getWidth()));
Z3ASTHandle left = construct(ce->getLeft(), width_out);
Z3ASTHandle right = construct(ce->getRight(), width_out);
Z3ASTHandle eq = eqExpr(left, right);

*width_out = ce->getWidth();
return iteExpr(eq, left, null);
}

case Expr::Concat: {
ConcatExpr *ce = cast<ConcatExpr>(e);
unsigned numKids = ce->getNumKids();
Expand Down
11 changes: 11 additions & 0 deletions lib/Solver/Z3CoreBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@ Z3ASTHandle Z3CoreBuilder::constructActual(ref<Expr> e, int *width_out) {
return iteExpr(cond, tExpr, fExpr);
}

case Expr::Convol: {
ConvolExpr *ce = cast<ConvolExpr>(e);
Z3ASTHandle null = construct(ConstantExpr::create(0, ce->getWidth()));
Z3ASTHandle left = construct(ce->getLeft(), width_out);
Z3ASTHandle right = construct(ce->getRight(), width_out);
Z3ASTHandle eq = eqExpr(left, right);

*width_out = ce->getWidth();
return iteExpr(eq, left, null);
}

case Expr::Concat: {
ConcatExpr *ce = cast<ConcatExpr>(e);
unsigned numKids = ce->getNumKids();
Expand Down

0 comments on commit 753eaee

Please sign in to comment.