31 instructionst::const_iterator it)
const 64 if(!instruction.
labels.empty())
67 for(
const auto &label : instruction.
labels)
78 switch(instruction.
type)
81 out <<
"NO INSTRUCTION TYPE SET" <<
'\n';
85 if(!instruction.
guard.is_true())
94 for(instructiont::targetst::const_iterator
95 gt_it=instruction.
targets.begin();
96 gt_it!=instruction.
targets.end();
99 if(gt_it!=instruction.
targets.begin())
101 out << (*gt_it)->target_number;
135 out <<
"SKIP" <<
'\n';
139 out <<
"END_FUNCTION" <<
'\n';
143 out <<
"LOCATION" <<
'\n';
151 instruction.
code.find(ID_exception_list).get_sub();
153 for(
const auto &ex : exception_list)
154 out <<
" " << ex.id();
157 if(instruction.
code.operands().size()==1)
158 out <<
": " <<
from_expr(ns, identifier, instruction.
code.op0());
164 if(!instruction.
targets.empty())
166 out <<
"CATCH-PUSH ";
170 instruction.
code.find(ID_exception_list).get_sub();
171 assert(instruction.
targets.size()==exception_list.size());
172 for(instructiont::targetst::const_iterator
173 gt_it=instruction.
targets.begin();
174 gt_it!=instruction.
targets.end();
178 if(gt_it!=instruction.
targets.begin())
180 out << exception_list[i].id() <<
"->" 181 << (*gt_it)->target_number;
191 out <<
"ATOMIC_BEGIN" <<
'\n';
195 out <<
"ATOMIC_END" <<
'\n';
199 out <<
"START THREAD ";
201 if(instruction.
targets.size()==1)
202 out << instruction.
targets.front()->target_number;
208 out <<
"END THREAD" <<
'\n';
212 throw "unknown statement";
225 assert(it->code.get_statement()==ID_decl);
226 assert(it->code.operands().size()==1);
228 decl_identifiers.insert(symbol_expr.get_identifier());
235 if(src.
id()==ID_dereference)
238 dest.push_back(src.
op0());
240 else if(src.
id()==ID_index)
243 dest.push_back(src.
op1());
246 else if(src.
id()==ID_member)
251 else if(src.
id()==ID_if)
254 dest.push_back(src.
op0());
261 const goto_programt::instructiont &instruction)
263 std::list<exprt> dest;
265 switch(instruction.type)
270 dest.push_back(instruction.guard);
292 dest.push_back(assignment.
rhs());
306 const goto_programt::instructiont &instruction)
308 std::list<exprt> dest;
310 switch(instruction.type)
317 dest.push_back(function_call.
lhs());
335 std::list<exprt> &dest)
337 if(src.
id()==ID_symbol)
339 else if(src.
id()==ID_address_of)
343 else if(src.
id()==ID_dereference)
358 const goto_programt::instructiont &instruction)
362 std::list<exprt> dest;
372 std::list<exprt> &dest)
385 const goto_programt::instructiont &instruction)
389 std::list<exprt> dest;
399 const goto_programt::instructiont &i)
406 return "(NO INSTRUCTION TYPE)";
409 if(!i.guard.is_true())
418 for(goto_programt::instructiont::targetst::const_iterator
419 gt_it=i.targets.begin();
420 gt_it!=i.targets.end();
423 if(gt_it!=i.targets.begin())
425 result+=std::to_string((*gt_it)->target_number);
435 return from_expr(ns, i.function, i.code);
444 result+=
from_expr(ns, i.function, i.guard);
457 return "END_FUNCTION";
469 return "ATOMIC_BEGIN";
475 result+=
"START THREAD ";
477 if(i.targets.size()==1)
478 result+=std::to_string(i.targets.front()->target_number);
485 throw "unknown statement";
const exprt & return_value() const
const std::string & id2string(const irep_idt &d)
unsigned target_number
A number to identify branch targets.
std::vector< irept > subt
std::string comment(const rw_set_baset::entryt &entry, bool write)
goto_program_instruction_typet type
What kind of instruction?
#define forall_expr(it, expr)
std::string as_string() const
std::string from_expr(const namespacet &ns, const irep_idt &identifier, const exprt &expr)
This class represents an instruction in the GOTO intermediate representation.
std::string as_string(const class namespacet &ns, const goto_programt::instructiont &i)
std::list< exprt > expressions_read(const goto_programt::instructiont &instruction)
const code_assignt & to_code_assign(const codet &code)
std::set< irep_idt > decl_identifierst
const irep_idt & id() const
API to expression classes.
const code_returnt & to_code_return(const codet &code)
#define forall_operands(it, expr)
void objects_read(const exprt &src, std::list< exprt > &dest)
#define forall_expr_list(it, expr)
void get_decl_identifiers(decl_identifierst &decl_identifiers) const
std::list< exprt > expressions_written(const goto_programt::instructiont &instruction)
unsigned location_number
A globally unique number to identify a program location.
Base class for all expressions.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast a generic exprt to a symbol_exprt.
void parse_lhs_read(const exprt &src, std::list< exprt > &dest)
guardT guard
Guard for gotos, assume, assert.
void objects_written(const exprt &src, std::list< exprt > &dest)
Expression to hold a symbol (variable)
source_locationt source_location
The location of the instruction in the source file.
const irep_idt & get_comment() const
targetst targets
The list of successor instructions.
std::ostream & output_instruction(const class namespacet &ns, const irep_idt &identifier, std::ostream &out, instructionst::const_iterator it) const
See below.
#define forall_goto_program_instructions(it, program)
bool is_target() const
Is this node a branch target?
const code_function_callt & to_code_function_call(const codet &code)