mirror of
https://github.com/Z3Prover/z3
synced 2026-02-14 21:01:49 +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
|
|
@ -249,7 +249,7 @@ class mbproj::impl {
|
|||
sub(fml, val);
|
||||
m_rw(val);
|
||||
if (!m.is_true(val)) {
|
||||
TRACE("qe", tout << mk_pp(fml, m) << " -> " << val << "\n";);
|
||||
TRACE(qe, tout << mk_pp(fml, m) << " -> " << val << "\n";);
|
||||
fmls[j++] = val;
|
||||
}
|
||||
}
|
||||
|
|
@ -295,22 +295,22 @@ class mbproj::impl {
|
|||
bool project_var(model_evaluator& eval, app* var, expr_ref& fml) {
|
||||
expr_ref val = eval(var);
|
||||
|
||||
TRACE("mbqi_project_verbose", tout << "MBQI: var: " << mk_pp(var, m) << "\n" << "fml: " << fml << "\n";);
|
||||
TRACE(mbqi_project_verbose, tout << "MBQI: var: " << mk_pp(var, m) << "\n" << "fml: " << fml << "\n";);
|
||||
expr_ref_vector terms(m);
|
||||
index_term_finder finder(m, var, terms);
|
||||
for_each_expr(finder, fml);
|
||||
|
||||
TRACE("mbqi_project_verbose", tout << "terms:\n" << terms;);
|
||||
TRACE(mbqi_project_verbose, tout << "terms:\n" << terms;);
|
||||
|
||||
for (expr* term : terms) {
|
||||
expr_ref tval = eval(term);
|
||||
|
||||
TRACE("mbqi_project_verbose", tout << "term: " << mk_pp(term, m) << " tval: " << tval << " val: " << val << "\n";);
|
||||
TRACE(mbqi_project_verbose, tout << "term: " << mk_pp(term, m) << " tval: " << tval << " val: " << val << "\n";);
|
||||
|
||||
// -- if the term does not contain an occurrence of var
|
||||
// -- and is in the same equivalence class in the model
|
||||
if (tval == val && !occurs(var, term)) {
|
||||
TRACE("mbqi_project",
|
||||
TRACE(mbqi_project,
|
||||
tout << "MBQI: replacing " << mk_pp(var, m) << " with " << mk_pp(term, m) << "\n";);
|
||||
expr_safe_replace sub(m);
|
||||
sub.insert(var, term);
|
||||
|
|
@ -319,7 +319,7 @@ class mbproj::impl {
|
|||
}
|
||||
}
|
||||
|
||||
TRACE("mbqi_project",
|
||||
TRACE(mbqi_project,
|
||||
tout << "MBQI: failed to eliminate " << mk_pp(var, m) << " from " << fml << "\n";);
|
||||
|
||||
return false;
|
||||
|
|
@ -434,11 +434,11 @@ public:
|
|||
fmls.reset();
|
||||
flatten_and(fml, fmls);
|
||||
m_dont_sub = dsub;
|
||||
TRACE("qe", tout << "spacer-qel " << vars << " " << fml << "\n");
|
||||
TRACE(qe, tout << "spacer-qel " << vars << " " << fml << "\n");
|
||||
}
|
||||
else {
|
||||
mbp(force_elim, vars, model, fmls, defs);
|
||||
TRACE("qe", tout << "mbp " << vars << " " << fmls << "\n";
|
||||
TRACE(qe, tout << "mbp " << vars << " " << fmls << "\n";
|
||||
if (defs) { tout << "defs: "; for (auto const& d : *defs) tout << d << "\n"; tout << "\n";});
|
||||
}
|
||||
}
|
||||
|
|
@ -449,12 +449,12 @@ public:
|
|||
app_ref var(m);
|
||||
expr_ref_vector unused_fmls(m);
|
||||
bool progress = true;
|
||||
TRACE("qe", tout << "eliminate vars: " << vars << "fmls: " << fmls << "\n");
|
||||
TRACE(qe, tout << "eliminate vars: " << vars << "fmls: " << fmls << "\n");
|
||||
if (!defs)
|
||||
preprocess_solve(model, vars, fmls);
|
||||
filter_variables(model, vars, fmls, unused_fmls);
|
||||
project_bools(model, vars, fmls);
|
||||
TRACE("qe", tout << "eliminate vars: " << vars << "\nfmls: " << fmls << "\nunused: " << unused_fmls <<"\n");
|
||||
TRACE(qe, tout << "eliminate vars: " << vars << "\nfmls: " << fmls << "\nunused: " << unused_fmls <<"\n");
|
||||
while (progress && !vars.empty() && !fmls.empty() && m.limit().inc()) {
|
||||
app_ref_vector new_vars(m);
|
||||
progress = false;
|
||||
|
|
@ -463,12 +463,12 @@ public:
|
|||
unsigned sz = defs->size();
|
||||
p->project(model, vars, fmls, *defs);
|
||||
progress |= sz < defs->size();
|
||||
TRACE("qe", tout << "after project " << m.get_family_name(p->get_family_id()) << ": " << vars << "\n");
|
||||
TRACE(qe, tout << "after project " << m.get_family_name(p->get_family_id()) << ": " << vars << "\n");
|
||||
}
|
||||
else if (p)
|
||||
(*p)(model, vars, fmls);
|
||||
}
|
||||
TRACE("qe", tout << "projecting " << vars << "\n");
|
||||
TRACE(qe, tout << "projecting " << vars << "\n");
|
||||
while (!vars.empty() && !fmls.empty() && !defs && m.limit().inc()) {
|
||||
var = vars.back();
|
||||
vars.pop_back();
|
||||
|
|
@ -503,7 +503,7 @@ public:
|
|||
vars.append(new_vars);
|
||||
if (progress && !defs)
|
||||
preprocess_solve(model, vars, fmls);
|
||||
TRACE("qe", tout << "looping " << vars << "\n");
|
||||
TRACE(qe, tout << "looping " << vars << "\n");
|
||||
|
||||
}
|
||||
if (fmls.empty()) {
|
||||
|
|
@ -511,14 +511,14 @@ public:
|
|||
}
|
||||
fmls.append(unused_fmls);
|
||||
SASSERT(validate_model(model, fmls));
|
||||
TRACE("qe", tout << "vars: " << vars << "\nfmls: " << fmls << "\n";);
|
||||
TRACE(qe, tout << "vars: " << vars << "\nfmls: " << fmls << "\n";);
|
||||
}
|
||||
|
||||
void do_qe_lite(app_ref_vector& vars, expr_ref& fml) {
|
||||
qe_lite qe(m, m_params, false);
|
||||
qe(vars, fml);
|
||||
m_rw(fml);
|
||||
TRACE("qe", tout << "After qe_lite:\n" << fml << "\n" << "Vars: " << vars << "\n";);
|
||||
TRACE(qe, tout << "After qe_lite:\n" << fml << "\n" << "Vars: " << vars << "\n";);
|
||||
SASSERT(!m.is_false(fml));
|
||||
}
|
||||
|
||||
|
|
@ -527,7 +527,7 @@ public:
|
|||
qel qe(m, m_params);
|
||||
qe(vars, fml);
|
||||
m_rw(fml);
|
||||
TRACE("qe", tout << "After qel:\n"
|
||||
TRACE(qe, tout << "After qel:\n"
|
||||
<< fml << "\n"
|
||||
<< "Vars: " << vars << "\n";);
|
||||
SASSERT(!m.is_false(fml));
|
||||
|
|
@ -546,13 +546,13 @@ public:
|
|||
mbptg(vars, fml, mdl);
|
||||
if (reduce_all_selects) rewrite_read_over_write(fml, mdl, fml);
|
||||
m_rw(fml);
|
||||
TRACE("qe", tout << "After mbp_tg:\n"
|
||||
TRACE(qe, tout << "After mbp_tg:\n"
|
||||
<< fml << " models " << mdl.is_true(fml) << "\n"
|
||||
<< "Vars: " << vars << "\n";);
|
||||
}
|
||||
|
||||
void spacer_qel(app_ref_vector& vars, model& mdl, expr_ref& fml) {
|
||||
TRACE("qe", tout << "Before projection:\n" << fml << "\n" << "Vars: " << vars << "\n";);
|
||||
TRACE(qe, tout << "Before projection:\n" << fml << "\n" << "Vars: " << vars << "\n";);
|
||||
|
||||
model_evaluator eval(mdl, m_params);
|
||||
eval.set_model_completion(true);
|
||||
|
|
@ -575,7 +575,7 @@ public:
|
|||
|
||||
// project reals, ints and other variables.
|
||||
if (!other_vars.empty()) {
|
||||
TRACE("qe", tout << "Other vars: " << other_vars << "\n" << mdl;);
|
||||
TRACE(qe, tout << "Other vars: " << other_vars << "\n" << mdl;);
|
||||
|
||||
expr_ref_vector fmls(m);
|
||||
flatten_and(fml, fmls);
|
||||
|
|
@ -584,7 +584,7 @@ public:
|
|||
fml = mk_and(fmls);
|
||||
m_rw(fml);
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "Projected other vars:\n" << fml << "\n";
|
||||
tout << "Remaining other vars:\n" << other_vars << "\n";);
|
||||
SASSERT(!m.is_false(fml));
|
||||
|
|
@ -598,7 +598,7 @@ public:
|
|||
// substitute any remaining other vars
|
||||
if (!m_dont_sub && !other_vars.empty()) {
|
||||
subst_vars(eval, other_vars, fml);
|
||||
TRACE("qe", tout << "After substituting remaining other vars:\n" << fml << "\n";);
|
||||
TRACE(qe, tout << "After substituting remaining other vars:\n" << fml << "\n";);
|
||||
// an extra round of simplification because subst_vars is not simplifying
|
||||
m_rw(fml);
|
||||
other_vars.reset();
|
||||
|
|
@ -611,7 +611,7 @@ public:
|
|||
}
|
||||
|
||||
void spacer(app_ref_vector& vars, model& mdl, expr_ref& fml) {
|
||||
TRACE("qe", tout << "spacer " << m_use_qel << " " << fml << " " << vars << "\n");
|
||||
TRACE(qe, tout << "spacer " << m_use_qel << " " << fml << " " << vars << "\n");
|
||||
if (m_use_qel)
|
||||
spacer_qel(vars, mdl, fml);
|
||||
else
|
||||
|
|
@ -619,7 +619,7 @@ public:
|
|||
}
|
||||
|
||||
void spacer_qe_lite(app_ref_vector& vars, model& mdl, expr_ref& fml) {
|
||||
TRACE("qe", tout << "Before projection:\n" << fml << "\n" << "Vars: " << vars << "\n";);
|
||||
TRACE(qe, tout << "Before projection:\n" << fml << "\n" << "Vars: " << vars << "\n";);
|
||||
|
||||
model_evaluator eval(mdl, m_params);
|
||||
eval.set_model_completion(true);
|
||||
|
|
@ -646,7 +646,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
TRACE("qe", tout << "Array vars: " << array_vars << "\n";);
|
||||
TRACE(qe, tout << "Array vars: " << array_vars << "\n";);
|
||||
|
||||
vars.reset();
|
||||
|
||||
|
|
@ -657,14 +657,14 @@ public:
|
|||
m_rw(fml);
|
||||
SASSERT(!m.is_false(fml));
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "extended model:\n" << mdl;
|
||||
tout << "Vars: " << vars << "\n";);
|
||||
}
|
||||
|
||||
// project reals, ints and other variables.
|
||||
if (!other_vars.empty()) {
|
||||
TRACE("qe", tout << "Other vars: " << other_vars << "\n" << mdl;);
|
||||
TRACE(qe, tout << "Other vars: " << other_vars << "\n" << mdl;);
|
||||
|
||||
expr_ref_vector fmls(m);
|
||||
flatten_and(fml, fmls);
|
||||
|
|
@ -673,7 +673,7 @@ public:
|
|||
fml = mk_and(fmls);
|
||||
m_rw(fml);
|
||||
|
||||
TRACE("qe",
|
||||
TRACE(qe,
|
||||
tout << "Projected other vars:\n" << fml << "\n";
|
||||
tout << "Remaining other vars:\n" << other_vars << "\n";);
|
||||
SASSERT(!m.is_false(fml));
|
||||
|
|
@ -687,7 +687,7 @@ public:
|
|||
// substitute any remaining other vars
|
||||
if (!m_dont_sub && !other_vars.empty()) {
|
||||
subst_vars(eval, other_vars, fml);
|
||||
TRACE("qe", tout << "After substituting remaining other vars:\n" << fml << "\n";);
|
||||
TRACE(qe, tout << "After substituting remaining other vars:\n" << fml << "\n";);
|
||||
// an extra round of simplification because subst_vars is not simplifying
|
||||
m_rw(fml);
|
||||
other_vars.reset();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue