44 auto p = util_make_unique<rd_range_domaint>(
bv_container);
46 return std::unique_ptr<statet>(p.release());
75 valuest::const_iterator v_entry=
values.find(identifier);
76 if(v_entry==
values.end() ||
77 v_entry->second.empty())
82 for(
const auto &
id : v_entry->second)
99 locationt from{trace_from->current_location()};
100 locationt to{trace_to->current_location()};
107 "ai has type reaching_definitions_analysist");
115 else if(from->is_start_thread())
118 else if(from->is_function_call())
121 else if(from->is_end_function())
124 else if(from->is_assign())
127 else if(from->is_decl())
130 else if(from->is_other())
140 const irep_idt &identifier = from->dead_symbol().get_identifier();
142 valuest::iterator entry=
values.find(identifier);
155 for(valuest::iterator it=
values.begin();
159 const irep_idt &identifier=it->first;
161 if(!ns.
lookup(identifier).is_shared() &&
166 valuest::iterator next=it;
187 for(valuest::iterator it=
values.begin();
191 const irep_idt &identifier=it->first;
195 if((ns.
lookup(identifier, sym) ||
201 valuest::iterator next=it;
213 for(
const auto ¶m : code_type.
parameters())
215 const irep_idt &identifier=param.get_identifier();
217 if(identifier.
empty())
221 if(param_bits.has_value())
236 if(from->call_lhs().is_not_nil())
256 for(
const auto &new_value : new_values)
258 const irep_idt &identifier=new_value.first;
261 (!ns.
lookup(identifier).is_shared() &&
264 for(
const auto &
id : new_value.second)
271 for(
const auto &
id : new_value.second)
280 for(
const auto ¶m : code_type.
parameters())
282 const irep_idt &identifier=param.get_identifier();
284 if(identifier.
empty())
287 valuest::iterator entry=
values.find(identifier);
297 if(call->call_lhs().is_not_nil())
311 goto_rw(function_to, to, rw_set);
312 const bool is_must_alias=rw_set.
get_w_set().size()==1;
314 for(
const auto &written_object_entry : rw_set.
get_w_set())
316 const irep_idt &identifier = written_object_entry.first;
319 if(ns.
lookup(identifier, symbol_ptr))
324 "Symbol is in symbol table");
327 rw_set.
get_ranges(written_object_entry.second);
333 for(
const auto &range : ranges)
334 kill(identifier, range.first, range.second);
336 for(
const auto &range : ranges)
337 gen(from, identifier, range.first, range.second);
354 assert(range_end>range_start);
356 valuest::iterator entry=
values.find(identifier);
360 bool clear_export_cache=
false;
363 for(values_innert::iterator
364 it=entry->second.begin();
365 it!=entry->second.end();
380 clear_export_cache=
true;
382 entry->second.erase(it++);
386 clear_export_cache=
true;
392 entry->second.erase(it++);
396 clear_export_cache=
true;
407 entry->second.erase(it++);
411 clear_export_cache=
true;
417 entry->second.erase(it++);
421 if(clear_export_cache)
424 values_innert::iterator it=entry->second.begin();
425 for(
const auto &
id : new_values)
427 while(it!=entry->second.end() && *it<
id)
429 if(it==entry->second.end() ||
id<*it)
431 entry->second.insert(it,
id);
433 else if(it!=entry->second.end())
448 valuest::iterator entry=
values.find(identifier);
452 XXX export_cache_available=
false;
457 for(rangest::iterator it=ranges.begin();
460 if(it->second.first!=-1 &&
461 it->second.first <= range_start)
463 else if(it->first >= range_start)
469 it->second.first=range_start;
501 std::pair<valuest::iterator, bool> entry=
503 rangest &ranges=entry.first->second;
507 for(rangest::iterator it=ranges.begin();
511 if(it->second.second!=from ||
512 (it->second.first!=-1 && it->second.first <= range_start) ||
513 (range_end!=-1 && it->first >= range_end))
515 else if(it->first > range_start)
518 merged_range_end=std::max(range_end, it->second.first);
521 else if(it->second.first==-1 ||
523 it->second.first >= range_end))
530 it->second.first=range_end;
536 ranges.insert(std::make_pair(
538 std::make_pair(merged_range_end, from)));
546 out <<
"Reaching definitions:\n";
554 for(
const auto &value :
values)
556 const irep_idt &identifier=value.first;
560 out <<
" " << identifier <<
"[";
562 for(ranges_at_loct::const_iterator itl=ranges.begin();
565 for(rangest::const_iterator itr=itl->second.begin();
566 itr!=itl->second.end();
569 if(itr!=itl->second.begin() ||
573 out << itr->first <<
":" << itr->second;
574 out <<
"@" << itl->first->location_number;
591 ranges_at_loct::iterator itr=it->second.begin();
592 for(
const auto &o : ito->second)
594 while(itr!=it->second.end() && itr->first<o.first)
596 if(itr==it->second.end() || o.first<itr->first)
598 it->second.insert(o);
601 else if(itr!=it->second.end())
603 assert(itr->first==o.first);
605 for(
const auto &o_range : o.second)
606 more=
gen(itr->second, o_range.first, o_range.second) ||
613 values_innert::iterator itr=dest.begin();
614 for(
const auto &
id : other)
616 while(itr!=dest.end() && *itr<
id)
618 if(itr==dest.end() ||
id<*itr)
620 dest.insert(itr,
id);
623 else if(itr!=dest.end())
642 valuest::iterator it=
values.begin();
643 for(
const auto &value : other.
values)
645 while(it!=
values.end() && it->first<value.first)
647 if(it==
values.end() || value.first<it->first)
654 assert(it->first==value.first);
686 valuest::iterator it=
values.begin();
687 for(
const auto &value : other.
values)
689 const irep_idt &identifier=value.first;
691 if(!ns.
lookup(identifier).is_shared()
695 while(it!=
values.end() && it->first<value.first)
697 if(it==
values.end() || value.first<it->first)
704 assert(it->first==value.first);
726 export_cachet::const_iterator entry=
export_cache.find(identifier);
731 return entry->second;
737 auto value_sets_=util_make_unique<value_set_analysis_fit>(
ns);
738 (*value_sets_)(goto_functions);
741 is_threaded=util_make_unique<is_threadedt>(goto_functions);
743 is_dirty=util_make_unique<dirtyt>(goto_functions);