Speedup mark_concat_ops() and simplify_mark() with a cache.

* src/ltlvisit/mark.hh, src/ltlvisit/mark.cc (mark_concat_ops,
simplify_mark): Rewrite these two functions as methods of
(mark_tools): this new class.
* src/ltlast/binop.cc, src/ltlast/unop.cc: Adjust computation
of not_marked to ignore marked operators that are not at
the top-level.  I.e., something like X(!{a}) is not marked.
* src/tgbaalgos/ltl2tgba_fm.cc (translate_dict::mt): New
instance of mark_tools.
(formula_canonizer::translate) Adjust calls to
mark_concat_ops() and simplify_mark().
This commit is contained in:
Alexandre Duret-Lutz 2011-11-13 19:44:40 +01:00
parent f68f639e68
commit 0f11e5fe0e
5 changed files with 116 additions and 77 deletions

View file

@ -1,5 +1,5 @@
// Copyright (C) 2010 Laboratoire de Recherche et Développement de
// l'Epita (LRDE).
// Copyright (C) 2010, 2011 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -23,18 +23,35 @@
#include "ltlast/formula.hh"
#include "ltlast/visitor.hh"
#include "misc/hash.hh"
namespace spot
{
namespace ltl
{
/// \brief Mark operators UConcat and EConcat.
/// \ingroup ltl_rewriting
///
/// \param f The formula to rewrite.
formula* mark_concat_ops(const formula* f);
class mark_tools
{
public:
/// \brief Mark operators UConcat and EConcat.
/// \ingroup ltl_rewriting
///
/// \param f The formula to rewrite.
formula* mark_concat_ops(const formula* f);
formula* simplify_mark(const formula* f);
mark_tools();
~mark_tools();
private:
typedef Sgi::hash_map<const formula*, const formula*,
ptr_hash<formula> > f2f_map;
f2f_map simpmark_;
f2f_map markops_;
visitor* simpvisitor_;
visitor* markvisitor_;
};
bool simplify_mark(formula*& f);
}
}