CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
letify.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Introduce LET for common subexpressions
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9#ifndef CPROVER_SOLVERS_SMT2_LETIFY_H
10#define CPROVER_SOLVERS_SMT2_LETIFY_H
11
12#include <util/std_expr.h>
13
16{
17public:
18 exprt operator()(const exprt &);
19
20protected:
21 // to produce a fresh ID for each new let
22 std::size_t let_id_count = 0;
23
34
35#if HASH_CODE
36 using seen_expressionst = std::unordered_map<exprt, let_count_idt, irep_hash>;
37#else
39#endif
40
42 const exprt &expr,
44 std::vector<exprt> &let_order);
45
46 static exprt letify(
47 const exprt &expr,
48 const std::vector<exprt> &let_order,
49 const seen_expressionst &map);
50
51 static exprt substitute_let(const exprt &expr, const seen_expressionst &map);
52};
53
54#endif // CPROVER_SOLVERS_SMT2_LETIFY_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
Base class for all expressions.
Definition expr.h:56
Introduce LET for common subexpressions.
Definition letify.h:16
static exprt letify(const exprt &expr, const std::vector< exprt > &let_order, const seen_expressionst &map)
Construct a nested let expression for expressions in let_order that are used more than once.
Definition letify.cpp:53
std::size_t let_id_count
Definition letify.h:22
void collect_bindings(const exprt &expr, seen_expressionst &map, std::vector< exprt > &let_order)
Definition letify.cpp:16
std::unordered_map< exprt, let_count_idt, irep_hash > seen_expressionst
Definition letify.h:36
static exprt substitute_let(const exprt &expr, const seen_expressionst &map)
Definition letify.cpp:89
exprt operator()(const exprt &)
Definition letify.cpp:79
Expression to hold a symbol (variable)
Definition std_expr.h:131
API to expression classes.
let_count_idt(std::size_t _count, const symbol_exprt &_let_symbol)
Definition letify.h:26
symbol_exprt let_symbol
Definition letify.h:32
std::size_t count
Definition letify.h:31