30 if(!ignore_labels && !it->labels.empty())
34 return !it->get_code().get_bool(ID_explicit);
38 if(it->get_condition().is_false())
49 return it->get_condition().is_true() && it->get_target() == next_it;
54 if(it->get_other().is_nil())
57 const irep_idt &statement = it->get_other().get_statement();
59 if(statement==ID_skip)
61 else if(statement==ID_expression)
66 if(expr.
id()==ID_typecast &&
67 expr.
type().
id()==ID_empty &&
100 typedef std::map<goto_programt::targett, goto_programt::targett>
102 new_targetst new_targets;
106 for(goto_programt::instructionst::iterator it = begin; it != end;)
111 std::list<irep_idt> labels;
113 while(
is_skip(goto_program, it,
true))
118 it == std::prev(end) ||
119 (std::next(it)->is_end_function() &&
120 (!labels.empty() || !it->labels.empty())))
126 labels.splice(labels.end(), it->labels);
133 it->labels.splice(it->labels.begin(), labels);
135 if(new_target!=old_target)
137 for(; old_target!=new_target; ++old_target)
138 new_targets[old_target]=new_target;
147 if(ins.is_goto() || ins.is_start_thread() || ins.is_catch())
149 for(
auto &target : ins.targets)
151 new_targetst::const_iterator result = new_targets.find(target);
153 if(result!=new_targets.end())
154 target = result->second;
159 while(new_targets.find(begin) != new_targets.end())
164 for(
const auto &new_target : new_targets)
176 if(
is_skip(goto_program, last) && !last->is_target())
200 gf_entry.second.body,
201 gf_entry.second.body.instructions.begin(),
202 gf_entry.second.body.instructions.end());
codet representation of an expression statement.
const exprt & expression() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
typet & type()
Return the type of the expression.
A collection of goto functions.
function_mapt function_map
goto_functionst goto_functions
GOTO functions.
A generic container class for the GOTO intermediate representation of one function.
instructionst instructions
The list of instructions in the goto program.
void update()
Update all indices.
instructionst::iterator targett
instructionst::const_iterator const_targett
void compute_target_numbers()
Compute the target numbers.
const irep_idt & id() const
void remove_skip(goto_programt &goto_program, goto_programt::targett begin, goto_programt::targett end)
remove unnecessary skip statements
bool is_skip(const goto_programt &body, goto_programt::const_targett it, bool ignore_labels)
Determine whether the instruction is semantically equivalent to a skip (no-op).
code_expressiont & to_code_expression(codet &code)
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
bool is_constant(const typet &type)
This method tests, if the given typet is a constant.