Go to the documentation of this file.
30 const exprt &src_original,
33 if(src_ssa.
id()!=src_original.
id())
47 tmp.
index()=index_value;
53 return std::move(tmp);
58 else if(
id==ID_member)
90 return std::move(tmp2);
92 else if(
id==ID_typecast)
100 return std::move(tmp);
102 else if(
id==ID_byte_extract_little_endian ||
103 id==ID_byte_extract_big_endian)
122 if(expr.
id()==ID_symbol)
124 const auto &type = expr.
type();
125 if(type.id() != ID_code && type.id() != ID_mathematical_function)
129 if(!ns.
lookup(
id, symbol))
158 if(SSA_step.
source.
pc->source_location.as_string().empty())
175 if(SSA_step.
source.
pc->code.get_statement()!=ID_function_call)
185 if(type.
id() == ID_array)
215 typedef symex_target_equationt::SSA_stepst::const_iterator ssa_step_iteratort;
216 typedef std::map<mp_integer, std::vector<ssa_step_iteratort>> time_mapt;
221 ssa_step_iteratort last_step_to_keep = target.
SSA_steps.end();
222 bool last_step_was_kept =
false;
227 for(ssa_step_iteratort it = target.
SSA_steps.begin();
232 last_step_to_keep == target.
SSA_steps.end() &&
233 is_last_step_to_keep(it, decision_procedure))
235 last_step_to_keep = it;
243 if(it->is_constraint() ||
246 else if(it->is_atomic_begin())
255 else if(it->is_shared_read() || it->is_shared_write() ||
260 if(it->is_shared_read() || it->is_shared_write())
265 exprt clock_value = decision_procedure.
get(
268 const auto cv = numeric_cast<mp_integer>(clock_value);
274 else if(it->is_atomic_end() && current_time<0)
277 INVARIANT(current_time >= 0,
"time keeping inconsistency");
282 time_mapt::const_iterator time_before_steps_it =
283 time_map.find(time_before);
285 if(time_before_steps_it != time_map.end())
287 std::vector<ssa_step_iteratort> ¤t_time_steps =
288 time_map[current_time];
290 current_time_steps.insert(
291 current_time_steps.end(),
292 time_before_steps_it->second.begin(),
293 time_before_steps_it->second.end());
295 time_map.erase(time_before_steps_it);
303 if(it->is_assignment() &&
312 if(it == last_step_to_keep)
314 last_step_was_kept =
true;
317 time_map[current_time].push_back(it);
321 last_step_to_keep == target.
SSA_steps.end() || last_step_was_kept,
322 "last step in SSA trace to keep must not be filtered out as a sync "
323 "instruction, not-taken branch, PHI node, or similar");
328 unsigned step_nr = 0;
330 for(
const auto &time_and_ssa_steps : time_map)
332 for(
const auto &ssa_step_it : time_and_ssa_steps.second)
334 const auto &SSA_step = *ssa_step_it;
338 goto_trace_step.
step_nr = ++step_nr;
340 goto_trace_step.
thread_nr = SSA_step.source.thread_nr;
341 goto_trace_step.
pc = SSA_step.source.pc;
342 goto_trace_step.
function_id = SSA_step.source.function_id;
343 if(SSA_step.is_assert())
345 goto_trace_step.
comment = SSA_step.comment;
346 goto_trace_step.
property_id = SSA_step.get_property_id();
348 goto_trace_step.
type = SSA_step.type;
349 goto_trace_step.
hidden = SSA_step.hidden;
351 goto_trace_step.
io_id = SSA_step.io_id;
352 goto_trace_step.
formatted = SSA_step.formatted;
357 arg = decision_procedure.
get(arg);
363 (SSA_step.is_assignment() &&
364 (SSA_step.assignment_type ==
366 SSA_step.assignment_type ==
371 if(SSA_step.original_full_lhs.is_not_nil())
377 SSA_step.original_full_lhs,
378 SSA_step.ssa_full_lhs),
383 if(SSA_step.ssa_full_lhs.is_not_nil())
386 decision_procedure.
get(SSA_step.ssa_full_lhs);
392 for(
const auto &j : SSA_step.converted_io_args)
394 if(j.is_constant() || j.id() == ID_string_constant)
396 goto_trace_step.
io_args.push_back(j);
400 exprt tmp = decision_procedure.
get(j);
401 goto_trace_step.
io_args.push_back(tmp);
405 if(SSA_step.is_assert() || SSA_step.is_assume() || SSA_step.is_goto())
407 goto_trace_step.
cond_expr = SSA_step.cond_expr;
410 decision_procedure.
get(SSA_step.cond_handle).
is_true();
413 if(ssa_step_it == last_step_to_keep)
421 symex_target_equationt::SSA_stepst::const_iterator last_step_to_keep,
426 const auto is_last_step_to_keep =
428 symex_target_equationt::SSA_stepst::const_iterator it,
432 target, is_last_step_to_keep, decision_procedure, ns, goto_trace);
436 symex_target_equationt::SSA_stepst::const_iterator step,
439 return step->is_assert() &&
440 decision_procedure.
get(step->cond_handle).
is_false();
virtual exprt get(const exprt &expr) const =0
Return expr with variables replaced by values from satisfying assignment if available.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
static void update_internal_field(const SSA_stept &SSA_step, goto_trace_stept &goto_trace_step, const namespacet &ns)
set internal for variables assignments related to dynamic_object and CPROVER internal functions (e....
const typet & subtype() const
const irep_idt get_original_name() const
void build_goto_trace(const symex_target_equationt &target, ssa_step_predicatet is_last_step_to_keep, const decision_proceduret &decision_procedure, const namespacet &ns, goto_tracet &goto_trace)
Build a trace by going through the steps of target and stopping after the step matching a given condi...
std::function< bool(symex_target_equationt::SSA_stepst::const_iterator, const decision_proceduret &)> ssa_step_predicatet
The type of an expression, extends irept.
Single SSA step in the equation.
goto_programt::const_targett pc
const byte_extract_exprt & to_byte_extract_expr(const exprt &expr)
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
typet type
Type of symbol.
The trinary if-then-else operator.
static symbol_exprt typeless(const irep_idt &id)
Generate a symbol_exprt without a proper type.
symex_targett::assignment_typet assignment_type
Base class for all expressions.
static bool is_failed_assertion_step(symex_target_equationt::SSA_stepst::const_iterator step, const decision_proceduret &decision_procedure)
static void set_internal_dynamic_object(const exprt &expr, goto_trace_stept &goto_trace_step, const namespacet &ns)
set internal field for variable assignment related to dynamic_object[0-9] and dynamic_[0-9]_array.
bool is_true() const
Return whether the expression is a constant representing true.
Step of the trace of a GOTO program.
symex_targett::sourcet source
static irep_idt rw_clock_id(event_it e, axiomt axiom=AX_PROPAGATION)
Build identifier for the read/write clock variable.
Decision Procedure Interface.
static void replace_nondet_in_type(typet &type, const decision_proceduret &solver)
Replace nondet values that appear in type by their values as found by solver.
bool is_false() const
Return whether the expression is a constant representing false.
@ VISIBLE_ACTUAL_PARAMETER
const exprt & size() const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
typet & type()
Return the type of the expression.
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
bool get_bool(const irep_namet &name) const
Expression classes for byte-level operators.
const ssa_exprt & to_ssa_expr(const exprt &expr)
Cast a generic exprt to an ssa_exprt.
@ HIDDEN_ACTUAL_PARAMETER
#define forall_operands(it, expr)
const exprt & struct_op() const
std::size_t step_nr
Number of the step in the trace.
std::vector< exprt > function_arguments
goto_programt::const_targett pc
bool simplify(exprt &expr, const namespacet &ns)
exprt simplify_expr(exprt src, const namespacet &ns)
const irep_idt & id() const
Inheriting the interface of symex_targett this class represents the SSA form of the input program as ...
Extract member of struct or union.
static exprt build_full_lhs_rec(const decision_proceduret &decision_procedure, const namespacet &ns, const exprt &src_original, const exprt &src_ssa)
assignment_typet assignment_type
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
int solver(std::istream &in)
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
Goto Programs with Functions.
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
static irep_idt entry_point()
Get the identifier of the entry point to a goto model.
Semantic type conversion.
Add constraints to equation encoding partial orders on events.
bool is_function_call() const