32 if(!ignore_labels && !it->labels.empty())
36 return !it->code().get_bool(ID_explicit);
40 if(it->condition().is_false())
51 return it->condition().is_true() && it->get_target() == next_it;
56 if(it->get_other().is_nil())
59 const irep_idt &statement = it->get_other().get_statement();
61 if(statement==ID_skip)
63 else if(statement==ID_expression)
67 if(expr.
id()==ID_typecast &&
68 expr.
type().
id()==ID_empty &&
106 new_targetst new_targets;
110 for(goto_programt::instructionst::iterator it = begin; it != end;)
115 std::list<irep_idt> labels;
117 while(
is_skip(goto_program, it,
true))
122 it == std::prev(end) ||
123 (std::next(it)->is_end_function() &&
124 (!labels.empty() || !it->labels.empty())))
130 labels.splice(labels.end(), it->labels);
137 it->labels.splice(it->labels.begin(), labels);
139 if(new_target!=old_target)
141 for(; old_target!=new_target; ++old_target)
142 new_targets[old_target]=new_target;
151 if(ins.is_goto() || ins.is_start_thread() || ins.is_catch())
153 for(
auto &target : ins.targets)
155 new_targetst::const_iterator result = new_targets.find(target);
157 if(result!=new_targets.end())
158 target = result->second;
163 while(new_targets.find(begin) != new_targets.end())
168 for(
const auto &new_target : new_targets)
180 if(
is_skip(goto_program, last) && !last->is_target())
204 gf_entry.second.body,
205 gf_entry.second.body.instructions.begin(),
206 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.
A total order over targett and const_targett.