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 "symex_target.h"
16 #include <util/expr.h>
17 
18 class byte_extract_exprt;
19 class expr_skeletont;
20 class goto_symex_statet;
21 class ssa_exprt;
22 struct symex_configt;
23 
26 {
27 public:
31  const namespacet &ns,
34  : state(state),
36  ns(ns),
38  target(target)
39  {
40  }
41 
46  void assign_symbol(
47  const ssa_exprt &lhs, // L1
48  const expr_skeletont &full_lhs,
49  const exprt &rhs,
50  const exprt::operandst &guard);
51 
52  void assign_rec(
53  const exprt &lhs,
54  const expr_skeletont &full_lhs,
55  const exprt &rhs,
56  exprt::operandst &guard);
57 
58 private:
61  const namespacet &ns;
64 
65  void assign_from_struct(
66  const ssa_exprt &lhs, // L1
67  const expr_skeletont &full_lhs,
68  const struct_exprt &rhs,
69  const exprt::operandst &guard);
70 
72  const ssa_exprt &lhs, // L1
73  const expr_skeletont &full_lhs,
74  const exprt &rhs,
75  const exprt::operandst &guard);
76 
79  template <bool use_update>
80  void assign_array(
81  const index_exprt &lhs,
82  const expr_skeletont &full_lhs,
83  const exprt &rhs,
84  exprt::operandst &guard);
85 
88  template <bool use_update>
90  const member_exprt &lhs,
91  const expr_skeletont &full_lhs,
92  const exprt &rhs,
93  exprt::operandst &guard);
94 
95  void assign_if(
96  const if_exprt &lhs,
97  const expr_skeletont &full_lhs,
98  const exprt &rhs,
99  exprt::operandst &guard);
100 
101  void assign_typecast(
102  const typecast_exprt &lhs,
103  const expr_skeletont &full_lhs,
104  const exprt &rhs,
105  exprt::operandst &guard);
106 
107  void assign_byte_extract(
108  const byte_extract_exprt &lhs,
109  const expr_skeletont &full_lhs,
110  const exprt &rhs,
111  exprt::operandst &guard);
112 };
113 
114 #endif // CPROVER_GOTO_SYMEX_SYMEX_ASSIGN_H
symex_targett::assignment_typet
assignment_typet
Definition: symex_target.h:68
symex_configt
Configuration used for a symbolic execution.
Definition: symex_config.h:16
goto_symex_statet
Central data structure: state.
Definition: goto_symex_state.h:41
symex_assignt::assign_from_struct
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.
Definition: symex_assign.cpp:128
symex_assignt::assign_struct_member
void assign_struct_member(const member_exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, exprt::operandst &guard)
Definition: symex_assign.cpp:290
if_exprt
The trinary if-then-else operator.
Definition: std_expr.h:2322
exprt
Base class for all expressions.
Definition: expr.h:55
symex_assignt
Functor for symex assignment.
Definition: symex_assign.h:25
symex_assignt::assign_byte_extract
void assign_byte_extract(const byte_extract_exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, exprt::operandst &guard)
Definition: symex_assign.cpp:369
expr.h
struct_exprt
Struct constructor from list of elements.
Definition: std_expr.h:1818
ssa_exprt
Expression providing an SSA-renamed symbol of expressions.
Definition: ssa_expr.h:16
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:90
symex_assignt::assign_typecast
void assign_typecast(const typecast_exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, exprt::operandst &guard)
Definition: symex_assign.cpp:239
symex_assignt::assign_if
void assign_if(const if_exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, exprt::operandst &guard)
Definition: symex_assign.cpp:352
symex_assignt::assign_array
void assign_array(const index_exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, exprt::operandst &guard)
Definition: symex_assign.cpp:253
symex_assignt::symex_assignt
symex_assignt(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:28
symex_assignt::assignment_type
symex_targett::assignment_typet assignment_type
Definition: symex_assign.h:60
exprt::operandst
std::vector< exprt > operandst
Definition: expr.h:58
symex_assignt::assign_rec
void assign_rec(const exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, exprt::operandst &guard)
Definition: symex_assign.cpp:36
symex_assignt::assign_non_struct_symbol
void assign_non_struct_symbol(const ssa_exprt &lhs, const expr_skeletont &full_lhs, const exprt &rhs, const exprt::operandst &guard)
Definition: symex_assign.cpp:150
symex_assignt::ns
const namespacet & ns
Definition: symex_assign.h:61
member_exprt
Extract member of struct or union.
Definition: std_expr.h:2793
symex_assignt::symex_config
const symex_configt & symex_config
Definition: symex_assign.h:62
symex_assignt::target
symex_targett & target
Definition: symex_assign.h:63
byte_extract_exprt
Expression of type type extracted from some object op starting at position offset (given in number of...
Definition: byte_operators.h:28
symex_assignt::state
goto_symex_statet & state
Definition: symex_assign.h:59
index_exprt
Array index operator.
Definition: std_expr.h:1409
typecast_exprt
Semantic type conversion.
Definition: std_expr.h:2016
symex_target.h
symex_targett
The interface of the target container for symbolic execution to record its symbolic steps into.
Definition: symex_target.h:24
expr_skeletont
Expression in which some part is missing and can be substituted for another expression.
Definition: expr_skeleton.h:25
symex_assignt::assign_symbol
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}...
Definition: symex_assign.cpp:226