3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-09-04 00:58:07 +00:00

use ast_manager as an attribute

This commit is contained in:
Nikolaj Bjorner 2022-12-02 07:53:32 -08:00
parent 5073959ae0
commit cf7bba6288
6 changed files with 311 additions and 316 deletions

View file

@ -25,10 +25,11 @@ Notes:
class bv_rewriter_core {
protected:
ast_manager& m;
typedef rational numeral;
bv_util m_util;
ast_manager & m() const { return m_util.get_manager(); }
family_id get_fid() const { return m_util.get_family_id(); }
expr_ref m_bit1;
bool is_numeral(expr * n) const { return m_util.is_numeral(n); }
bool is_numeral(expr * n, numeral & r) const { unsigned sz; return m_util.is_numeral(n, r, sz); }
@ -44,7 +45,7 @@ protected:
decl_kind power_decl_kind() const { UNREACHABLE(); return static_cast<decl_kind>(UINT_MAX); }
public:
bv_rewriter_core(ast_manager & m):m_util(m) {}
bv_rewriter_core(ast_manager & m):m(m), m_util(m), m_bit1(m) {}
};
class bv_rewriter : public poly_rewriter<bv_rewriter_core> {
@ -176,7 +177,7 @@ public:
br_status mk_app_core(func_decl * f, unsigned num_args, expr * const * args, expr_ref & result);
void mk_app(func_decl * f, unsigned num_args, expr * const * args, expr_ref & result) {
if (mk_app_core(f, num_args, args, result) == BR_FAILED)
result = m().mk_app(f, num_args, args);
result = m.mk_app(f, num_args, args);
}
bool is_urem_any(expr * e, expr * & dividend, expr * & divisor);
@ -190,14 +191,14 @@ public:
#define MK_BV_BINARY(OP) \
expr_ref OP(expr* a, expr* b) { \
expr_ref result(m()); \
expr_ref result(m); \
if (BR_FAILED == OP(a, b, result)) \
result = m_util.OP(a, b); \
return result; \
} \
expr_ref mk_zero_extend(unsigned n, expr * arg) {
expr_ref result(m());
expr_ref result(m);
if (BR_FAILED == mk_zero_extend(n, arg, result))
result = m_util.mk_zero_extend(n, arg);
return result;
@ -211,7 +212,7 @@ public:
expr_ref mk_bv2int(expr* a) {
expr_ref result(m());
expr_ref result(m);
if (BR_FAILED == mk_bv2int(a, result))
result = m_util.mk_bv2int(a);
return result;