void TritonToZ3Ast::operator()(triton::ast::ZxNode& e) { Z3Result ext = this->eval(*e.getChilds()[0]); Z3Result value = this->eval(*e.getChilds()[1]); triton::uint32 extv = static_cast<triton::uint32>(ext.getUintValue()); z3::expr newexpr = to_expr(this->result.getContext(), Z3_mk_zero_ext(this->result.getContext(), extv, value.getExpr())); this->result.setExpr(newexpr); }
void TritonToZ3Ast::operator()(triton::ast::BvNode& e) { Z3Result value = this->eval(*e.getChilds()[0]); Z3Result size = this->eval(*e.getChilds()[1]); triton::uint32 bvsize = static_cast<triton::uint32>(size.getUintValue()); z3::expr newexpr = this->result.getContext().bv_val(value.getStringValue().c_str(), bvsize); this->result.setExpr(newexpr); }
void TritonToZ3Ast::operator()(triton::ast::ExtractNode& e) { Z3Result high = this->eval(*e.getChilds()[0]); Z3Result low = this->eval(*e.getChilds()[1]); Z3Result value = this->eval(*e.getChilds()[2]); triton::uint32 hv = static_cast<triton::uint32>(high.getUintValue()); triton::uint32 lv = static_cast<triton::uint32>(low.getUintValue()); z3::expr newexpr = to_expr(this->result.getContext(), Z3_mk_extract(this->result.getContext(), hv, lv, value.getExpr())); this->result.setExpr(newexpr); }
uint512 AnalysisProcessor::evaluateAST(smt2lib::smtAstAbstractNode *node) { Z3ast z3ast{}; Z3Result result = z3ast.eval(*node); uint512 nbResult{result.getStringValue()}; return nbResult; }