Skip to content

Pointer analysis tidy #527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 7 additions & 17 deletions src/pointer-analysis/value_set_analysis_fi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,31 +202,21 @@ void value_set_analysis_fit::add_vars(
get_globals(globals);

value_set_fit &v=state.value_set;
v.add_vars(globals);

for(goto_functionst::function_mapt::const_iterator
f_it=goto_functions.function_map.begin();
f_it!=goto_functions.function_map.end();
f_it++)
forall_goto_functions(f_it, goto_functions)
{
// get the locals
std::set<irep_idt> locals;
get_local_identifiers(f_it->second, locals);

forall_goto_program_instructions(i_it, f_it->second.body)
for(auto l : locals)
{
v.add_vars(globals);
const symbolt &symbol=ns.lookup(l);

for(std::set<irep_idt>::const_iterator
l_it=locals.begin();
l_it!=locals.end();
l_it++)
{
const symbolt &symbol=ns.lookup(*l_it);

std::list<value_set_fit::entryt> entries;
get_entries(symbol, entries);
v.add_vars(entries);
}
std::list<value_set_fit::entryt> entries;
get_entries(symbol, entries);
v.add_vars(entries);
}
}
}
Expand Down
56 changes: 18 additions & 38 deletions src/pointer-analysis/value_set_analysis_fivr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,33 +84,23 @@ void value_set_analysis_fivrt::add_vars(
entry_cachet entry_cache;

value_set_fivrt &v=state.value_set;
v.add_vars(globals);

for(goto_programt::instructionst::const_iterator
i_it=goto_program.instructions.begin();
i_it!=goto_program.instructions.end();
i_it++)
for(auto l : locals)
{
v.add_vars(globals);
// cache hit?
entry_cachet::const_iterator e_it=entry_cache.find(l);

for(goto_programt::decl_identifierst::const_iterator
l_it=locals.begin();
l_it!=locals.end();
l_it++)
if(e_it==entry_cache.end())
{
// cache hit?
entry_cachet::const_iterator e_it=entry_cache.find(*l_it);
const symbolt &symbol=ns.lookup(l);

if(e_it==entry_cache.end())
{
const symbolt &symbol=ns.lookup(*l_it);

std::list<value_set_fivrt::entryt> &entries=entry_cache[*l_it];
get_entries(symbol, entries);
v.add_vars(entries);
}
else
v.add_vars(e_it->second);
std::list<value_set_fivrt::entryt> &entries=entry_cache[l];
get_entries(symbol, entries);
v.add_vars(entries);
}
else
v.add_vars(e_it->second);
}
}

Expand Down Expand Up @@ -202,31 +192,21 @@ void value_set_analysis_fivrt::add_vars(
get_globals(globals);

value_set_fivrt &v=state.value_set;
v.add_vars(globals);

for(goto_functionst::function_mapt::const_iterator
f_it=goto_functions.function_map.begin();
f_it!=goto_functions.function_map.end();
f_it++)
forall_goto_functions(f_it, goto_functions)
{
// get the locals
std::set<irep_idt> locals;
get_local_identifiers(f_it->second, locals);

forall_goto_program_instructions(i_it, f_it->second.body)
for(auto l : locals)
{
v.add_vars(globals);
const symbolt &symbol=ns.lookup(l);

for(std::set<irep_idt>::const_iterator
l_it=locals.begin();
l_it!=locals.end();
l_it++)
{
const symbolt &symbol=ns.lookup(*l_it);

std::list<value_set_fivrt::entryt> entries;
get_entries(symbol, entries);
v.add_vars(entries);
}
std::list<value_set_fivrt::entryt> entries;
get_entries(symbol, entries);
v.add_vars(entries);
}
}
}
Expand Down
56 changes: 18 additions & 38 deletions src/pointer-analysis/value_set_analysis_fivrns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,33 +84,23 @@ void value_set_analysis_fivrnst::add_vars(
entry_cachet entry_cache;

value_set_fivrnst &v=state.value_set;
v.add_vars(globals);

for(goto_programt::instructionst::const_iterator
i_it=goto_program.instructions.begin();
i_it!=goto_program.instructions.end();
i_it++)
for(auto l : locals)
{
v.add_vars(globals);
// cache hit?
entry_cachet::const_iterator e_it=entry_cache.find(l);

for(goto_programt::decl_identifierst::const_iterator
l_it=locals.begin();
l_it!=locals.end();
l_it++)
if(e_it==entry_cache.end())
{
// cache hit?
entry_cachet::const_iterator e_it=entry_cache.find(*l_it);
const symbolt &symbol=ns.lookup(l);

if(e_it==entry_cache.end())
{
const symbolt &symbol=ns.lookup(*l_it);

std::list<value_set_fivrnst::entryt> &entries=entry_cache[*l_it];
get_entries(symbol, entries);
v.add_vars(entries);
}
else
v.add_vars(e_it->second);
std::list<value_set_fivrnst::entryt> &entries=entry_cache[l];
get_entries(symbol, entries);
v.add_vars(entries);
}
else
v.add_vars(e_it->second);
}
}

Expand Down Expand Up @@ -202,31 +192,21 @@ void value_set_analysis_fivrnst::add_vars(
get_globals(globals);

value_set_fivrnst &v=state.value_set;
v.add_vars(globals);

for(goto_functionst::function_mapt::const_iterator
f_it=goto_functions.function_map.begin();
f_it!=goto_functions.function_map.end();
f_it++)
forall_goto_functions(f_it, goto_functions)
{
// get the locals
std::set<irep_idt> locals;
get_local_identifiers(f_it->second, locals);

forall_goto_program_instructions(i_it, f_it->second.body)
for(auto l : locals)
{
v.add_vars(globals);
const symbolt &symbol=ns.lookup(l);

for(std::set<irep_idt>::const_iterator
l_it=locals.begin();
l_it!=locals.end();
l_it++)
{
const symbolt &symbol=ns.lookup(*l_it);

std::list<value_set_fivrnst::entryt> entries;
get_entries(symbol, entries);
v.add_vars(entries);
}
std::list<value_set_fivrnst::entryt> entries;
get_entries(symbol, entries);
v.add_vars(entries);
}
}
}
Expand Down