Revamp the multop interface to allow some basic optimizations like
not constructing a single-child multop. * src/ltlast/multop.hh (multop::instance(type)): Remove. (multop::instance(type, formula*, formula*)): Return a formula*. (multop::instance(type, vec*)): Make it public and return a formula*. (multop::add_sorted, multop::add): * src/ltlast/multop.cc (multop::instance(type, vec*)): Rewrite. (multop::instance(type)): Delete. (multop::instance(type, formula*, formula*)): Adjust. (multop::add_sorted, multop::add): Remove. * src/ltlvisit/clone.cc (clone_visitor::visit(multop*)) Adjust. * src/ltlvisit/nenoform.cc (negative_normal_form_visitor::::visit(multop*)) Adjust. * src/ltltest/equals.test: Make sure `a & a' and `a' are equals. * wrap/python/tests/ltlsimple.py: Adjust.
This commit is contained in:
parent
317fed597b
commit
de6314ed74
8 changed files with 123 additions and 98 deletions
|
|
@ -47,13 +47,11 @@ namespace spot
|
|||
void
|
||||
clone_visitor::visit(multop* mo)
|
||||
{
|
||||
multop* res = multop::instance(mo->op());
|
||||
multop::vec* res = new multop::vec;
|
||||
unsigned mos = mo->size();
|
||||
for (unsigned i = 0; i < mos; ++i)
|
||||
{
|
||||
multop::add(&res, recurse(mo->nth(i)));
|
||||
}
|
||||
result_ = res;
|
||||
res->push_back(recurse(mo->nth(i)));
|
||||
result_ = multop::instance(mo->op(), res);
|
||||
}
|
||||
|
||||
formula*
|
||||
|
|
|
|||
|
|
@ -143,11 +143,11 @@ namespace spot
|
|||
op = multop::And;
|
||||
break;
|
||||
}
|
||||
multop* res = multop::instance(op);
|
||||
multop::vec* res = new multop::vec;
|
||||
unsigned mos = mo->size();
|
||||
for (unsigned i = 0; i < mos; ++i)
|
||||
multop::add(&res, recurse(mo->nth(i)));
|
||||
result_ = res;
|
||||
res->push_back(recurse(mo->nth(i)));
|
||||
result_ = multop::instance(op, res);
|
||||
}
|
||||
|
||||
formula*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue