Skip to content
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
2 changes: 0 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ DerivePointerAlignment: 'false'
DisableFormat: 'false'
ExperimentalAutoDetectBinPacking: 'false'
ForEachMacros: [
'forall_rw_range_set_r_objects',
'forall_rw_range_set_w_objects',
'forall_rw_set_r_entries',
'forall_rw_set_w_entries',
'forall_goto_functions',
Expand Down
10 changes: 5 additions & 5 deletions src/analyses/dependence_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ void dep_graph_domaint::data_dependencies(
rw_range_set_value_sett rw_set(ns, value_sets);
goto_rw(function_to, to, rw_set);

forall_rw_range_set_r_objects(it, rw_set)
for(const auto &read_object_entry : rw_set.get_r_set())
{
const range_domaint &r_ranges=rw_set.get_ranges(it);
const rd_range_domaint::ranges_at_loct &w_ranges=
dep_graph.reaching_definitions()[to].get(it->first);
const range_domaint &r_ranges = rw_set.get_ranges(read_object_entry.second);
const rd_range_domaint::ranges_at_loct &w_ranges =
dep_graph.reaching_definitions()[to].get(read_object_entry.first);

for(const auto &w_range : w_ranges)
{
Expand All @@ -186,7 +186,7 @@ void dep_graph_domaint::data_dependencies(
}
}

dep_graph.reaching_definitions()[to].clear_cache(it->first);
dep_graph.reaching_definitions()[to].clear_cache(read_object_entry.first);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/analyses/goto_rw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@ rw_range_sett::~rw_range_sett()
void rw_range_sett::output(std::ostream &out) const
{
out << "READ:\n";
forall_rw_range_set_r_objects(it, *this)
for(const auto &read_object_entry : get_r_set())
{
out << " " << it->first;
it->second->output(ns, out);
out << " " << read_object_entry.first;
read_object_entry.second->output(ns, out);
out << '\n';
}

out << '\n';

out << "WRITE:\n";
forall_rw_range_set_w_objects(it, *this)
for(const auto &written_object_entry : get_w_set())
{
out << " " << it->first;
it->second->output(ns, out);
out << " " << written_object_entry.first;
written_object_entry.second->output(ns, out);
out << '\n';
}
}
Expand Down
22 changes: 8 additions & 14 deletions src/analyses/goto_rw.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ Date: April 2010

#include <goto-programs/goto_model.h>

#define forall_rw_range_set_r_objects(it, rw_set) \
for(rw_range_sett::objectst::const_iterator it=(rw_set).get_r_set().begin(); \
it!=(rw_set).get_r_set().end(); ++it)

#define forall_rw_range_set_w_objects(it, rw_set) \
for(rw_range_sett::objectst::const_iterator it=(rw_set).get_w_set().begin(); \
it!=(rw_set).get_w_set().end(); ++it)

class rw_range_sett;
class goto_modelt;

Expand Down Expand Up @@ -136,10 +128,11 @@ class rw_range_sett
return w_range_set;
}

const range_domaint &get_ranges(objectst::const_iterator it) const
const range_domaint &
get_ranges(const std::unique_ptr<range_domain_baset> &ranges) const
{
PRECONDITION(dynamic_cast<range_domaint*>(it->second.get())!=nullptr);
return static_cast<const range_domaint &>(*it->second);
PRECONDITION(dynamic_cast<range_domaint *>(ranges.get()) != nullptr);
return static_cast<const range_domaint &>(*ranges);
}

enum class get_modet { LHS_W, READ };
Expand Down Expand Up @@ -360,11 +353,12 @@ class rw_guarded_range_set_value_sett:public rw_range_set_value_sett
{
}

const guarded_range_domaint &get_ranges(objectst::const_iterator it) const
const guarded_range_domaint &
get_ranges(const std::unique_ptr<range_domain_baset> &ranges) const
{
PRECONDITION(
dynamic_cast<guarded_range_domaint*>(it->second.get())!=nullptr);
return static_cast<const guarded_range_domaint &>(*it->second);
dynamic_cast<guarded_range_domaint *>(ranges.get()) != nullptr);
return static_cast<const guarded_range_domaint &>(*ranges);
}

void get_objects_rec(
Expand Down
14 changes: 8 additions & 6 deletions src/analyses/reaching_definitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,17 @@ void rd_range_domaint::transform(
goto_rw(to, rw_set);
const bool is_must_alias=rw_set.get_w_set().size()==1;

forall_rw_range_set_w_objects(it, rw_set)
for(const auto &written_object_entry : rw_set.get_w_set())
{
const irep_idt &identifier=it->first;
const irep_idt &identifier = written_object_entry.first;
// ignore symex::invalid_object
const symbolt *symbol_ptr;
if(ns.lookup(identifier, symbol_ptr))
continue;
assert(symbol_ptr!=0);

const range_domaint &ranges=rw_set.get_ranges(it);
const range_domaint &ranges =
rw_set.get_ranges(written_object_entry.second);

if(is_must_alias &&
(!rd->get_is_threaded()(from) ||
Expand Down Expand Up @@ -345,9 +346,9 @@ void rd_range_domaint::transform_assign(
goto_rw(function_to, to, rw_set);
const bool is_must_alias=rw_set.get_w_set().size()==1;

forall_rw_range_set_w_objects(it, rw_set)
for(const auto &written_object_entry : rw_set.get_w_set())
{
const irep_idt &identifier=it->first;
const irep_idt &identifier = written_object_entry.first;
// ignore symex::invalid_object
const symbolt *symbol_ptr;
if(ns.lookup(identifier, symbol_ptr))
Expand All @@ -357,7 +358,8 @@ void rd_range_domaint::transform_assign(
nullptr_exceptiont,
"Symbol is in symbol table");

const range_domaint &ranges=rw_set.get_ranges(it);
const range_domaint &ranges =
rw_set.get_ranges(written_object_entry.second);

if(is_must_alias &&
(!rd.get_is_threaded()(from) ||
Expand Down