21 const cfgt::nodet &node,
27 dep_graph[dep_graph[node.PC].get_node_id()];
29 for(dependence_grapht::edgest::const_iterator
33 add_to_queue(queue, dep_node_to_cfg[it->first], node.PC);
37 const cfgt::nodet &node,
41 goto_functionst::function_mapt::const_iterator f_it=
45 assert(!f_it->second.body.instructions.empty());
47 f_it->second.body.instructions.begin();
49 cfgt::entry_mapt::const_iterator entry=
53 for(cfgt::edgest::const_iterator
54 it=
cfg[entry->second].
in.begin();
55 it!=
cfg[entry->second].
in.end();
61 const cfgt::nodet &node,
72 for(find_symbols_sett::const_iterator
77 decl_deadt::iterator entry=decl_dead.find(*it);
78 if(entry==decl_dead.end())
81 while(!entry->second.empty())
87 decl_dead.erase(entry);
121 jumpst::iterator next=it;
136 for( ; !lex_succ->is_end_function(); ++lex_succ)
138 cfgt::entry_mapt::const_iterator entry=
142 if(
cfg[entry->second].node_required)
145 if(lex_succ->is_end_function())
154 cfg_post_dominatorst::cfgt::entry_mapt::const_iterator e=
163 if(n.dominators.find(lex_succ)==n.dominators.end())
173 std::size_t post_dom_size=0;
174 for(cfg_dominatorst::target_sett::const_iterator
175 d_it=n.dominators.begin();
176 d_it!=n.dominators.end();
179 cfgt::entry_mapt::const_iterator entry=
183 if(
cfg[entry->second].node_required)
185 const irep_idt id2=(*d_it)->function;
187 "goto/jump expected to be within a single function");
189 cfg_post_dominatorst::cfgt::entry_mapt::const_iterator e2=
197 if(n2.dominators.size()>post_dom_size)
200 post_dom_size=n2.dominators.
size();
204 if(nearest!=lex_succ)
222 std::vector<cfgt::entryt> dep_node_to_cfg;
223 dep_node_to_cfg.reserve(dep_graph.
size());
226 cfgt::entry_mapt::const_iterator entry=
230 dep_node_to_cfg.push_back(entry->second);
234 while(!queue.empty())
236 while(!queue.empty())
243 if(node.node_required)
247 node.node_required=
true;
268 const irep_idt &statement=target->code.get_statement();
269 if(statement==ID_array_copy)
272 if(!target->is_assign())
276 if(a.
lhs().
id()!=ID_symbol)
299 for(cfgt::entry_mapt::iterator
304 if(criterion(e_it->first))
308 else if((e_it->first->is_goto() && e_it->first->guard.is_true()) ||
309 e_it->first->is_throw())
310 jumps.push_back(e_it->second);
311 else if(e_it->first->is_decl())
314 decl_dead[s.get_identifier()].push(e_it->second);
316 else if(e_it->first->is_dead())
319 decl_dead[s.get_identifier()].push(e_it->second);
325 dep_graph(goto_functions, ns);
328 fixedpoint(goto_functions, queue, jumps, decl_dead, dep_graph);
334 if(f_it->second.body_available())
339 if(!i_it->is_end_function() &&
340 !
cfg[e].node_required)
342 #ifdef DEBUG_FULL_SLICERT 347 for(std::set<unsigned>::const_iterator
348 req_it=
cfg[e].required_by.begin();
349 req_it!=
cfg[e].required_by.end();
352 if(req_it!=
cfg[e].required_by.begin())
356 i_it->source_location.set_column(c);
357 i_it->source_location.set_comment(c);
393 const std::list<std::string> &properties)
401 const std::list<std::string> &properties)
const code_declt & to_code_decl(const codet &code)
void add_dependencies(const cfgt::nodet &node, queuet &queue, const dependence_grapht &dep_graph, const dep_node_to_cfgt &dep_node_to_cfg)
const code_deadt & to_code_dead(const codet &code)
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
virtual ~slicing_criteriont()
const irep_idt & get_identifier() const
std::unordered_map< irep_idt, queuet > decl_deadt
static bool implicit(goto_programt::const_targett target)
function_mapt function_map
symbol_tablet symbol_table
Symbol table.
const code_assignt & to_code_assign(const codet &code)
const irep_idt & id() const
std::stack< cfgt::entryt > queuet
cfg_base_nodet< cfg_nodet, goto_programt::const_targett > nodet
std::map< irep_idt, cfg_post_dominatorst > post_dominators_mapt
instructionst::const_iterator const_targett
void fixedpoint(goto_functionst &goto_functions, queuet &queue, jumpst &jumps, decl_deadt &decl_dead, const dependence_grapht &dep_graph)
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
std::list< cfgt::entryt > jumpst
const post_dominators_mapt & cfg_post_dominators() const
A collection of goto functions.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
void add_decl_dead(const cfgt::nodet &node, queuet &queue, decl_deadt &decl_dead)
nodet::node_indext node_indext
void property_slicer(goto_functionst &goto_functions, const namespacet &ns, const std::list< std::string > &properties)
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
void add_function_calls(const cfgt::nodet &node, queuet &queue, const goto_functionst &goto_functions)
void add_to_queue(queuet &queue, const cfgt::entryt &entry, goto_programt::const_targett reason)
void full_slicer(goto_functionst &goto_functions, const namespacet &ns, const slicing_criteriont &criterion)
void remove_skip(goto_programt &goto_program, goto_programt::targett begin, goto_programt::targett end)
remove unnecessary skip statements
#define Forall_goto_functions(it, functions)
const edgest & in(node_indext n) const
#define Forall_goto_program_instructions(it, program)
Expression to hold a symbol (variable)
std::unordered_set< irep_idt > find_symbols_sett
void add_jumps(queuet &queue, jumpst &jumps, const dependence_grapht::post_dominators_mapt &post_dominators)
std::vector< cfgt::entryt > dep_node_to_cfgt
void operator()(goto_functionst &goto_functions, const namespacet &ns, const slicing_criteriont &criterion)
void find_symbols(const exprt &src, find_symbols_sett &dest)
goto_functionst goto_functions
GOTO functions.
A codet representing an assignment in the program.