36 typedef std::list<irep_idt> symbol_listt;
37 symbol_listt symbol_list;
42 !symbol_pair.second.is_type && !symbol_pair.second.is_macro &&
43 symbol_pair.second.type.id() == ID_code &&
44 (symbol_pair.second.mode == ID_C || symbol_pair.second.mode == ID_cpp ||
45 symbol_pair.second.mode == ID_java ||
46 symbol_pair.second.mode ==
"jsil" ||
47 symbol_pair.second.mode == ID_statement_list))
49 symbol_list.push_back(symbol_pair.first);
53 for(
const auto &
id : symbol_list)
64 if(!symbol_pair.second.is_type &&
65 symbol_pair.second.type.id()==ID_code &&
66 symbol_pair.second.value.is_not_nil())
68 symbol_pair.second.value=
codet();
78 for(
const auto &label : instruction.labels)
90 const typet &return_type,
94 if(!f.body.instructions.empty() &&
95 f.body.instructions.back().is_return())
99 if(!f.body.instructions.empty() &&
100 f.body.instructions.back().is_goto() &&
101 f.body.instructions.back().guard.is_true())
105 if(!f.body.instructions.empty())
113 if(last_instruction->is_goto() && last_instruction->condition().is_true())
119 if(last_instruction->is_set_return_value())
124 last_instruction->is_dead() &&
125 last_instruction != f.body.instructions.begin() &&
126 !last_instruction->is_target())
148 if(f.body_available())
156 f.set_parameter_identifiers(code_type);
164 for(
const auto &p : f.parameter_identifiers)
168 "parameter identifier should not be empty",
174 "parameter identifier must be a known symbol",
214 !f.body.instructions.empty() &&
218 f.body.instructions.front().source_location());
219 f.body.insert_before_swap(f.body.instructions.begin(), a_begin);
224 for(
auto &instruction : f.body.instructions)
226 if(instruction.is_goto() && instruction.get_target()->is_end_function())
227 instruction.set_target(a_end);
232 f.body.destructive_append(tmp_end_function);
251 symbol_table_builder, goto_model.
goto_functions, message_handler);
263 symbol_table_builder, message_handler);
278 symbol_table_builder, message_handler);
lifetimet
Selects the kind of objects allocated.
@ STATIC_GLOBAL
Allocate global objects with static lifetime.
@ AUTOMATIC_LOCAL
Allocate local objects with automatic lifetime.
source_locationt end_location() const
const typet & return_type() const
Data structure for representing an arbitrary statement in a program.
const irep_idt & get_statement() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
goto_convert_functionst(symbol_table_baset &_symbol_table, message_handlert &_message_handler)
void add_return(goto_functionst::goto_functiont &, const typet &return_type, const source_locationt &)
void goto_convert(goto_functionst &functions)
void convert_function(const irep_idt &identifier, goto_functionst::goto_functiont &result)
static bool hide(const goto_programt &)
virtual ~goto_convert_functionst()
symbol_table_baset & symbol_table
void goto_convert_rec(const codet &code, goto_programt &dest, const irep_idt &mode)
std::string tmp_symbol_prefix
struct goto_convertt::targetst targets
A collection of goto functions.
function_mapt function_map
void compute_location_numbers()
::goto_functiont goto_functiont
symbol_tablet symbol_table
Symbol table.
goto_functionst goto_functions
GOTO functions.
This class represents an instruction in the GOTO intermediate representation.
A generic container class for the GOTO intermediate representation of one function.
instructionst instructions
The list of instructions in the goto program.
static instructiont make_set_return_value(exprt return_value, const source_locationt &l=source_locationt::nil())
static instructiont make_end_function(const source_locationt &l=source_locationt::nil())
instructionst::iterator targett
instructionst::const_iterator const_targett
static instructiont make_atomic_end(const source_locationt &l=source_locationt::nil())
static instructiont make_atomic_begin(const source_locationt &l=source_locationt::nil())
targett add(instructiont &&instruction)
Adds a given instruction at the end.
const irep_idt & id() const
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
A side_effect_exprt that returns a non-deterministically chosen value.
The symbol table base class interface.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
bool has_symbol(const irep_idt &name) const
Check whether a symbol exists in the symbol table.
static symbol_table_buildert wrap(symbol_table_baset &base_symbol_table)
bool is_compiled() const
Returns true iff the the symbol's value has been compiled to a goto program.
typet type
Type of symbol.
irep_idt name
The unique identifier.
exprt value
Initial value of symbol.
irep_idt mode
Language mode.
The type of an expression, extends irept.
bool has_prefix(const std::string &s, const std::string &prefix)
void goto_convert(goto_modelt &goto_model, message_handlert &message_handler)
Goto Programs with Functions.
const std::string & id2string(const irep_idt &d)
#define DATA_INVARIANT_WITH_DIAGNOSTICS(CONDITION, REASON,...)
#define INITIALIZE_FUNCTION
const code_blockt & to_code_block(const codet &code)
const codet & to_code(const exprt &expr)
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
void set_return(goto_programt::targett _return_target)