cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
ssa_step.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
9
#ifndef CPROVER_GOTO_SYMEX_SSA_STEP_H
10
#define CPROVER_GOTO_SYMEX_SSA_STEP_H
11
12
#include <
util/ssa_expr.h
>
13
14
#include <
goto-programs/goto_trace.h
>
15
16
#include "
symex_target.h
"
17
46
class
SSA_stept
47
{
48
public
:
49
symex_targett::sourcet
source
;
50
goto_trace_stept::typet
type
;
51
52
bool
is_assert
()
const
53
{
54
return
type
==
goto_trace_stept::typet::ASSERT
;
55
}
56
57
bool
is_assume
()
const
58
{
59
return
type
==
goto_trace_stept::typet::ASSUME
;
60
}
61
62
bool
is_assignment
()
const
63
{
64
return
type
==
goto_trace_stept::typet::ASSIGNMENT
;
65
}
66
67
bool
is_goto
()
const
68
{
69
return
type
==
goto_trace_stept::typet::GOTO
;
70
}
71
72
bool
is_constraint
()
const
73
{
74
return
type
==
goto_trace_stept::typet::CONSTRAINT
;
75
}
76
77
bool
is_location
()
const
78
{
79
return
type
==
goto_trace_stept::typet::LOCATION
;
80
}
81
82
bool
is_output
()
const
83
{
84
return
type
==
goto_trace_stept::typet::OUTPUT
;
85
}
86
87
bool
is_decl
()
const
88
{
89
return
type
==
goto_trace_stept::typet::DECL
;
90
}
91
92
bool
is_function_call
()
const
93
{
94
return
type
==
goto_trace_stept::typet::FUNCTION_CALL
;
95
}
96
97
bool
is_function_return
()
const
98
{
99
return
type
==
goto_trace_stept::typet::FUNCTION_RETURN
;
100
}
101
102
bool
is_shared_read
()
const
103
{
104
return
type
==
goto_trace_stept::typet::SHARED_READ
;
105
}
106
107
bool
is_shared_write
()
const
108
{
109
return
type
==
goto_trace_stept::typet::SHARED_WRITE
;
110
}
111
112
bool
is_spawn
()
const
113
{
114
return
type
==
goto_trace_stept::typet::SPAWN
;
115
}
116
117
bool
is_memory_barrier
()
const
118
{
119
return
type
==
goto_trace_stept::typet::MEMORY_BARRIER
;
120
}
121
122
bool
is_atomic_begin
()
const
123
{
124
return
type
==
goto_trace_stept::typet::ATOMIC_BEGIN
;
125
}
126
127
bool
is_atomic_end
()
const
128
{
129
return
type
==
goto_trace_stept::typet::ATOMIC_END
;
130
}
131
132
// we may choose to hide
133
bool
hidden
=
false
;
134
135
exprt
guard
;
136
exprt
guard_handle
;
137
138
// for ASSIGNMENT and DECL
139
ssa_exprt
ssa_lhs
;
140
exprt
ssa_full_lhs
,
original_full_lhs
;
141
exprt
ssa_rhs
;
142
symex_targett::assignment_typet
assignment_type
;
143
144
// for ASSUME/ASSERT/GOTO/CONSTRAINT
145
exprt
cond_expr
;
146
exprt
cond_handle
;
147
std::string
comment
;
148
// for ASSERT (which includes loop unwinding assertions)
149
irep_idt
property_id
;
150
151
exprt
get_ssa_expr
()
const
152
{
153
return
((
is_shared_read
() ||
is_shared_write
()) ?
ssa_lhs
:
cond_expr
);
154
}
155
156
// for INPUT/OUTPUT
157
irep_idt
format_string
,
io_id
;
158
bool
formatted
=
false
;
159
std::list<exprt>
io_args
;
160
std::list<exprt>
converted_io_args
;
161
162
// for function calls: the function that is called
163
irep_idt
called_function
;
164
165
// for function calls
166
std::vector<exprt>
ssa_function_arguments
,
converted_function_arguments
;
167
168
// for SHARED_READ/SHARED_WRITE and ATOMIC_BEGIN/ATOMIC_END
169
unsigned
atomic_section_id
= 0;
170
171
// for slicing
172
bool
ignore
=
false
;
173
174
// for incremental conversion
175
bool
converted
=
false
;
176
177
SSA_stept
(
178
const
symex_targett::sourcet
&_source,
179
goto_trace_stept::typet
_type)
180
:
source
(_source),
181
type
(_type),
182
hidden
(false),
183
guard
(static_cast<const
exprt
&>(
get_nil_irep
())),
184
guard_handle
(
false_exprt
()),
185
ssa_lhs
(static_cast<const
ssa_exprt
&>(
get_nil_irep
())),
186
ssa_full_lhs
(static_cast<const
exprt
&>(
get_nil_irep
())),
187
original_full_lhs
(static_cast<const
exprt
&>(
get_nil_irep
())),
188
ssa_rhs
(static_cast<const
exprt
&>(
get_nil_irep
())),
189
assignment_type
(
symex_targett
::assignment_typet::STATE),
190
cond_expr
(static_cast<const
exprt
&>(
get_nil_irep
())),
191
cond_handle
(
false_exprt
()),
192
formatted
(false),
193
atomic_section_id
(0),
194
ignore
(false)
195
{
196
}
197
198
void
output
(std::ostream &out)
const
;
199
200
void
validate
(
const
namespacet
&ns,
const
validation_modet
vm)
const
;
201
};
202
203
class
SSA_assignment_stept
:
public
SSA_stept
204
{
205
public
:
206
SSA_assignment_stept
(
207
symex_targett::sourcet
source
,
208
exprt
guard
,
209
ssa_exprt
ssa_lhs
,
210
exprt
ssa_full_lhs
,
211
exprt
original_full_lhs
,
212
exprt
ssa_rhs
,
213
symex_targett::assignment_typet
assignment_type
);
214
};
215
216
#endif
// CPROVER_GOTO_SYMEX_SSA_STEP_H
SSA_assignment_stept::SSA_assignment_stept
SSA_assignment_stept(symex_targett::sourcet source, exprt guard, ssa_exprt ssa_lhs, exprt ssa_full_lhs, exprt original_full_lhs, exprt ssa_rhs, symex_targett::assignment_typet assignment_type)
Definition
ssa_step.cpp:189
SSA_stept::io_id
irep_idt io_id
Definition
ssa_step.h:157
SSA_stept::ignore
bool ignore
Definition
ssa_step.h:172
SSA_stept::called_function
irep_idt called_function
Definition
ssa_step.h:163
SSA_stept::is_assume
bool is_assume() const
Definition
ssa_step.h:57
SSA_stept::guard_handle
exprt guard_handle
Definition
ssa_step.h:136
SSA_stept::validate
void validate(const namespacet &ns, const validation_modet vm) const
Check that the SSA step is well-formed.
Definition
ssa_step.cpp:129
SSA_stept::ssa_function_arguments
std::vector< exprt > ssa_function_arguments
Definition
ssa_step.h:166
SSA_stept::is_location
bool is_location() const
Definition
ssa_step.h:77
SSA_stept::cond_expr
exprt cond_expr
Definition
ssa_step.h:145
SSA_stept::cond_handle
exprt cond_handle
Definition
ssa_step.h:146
SSA_stept::atomic_section_id
unsigned atomic_section_id
Definition
ssa_step.h:169
SSA_stept::format_string
irep_idt format_string
Definition
ssa_step.h:157
SSA_stept::assignment_type
symex_targett::assignment_typet assignment_type
Definition
ssa_step.h:142
SSA_stept::converted_io_args
std::list< exprt > converted_io_args
Definition
ssa_step.h:160
SSA_stept::is_function_return
bool is_function_return() const
Definition
ssa_step.h:97
SSA_stept::formatted
bool formatted
Definition
ssa_step.h:158
SSA_stept::ssa_full_lhs
exprt ssa_full_lhs
Definition
ssa_step.h:140
SSA_stept::is_atomic_end
bool is_atomic_end() const
Definition
ssa_step.h:127
SSA_stept::type
goto_trace_stept::typet type
Definition
ssa_step.h:50
SSA_stept::hidden
bool hidden
Definition
ssa_step.h:133
SSA_stept::is_constraint
bool is_constraint() const
Definition
ssa_step.h:72
SSA_stept::guard
exprt guard
Definition
ssa_step.h:135
SSA_stept::is_shared_write
bool is_shared_write() const
Definition
ssa_step.h:107
SSA_stept::ssa_rhs
exprt ssa_rhs
Definition
ssa_step.h:141
SSA_stept::comment
std::string comment
Definition
ssa_step.h:147
SSA_stept::is_goto
bool is_goto() const
Definition
ssa_step.h:67
SSA_stept::source
symex_targett::sourcet source
Definition
ssa_step.h:49
SSA_stept::is_atomic_begin
bool is_atomic_begin() const
Definition
ssa_step.h:122
SSA_stept::original_full_lhs
exprt original_full_lhs
Definition
ssa_step.h:140
SSA_stept::get_ssa_expr
exprt get_ssa_expr() const
Definition
ssa_step.h:151
SSA_stept::converted
bool converted
Definition
ssa_step.h:175
SSA_stept::is_shared_read
bool is_shared_read() const
Definition
ssa_step.h:102
SSA_stept::is_decl
bool is_decl() const
Definition
ssa_step.h:87
SSA_stept::property_id
irep_idt property_id
Definition
ssa_step.h:149
SSA_stept::io_args
std::list< exprt > io_args
Definition
ssa_step.h:159
SSA_stept::is_output
bool is_output() const
Definition
ssa_step.h:82
SSA_stept::is_function_call
bool is_function_call() const
Definition
ssa_step.h:92
SSA_stept::output
void output(std::ostream &out) const
Definition
ssa_step.cpp:14
SSA_stept::SSA_stept
SSA_stept(const symex_targett::sourcet &_source, goto_trace_stept::typet _type)
Definition
ssa_step.h:177
SSA_stept::is_memory_barrier
bool is_memory_barrier() const
Definition
ssa_step.h:117
SSA_stept::is_assignment
bool is_assignment() const
Definition
ssa_step.h:62
SSA_stept::converted_function_arguments
std::vector< exprt > converted_function_arguments
Definition
ssa_step.h:166
SSA_stept::ssa_lhs
ssa_exprt ssa_lhs
Definition
ssa_step.h:139
SSA_stept::is_spawn
bool is_spawn() const
Definition
ssa_step.h:112
SSA_stept::is_assert
bool is_assert() const
Definition
ssa_step.h:52
exprt
Base class for all expressions.
Definition
expr.h:57
false_exprt
The Boolean constant false.
Definition
std_expr.h:3125
goto_trace_stept::typet
typet
Definition
goto_trace.h:75
goto_trace_stept::typet::SPAWN
@ SPAWN
Definition
goto_trace.h:91
goto_trace_stept::typet::ASSERT
@ ASSERT
Definition
goto_trace.h:79
goto_trace_stept::typet::ATOMIC_END
@ ATOMIC_END
Definition
goto_trace.h:94
goto_trace_stept::typet::GOTO
@ GOTO
Definition
goto_trace.h:80
goto_trace_stept::typet::OUTPUT
@ OUTPUT
Definition
goto_trace.h:83
goto_trace_stept::typet::MEMORY_BARRIER
@ MEMORY_BARRIER
Definition
goto_trace.h:92
goto_trace_stept::typet::SHARED_WRITE
@ SHARED_WRITE
Definition
goto_trace.h:90
goto_trace_stept::typet::SHARED_READ
@ SHARED_READ
Definition
goto_trace.h:89
goto_trace_stept::typet::LOCATION
@ LOCATION
Definition
goto_trace.h:81
goto_trace_stept::typet::DECL
@ DECL
Definition
goto_trace.h:84
goto_trace_stept::typet::ASSIGNMENT
@ ASSIGNMENT
Definition
goto_trace.h:77
goto_trace_stept::typet::FUNCTION_RETURN
@ FUNCTION_RETURN
Definition
goto_trace.h:87
goto_trace_stept::typet::ASSUME
@ ASSUME
Definition
goto_trace.h:78
goto_trace_stept::typet::CONSTRAINT
@ CONSTRAINT
Definition
goto_trace.h:88
goto_trace_stept::typet::ATOMIC_BEGIN
@ ATOMIC_BEGIN
Definition
goto_trace.h:93
goto_trace_stept::typet::FUNCTION_CALL
@ FUNCTION_CALL
Definition
goto_trace.h:86
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition
namespace.h:91
ssa_exprt
Expression providing an SSA-renamed symbol of expressions.
Definition
ssa_expr.h:17
symex_targett
The interface of the target container for symbolic execution to record its symbolic steps into.
Definition
symex_target.h:25
symex_targett::assignment_typet
assignment_typet
Definition
symex_target.h:69
goto_trace.h
Traces of GOTO Programs.
get_nil_irep
const irept & get_nil_irep()
Definition
irep.cpp:19
ssa_expr.h
symex_targett::sourcet
Identifies source in the context of symbolic execution.
Definition
symex_target.h:37
symex_target.h
Generate Equation using Symbolic Execution.
validation_modet
validation_modet
Definition
validation_mode.h:13
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
goto-symex
ssa_step.h
Generated by
1.17.0