mirror of
https://github.com/Z3Prover/z3
synced 2026-04-20 19:03:29 +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
|
|
@ -427,7 +427,7 @@ bool grobner::is_eq_monomial_body(monomial const * m1, monomial const * m2) {
|
|||
\remark This method assumes the monomials are sorted.
|
||||
*/
|
||||
void grobner::merge_monomials(ptr_vector<monomial> & monomials) {
|
||||
TRACE("grobner", tout << "before merging monomials:\n"; display_monomials(tout, monomials.size(), monomials.data()); tout << "\n";);
|
||||
TRACE(grobner, tout << "before merging monomials:\n"; display_monomials(tout, monomials.size(), monomials.data()); tout << "\n";);
|
||||
unsigned j = 0;
|
||||
unsigned sz = monomials.size();
|
||||
if (sz == 0)
|
||||
|
|
@ -459,7 +459,7 @@ void grobner::merge_monomials(ptr_vector<monomial> & monomials) {
|
|||
j++;
|
||||
monomials.shrink(j);
|
||||
del_monomials(to_delete);
|
||||
TRACE("grobner", tout << "after merging monomials:\n"; display_monomials(tout, monomials.size(), monomials.data()); tout << "\n";);
|
||||
TRACE(grobner, tout << "after merging monomials:\n"; display_monomials(tout, monomials.size(), monomials.data()); tout << "\n";);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -538,7 +538,7 @@ bool grobner::is_subset(monomial const * m1, monomial const * m2, ptr_vector<exp
|
|||
if (i1 >= sz1) {
|
||||
for (; i2 < sz2; i2++)
|
||||
rest.push_back(m2->m_vars[i2]);
|
||||
TRACE("grobner",
|
||||
TRACE(grobner,
|
||||
tout << "monomial: "; display_monomial(tout, *m1); tout << " is a subset of ";
|
||||
display_monomial(tout, *m2); tout << "\n";
|
||||
tout << "rest: "; display_vars(tout, rest.size(), rest.data()); tout << "\n";);
|
||||
|
|
@ -563,7 +563,7 @@ bool grobner::is_subset(monomial const * m1, monomial const * m2, ptr_vector<exp
|
|||
}
|
||||
}
|
||||
// is not subset
|
||||
TRACE("grobner", tout << "monomial: "; display_monomial(tout, *m1); tout << " is not a subset of ";
|
||||
TRACE(grobner, tout << "monomial: "; display_monomial(tout, *m1); tout << " is not a subset of ";
|
||||
display_monomial(tout, *m2); tout << "\n";);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -619,7 +619,7 @@ grobner::equation * grobner::copy_equation(equation const * eq) {
|
|||
Return new_equation if source->m_scope_lvl > target->m_scope_lvl, moreover target is freezed, and new_equation contains the result.
|
||||
*/
|
||||
grobner::equation * grobner::simplify(equation const * source, equation * target) {
|
||||
TRACE("grobner", tout << "simplifying: "; display_equation(tout, *target); tout << "using: "; display_equation(tout, *source););
|
||||
TRACE(grobner, tout << "simplifying: "; display_equation(tout, *target); tout << "using: "; display_equation(tout, *source););
|
||||
if (source->get_num_monomials() == 0)
|
||||
return nullptr;
|
||||
if (!m_manager.inc())
|
||||
|
|
@ -673,7 +673,7 @@ grobner::equation * grobner::simplify(equation const * source, equation * target
|
|||
}
|
||||
}
|
||||
while (simplified && m_manager.inc());
|
||||
TRACE("grobner", tout << "result: "; display_equation(tout, *target););
|
||||
TRACE(grobner, tout << "result: "; display_equation(tout, *target););
|
||||
return result ? target : nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -686,7 +686,7 @@ grobner::equation * grobner::simplify(equation const * source, equation * target
|
|||
grobner::equation * grobner::simplify_using_processed(equation * eq) {
|
||||
bool result = false;
|
||||
bool simplified;
|
||||
TRACE("grobner", tout << "simplifying: "; display_equation(tout, *eq); tout << "using already processed equalities\n";);
|
||||
TRACE(grobner, tout << "simplifying: "; display_equation(tout, *eq); tout << "using already processed equalities\n";);
|
||||
do {
|
||||
simplified = false;
|
||||
for (equation const* p : m_processed) {
|
||||
|
|
@ -702,7 +702,7 @@ grobner::equation * grobner::simplify_using_processed(equation * eq) {
|
|||
}
|
||||
}
|
||||
while (simplified);
|
||||
TRACE("grobner", tout << "simplification result: "; display_equation(tout, *eq););
|
||||
TRACE(grobner, tout << "simplification result: "; display_equation(tout, *eq););
|
||||
return result ? eq : nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -739,7 +739,7 @@ grobner::equation * grobner::pick_next() {
|
|||
del_equation(e);
|
||||
if (r)
|
||||
m_to_process.erase(r);
|
||||
TRACE("grobner", tout << "selected equation: "; if (!r) tout << "<null>\n"; else display_equation(tout, *r););
|
||||
TRACE(grobner, tout << "selected equation: "; if (!r) tout << "<null>\n"; else display_equation(tout, *r););
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -819,7 +819,7 @@ void grobner::simplify_to_process(equation * eq) {
|
|||
\brief If m1 = (* c M M1) and m2 = (* d M M2) and M is non empty, then return true and store M1 in rest1 and M2 in rest2.
|
||||
*/
|
||||
bool grobner::unify(monomial const * m1, monomial const * m2, ptr_vector<expr> & rest1, ptr_vector<expr> & rest2) {
|
||||
TRACE("grobner", tout << "unifying: "; display_monomial(tout, *m1); tout << " "; display_monomial(tout, *m2); tout << "\n";);
|
||||
TRACE(grobner, tout << "unifying: "; display_monomial(tout, *m1); tout << " "; display_monomial(tout, *m2); tout << "\n";);
|
||||
bool found_M = false;
|
||||
unsigned i1 = 0;
|
||||
unsigned i2 = 0;
|
||||
|
|
@ -872,7 +872,7 @@ void grobner::superpose(equation * eq1, equation * eq2) {
|
|||
ptr_vector<expr> & rest2 = m_tmp_vars2;
|
||||
rest2.reset();
|
||||
if (unify(eq1->m_monomials[0], eq2->m_monomials[0], rest1, rest2)) {
|
||||
TRACE("grobner", tout << "superposing:\n"; display_equation(tout, *eq1); display_equation(tout, *eq2);
|
||||
TRACE(grobner, tout << "superposing:\n"; display_equation(tout, *eq1); display_equation(tout, *eq2);
|
||||
tout << "rest1: "; display_vars(tout, rest1.size(), rest1.data()); tout << "\n";
|
||||
tout << "rest2: "; display_vars(tout, rest2.size(), rest2.data()); tout << "\n";);
|
||||
ptr_vector<monomial> & new_monomials = m_tmp_monomials;
|
||||
|
|
@ -882,7 +882,7 @@ void grobner::superpose(equation * eq1, equation * eq2) {
|
|||
c.neg();
|
||||
mul_append(1, eq2, c, rest1, new_monomials);
|
||||
simplify(new_monomials);
|
||||
TRACE("grobner", tout << "resulting monomials: "; display_monomials(tout, new_monomials.size(), new_monomials.data()); tout << "\n";);
|
||||
TRACE(grobner, tout << "resulting monomials: "; display_monomials(tout, new_monomials.size(), new_monomials.data()); tout << "\n";);
|
||||
if (new_monomials.empty())
|
||||
return;
|
||||
m_num_new_equations++;
|
||||
|
|
@ -929,7 +929,7 @@ bool grobner::compute_basis_step() {
|
|||
superpose(eq);
|
||||
m_processed.insert(eq);
|
||||
simplify_to_process(eq);
|
||||
TRACE("grobner", tout << "end of iteration:\n"; display(tout););
|
||||
TRACE(grobner, tout << "end of iteration:\n"; display(tout););
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace dd {
|
|||
simplify_exlin() ||
|
||||
false)) {
|
||||
DEBUG_CODE(s.invariant(););
|
||||
TRACE("dd.solver", s.display(tout););
|
||||
TRACE(dd_solver, s.display(tout););
|
||||
}
|
||||
}
|
||||
catch (pdd_manager::mem_out) {
|
||||
|
|
@ -88,7 +88,7 @@ namespace dd {
|
|||
};
|
||||
|
||||
bool simplifier::simplify_linear_step(bool binary) {
|
||||
TRACE("dd.solver", tout << "binary " << binary << "\n";);
|
||||
TRACE(dd_solver, tout << "binary " << binary << "\n";);
|
||||
IF_VERBOSE(3, verbose_stream() << "binary " << binary << "\n");
|
||||
equation_vector linear;
|
||||
for (equation* e : s.m_to_simplify) {
|
||||
|
|
@ -132,7 +132,7 @@ namespace dd {
|
|||
continue;
|
||||
unsigned v = src->poly().var();
|
||||
equation_vector const& uses = use_list[v];
|
||||
TRACE("dd.solver",
|
||||
TRACE(dd_solver,
|
||||
s.display(tout << "uses of: ", *src) << "\n";
|
||||
for (equation* e : uses) s.display(tout, *e) << "\n";);
|
||||
bool changed_leading_term;
|
||||
|
|
@ -184,7 +184,7 @@ namespace dd {
|
|||
since px = ry
|
||||
*/
|
||||
bool simplifier::simplify_cc_step() {
|
||||
TRACE("dd.solver", tout << "cc\n";);
|
||||
TRACE(dd_solver, tout << "cc\n";);
|
||||
IF_VERBOSE(3, verbose_stream() << "cc\n");
|
||||
u_map<equation*> los;
|
||||
bool reduced = false;
|
||||
|
|
@ -215,7 +215,7 @@ namespace dd {
|
|||
\brief remove ax+b from p if x occurs as a leaf in p and a is a constant.
|
||||
*/
|
||||
bool simplifier::simplify_leaf_step() {
|
||||
TRACE("dd.solver", tout << "leaf\n";);
|
||||
TRACE(dd_solver, tout << "leaf\n";);
|
||||
IF_VERBOSE(3, verbose_stream() << "leaf\n");
|
||||
use_list_t use_list = get_use_list();
|
||||
equation_vector leaves;
|
||||
|
|
@ -257,7 +257,7 @@ namespace dd {
|
|||
\brief treat equations as processed if top variable occurs only once.
|
||||
*/
|
||||
bool simplifier::simplify_elim_pure_step() {
|
||||
TRACE("dd.solver", tout << "pure\n";);
|
||||
TRACE(dd_solver, tout << "pure\n";);
|
||||
IF_VERBOSE(3, verbose_stream() << "pure\n");
|
||||
use_list_t use_list = get_use_list();
|
||||
solver::scoped_update sc(s.m_to_simplify);
|
||||
|
|
@ -426,7 +426,7 @@ namespace dd {
|
|||
unsigned modest_num_eqs = std::max(eqs.size(), 500u);
|
||||
unsigned max_xlin_eqs = modest_num_eqs;
|
||||
unsigned max_degree = 5;
|
||||
TRACE("dd.solver", tout << "augment " << nv << "\n";
|
||||
TRACE(dd_solver, tout << "augment " << nv << "\n";
|
||||
for (auto const& o : orbits) tout << o.num_elems() << "\n";);
|
||||
vector<pdd> n_eqs;
|
||||
unsigned start = rand();
|
||||
|
|
@ -475,7 +475,7 @@ namespace dd {
|
|||
end_of_new_eqs:
|
||||
s.m_config.m_random_seed = rand();
|
||||
eqs.append(n_eqs);
|
||||
TRACE("dd.solver", for (pdd const& p : eqs) tout << p << "\n";);
|
||||
TRACE(dd_solver, for (pdd const& p : eqs) tout << p << "\n";);
|
||||
}
|
||||
|
||||
void simplifier::simplify_exlin(vector<uint_set> const& orbits, vector<pdd> const& eqs, vector<pdd>& simp_eqs) {
|
||||
|
|
@ -570,12 +570,12 @@ namespace dd {
|
|||
}
|
||||
}
|
||||
|
||||
TRACE("dd.solver", tout << bm << "\n";);
|
||||
TRACE(dd_solver, tout << bm << "\n";);
|
||||
IF_VERBOSE(10, verbose_stream() << "bit-matrix solving\n");
|
||||
|
||||
bm.solve();
|
||||
|
||||
TRACE("dd.solver", tout << bm << "\n";);
|
||||
TRACE(dd_solver, tout << bm << "\n";);
|
||||
IF_VERBOSE(10, verbose_stream() << "bit-matrix solved\n");
|
||||
|
||||
for (auto const& r : bm) {
|
||||
|
|
@ -603,7 +603,7 @@ namespace dd {
|
|||
}
|
||||
}
|
||||
if (!p.is_zero()) {
|
||||
TRACE("dd.solver", tout << "new linear: " << p << "\n";);
|
||||
TRACE(dd_solver, tout << "new linear: " << p << "\n";);
|
||||
simp_eqs.push_back(p);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,10 +93,10 @@ namespace dd {
|
|||
if (done())
|
||||
return;
|
||||
init_saturate();
|
||||
TRACE("dd.solver", display(tout););
|
||||
TRACE(dd_solver, display(tout););
|
||||
try {
|
||||
while (!done() && step()) {
|
||||
TRACE("dd.solver", display(tout););
|
||||
TRACE(dd_solver, display(tout););
|
||||
DEBUG_CODE(invariant(););
|
||||
IF_VERBOSE(3, display_statistics(verbose_stream()));
|
||||
}
|
||||
|
|
@ -159,7 +159,7 @@ namespace dd {
|
|||
if (eq.poly().is_unary() && eq.poly().hi().val() < 0)
|
||||
eq = -eq.poly();
|
||||
|
||||
TRACE("dd.solver", display(tout << "simplification result: ", eq););
|
||||
TRACE(dd_solver, display(tout << "simplification result: ", eq););
|
||||
}
|
||||
|
||||
void solver::well_formed() {
|
||||
|
|
@ -229,7 +229,7 @@ namespace dd {
|
|||
m_too_complex = true;
|
||||
return false;
|
||||
}
|
||||
TRACE("dd.solver",
|
||||
TRACE(dd_solver,
|
||||
tout << "reduce: " << dst.poly() << "\n";
|
||||
tout << "using: " << t << "\n";
|
||||
tout << "to: " << r << "\n";);
|
||||
|
|
@ -246,7 +246,7 @@ namespace dd {
|
|||
pdd t = src.poly();
|
||||
pdd r = dst.poly().reduce(t);
|
||||
changed_leading_term = dst.state() == processed && m.different_leading_term(r, dst.poly());
|
||||
TRACE("dd.solver",
|
||||
TRACE(dd_solver,
|
||||
tout << "reduce: " << dst.poly() << "\n";
|
||||
tout << "using: " << t << "\n";
|
||||
tout << "to: " << r << "\n";);
|
||||
|
|
@ -261,7 +261,7 @@ namespace dd {
|
|||
let eq1: ab+q=0, and eq2: ac+e=0, then qc - eb = 0
|
||||
*/
|
||||
void solver::superpose(equation const& eq1, equation const& eq2) {
|
||||
TRACE("dd.solver_d", display(tout << "eq1=", eq1); display(tout << "eq2=", eq2););
|
||||
TRACE(dd_solver_d, display(tout << "eq1=", eq1); display(tout << "eq2=", eq2););
|
||||
pdd r(m);
|
||||
if (m.try_spoly(eq1.poly(), eq2.poly(), r) && !r.is_zero()) {
|
||||
if (is_too_complex(r)) {
|
||||
|
|
@ -297,7 +297,7 @@ namespace dd {
|
|||
simplify_using(m_processed, eq);
|
||||
if (done())
|
||||
return false;
|
||||
TRACE("dd.solver", display(tout << "eq = ", eq););
|
||||
TRACE(dd_solver, display(tout << "eq = ", eq););
|
||||
superpose(eq);
|
||||
simplify_using(m_to_simplify, eq);
|
||||
if (done())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue