cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
symex_decl.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Symbolic Execution
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
11
12
#include "
goto_symex.h
"
13
14
#include <
util/std_expr.h
>
15
16
#include "
path_storage.h
"
17
18
void
goto_symext::symex_decl
(
statet
&state)
19
{
20
const
goto_programt::instructiont
&instruction=*state.
source
.
pc
;
21
symex_decl
(state, instruction.
decl_symbol
());
22
}
23
24
void
goto_symext::symex_decl
(
statet
&state,
const
symbol_exprt
&expr)
25
{
26
// each declaration introduces a new object, which we record as a fresh L1
27
// index
28
29
// We use "1" as the first level-1 index, which is in line with doing so for
30
// level-2 indices (but it's an arbitrary choice, we have just always been
31
// doing it this way).
32
ssa_exprt
ssa = state.
add_object
(
33
expr,
34
[
this
](
const
irep_idt
&l0_name) {
35
return
path_storage
.get_unique_l1_index(l0_name, 1);
36
},
37
ns
);
38
39
ssa = state.
declare
(std::move(ssa),
ns
);
40
41
// we hide the declaration of auxiliary variables
42
// and if the statement itself is hidden
43
bool
hidden =
ns
.lookup(expr.
get_identifier
()).is_auxiliary ||
44
state.
call_stack
().
top
().
hidden_function
||
45
state.
source
.
pc
->source_location().get_hide();
46
47
target
.decl(
48
state.
guard
.
as_expr
(),
49
ssa,
50
state.
field_sensitivity
.
apply
(
ns
, state, ssa,
false
),
51
state.
source
,
52
hidden ?
symex_targett::assignment_typet::HIDDEN
53
:
symex_targett::assignment_typet::STATE
);
54
55
if
(
path_storage
.dirty(ssa.
get_object_name
()) && state.
atomic_section_id
== 0)
56
target
.shared_write(
57
state.
guard
.
as_expr
(),
58
ssa,
59
state.
atomic_section_id
,
60
state.
source
);
61
62
shadow_memory
.symex_field_local_init(state, ssa);
63
}
call_stackt::top
framet & top()
Definition
call_stack.h:17
field_sensitivityt::apply
exprt apply(const namespacet &ns, goto_symex_statet &state, exprt expr, bool write) const
Turn an expression expr into a field-sensitive SSA expression.
Definition
field_sensitivity.cpp:154
framet::hidden_function
bool hidden_function
Definition
frame.h:40
goto_programt::instructiont
This class represents an instruction in the GOTO intermediate representation.
Definition
goto_program.h:180
goto_programt::instructiont::decl_symbol
const symbol_exprt & decl_symbol() const
Get the declared symbol for DECL.
Definition
goto_program.h:227
goto_statet::guard
guardt guard
Definition
goto_state.h:58
goto_statet::atomic_section_id
unsigned atomic_section_id
Threads.
Definition
goto_state.h:76
goto_symex_statet::declare
ssa_exprt declare(ssa_exprt ssa, const namespacet &ns)
Add invalid (or a failed symbol) to the value_set if ssa is a pointer, ensure that level2 index of sy...
Definition
goto_symex_state.cpp:829
goto_symex_statet::add_object
ssa_exprt add_object(const symbol_exprt &expr, std::function< std::size_t(const irep_idt &)> index_generator, const namespacet &ns)
Instantiate the object expr.
Definition
goto_symex_state.cpp:804
goto_symex_statet::call_stack
call_stackt & call_stack()
Definition
goto_symex_state.h:147
goto_symex_statet::field_sensitivity
field_sensitivityt field_sensitivity
Definition
goto_symex_state.h:122
goto_symex_statet::source
symex_targett::sourcet source
Definition
goto_symex_state.h:62
goto_symext::statet
goto_symex_statet statet
A type abbreviation for goto_symex_statet.
Definition
goto_symex.h:41
goto_symext::symex_decl
virtual void symex_decl(statet &state)
Symbolically execute a DECL instruction.
Definition
symex_decl.cpp:18
goto_symext::path_storage
path_storaget & path_storage
Symbolic execution paths to be resumed later.
Definition
goto_symex.h:808
goto_symext::target
symex_target_equationt & target
The equation that this execution is building up.
Definition
goto_symex.h:264
goto_symext::shadow_memory
shadow_memoryt shadow_memory
Shadow memory instrumentation API.
Definition
goto_symex.h:837
goto_symext::ns
namespacet ns
Initialized just before symbolic execution begins, to point to both outer_symbol_table and the symbol...
Definition
goto_symex.h:256
guard_exprt::as_expr
exprt as_expr() const
Definition
guard_expr.h:46
ssa_exprt
Expression providing an SSA-renamed symbol of expressions.
Definition
ssa_expr.h:17
ssa_exprt::get_object_name
irep_idt get_object_name() const
Definition
ssa_expr.cpp:145
symbol_exprt
Expression to hold a symbol (variable).
Definition
std_expr.h:132
symbol_exprt::get_identifier
const irep_idt & get_identifier() const
Definition
std_expr.h:161
symex_targett::assignment_typet::STATE
@ STATE
Definition
symex_target.h:70
symex_targett::assignment_typet::HIDDEN
@ HIDDEN
Definition
symex_target.h:71
goto_symex.h
Symbolic Execution.
path_storage.h
Storage of symbolic execution paths to resume.
std_expr.h
API to expression classes.
symex_targett::sourcet::pc
goto_programt::const_targett pc
Definition
symex_target.h:42
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
goto-symex
symex_decl.cpp
Generated by
1.17.0