CBMC
symex_assign.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_SYMEX_ASSIGN_H
13 #define CPROVER_GOTO_SYMEX_SYMEX_ASSIGN_H
14 
15 #include <util/expr.h>
16 
17 #include "shadow_memory.h"
18 #include "symex_target.h"
19 
20 class byte_extract_exprt;
21 class expr_skeletont;
22 class goto_symex_statet;
23 class ssa_exprt;
24 struct symex_configt;
25 
28 {
29 public:
31  std::optional<shadow_memoryt> shadow_memory,
34  const namespacet &ns,
38  state(state),
40  ns(ns),
42  target(target)
43  {
44  }
45 
50  void assign_symbol(
51  const ssa_exprt &lhs, // L1
52  const expr_skeletont &full_lhs,
53  const exprt &rhs,
54  const exprt::operandst &guard);
55 
56  void assign_rec(
57  const exprt &lhs,
58  const expr_skeletont &full_lhs,
59  const exprt &rhs,
61 
62 private:
63  std::optional<shadow_memoryt> shadow_memory;
66  const namespacet &ns;
69 
70  void assign_from_struct(
71  const ssa_exprt &lhs, // L1
72  const expr_skeletont &full_lhs,
73  const struct_exprt &rhs,
74  const exprt::operandst &guard);
75 
77  const ssa_exprt &lhs, // L1
78  const expr_skeletont &full_lhs,
79  const exprt &rhs,
80  const exprt::operandst &guard);
81 
84  template <bool use_update>
85  void assign_array(
86  const index_exprt &lhs,
87  const expr_skeletont &full_lhs,
88  const exprt &rhs,
90 
93  template <bool use_update>
95  const member_exprt &lhs,
96  const expr_skeletont &full_lhs,
97  const exprt &rhs,
99 
100  void assign_if(
101  const if_exprt &lhs,
102  const expr_skeletont &full_lhs,
103  const exprt &rhs,
105 
106  void assign_typecast(
107  const typecast_exprt &lhs,
108  const expr_skeletont &full_lhs,
109  const exprt &rhs,
111 
112  void assign_byte_extract(
113  const byte_extract_exprt &lhs,
114  const expr_skeletont &full_lhs,
115  const exprt &rhs,
117 };
118 
119 #endif // CPROVER_GOTO_SYMEX_SYMEX_ASSIGN_H
static exprt guard(const exprt::operandst &guards, exprt cond)
Expression of type type extracted from some object op starting at position offset (given in number of...
Expression in which some part is missing and can be substituted for another expression.
Definition: expr_skeleton.h:26
Base class for all expressions.
Definition: expr.h:56
std::vector< exprt > operandst
Definition: expr.h:58
Central data structure: state.
The trinary if-then-else operator.
Definition: std_expr.h:2380
Array index operator.
Definition: std_expr.h:1470
Extract member of struct or union.
Definition: std_expr.h:2854
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:94
Expression providing an SSA-renamed symbol of expressions.
Definition: ssa_expr.h:17
Struct constructor from list of elements.
Definition: std_expr.h:1877
Functor for symex assignment.
Definition: symex_assign.h:28
void assign_byte_extract(const byte_extract_exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, exprt::operandst &guard)
void assign_if(const if_exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, exprt::operandst &guard)
const symex_configt & symex_config
Definition: symex_assign.h:67
void assign_non_struct_symbol(const ssa_exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, const exprt::operandst &guard)
goto_symex_statet & state
Definition: symex_assign.h:64
void assign_array(const index_exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, exprt::operandst &guard)
symex_targett & target
Definition: symex_assign.h:68
void assign_rec(const exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, exprt::operandst &guard)
void assign_symbol(const ssa_exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, const exprt::operandst &guard)
Record the assignment of value rhs to variable lhs in state and add the equation to target: lhs#{n+1}...
void assign_struct_member(const member_exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, exprt::operandst &guard)
symex_targett::assignment_typet assignment_type
Definition: symex_assign.h:65
const namespacet & ns
Definition: symex_assign.h:66
void assign_from_struct(const ssa_exprt &lhs, const expr_skeletont &full_lhs, const struct_exprt &rhs, const exprt::operandst &guard)
Assign a struct expression to a symbol.
void assign_typecast(const typecast_exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, exprt::operandst &guard)
std::optional< shadow_memoryt > shadow_memory
Definition: symex_assign.h:63
symex_assignt(std::optional< shadow_memoryt > shadow_memory, goto_symex_statet &state, symex_targett::assignment_typet assignment_type, const namespacet &ns, const symex_configt &symex_config, symex_targett &target)
Definition: symex_assign.h:30
The interface of the target container for symbolic execution to record its symbolic steps into.
Definition: symex_target.h:25
Semantic type conversion.
Definition: std_expr.h:2073
Symex Shadow Memory Instrumentation.
Configuration used for a symbolic execution.
Definition: symex_config.h:19
Generate Equation using Symbolic Execution.