mirror of
https://github.com/Z3Prover/z3
synced 2025-09-03 08:38:06 +00:00
Centralize and document TRACE tags using X-macros (#7657)
* Introduce X-macro-based trace tag definition - Created trace_tags.def to centralize TRACE tag definitions - Each tag includes a symbolic name and description - Set up enum class TraceTag for type-safe usage in TRACE macros * Add script to generate Markdown documentation from trace_tags.def - Python script parses trace_tags.def and outputs trace_tags.md * Refactor TRACE_NEW to prepend TraceTag and pass enum to is_trace_enabled * trace: improve trace tag handling system with hierarchical tagging - Introduce hierarchical tag-class structure: enabling a tag class activates all child tags - Unify TRACE, STRACE, SCTRACE, and CTRACE under enum TraceTag - Implement initial version of trace_tag.def using X(tag, tag_class, description) (class names and descriptions to be refined in a future update) * trace: replace all string-based TRACE tags with enum TraceTag - Migrated all TRACE, STRACE, SCTRACE, and CTRACE macros to use enum TraceTag values instead of raw string literals * trace : add cstring header * trace : Add Markdown documentation generation from trace_tags.def via mk_api_doc.py * trace : rename macro parameter 'class' to 'tag_class' and remove Unicode comment in trace_tags.h. * trace : Add TODO comment for future implementation of tag_class activation * trace : Disable code related to tag_class until implementation is ready (#7663).
This commit is contained in:
parent
d766292dab
commit
0a93ff515d
583 changed files with 8698 additions and 7299 deletions
|
@ -437,10 +437,10 @@ namespace euf {
|
|||
if (eq_id == UINT_MAX)
|
||||
break;
|
||||
|
||||
TRACE("plugin", tout << "propagate " << eq_id << ": " << eq_pp(*this, m_eqs[eq_id]) << "\n");
|
||||
TRACE(plugin, tout << "propagate " << eq_id << ": " << eq_pp(*this, m_eqs[eq_id]) << "\n");
|
||||
|
||||
// simplify eq using processed
|
||||
TRACE("plugin",
|
||||
TRACE(plugin,
|
||||
for (auto other_eq : backward_iterator(eq_id))
|
||||
tout << "backward iterator " << eq_id << " vs " << other_eq << " " << is_processed(other_eq) << "\n");
|
||||
for (auto other_eq : backward_iterator(eq_id))
|
||||
|
@ -466,7 +466,7 @@ namespace euf {
|
|||
}
|
||||
propagate_shared();
|
||||
|
||||
CTRACE("plugin", !m_shared.empty() || !m_eqs.empty(), display(tout));
|
||||
CTRACE(plugin, !m_shared.empty() || !m_eqs.empty(), display(tout));
|
||||
}
|
||||
|
||||
unsigned ac_plugin::pick_next_eq() {
|
||||
|
@ -637,11 +637,11 @@ namespace euf {
|
|||
auto& src = m_eqs[src_eq]; // src_r_counts, src_l_counts are initialized
|
||||
auto& dst = m_eqs[dst_eq];
|
||||
|
||||
TRACE("plugin", tout << "forward simplify " << eq_pp(*this, src) << " " << eq_pp(*this, dst) << "\n");
|
||||
TRACE(plugin, tout << "forward simplify " << eq_pp(*this, src) << " " << eq_pp(*this, dst) << "\n");
|
||||
|
||||
|
||||
if (forward_subsumes(src_eq, dst_eq)) {
|
||||
TRACE("plugin", tout << "forward subsumed\n");
|
||||
TRACE(plugin, tout << "forward subsumed\n");
|
||||
set_status(dst_eq, eq_status::is_dead);
|
||||
return;
|
||||
}
|
||||
|
@ -691,7 +691,7 @@ namespace euf {
|
|||
push_undo(is_update_eq);
|
||||
m_src_r.reset();
|
||||
m_src_r.append(monomial(src.r).m_nodes);
|
||||
TRACE("plugin", tout << "rewritten to " << m_pp(*this, monomial(new_r)) << "\n");
|
||||
TRACE(plugin, tout << "rewritten to " << m_pp(*this, monomial(new_r)) << "\n");
|
||||
}
|
||||
|
||||
bool ac_plugin::backward_simplify(unsigned dst_eq, unsigned src_eq) {
|
||||
|
@ -703,10 +703,10 @@ namespace euf {
|
|||
//
|
||||
// dst_ids, dst_count contain rhs of dst_eq
|
||||
//
|
||||
TRACE("plugin", tout << "backward simplify " << eq_pp(*this, src) << " " << eq_pp(*this, dst) << " can-be-subset: " << can_be_subset(monomial(src.l), monomial(dst.r)) << "\n");
|
||||
TRACE(plugin, tout << "backward simplify " << eq_pp(*this, src) << " " << eq_pp(*this, dst) << " can-be-subset: " << can_be_subset(monomial(src.l), monomial(dst.r)) << "\n");
|
||||
|
||||
if (backward_subsumes(src_eq, dst_eq)) {
|
||||
TRACE("plugin", tout << "backward subsumed\n");
|
||||
TRACE(plugin, tout << "backward subsumed\n");
|
||||
set_status(dst_eq, eq_status::is_dead);
|
||||
return true;
|
||||
}
|
||||
|
@ -714,7 +714,7 @@ namespace euf {
|
|||
if (!can_be_subset(monomial(src.l), monomial(dst.r)))
|
||||
return false;
|
||||
if (!is_subset(m_dst_r_counts, m_src_l_counts, monomial(src.l))) {
|
||||
TRACE("plugin", tout << "not subset\n");
|
||||
TRACE(plugin, tout << "not subset\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -731,7 +731,7 @@ namespace euf {
|
|||
m_update_eq_trail.push_back({ dst_eq, m_eqs[dst_eq] });
|
||||
m_eqs[dst_eq].r = new_r;
|
||||
m_eqs[dst_eq].j = j;
|
||||
TRACE("plugin", tout << "rewritten to " << m_pp(*this, monomial(new_r)) << "\n");
|
||||
TRACE(plugin, tout << "rewritten to " << m_pp(*this, monomial(new_r)) << "\n");
|
||||
push_undo(is_update_eq);
|
||||
return true;
|
||||
}
|
||||
|
@ -850,7 +850,7 @@ namespace euf {
|
|||
continue;
|
||||
if (!is_subset(m_m_counts, m_eq_counts, monomial(src.l)))
|
||||
continue;
|
||||
TRACE("plugin", display_equation(tout << "reduce ", src) << "\n");
|
||||
TRACE(plugin, display_equation(tout << "reduce ", src) << "\n");
|
||||
SASSERT(is_correct_ref_count(monomial(src.l), m_eq_counts));
|
||||
rewrite1(m_eq_counts, monomial(src.r), m_m_counts, m);
|
||||
j = join(j, eq);
|
||||
|
@ -900,7 +900,7 @@ namespace euf {
|
|||
auto& src = m_eqs[src_eq];
|
||||
auto& dst = m_eqs[dst_eq];
|
||||
|
||||
TRACE("plugin", tout << "superpose: "; display_equation(tout, src); tout << " "; display_equation(tout, dst); tout << "\n";);
|
||||
TRACE(plugin, tout << "superpose: "; display_equation(tout, src); tout << " "; display_equation(tout, dst); tout << "\n";);
|
||||
// AB -> C, AD -> E => BE ~ CD
|
||||
// m_src_ids, m_src_counts contains information about src (call it AD -> E)
|
||||
m_dst_l_counts.reset();
|
||||
|
@ -941,7 +941,7 @@ namespace euf {
|
|||
return;
|
||||
}
|
||||
|
||||
TRACE("plugin", tout << m_pp(*this, m_src_r) << "== " << m_pp(*this, m_dst_r) << "\n";);
|
||||
TRACE(plugin, tout << m_pp(*this, m_src_r) << "== " << m_pp(*this, m_dst_r) << "\n";);
|
||||
|
||||
justification j = justify_rewrite(src_eq, dst_eq);
|
||||
reduce(m_dst_r, j);
|
||||
|
@ -994,11 +994,11 @@ namespace euf {
|
|||
m_monomial_table.reset();
|
||||
for (auto const& s1 : m_shared) {
|
||||
shared s2;
|
||||
TRACE("plugin", tout << "shared " << m_pp(*this, monomial(s1.m)) << "\n");
|
||||
TRACE(plugin, tout << "shared " << m_pp(*this, monomial(s1.m)) << "\n");
|
||||
if (!m_monomial_table.find(s1.m, s2))
|
||||
m_monomial_table.insert(s1.m, s1);
|
||||
else if (s2.n->get_root() != s1.n->get_root()) {
|
||||
TRACE("plugin", tout << m_pp(*this, monomial(s1.m)) << " == " << m_pp(*this, monomial(s2.m)) << "\n");
|
||||
TRACE(plugin, tout << m_pp(*this, monomial(s1.m)) << " == " << m_pp(*this, monomial(s2.m)) << "\n");
|
||||
push_merge(s1.n, s2.n, justification::dependent(m_dep_manager.mk_join(m_dep_manager.mk_leaf(s1.j), m_dep_manager.mk_leaf(s2.j))));
|
||||
}
|
||||
}
|
||||
|
@ -1008,7 +1008,7 @@ namespace euf {
|
|||
auto j = s.j;
|
||||
auto old_m = s.m;
|
||||
ptr_vector<node> m1(monomial(old_m).m_nodes);
|
||||
TRACE("plugin", tout << "simplify " << m_pp(*this, monomial(old_m)) << "\n");
|
||||
TRACE(plugin, tout << "simplify " << m_pp(*this, monomial(old_m)) << "\n");
|
||||
if (!reduce(m1, j))
|
||||
return;
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace euf {
|
|||
if (!bv.is_bv(x->get_expr()))
|
||||
return;
|
||||
|
||||
TRACE("bv", tout << "merge_eh " << g.bpp(x) << " == " << g.bpp(y) << "\n");
|
||||
TRACE(bv, tout << "merge_eh " << g.bpp(x) << " == " << g.bpp(y) << "\n");
|
||||
SASSERT(!m_internal);
|
||||
flet<bool> _internal(m_internal, true);
|
||||
|
||||
|
@ -208,7 +208,7 @@ namespace euf {
|
|||
m_ensure_concat.reset();
|
||||
auto ensure_concat = [&](unsigned lo, unsigned mid, unsigned hi) {
|
||||
// verbose_stream() << lo << " " << mid << " " << hi << "\n";
|
||||
TRACE("bv", tout << "ensure-concat " << lo << " " << mid << " " << hi << "\n");
|
||||
TRACE(bv, tout << "ensure-concat " << lo << " " << mid << " " << hi << "\n");
|
||||
unsigned lo_, hi_;
|
||||
for (enode* p1 : enode_parents(n))
|
||||
if (is_extract(p1, lo_, hi_) && lo_ == lo && hi_ == hi && p1->get_arg(0)->get_root() == arg_r)
|
||||
|
@ -218,14 +218,14 @@ namespace euf {
|
|||
};
|
||||
|
||||
auto propagate_above = [&](enode* b) {
|
||||
TRACE("bv", tout << "propagate-above " << g.bpp(b) << "\n");
|
||||
TRACE(bv, tout << "propagate-above " << g.bpp(b) << "\n");
|
||||
for (enode* sib : enode_class(b))
|
||||
if (is_extract(sib, lo2, hi2) && sib->get_arg(0)->get_root() == arg_r && hi1 + 1 == lo2)
|
||||
m_ensure_concat.push_back({lo1, hi1, hi2});
|
||||
};
|
||||
|
||||
auto propagate_below = [&](enode* a) {
|
||||
TRACE("bv", tout << "propagate-below " << g.bpp(a) << "\n");
|
||||
TRACE(bv, tout << "propagate-below " << g.bpp(a) << "\n");
|
||||
for (enode* sib : enode_class(a))
|
||||
if (is_extract(sib, lo2, hi2) && sib->get_arg(0)->get_root() == arg_r && hi2 + 1 == lo1)
|
||||
m_ensure_concat.push_back({lo2, hi2, hi1});
|
||||
|
@ -271,7 +271,7 @@ namespace euf {
|
|||
|
||||
|
||||
void bv_plugin::propagate_register_node(enode* n) {
|
||||
TRACE("bv", tout << "register " << g.bpp(n) << "\n");
|
||||
TRACE(bv, tout << "register " << g.bpp(n) << "\n");
|
||||
enode* a, * b;
|
||||
unsigned lo, hi;
|
||||
if (is_concat(n, a, b)) {
|
||||
|
@ -296,7 +296,7 @@ namespace euf {
|
|||
push_merge(mk_extract(arg, 0, w - 1), arg);
|
||||
ensure_slice(arg, lo, hi);
|
||||
}
|
||||
TRACE("bv", tout << "done register " << g.bpp(n) << "\n");
|
||||
TRACE(bv, tout << "done register " << g.bpp(n) << "\n");
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -306,7 +306,7 @@ namespace euf {
|
|||
enode* r = n;
|
||||
unsigned lb = 0, ub = width(n) - 1;
|
||||
while (true) {
|
||||
TRACE("bv", tout << "ensure slice " << g.bpp(n) << " " << lb << " [" << lo << ", " << hi << "] " << ub << "\n");
|
||||
TRACE(bv, tout << "ensure slice " << g.bpp(n) << " " << lb << " [" << lo << ", " << hi << "] " << ub << "\n");
|
||||
SASSERT(lb <= lo && hi <= ub);
|
||||
SASSERT(ub - lb + 1 == width(r));
|
||||
if (lb == lo && ub == hi)
|
||||
|
@ -370,7 +370,7 @@ namespace euf {
|
|||
SASSERT(!ys.empty());
|
||||
auto x = xs.back();
|
||||
auto y = ys.back();
|
||||
TRACE("bv", tout << "merge " << g.bpp(x) << " " << g.bpp(y) << "\n");
|
||||
TRACE(bv, tout << "merge " << g.bpp(x) << " " << g.bpp(y) << "\n");
|
||||
if (unfold_sub(x, xs))
|
||||
continue;
|
||||
else if (unfold_sub(y, ys))
|
||||
|
@ -407,7 +407,7 @@ namespace euf {
|
|||
}
|
||||
|
||||
void bv_plugin::split(enode* n, unsigned cut) {
|
||||
TRACE("bv", tout << "split: " << g.bpp(n) << " " << cut << "\n");
|
||||
TRACE(bv, tout << "split: " << g.bpp(n) << " " << cut << "\n");
|
||||
unsigned w = width(n);
|
||||
SASSERT(!info(n).hi);
|
||||
SASSERT(0 < cut && cut < w);
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace euf {
|
|||
}
|
||||
|
||||
enode_bool_pair egraph::insert_table(enode* p) {
|
||||
TRACE("euf_verbose", tout << "insert_table " << bpp(p) << "\n");
|
||||
TRACE(euf_verbose, tout << "insert_table " << bpp(p) << "\n");
|
||||
//SASSERT(!m_table.contains_ptr(p));
|
||||
auto rc = m_table.insert(p);
|
||||
p->m_cg = rc.first;
|
||||
|
@ -163,7 +163,7 @@ namespace euf {
|
|||
}
|
||||
|
||||
void egraph::add_th_eq(theory_id id, theory_var v1, theory_var v2, enode* c, enode* r) {
|
||||
TRACE("euf", tout << "eq: " << v1 << " == " << v2 << " - " << bpp(c) << " == " << bpp(r) << "\n";);
|
||||
TRACE(euf, tout << "eq: " << v1 << " == " << v2 << " - " << bpp(c) << " == " << bpp(r) << "\n";);
|
||||
m_new_th_eqs.push_back(th_eq(id, v1, v2, c, r));
|
||||
m_updates.push_back(update_record(update_record::new_th_eq()));
|
||||
++m_stats.m_num_th_eqs;
|
||||
|
@ -175,7 +175,7 @@ namespace euf {
|
|||
void egraph::add_th_diseq(theory_id id, theory_var v1, theory_var v2, enode* eq) {
|
||||
if (!th_propagates_diseqs(id))
|
||||
return;
|
||||
TRACE("euf_verbose", tout << "eq: " << v1 << " != " << v2 << "\n";);
|
||||
TRACE(euf_verbose, tout << "eq: " << v1 << " != " << v2 << "\n";);
|
||||
m_new_th_eqs.push_back(th_eq(id, v1, v2, eq->get_expr()));
|
||||
m_updates.push_back(update_record(update_record::new_th_eq()));
|
||||
auto* p = get_plugin(id);
|
||||
|
@ -185,7 +185,7 @@ namespace euf {
|
|||
}
|
||||
|
||||
void egraph::add_literal(enode* n, enode* ante) {
|
||||
TRACE("euf", tout << "propagate " << bpp(n) << " " << bpp(ante) << "\n");
|
||||
TRACE(euf, tout << "propagate " << bpp(n) << " " << bpp(ante) << "\n");
|
||||
if (!m_on_propagate_literal)
|
||||
return;
|
||||
if (!ante) ++m_stats.m_num_eqs; else ++m_stats.m_num_lits;
|
||||
|
@ -222,7 +222,7 @@ namespace euf {
|
|||
enode* arg1 = n->get_arg(0), * arg2 = n->get_arg(1);
|
||||
enode* r1 = arg1->get_root();
|
||||
enode* r2 = arg2->get_root();
|
||||
TRACE("euf", tout << "new-diseq: " << bpp(r1) << " " << bpp(r2) << ": " << r1->has_th_vars() << " " << r2->has_th_vars() << "\n";);
|
||||
TRACE(euf, tout << "new-diseq: " << bpp(r1) << " " << bpp(r2) << ": " << r1->has_th_vars() << " " << r2->has_th_vars() << "\n";);
|
||||
if (r1 == r2) {
|
||||
add_literal(n, nullptr);
|
||||
return;
|
||||
|
@ -323,7 +323,7 @@ namespace euf {
|
|||
if (!m.is_bool(n->get_sort()))
|
||||
return;
|
||||
if (enable_merge_tf != n->merge_tf()) {
|
||||
TRACE("euf", tout << "set tf " << enable_merge_tf << " " << bpp(n) << "\n");
|
||||
TRACE(euf, tout << "set tf " << enable_merge_tf << " " << bpp(n) << "\n");
|
||||
n->set_merge_tf(enable_merge_tf);
|
||||
m_updates.push_back(update_record(n, update_record::toggle_merge_tf()));
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ namespace euf {
|
|||
void egraph::set_value(enode* n, lbool value, justification j) {
|
||||
if (n->value() == l_undef) {
|
||||
force_push();
|
||||
TRACE("euf", tout << bpp(n) << " := " << value << "\n";);
|
||||
TRACE(euf, tout << bpp(n) << " := " << value << "\n";);
|
||||
n->set_value(value);
|
||||
n->m_lit_justification = j;
|
||||
m_updates.push_back(update_record(n, update_record::value_assignment()));
|
||||
|
@ -459,7 +459,7 @@ namespace euf {
|
|||
break;
|
||||
case update_record::tag_t::is_update_children:
|
||||
for (unsigned i = 0; i < p.r1->num_args(); ++i) {
|
||||
CTRACE("euf", (p.r1->m_args[i]->get_root()->m_parents.back() != p.r1),
|
||||
CTRACE(euf, (p.r1->m_args[i]->get_root()->m_parents.back() != p.r1),
|
||||
display(tout << bpp(p.r1->m_args[i]) << " " << bpp(p.r1->m_args[i]->get_root()) << " "););
|
||||
SASSERT(p.r1->m_args[i]->get_root()->m_parents.back() == p.r1);
|
||||
p.r1->m_args[i]->get_root()->m_parents.pop_back();
|
||||
|
@ -494,7 +494,7 @@ namespace euf {
|
|||
if (r1 == r2)
|
||||
return;
|
||||
|
||||
TRACE("euf", j.display(tout << "merge: " << bpp(n1) << " == " << bpp(n2) << " ", m_display_justification) << "\n" << bpp(r1) << " " << bpp(r2) << "\n";);
|
||||
TRACE(euf, j.display(tout << "merge: " << bpp(n1) << " == " << bpp(n2) << " ", m_display_justification) << "\n" << bpp(r1) << " " << bpp(r2) << "\n";);
|
||||
IF_VERBOSE(20, j.display(verbose_stream() << "merge: " << bpp(n1) << " == " << bpp(n2) << " ", m_display_justification) << "\n";);
|
||||
force_push();
|
||||
SASSERT(m_num_scopes == 0);
|
||||
|
@ -537,7 +537,7 @@ namespace euf {
|
|||
}
|
||||
|
||||
void egraph::remove_parents(enode* r) {
|
||||
TRACE("euf_verbose", tout << bpp(r) << "\n");
|
||||
TRACE(euf_verbose, tout << bpp(r) << "\n");
|
||||
SASSERT(all_of(enode_parents(r), [&](enode* p) { return !p->is_marked1(); }));
|
||||
for (enode* p : enode_parents(r)) {
|
||||
if (p->is_marked1())
|
||||
|
@ -548,7 +548,7 @@ namespace euf {
|
|||
SASSERT(m_table.contains_ptr(p));
|
||||
p->mark1();
|
||||
erase_from_table(p);
|
||||
CTRACE("euf_verbose", m_table.contains_ptr(p), tout << bpp(p) << "\n"; display(tout));
|
||||
CTRACE(euf_verbose, m_table.contains_ptr(p), tout << bpp(p) << "\n"; display(tout));
|
||||
SASSERT(!m_table.contains_ptr(p));
|
||||
}
|
||||
else if (p->is_equality())
|
||||
|
@ -561,11 +561,11 @@ namespace euf {
|
|||
if (!p->is_marked1())
|
||||
continue;
|
||||
p->unmark1();
|
||||
TRACE("euf_verbose", tout << "reinsert " << bpp(r1) << " " << bpp(r2) << " " << bpp(p) << " " << p->cgc_enabled() << "\n";);
|
||||
TRACE(euf_verbose, tout << "reinsert " << bpp(r1) << " " << bpp(r2) << " " << bpp(p) << " " << p->cgc_enabled() << "\n";);
|
||||
if (p->cgc_enabled()) {
|
||||
auto [p_other, comm] = insert_table(p);
|
||||
SASSERT(m_table.contains_ptr(p) == (p_other == p));
|
||||
CTRACE("euf_verbose", p_other != p, tout << "reinsert " << bpp(p) << " == " << bpp(p_other) << " " << p->value() << " " << p_other->value() << "\n");
|
||||
CTRACE(euf_verbose, p_other != p, tout << "reinsert " << bpp(p) << " == " << bpp(p_other) << " " << p->value() << " " << p_other->value() << "\n");
|
||||
if (p_other != p)
|
||||
m_to_merge.push_back(to_merge(p_other, p, comm));
|
||||
else
|
||||
|
@ -599,14 +599,14 @@ namespace euf {
|
|||
|
||||
void egraph::undo_eq(enode* r1, enode* n1, unsigned r2_num_parents) {
|
||||
enode* r2 = r1->get_root();
|
||||
TRACE("euf_verbose", tout << "undo-eq old-root: " << bpp(r1) << " current-root " << bpp(r2) << " node: " << bpp(n1) << "\n";);
|
||||
TRACE(euf_verbose, tout << "undo-eq old-root: " << bpp(r1) << " current-root " << bpp(r2) << " node: " << bpp(n1) << "\n";);
|
||||
r2->dec_class_size(r1->class_size());
|
||||
r2->set_is_shared(l_undef);
|
||||
std::swap(r1->m_next, r2->m_next);
|
||||
auto begin = r2->begin_parents() + r2_num_parents, end = r2->end_parents();
|
||||
for (auto it = begin; it != end; ++it) {
|
||||
enode* p = *it;
|
||||
TRACE("euf_verbose", tout << "erase " << bpp(p) << "\n";);
|
||||
TRACE(euf_verbose, tout << "erase " << bpp(p) << "\n";);
|
||||
SASSERT(!p->cgc_enabled() || m_table.contains_ptr(p));
|
||||
SASSERT(!p->cgc_enabled() || p->is_cgr());
|
||||
if (p->cgc_enabled())
|
||||
|
@ -661,7 +661,7 @@ namespace euf {
|
|||
m_updates.push_back(update_record(false, update_record::inconsistent()));
|
||||
m_n1 = n1;
|
||||
m_n2 = n2;
|
||||
TRACE("euf", tout << "conflict " << bpp(n1) << " " << bpp(n2) << " " << j << " " << n1->get_root()->value() << " " << n2->get_root()->value() << "\n");
|
||||
TRACE(euf, tout << "conflict " << bpp(n1) << " " << bpp(n2) << " " << j << " " << n1->get_root()->value() << " " << n2->get_root()->value() << "\n");
|
||||
m_justification = j;
|
||||
}
|
||||
|
||||
|
@ -678,11 +678,11 @@ namespace euf {
|
|||
SASSERT(n2->acyclic());
|
||||
SASSERT(n1->get_root()->reaches(n1));
|
||||
SASSERT(!n2->get_root()->m_target);
|
||||
TRACE("euf_verbose", tout << "merge " << n1->get_expr_id() << " " << n2->get_expr_id() << " updates: " << m_updates.size() << "\n";);
|
||||
TRACE(euf_verbose, tout << "merge " << n1->get_expr_id() << " " << n2->get_expr_id() << " updates: " << m_updates.size() << "\n";);
|
||||
}
|
||||
|
||||
void egraph::unmerge_justification(enode* n1) {
|
||||
TRACE("euf_verbose", tout << "unmerge " << n1->get_expr_id() << " " << n1->m_target->get_expr_id() << "\n";);
|
||||
TRACE(euf_verbose, tout << "unmerge " << n1->get_expr_id() << " " << n1->m_target->get_expr_id() << "\n";);
|
||||
// r1 -> .. -> n1 -> n2 -> ... -> r2
|
||||
// where n2 = n1->m_target
|
||||
SASSERT(n1->get_root()->reaches(n1));
|
||||
|
@ -749,7 +749,7 @@ namespace euf {
|
|||
push_lca(n1->get_arg(1), n2->get_arg(0));
|
||||
return;
|
||||
}
|
||||
TRACE("euf_verbose", tout << bpp(n1) << " " << bpp(n2) << "\n");
|
||||
TRACE(euf_verbose, tout << bpp(n1) << " " << bpp(n2) << "\n");
|
||||
|
||||
for (unsigned i = 0; i < n1->num_args(); ++i)
|
||||
push_lca(n1->get_arg(i), n2->get_arg(i));
|
||||
|
@ -808,7 +808,7 @@ namespace euf {
|
|||
|
||||
template <typename T>
|
||||
void egraph::explain_eq(ptr_vector<T>& justifications, cc_justification* cc, enode* a, enode* b, justification const& j) {
|
||||
TRACE("euf_verbose", tout << "explain-eq: " << bpp(a) << " == " << bpp(b) << " jst: " << j << "\n";);
|
||||
TRACE(euf_verbose, tout << "explain-eq: " << bpp(a) << " == " << bpp(b) << " jst: " << j << "\n";);
|
||||
if (j.is_external())
|
||||
justifications.push_back(j.ext<T>());
|
||||
else if (j.is_congruence())
|
||||
|
@ -833,7 +833,7 @@ namespace euf {
|
|||
SASSERT(a->get_root() == b->get_root());
|
||||
|
||||
enode* lca = find_lca(a, b);
|
||||
TRACE("euf_verbose", tout << "explain-eq: " << bpp(a) << " == " << bpp(b) << " lca: " << bpp(lca) << "\n";);
|
||||
TRACE(euf_verbose, tout << "explain-eq: " << bpp(a) << " == " << bpp(b) << " lca: " << bpp(lca) << "\n";);
|
||||
push_to_lca(a, lca);
|
||||
push_to_lca(b, lca);
|
||||
if (m_used_eq)
|
||||
|
@ -865,7 +865,7 @@ namespace euf {
|
|||
continue;
|
||||
if (n->m_target) {
|
||||
n->mark1();
|
||||
CTRACE("euf_verbose", m_display_justification, n->m_justification.display(tout << n->get_expr_id() << " = " << n->m_target->get_expr_id() << " ", m_display_justification) << "\n";);
|
||||
CTRACE(euf_verbose, m_display_justification, n->m_justification.display(tout << n->get_expr_id() << " = " << n->m_target->get_expr_id() << " ", m_display_justification) << "\n";);
|
||||
explain_eq(justifications, cc, n, n->m_target, n->m_justification);
|
||||
}
|
||||
else if (!n->is_marked1() && n->value() != l_undef) {
|
||||
|
@ -884,9 +884,9 @@ namespace euf {
|
|||
n->invariant(*this);
|
||||
for (enode* n : m_nodes)
|
||||
if (n->cgc_enabled() && n->num_args() > 0 && (!m_table.find(n) || n->get_root() != m_table.find(n)->get_root())) {
|
||||
CTRACE("euf", !m_table.find(n), tout << "node is not in table\n";);
|
||||
CTRACE("euf", m_table.find(n), tout << "root " << bpp(n->get_root()) << " table root " << bpp(m_table.find(n)->get_root()) << "\n";);
|
||||
TRACE("euf", display(tout << bpp(n) << " is not closed under congruence\n"););
|
||||
CTRACE(euf, !m_table.find(n), tout << "node is not in table\n";);
|
||||
CTRACE(euf, m_table.find(n), tout << "root " << bpp(n->get_root()) << " table root " << bpp(m_table.find(n)->get_root()) << "\n";);
|
||||
TRACE(euf, display(tout << bpp(n) << " is not closed under congruence\n"););
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace euf {
|
|||
for (enode* arg : enode_args(p)) {
|
||||
found |= arg->get_root() == this;
|
||||
}
|
||||
CTRACE("euf", !found, tout << g.bpp(p) << " does not have a child with root: " << g.bpp(this) << "\n";);
|
||||
CTRACE(euf, !found, tout << g.bpp(p) << " does not have a child with root: " << g.bpp(this) << "\n";);
|
||||
VERIFY(found);
|
||||
}
|
||||
for (enode* c : enode_class(this)) {
|
||||
|
@ -55,7 +55,7 @@ namespace euf {
|
|||
for (enode* q : enode_parents(this)) {
|
||||
found |= p->congruent(q);
|
||||
}
|
||||
CTRACE("euf", !found, tout << "parent " << g.bpp(p) << " of " << g.bpp(c) << " is not congruent to a parent of " << g.bpp(this) << "\n";);
|
||||
CTRACE(euf, !found, tout << "parent " << g.bpp(p) << " of " << g.bpp(c) << " is not congruent to a parent of " << g.bpp(this) << "\n";);
|
||||
VERIFY(found);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ namespace euf {
|
|||
UNTAG(table*, t)->erase(n);
|
||||
break;
|
||||
}
|
||||
CTRACE("euf", contains_ptr(n), display(tout));
|
||||
CTRACE(euf, contains_ptr(n), display(tout));
|
||||
SASSERT(!contains_ptr(n));
|
||||
}
|
||||
|
||||
|
|
|
@ -951,7 +951,7 @@ namespace euf {
|
|||
for (unsigned reg : m_todo) {
|
||||
expr * p = m_registers[reg];
|
||||
SASSERT(!is_quantifier(p));
|
||||
TRACE("mam", tout << "lin: " << reg << " " << get_check_mark(reg) << " " << is_var(p) << "\n";);
|
||||
TRACE(mam, tout << "lin: " << reg << " " << get_check_mark(reg) << " " << is_var(p) << "\n";);
|
||||
if (is_var(p)) {
|
||||
unsigned var_id = to_var(p)->get_idx();
|
||||
if (m_vars[var_id] != -1)
|
||||
|
@ -1298,7 +1298,7 @@ namespace euf {
|
|||
return nullptr; // it is unlikely we will find a compatible node
|
||||
}
|
||||
if (curr_compatibility > max_compatibility) {
|
||||
TRACE("mam", tout << "better child " << best_child << " -> " << curr_child << "\n";);
|
||||
TRACE(mam, tout << "better child " << best_child << " -> " << curr_child << "\n";);
|
||||
best_child = curr_child;
|
||||
max_compatibility = curr_compatibility;
|
||||
}
|
||||
|
@ -1507,16 +1507,16 @@ namespace euf {
|
|||
for (;;) {
|
||||
m_compatible.reset();
|
||||
m_incompatible.reset();
|
||||
TRACE("mam_compiler_detail", tout << "processing head: " << *head << "\n";);
|
||||
TRACE(mam_compiler_detail, tout << "processing head: " << *head << "\n";);
|
||||
instruction * curr = head->m_next;
|
||||
instruction * last = head;
|
||||
while (curr != nullptr && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) {
|
||||
TRACE("mam_compiler_detail", tout << "processing instr: " << *curr << "\n";);
|
||||
TRACE(mam_compiler_detail, tout << "processing instr: " << *curr << "\n";);
|
||||
switch (curr->m_opcode) {
|
||||
case BIND1: case BIND2: case BIND3: case BIND4: case BIND5: case BIND6: case BINDN: {
|
||||
bind* bnd = static_cast<bind*>(curr);
|
||||
if (is_compatible(bnd)) {
|
||||
TRACE("mam_compiler_detail", tout << "compatible\n";);
|
||||
TRACE(mam_compiler_detail, tout << "compatible\n";);
|
||||
unsigned ireg = bnd->m_ireg;
|
||||
SASSERT(m_todo.contains(ireg));
|
||||
m_todo.erase(ireg);
|
||||
|
@ -1531,7 +1531,7 @@ namespace euf {
|
|||
}
|
||||
}
|
||||
else {
|
||||
TRACE("mam_compiler_detail", tout << "incompatible\n";);
|
||||
TRACE(mam_compiler_detail, tout << "incompatible\n";);
|
||||
m_incompatible.push_back(curr);
|
||||
}
|
||||
break;
|
||||
|
@ -1539,7 +1539,7 @@ namespace euf {
|
|||
case CHECK: {
|
||||
check* chk = static_cast<check*>(curr);
|
||||
if (is_compatible(chk)) {
|
||||
TRACE("mam_compiler_detail", tout << "compatible\n";);
|
||||
TRACE(mam_compiler_detail, tout << "compatible\n";);
|
||||
unsigned reg = chk->m_reg;
|
||||
SASSERT(m_todo.contains(reg));
|
||||
m_todo.erase(reg);
|
||||
|
@ -1547,7 +1547,7 @@ namespace euf {
|
|||
m_compatible.push_back(curr);
|
||||
}
|
||||
else if (m_use_filters && is_semi_compatible(chk)) {
|
||||
TRACE("mam_compiler_detail", tout << "semi compatible\n";);
|
||||
TRACE(mam_compiler_detail, tout << "semi compatible\n";);
|
||||
unsigned reg = chk->m_reg;
|
||||
enode * n1 = chk->m_enode;
|
||||
// n1->has_lbl_hash may be false, even
|
||||
|
@ -1575,14 +1575,14 @@ namespace euf {
|
|||
m_incompatible.push_back(curr);
|
||||
}
|
||||
else {
|
||||
TRACE("mam_compiler_detail", tout << "incompatible " << chk->m_reg << "\n";);
|
||||
TRACE(mam_compiler_detail, tout << "incompatible " << chk->m_reg << "\n";);
|
||||
m_incompatible.push_back(curr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case COMPARE:
|
||||
if (is_compatible(static_cast<compare*>(curr))) {
|
||||
TRACE("mam_compiler_detail", tout << "compatible\n";);
|
||||
TRACE(mam_compiler_detail, tout << "compatible\n";);
|
||||
unsigned reg1 = static_cast<compare*>(curr)->m_reg1;
|
||||
unsigned reg2 = static_cast<compare*>(curr)->m_reg2;
|
||||
SASSERT(m_todo.contains(reg2));
|
||||
|
@ -1598,7 +1598,7 @@ namespace euf {
|
|||
m_compatible.push_back(curr);
|
||||
}
|
||||
else {
|
||||
TRACE("mam_compiler_detail", tout << "incompatible\n";);
|
||||
TRACE(mam_compiler_detail, tout << "incompatible\n";);
|
||||
m_incompatible.push_back(curr);
|
||||
}
|
||||
break;
|
||||
|
@ -1619,8 +1619,8 @@ namespace euf {
|
|||
SASSERT(m_use_filters);
|
||||
if (is_compatible(flt)) {
|
||||
unsigned reg = flt->m_reg;
|
||||
TRACE("mam_compiler_detail", tout << "compatible " << reg << "\n";);
|
||||
CTRACE("mam_compiler_bug", !m_todo.contains(reg), {
|
||||
TRACE(mam_compiler_detail, tout << "compatible " << reg << "\n";);
|
||||
CTRACE(mam_compiler_bug, !m_todo.contains(reg), {
|
||||
for (unsigned t : m_todo) { tout << t << " "; }
|
||||
tout << "\nregisters:\n";
|
||||
unsigned i = 0;
|
||||
|
@ -1637,8 +1637,8 @@ namespace euf {
|
|||
}
|
||||
else if (is_semi_compatible(flt)) {
|
||||
unsigned reg = flt->m_reg;
|
||||
TRACE("mam_compiler_detail", tout << "semi compatible " << reg << "\n";);
|
||||
CTRACE("mam_compiler_bug", !m_todo.contains(reg), {
|
||||
TRACE(mam_compiler_detail, tout << "semi compatible " << reg << "\n";);
|
||||
CTRACE(mam_compiler_bug, !m_todo.contains(reg), {
|
||||
for (unsigned t : m_todo) { tout << t << " "; }
|
||||
tout << "\nregisters:\n";
|
||||
unsigned i = 0;
|
||||
|
@ -1648,7 +1648,7 @@ namespace euf {
|
|||
});
|
||||
SASSERT(m_todo.contains(reg));
|
||||
unsigned h = get_pat_lbl_hash(reg);
|
||||
TRACE("mam_lbl_bug",
|
||||
TRACE(mam_lbl_bug,
|
||||
tout << "curr_set: " << flt->m_lbl_set << "\n";
|
||||
tout << "new hash: " << h << "\n";);
|
||||
set_check_mark(reg, CHECK_SET);
|
||||
|
@ -1667,13 +1667,13 @@ namespace euf {
|
|||
}
|
||||
}
|
||||
else {
|
||||
TRACE("mam_compiler_detail", tout << "incompatible\n";);
|
||||
TRACE(mam_compiler_detail, tout << "incompatible\n";);
|
||||
m_incompatible.push_back(curr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
TRACE("mam_compiler_detail", tout << "incompatible\n";);
|
||||
TRACE(mam_compiler_detail, tout << "incompatible\n";);
|
||||
m_incompatible.push_back(curr);
|
||||
break;
|
||||
}
|
||||
|
@ -1681,7 +1681,7 @@ namespace euf {
|
|||
curr = curr->m_next;
|
||||
}
|
||||
|
||||
TRACE("mam_compiler", tout << *head << " " << head << "\n";
|
||||
TRACE(mam_compiler, tout << *head << " " << head << "\n";
|
||||
tout << "m_compatible.size(): " << m_compatible.size() << "\n";
|
||||
tout << "m_incompatible.size(): " << m_incompatible.size() << "\n";);
|
||||
|
||||
|
@ -1691,7 +1691,7 @@ namespace euf {
|
|||
SASSERT(curr->m_opcode == CHOOSE);
|
||||
choose * first_child = static_cast<choose *>(curr);
|
||||
choose * best_child = find_best_child(first_child);
|
||||
TRACE("mam", tout << "best child " << best_child << "\n";);
|
||||
TRACE(mam, tout << "best child " << best_child << "\n";);
|
||||
if (best_child == nullptr) {
|
||||
// There is no compatible child
|
||||
// Suppose the sequence is:
|
||||
|
@ -1776,7 +1776,7 @@ namespace euf {
|
|||
init(r, qa, mp, first_idx);
|
||||
linearise(r->m_root, first_idx);
|
||||
r->m_num_choices = m_num_choices;
|
||||
TRACE("mam_compiler", tout << "new tree for:\n" << mk_pp(mp, m) << "\n" << *r;);
|
||||
TRACE(mam_compiler, tout << "new tree for:\n" << mk_pp(mp, m) << "\n" << *r;);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -1794,21 +1794,21 @@ namespace euf {
|
|||
return;
|
||||
}
|
||||
m_is_tmp_tree = is_tmp_tree;
|
||||
TRACE("mam_compiler", tout << "updating tree with:\n" << mk_pp(mp, m) << "\n";);
|
||||
TRACE("mam_bug", tout << "before insertion\n" << *tree << "\n";);
|
||||
TRACE(mam_compiler, tout << "updating tree with:\n" << mk_pp(mp, m) << "\n";);
|
||||
TRACE(mam_bug, tout << "before insertion\n" << *tree << "\n";);
|
||||
if (!is_tmp_tree)
|
||||
m_ct_manager.save_num_regs(tree);
|
||||
init(tree, qa, mp, first_idx);
|
||||
m_num_choices = tree->m_num_choices;
|
||||
insert(tree->m_root, first_idx);
|
||||
TRACE("mam_bug",
|
||||
TRACE(mam_bug,
|
||||
tout << "m_num_choices: " << m_num_choices << "\n";);
|
||||
if (m_num_choices > tree->m_num_choices) {
|
||||
if (!is_tmp_tree)
|
||||
m_ct_manager.save_num_choices(tree);
|
||||
tree->m_num_choices = m_num_choices;
|
||||
}
|
||||
TRACE("mam_bug",
|
||||
TRACE(mam_bug,
|
||||
tout << "m_num_choices: " << m_num_choices << "\n";
|
||||
tout << "new tree:\n" << *tree;
|
||||
tout << "todo ";
|
||||
|
@ -1999,7 +1999,7 @@ namespace euf {
|
|||
}
|
||||
|
||||
void init(code_tree * t) {
|
||||
TRACE("mam_bug", tout << "preparing to match tree:\n" << *t << "\n";);
|
||||
TRACE(mam_bug, tout << "preparing to match tree:\n" << *t << "\n";);
|
||||
m_registers.reserve(t->get_num_regs(), nullptr);
|
||||
m_bindings.reserve(t->get_num_regs(), nullptr);
|
||||
if (m_backtrack_stack.size() < t->get_num_choices())
|
||||
|
@ -2010,14 +2010,14 @@ namespace euf {
|
|||
void execute(code_tree * t) {
|
||||
if (!t->has_candidates())
|
||||
return;
|
||||
TRACE("trigger_bug", tout << "execute for code tree:\n"; t->display(tout););
|
||||
TRACE(trigger_bug, tout << "execute for code tree:\n"; t->display(tout););
|
||||
init(t);
|
||||
t->save_qhead(ctx);
|
||||
enode* app;
|
||||
if (t->filter_candidates()) {
|
||||
code_tree::scoped_unmark _unmark(t);
|
||||
while ((app = t->next_candidate()) && !ctx.resource_limits_exceeded()) {
|
||||
TRACE("trigger_bug", tout << "candidate\n" << ctx.get_egraph().bpp(app) << "\n";);
|
||||
TRACE(trigger_bug, tout << "candidate\n" << ctx.get_egraph().bpp(app) << "\n";);
|
||||
if (!app->is_marked3() && app->is_cgr()) {
|
||||
execute_core(t, app);
|
||||
app->mark3();
|
||||
|
@ -2026,7 +2026,7 @@ namespace euf {
|
|||
}
|
||||
else {
|
||||
while ((app = t->next_candidate()) && !ctx.resource_limits_exceeded()) {
|
||||
TRACE("trigger_bug", tout << "candidate\n" << ctx.get_egraph().bpp(app) << "\n";);
|
||||
TRACE(trigger_bug, tout << "candidate\n" << ctx.get_egraph().bpp(app) << "\n";);
|
||||
if (app->is_cgr())
|
||||
execute_core(t, app);
|
||||
}
|
||||
|
@ -2175,7 +2175,7 @@ namespace euf {
|
|||
bp.m_instr = c;
|
||||
bp.m_old_max_generation = m_max_generation;
|
||||
if (best_v == nullptr) {
|
||||
TRACE("mam_bug", tout << "m_top: " << m_top << ", m_backtrack_stack.size(): " << m_backtrack_stack.size() << "\n";
|
||||
TRACE(mam_bug, tout << "m_top: " << m_top << ", m_backtrack_stack.size(): " << m_backtrack_stack.size() << "\n";
|
||||
tout << *c << "\n";);
|
||||
bp.m_to_recycle = nullptr;
|
||||
bp.m_it = ctx.get_egraph().enodes_of(lbl).begin();
|
||||
|
@ -2255,7 +2255,7 @@ namespace euf {
|
|||
}
|
||||
|
||||
bool interpreter::execute_core(code_tree * t, enode * n) {
|
||||
TRACE("trigger_bug", tout << "interpreter::execute_core\n"; t->display(tout); tout << "\nenode\n" << mk_ismt2_pp(n->get_expr(), m) << "\n";);
|
||||
TRACE(trigger_bug, tout << "interpreter::execute_core\n"; t->display(tout); tout << "\nenode\n" << mk_ismt2_pp(n->get_expr(), m) << "\n";);
|
||||
unsigned since_last_check = 0;
|
||||
|
||||
#ifdef _PROFILE_MAM
|
||||
|
@ -2269,7 +2269,7 @@ namespace euf {
|
|||
t->inc_counter();
|
||||
#endif
|
||||
// It doesn't make sense to process an irrelevant enode.
|
||||
TRACE("mam_execute_core", tout << "EXEC " << t->get_root_lbl()->get_name() << "\n";);
|
||||
TRACE(mam_execute_core, tout << "EXEC " << t->get_root_lbl()->get_name() << "\n";);
|
||||
if (!ctx.is_relevant(n))
|
||||
return false;
|
||||
SASSERT(ctx.is_relevant(n));
|
||||
|
@ -2286,7 +2286,7 @@ namespace euf {
|
|||
|
||||
main_loop:
|
||||
|
||||
TRACE("mam_int", display_pc_info(tout););
|
||||
TRACE(mam_int, display_pc_info(tout););
|
||||
#ifdef _PROFILE_MAM
|
||||
const_cast<instruction*>(m_pc)->m_counter++;
|
||||
#endif
|
||||
|
@ -2425,7 +2425,7 @@ namespace euf {
|
|||
m_app = get_first_f_app(static_cast<const bind *>(m_pc)->m_label, static_cast<const bind *>(m_pc)->m_num_args, m_n1); \
|
||||
if (!m_app) \
|
||||
goto backtrack; \
|
||||
TRACE("mam_int", tout << "bind candidate: " << mk_pp(m_app->get_expr(), m) << "\n";); \
|
||||
TRACE(mam_int, tout << "bind candidate: " << mk_pp(m_app->get_expr(), m) << "\n";); \
|
||||
m_backtrack_stack[m_top].m_instr = m_pc; \
|
||||
m_backtrack_stack[m_top].m_old_max_generation = m_curr_max_generation; \
|
||||
m_backtrack_stack[m_top].m_curr = m_app; \
|
||||
|
@ -2624,7 +2624,7 @@ namespace euf {
|
|||
if (m_app == nullptr)
|
||||
goto backtrack;
|
||||
m_pattern_instances.push_back(m_app);
|
||||
TRACE("mam_int", tout << "continue candidate:\n" << mk_ll_pp(m_app->get_expr(), m););
|
||||
TRACE(mam_int, tout << "continue candidate:\n" << mk_ll_pp(m_app->get_expr(), m););
|
||||
for (unsigned i = 0; i < m_num_args; i++)
|
||||
m_registers[m_oreg+i] = m_app->get_arg(i);
|
||||
m_pc = m_pc->m_next;
|
||||
|
@ -2643,9 +2643,9 @@ namespace euf {
|
|||
goto main_loop;
|
||||
|
||||
backtrack:
|
||||
TRACE("mam_int", tout << "backtracking.\n";);
|
||||
TRACE(mam_int, tout << "backtracking.\n";);
|
||||
if (m_top == 0) {
|
||||
TRACE("mam_int", tout << "no more alternatives.\n";);
|
||||
TRACE(mam_int, tout << "no more alternatives.\n";);
|
||||
#ifdef _PROFILE_MAM
|
||||
t->get_watch().stop();
|
||||
#endif
|
||||
|
@ -2655,7 +2655,7 @@ namespace euf {
|
|||
m_max_generation = bp.m_old_max_generation;
|
||||
|
||||
|
||||
TRACE("mam_int", tout << "backtrack top: " << bp.m_instr << " " << *(bp.m_instr) << "\n";);
|
||||
TRACE(mam_int, tout << "backtrack top: " << bp.m_instr << " " << *(bp.m_instr) << "\n";);
|
||||
#ifdef _PROFILE_MAM
|
||||
if (bp.m_instr->m_opcode != CHOOSE) // CHOOSE has a different status. It is a control flow backtracking.
|
||||
const_cast<instruction*>(bp.m_instr)->m_counter++;
|
||||
|
@ -2682,7 +2682,7 @@ namespace euf {
|
|||
switch (bp.m_instr->m_opcode) {
|
||||
case CHOOSE:
|
||||
m_pc = static_cast<const choose*>(bp.m_instr)->m_alt;
|
||||
TRACE("mam_int", tout << "alt: " << m_pc << "\n";);
|
||||
TRACE(mam_int, tout << "alt: " << m_pc << "\n";);
|
||||
SASSERT(m_pc != 0);
|
||||
m_top--;
|
||||
goto main_loop;
|
||||
|
@ -2695,7 +2695,7 @@ namespace euf {
|
|||
goto backtrack; \
|
||||
} \
|
||||
bp.m_curr = m_app; \
|
||||
TRACE("mam_int", tout << "bind next candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); \
|
||||
TRACE(mam_int, tout << "bind next candidate:\n" << mk_ll_pp(m_app->get_expr(), m);); \
|
||||
m_oreg = m_b->m_oreg
|
||||
|
||||
BBIND_COMMON();
|
||||
|
@ -2775,7 +2775,7 @@ namespace euf {
|
|||
m_pattern_instances.push_back(m_app);
|
||||
// continue succeeded
|
||||
update_max_generation(m_app, nullptr); // null indicates a top-level match
|
||||
TRACE("mam_int", tout << "continue next candidate:\n" << mk_ll_pp(m_app->get_expr(), m););
|
||||
TRACE(mam_int, tout << "continue next candidate:\n" << mk_ll_pp(m_app->get_expr(), m););
|
||||
m_num_args = c->m_num_args;
|
||||
m_oreg = c->m_oreg;
|
||||
for (unsigned i = 0; i < m_num_args; i++)
|
||||
|
@ -2884,7 +2884,7 @@ namespace euf {
|
|||
m_trees[lbl_id]->get_patterns().push_back(std::make_pair(qa, mp));
|
||||
ctx.get_trail().push(push_back_trail<std::pair<quantifier*, app*>, false>(m_trees[lbl_id]->get_patterns()));
|
||||
});
|
||||
TRACE("trigger_bug", tout << "after add_pattern, first_idx: " << first_idx << "\n"; m_trees[lbl_id]->display(tout););
|
||||
TRACE(trigger_bug, tout << "after add_pattern, first_idx: " << first_idx << "\n"; m_trees[lbl_id]->display(tout););
|
||||
}
|
||||
|
||||
void reset() {
|
||||
|
@ -3093,7 +3093,7 @@ namespace euf {
|
|||
void add_candidate(code_tree * t, enode * app) {
|
||||
if (!t)
|
||||
return;
|
||||
TRACE("q", tout << "candidate " << ctx.get_egraph().bpp(app) << "\n";);
|
||||
TRACE(q, tout << "candidate " << ctx.get_egraph().bpp(app) << "\n";);
|
||||
if (!t->has_candidates()) {
|
||||
ctx.get_trail().push(push_back_trail<code_tree*, false>(m_to_match));
|
||||
m_to_match.push_back(t);
|
||||
|
@ -3126,8 +3126,8 @@ namespace euf {
|
|||
void update_clbls(func_decl * lbl) {
|
||||
unsigned lbl_id = lbl->get_small_id();
|
||||
m_is_clbl.reserve(lbl_id+1, false);
|
||||
TRACE("trigger_bug", tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";);
|
||||
TRACE("mam_bug", tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";);
|
||||
TRACE(trigger_bug, tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";);
|
||||
TRACE(mam_bug, tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";);
|
||||
if (m_is_clbl[lbl_id])
|
||||
return;
|
||||
ctx.get_trail().push(set_bitvector_trail(m_is_clbl, lbl_id));
|
||||
|
@ -3136,7 +3136,7 @@ namespace euf {
|
|||
for (enode* app : m_egraph.enodes_of(lbl)) {
|
||||
if (ctx.is_relevant(app)) {
|
||||
update_lbls(app, h);
|
||||
TRACE("mam_bug", tout << "updating labels of: #" << app->get_expr_id() << "\n";
|
||||
TRACE(mam_bug, tout << "updating labels of: #" << app->get_expr_id() << "\n";
|
||||
tout << "new_elem: " << h << "\n";
|
||||
tout << "lbls: " << app->get_lbls() << "\n";
|
||||
tout << "r.lbls: " << app->get_root()->get_lbls() << "\n";);
|
||||
|
@ -3152,10 +3152,10 @@ namespace euf {
|
|||
if (!r_plbls.may_contain(elem)) {
|
||||
ctx.get_trail().push(mam_value_trail<approx_set>(r_plbls));
|
||||
r_plbls.insert(elem);
|
||||
TRACE("trigger_bug", tout << "updating plabels of:\n" << mk_ismt2_pp(c->get_root()->get_expr(), m) << "\n";
|
||||
TRACE(trigger_bug, tout << "updating plabels of:\n" << mk_ismt2_pp(c->get_root()->get_expr(), m) << "\n";
|
||||
tout << "new_elem: " << static_cast<unsigned>(elem) << "\n";
|
||||
tout << "plbls: " << c->get_root()->get_plbls() << "\n";);
|
||||
TRACE("mam_bug", tout << "updating plabels of: #" << c->get_root()->get_expr_id() << "\n";
|
||||
TRACE(mam_bug, tout << "updating plabels of: #" << c->get_root()->get_expr_id() << "\n";
|
||||
tout << "new_elem: " << static_cast<unsigned>(elem) << "\n";
|
||||
tout << "plbls: " << c->get_root()->get_plbls() << "\n";);
|
||||
|
||||
|
@ -3166,9 +3166,9 @@ namespace euf {
|
|||
void update_plbls(func_decl * lbl) {
|
||||
unsigned lbl_id = lbl->get_small_id();
|
||||
m_is_plbl.reserve(lbl_id+1, false);
|
||||
TRACE("trigger_bug", tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << ", lbl_id: " << lbl_id << "\n";
|
||||
TRACE(trigger_bug, tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << ", lbl_id: " << lbl_id << "\n";
|
||||
tout << "mam: " << this << "\n";);
|
||||
TRACE("mam_bug", tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << "\n";);
|
||||
TRACE(mam_bug, tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << "\n";);
|
||||
if (m_is_plbl[lbl_id])
|
||||
return;
|
||||
ctx.get_trail().push(set_bitvector_trail(m_is_plbl, lbl_id));
|
||||
|
@ -3282,7 +3282,7 @@ namespace euf {
|
|||
ctx.get_trail().push(set_ptr_trail<path_tree>(m_pc[h1][h2]));
|
||||
m_pc[h1][h2] = mk_path_tree(p, qa, mp);
|
||||
}
|
||||
TRACE("mam_path_tree_updt",
|
||||
TRACE(mam_path_tree_updt,
|
||||
tout << "updated path tree:\n";
|
||||
m_pc[h1][h2]->display(tout, 2););
|
||||
}
|
||||
|
@ -3320,7 +3320,7 @@ namespace euf {
|
|||
m_pp[h1][h2].second = mk_path_tree(p2, qa, mp);
|
||||
}
|
||||
}
|
||||
TRACE("mam_path_tree_updt",
|
||||
TRACE(mam_path_tree_updt,
|
||||
tout << "updated path tree:\n";
|
||||
SASSERT(h1 <= h2);
|
||||
m_pp[h1][h2].first->display(tout, 2);
|
||||
|
@ -3386,7 +3386,7 @@ namespace euf {
|
|||
update_plbls(plbl);
|
||||
if (!n->has_lbl_hash())
|
||||
m_egraph.set_lbl_hash(n);
|
||||
TRACE("mam_bug",
|
||||
TRACE(mam_bug,
|
||||
tout << "updating pc labels " << plbl->get_name() << " " <<
|
||||
static_cast<unsigned>(n->get_lbl_hash()) << "\n";
|
||||
tout << "#" << n->get_expr_id() << " " << n->get_root()->get_lbls() << "\n";
|
||||
|
@ -3396,7 +3396,7 @@ namespace euf {
|
|||
}
|
||||
|
||||
func_decl * clbl = to_app(child)->get_decl();
|
||||
TRACE("mam_bug", tout << "updating pc labels " << plbl->get_name() << " " << clbl->get_name() << "\n";);
|
||||
TRACE(mam_bug, tout << "updating pc labels " << plbl->get_name() << " " << clbl->get_name() << "\n";);
|
||||
update_plbls(plbl);
|
||||
update_clbls(clbl);
|
||||
update_pc(m_lbl_hasher(plbl), m_lbl_hasher(clbl), new_path, qa, mp);
|
||||
|
@ -3408,7 +3408,7 @@ namespace euf {
|
|||
\brief Update inverted path index.
|
||||
*/
|
||||
void update_filters(quantifier * qa, app * mp) {
|
||||
TRACE("mam_bug", tout << "updating filters using:\n" << mk_pp(mp, m) << "\n";);
|
||||
TRACE(mam_bug, tout << "updating filters using:\n" << mk_pp(mp, m) << "\n";);
|
||||
unsigned num_vars = qa->get_num_decls();
|
||||
if (num_vars >= m_var_paths.size())
|
||||
m_var_paths.resize(num_vars+1);
|
||||
|
@ -3460,7 +3460,7 @@ namespace euf {
|
|||
\brief Collect new E-matching candidates using the inverted path index t.
|
||||
*/
|
||||
void collect_parents(enode * r, path_tree * t) {
|
||||
TRACE("mam", tout << ctx.get_egraph().bpp(r) << " " << t << "\n";);
|
||||
TRACE(mam, tout << ctx.get_egraph().bpp(r) << " " << t << "\n";);
|
||||
if (t == nullptr)
|
||||
return;
|
||||
#ifdef _PROFILE_PATH_TREE
|
||||
|
@ -3481,7 +3481,7 @@ namespace euf {
|
|||
#ifdef _PROFILE_PATH_TREE
|
||||
t->m_counter++;
|
||||
#endif
|
||||
TRACE("mam_path_tree",
|
||||
TRACE(mam_path_tree,
|
||||
tout << "processing:\n";
|
||||
t->display(tout, 2););
|
||||
enode_vector * v = t->m_todo;
|
||||
|
@ -3526,7 +3526,7 @@ namespace euf {
|
|||
std::cout << "Avg2. " << static_cast<double>(total_sz2)/static_cast<double>(counter2) << ", Max2. " << max_sz2 << "\n";
|
||||
#endif
|
||||
|
||||
TRACE("mam_path_tree", tout << "processing: #" << curr_child->get_expr_id() << "\n";);
|
||||
TRACE(mam_path_tree, tout << "processing: #" << curr_child->get_expr_id() << "\n";);
|
||||
for (enode* curr_parent : euf::enode_parents(curr_child)) {
|
||||
#ifdef _PROFILE_PATH_TREE
|
||||
if (curr_parent->is_equality())
|
||||
|
@ -3541,8 +3541,8 @@ namespace euf {
|
|||
bool is_flat_assoc = lbl->is_flat_associative();
|
||||
enode * curr_parent_root = curr_parent->get_root();
|
||||
enode * curr_parent_cg = curr_parent->get_cg();
|
||||
TRACE("mam_path_tree", tout << "processing parent:\n" << mk_pp(curr_parent->get_expr(), m) << "\n";);
|
||||
TRACE("mam_path_tree", tout << "parent is marked: " << curr_parent->is_marked1() << "\n";);
|
||||
TRACE(mam_path_tree, tout << "processing parent:\n" << mk_pp(curr_parent->get_expr(), m) << "\n";);
|
||||
TRACE(mam_path_tree, tout << "parent is marked: " << curr_parent->is_marked1() << "\n";);
|
||||
if (filter.may_contain(m_lbl_hasher(lbl)) &&
|
||||
!curr_parent->is_marked1() &&
|
||||
(curr_parent_cg == curr_parent || !is_eq(curr_parent_cg, curr_parent_root)) &&
|
||||
|
@ -3572,7 +3572,7 @@ namespace euf {
|
|||
is_eq(curr_tree->m_ground_arg, curr_parent->get_arg(curr_tree->m_ground_arg_idx))
|
||||
)) {
|
||||
if (curr_tree->m_code) {
|
||||
TRACE("mam_path_tree", tout << "found candidate " << expr_ref(curr_parent->get_expr(), m) << "\n";);
|
||||
TRACE(mam_path_tree, tout << "found candidate " << expr_ref(curr_parent->get_expr(), m) << "\n";);
|
||||
add_candidate(curr_tree->m_code, curr_parent);
|
||||
}
|
||||
if (curr_tree->m_first_child) {
|
||||
|
@ -3621,8 +3621,8 @@ namespace euf {
|
|||
void process_pp(enode * r1, enode * r2) {
|
||||
approx_set & plbls1 = r1->get_plbls();
|
||||
approx_set & plbls2 = r2->get_plbls();
|
||||
TRACE("incremental_matcher", tout << "pp: plbls1: " << plbls1 << ", plbls2: " << plbls2 << "\n";);
|
||||
TRACE("mam_info", tout << "pp: " << plbls1.size() * plbls2.size() << "\n";);
|
||||
TRACE(incremental_matcher, tout << "pp: plbls1: " << plbls1 << ", plbls2: " << plbls2 << "\n";);
|
||||
TRACE(mam_info, tout << "pp: " << plbls1.size() * plbls2.size() << "\n";);
|
||||
if (!plbls1.empty() && !plbls2.empty()) {
|
||||
for (unsigned plbl1 : plbls1) {
|
||||
if (!m.inc()) {
|
||||
|
@ -3682,7 +3682,7 @@ namespace euf {
|
|||
return;
|
||||
ctx.get_trail().push(value_trail<unsigned>(m_new_patterns_qhead));
|
||||
|
||||
TRACE("mam_new_pat", tout << "matching new patterns:\n";);
|
||||
TRACE(mam_new_pat, tout << "matching new patterns:\n";);
|
||||
m_tmp_trees_to_delete.reset();
|
||||
for (; m_new_patterns_qhead < m_new_patterns.size(); ++m_new_patterns_qhead) {
|
||||
if (!m.inc())
|
||||
|
@ -3741,8 +3741,8 @@ namespace euf {
|
|||
|
||||
void add_pattern(quantifier * qa, app * mp) override {
|
||||
SASSERT(m.is_pattern(mp));
|
||||
TRACE("trigger_bug", tout << "adding pattern\n" << mk_ismt2_pp(qa, m) << "\n" << mk_ismt2_pp(mp, m) << "\n";);
|
||||
TRACE("mam_bug", tout << "adding pattern\n" << mk_pp(qa, m) << "\n" << mk_pp(mp, m) << "\n";);
|
||||
TRACE(trigger_bug, tout << "adding pattern\n" << mk_ismt2_pp(qa, m) << "\n" << mk_ismt2_pp(mp, m) << "\n";);
|
||||
TRACE(mam_bug, tout << "adding pattern\n" << mk_pp(qa, m) << "\n" << mk_pp(mp, m) << "\n";);
|
||||
// Z3 checks if a pattern is ground or not before solving.
|
||||
// Ground patterns are discarded.
|
||||
// However, the simplifier may turn a non-ground pattern into a ground one.
|
||||
|
@ -3786,7 +3786,7 @@ namespace euf {
|
|||
}
|
||||
|
||||
void propagate() override {
|
||||
TRACE("trigger_bug", tout << "match\n"; display(tout););
|
||||
TRACE(trigger_bug, tout << "match\n"; display(tout););
|
||||
propagate_to_match();
|
||||
propagate_new_patterns();
|
||||
}
|
||||
|
@ -3805,14 +3805,14 @@ namespace euf {
|
|||
}
|
||||
|
||||
bool check_missing_instances() override {
|
||||
TRACE("missing_instance", tout << "checking for missing instances...\n";);
|
||||
TRACE(missing_instance, tout << "checking for missing instances...\n";);
|
||||
flet<bool> l(m_check_missing_instances, true);
|
||||
rematch(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void on_match(quantifier * qa, app * pat, unsigned num_bindings, enode * const * bindings, unsigned max_generation) override {
|
||||
TRACE("trigger_bug", tout << "found match " << mk_pp(qa, m) << "\n";);
|
||||
TRACE(trigger_bug, tout << "found match " << mk_pp(qa, m) << "\n";);
|
||||
unsigned min_gen = 0, max_gen = 0;
|
||||
m_interpreter.get_min_max_top_generation(min_gen, max_gen);
|
||||
m_ematch.on_binding(qa, pat, bindings, max_generation, min_gen, max_gen);
|
||||
|
@ -3822,23 +3822,23 @@ namespace euf {
|
|||
// If lazy == true, then n is not added to the list of
|
||||
// candidate enodes for matching. That is, the method just updates the lbls.
|
||||
void add_node(enode * n, bool lazy) override {
|
||||
TRACE("trigger_bug", tout << "relevant_eh:\n" << mk_ismt2_pp(n->get_expr(), m) << "\n";
|
||||
TRACE(trigger_bug, tout << "relevant_eh:\n" << mk_ismt2_pp(n->get_expr(), m) << "\n";
|
||||
tout << "mam: " << this << "\n";);
|
||||
TRACE("mam", tout << "relevant_eh: #" << n->get_expr_id() << "\n";);
|
||||
TRACE(mam, tout << "relevant_eh: #" << n->get_expr_id() << "\n";);
|
||||
if (n->has_lbl_hash())
|
||||
update_lbls(n, n->get_lbl_hash());
|
||||
|
||||
if (n->num_args() > 0) {
|
||||
func_decl * lbl = n->get_decl();
|
||||
unsigned h = m_lbl_hasher(lbl);
|
||||
TRACE("trigger_bug", tout << "lbl: " << lbl->get_name() << " is_clbl(lbl): " << is_clbl(lbl)
|
||||
TRACE(trigger_bug, tout << "lbl: " << lbl->get_name() << " is_clbl(lbl): " << is_clbl(lbl)
|
||||
<< ", is_plbl(lbl): " << is_plbl(lbl) << ", h: " << h << "\n";
|
||||
tout << "lbl_id: " << lbl->get_small_id() << "\n";);
|
||||
if (is_clbl(lbl))
|
||||
update_lbls(n, h);
|
||||
if (is_plbl(lbl))
|
||||
update_children_plbls(n, h);
|
||||
TRACE("mam_bug", tout << "adding relevant candidate:\n" << mk_ll_pp(n->get_expr(), m) << "\n";);
|
||||
TRACE(mam_bug, tout << "adding relevant candidate:\n" << mk_ll_pp(n->get_expr(), m) << "\n";);
|
||||
if (!lazy)
|
||||
add_candidate(n);
|
||||
}
|
||||
|
@ -3852,9 +3852,9 @@ namespace euf {
|
|||
flet<enode *> l1(m_other, other);
|
||||
flet<enode *> l2(m_root, root);
|
||||
|
||||
TRACE("mam", tout << "on_merge: #" << other->get_expr_id() << " #" << root->get_expr_id() << "\n";);
|
||||
TRACE("mam_inc_bug_detail", m_egraph.display(tout););
|
||||
TRACE("mam_inc_bug",
|
||||
TRACE(mam, tout << "on_merge: #" << other->get_expr_id() << " #" << root->get_expr_id() << "\n";);
|
||||
TRACE(mam_inc_bug_detail, m_egraph.display(tout););
|
||||
TRACE(mam_inc_bug,
|
||||
tout << "before:\n#" << other->get_expr_id() << " #" << root->get_expr_id() << "\n";
|
||||
tout << "other.lbls: " << other->get_lbls() << "\n";
|
||||
tout << "root.lbls: " << root->get_lbls() << "\n";
|
||||
|
@ -3874,7 +3874,7 @@ namespace euf {
|
|||
ctx.get_trail().push(mam_value_trail<approx_set>(root_plbls));
|
||||
root_lbls |= other_lbls;
|
||||
root_plbls |= other_plbls;
|
||||
TRACE("mam_inc_bug",
|
||||
TRACE(mam_inc_bug,
|
||||
tout << "after:\n";
|
||||
tout << "other.lbls: " << other->get_lbls() << "\n";
|
||||
tout << "root.lbls: " << root->get_lbls() << "\n";
|
||||
|
|
|
@ -26,12 +26,12 @@ namespace euf {
|
|||
}
|
||||
|
||||
void plugin::push_merge(enode* a, enode* b, justification j) {
|
||||
TRACE("euf", tout << "push-merge " << g.bpp(a) << " == " << g.bpp(b) << " " << j << "\n");
|
||||
TRACE(euf, tout << "push-merge " << g.bpp(a) << " == " << g.bpp(b) << " " << j << "\n");
|
||||
g.push_merge(a, b, j);
|
||||
}
|
||||
|
||||
void plugin::push_merge(enode* a, enode* b) {
|
||||
TRACE("plugin", tout << g.bpp(a) << " == " << g.bpp(b) << "\n");
|
||||
TRACE(plugin, tout << g.bpp(a) << " == " << g.bpp(b) << "\n");
|
||||
g.push_merge(a, b, justification::axiom(get_id()));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue