ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
simplification_check.h
Go to the documentation of this file.
1#ifndef ESBMC_IREP2_SIMPLIFICATION_CHECK_H
2#define ESBMC_IREP2_SIMPLIFICATION_CHECK_H
3
4#include <functional>
5#include <irep2/irep2_expr.h>
6
33{
36using checkert =
37 std::function<void(const expr2tc &before, const expr2tc &after)>;
38
39void install(checkert checker);
40
42void clear();
43
44namespace detail
45{
46void run(const expr2tc &before, const expr2tc &after);
47}
48
53inline void verify_rewrite(const expr2tc &before, const expr2tc &after)
54{
55#ifdef ENABLE_SIMPLIFIER_EQUIVALENCE_CHECK
56 detail::run(before, after);
57#else
58 (void)before;
59 (void)after;
60#endif
61}
62
66inline void verify_node_rewrite(const expr2t &before, const expr2tc &after)
67{
68#ifdef ENABLE_SIMPLIFIER_EQUIVALENCE_CHECK
69 detail::run(before.clone(), after);
70#else
71 (void)before;
72 (void)after;
73#endif
74}
75
81 const expr2tc &before,
82 const expr2t &node,
83 const expr2tc &after)
84{
85#ifdef ENABLE_SIMPLIFIER_EQUIVALENCE_CHECK
86 detail::run(is_nil_expr(before) ? node.clone() : before, after);
87#else
88 (void)before;
89 (void)node;
90 (void)after;
91#endif
92}
93} // namespace simplification_check
94
95#endif
Base class for all expressions.
Definition irep2.h:725
expr2tc clone() const
Definition irep2_expr.cpp:455
bool is_nil_expr(const expr2tc &exp)
Definition irep2.h:916
irep_container< expr2t > expr2tc
Definition irep2.h:431
Definition simplification_check.h:45
void run(const expr2tc &before, const expr2tc &after)
Definition simplification_check.cpp:25
Debug-mode guard on the expression simplifier (esbmc/esbmc#4625).
Definition simplification_check.h:33
void install(checkert checker)
Definition simplification_check.cpp:15
void clear()
Uninstall, restoring the inert default.
Definition simplification_check.cpp:20
void verify_rewrite(const expr2tc &before, const expr2tc &after)
Consult the installed checker.
Definition simplification_check.h:53
void verify_rewrite_or_node(const expr2tc &before, const expr2t &node, const expr2tc &after)
As above, for a caller that holds the rewritten node in a container only sometimes – a nil before mea...
Definition simplification_check.h:80
void verify_node_rewrite(const expr2t &before, const expr2tc &after)
As above, where the rewritten node exists only as this.
Definition simplification_check.h:66
std::function< void(const expr2tc &before, const expr2tc &after)> checkert
Called for every rewrite the simplifier performs.
Definition simplification_check.h:36