CBMC
renaming_level.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Symbolic Execution
4 
5 Author: Romain Brenguier, romain.brenguier@diffblue.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_GOTO_SYMEX_RENAMING_LEVEL_H
13 #define CPROVER_GOTO_SYMEX_RENAMING_LEVEL_H
14 
15 #include <util/irep.h>
16 #include <util/sharing_map.h>
17 
18 #include "renamed.h"
19 
26 
34 symex_level0(ssa_exprt ssa_expr, const namespacet &ns, std::size_t thread_nr);
35 
40 {
42  void insert(const renamedt<ssa_exprt, L0> &ssa, std::size_t index);
43 
47  std::optional<std::pair<ssa_exprt, std::size_t>>
48  insert_or_replace(const renamedt<ssa_exprt, L0> &ssa, std::size_t index);
49 
51  bool has(const renamedt<ssa_exprt, L0> &ssa) const;
52 
57 
59  void restore_from(const symex_level1t &other);
60 
61 private:
63 };
64 
69 {
71 
75 
77  unsigned latest_index(const irep_idt &identifier) const;
78 
81  std::size_t increase_generation(
82  const irep_idt &l1_identifier,
83  const ssa_exprt &lhs,
84  std::function<std::size_t(const irep_idt &)> fresh_l2_name_provider);
85 };
86 
89 
92 
95 bool check_renaming(const exprt &expr);
96 
99 bool check_renaming_l1(const exprt &expr);
100 
103 bool check_renaming(const typet &type);
104 
105 #endif // CPROVER_GOTO_SYMEX_RENAMING_LEVEL_H
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:38
Base class for all expressions.
Definition: expr.h:56
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:94
Wrapper for expressions or types which have been renamed up to a given level.
Definition: renamed.h:33
Expression providing an SSA-renamed symbol of expressions.
Definition: ssa_expr.h:17
The type of an expression, extends irept.
Definition: type.h:29
Class for expressions or types renamed up to a given level.
exprt get_original_name(exprt expr)
Undo all levels of renaming.
bool check_renaming(const exprt &expr)
Check that expr is correctly renamed to level 2 and return true in case an error is detected.
renamedt< ssa_exprt, L0 > symex_level0(ssa_exprt ssa_expr, const namespacet &ns, std::size_t thread_nr)
Set the level 0 renaming of SSA expressions.
bool check_renaming_l1(const exprt &expr)
Check that expr is correctly renamed to level 1 and return true in case an error is detected.
Sharing map.
Functor to set the level 1 renaming of SSA expressions.
symex_renaming_levelt current_names
std::optional< std::pair< ssa_exprt, std::size_t > > insert_or_replace(const renamedt< ssa_exprt, L0 > &ssa, std::size_t index)
Set the index for ssa to index.
void restore_from(const symex_level1t &other)
Insert the content of other into this renaming.
renamedt< ssa_exprt, L1 > operator()(renamedt< ssa_exprt, L0 > l0_expr) const
bool has(const renamedt< ssa_exprt, L0 > &ssa) const
void insert(const renamedt< ssa_exprt, L0 > &ssa, std::size_t index)
Assume ssa is not already known.
Functor to set the level 2 renaming of SSA expressions.
unsigned latest_index(const irep_idt &identifier) const
Counter corresponding to an identifier.
renamedt< ssa_exprt, L2 > operator()(renamedt< ssa_exprt, L1 > l1_expr) const
Set L2 tag to correspond to the current count of the identifier of l1_expr's.
symex_renaming_levelt current_names
std::size_t increase_generation(const irep_idt &l1_identifier, const ssa_exprt &lhs, std::function< std::size_t(const irep_idt &)> fresh_l2_name_provider)
Allocates a fresh L2 name for the given L1 identifier, and makes it the latest generation on this pat...