Go to the documentation of this file.
46 !directed_graph.empty(),
47 "at least " +
id2string(entry_point) +
" should be reachable");
53 for(std::size_t node_idx = 0; node_idx < directed_graph.size(); ++node_idx)
55 const irep_idt &
id = directed_graph[node_idx].function;
64 for(
const auto &i : it->second.body.instructions)
66 i.apply([&symbols_to_keep](
const exprt &expr) {
72 goto_functionst::function_mapt::iterator f_it;
81 bool fixed_point_reached =
false;
86 std::vector<bool> seen(goto_program.
instructions.size(),
false);
87 while(!fixed_point_reached)
89 fixed_point_reached =
true;
91 std::vector<bool>::iterator seen_it = seen.begin();
94 if(!*seen_it && instruction.is_assign())
103 symbols_to_keep.find(
id) != symbols_to_keep.end())
105 fixed_point_reached =
false;
106 find_symbols(instruction.assign_rhs(), symbols_to_keep);
118 bool changed =
false;
122 entry.second.is_static_lifetime && !entry.second.is_type &&
123 !entry.second.is_macro && entry.second.type.id() != ID_code &&
125 symbols_to_keep.find(entry.first) == symbols_to_keep.end())
130 symbol.
value.
set(ID_C_no_nondet_initialization, 1);
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const symbolt & lookup_ref(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
static bool find_symbols(symbol_kindt, const typet &, std::function< bool(const symbol_exprt &)>, std::unordered_set< irep_idt > &bindings)
void slice_global_inits(goto_modelt &goto_model, message_handlert &message_handler)
Remove initialization of global variables that are not used in any function reachable from the entry ...
Base class for all expressions.
function_mapt function_map
static call_grapht create_from_root_function(const goto_modelt &model, const irep_idt &root, bool collect_callsites)
Thrown when a goto program that's being processed is in an invalid format, for example passing the wr...
void goto_convert(const codet &code, symbol_table_baset &symbol_table, goto_programt &dest, message_handlert &message_handler, const irep_idt &mode)
bool has_prefix(const std::string &s, const std::string &prefix)
symbolt & get_writeable_ref(const irep_idt &name)
Find a symbol in the symbol table for read-write access.
const std::string & id2string(const irep_idt &d)
void set(const irep_idt &name, const irep_idt &value)
const irep_idt & get_identifier() const
#define INITIALIZE_FUNCTION
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
directed_grapht get_directed_graph() const
Returns a grapht representation of this call graph, suitable for use with generic grapht algorithms.
instructionst instructions
The list of instructions in the goto program.
A collection of goto functions.
A call graph (https://en.wikipedia.org/wiki/Call_graph) for a GOTO model or GOTO functions collection...
exprt value
Initial value of symbol.
goto_functionst goto_functions
GOTO functions.
std::unordered_set< irep_idt > find_symbols_sett
source_locationt location
Source code location of definition of symbol.
static optionalt< codet > static_lifetime_init(const irep_idt &identifier, symbol_tablet &symbol_table)
A generic container class for the GOTO intermediate representation of one function.
static irep_idt entry_point()
Get the identifier of the entry point to a goto model.
symbol_tablet symbol_table
Symbol table.
message_handlert * message_handler