Skip to content

Commit 7285b54

Browse files
Petr BauchPetr Bauch
authored andcommitted
Inline constraints
Their form is simple enough to justify having them nameless.
1 parent b478432 commit 7285b54

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/goto-symex/memory_model.cpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ void memory_model_baset::read_from(symex_target_equationt &equation)
6767
}
6868
}
6969

70-
// value equals the one of some write
71-
72-
exprt rf_some = disjunction(rf_choice_symbols);
73-
7470
// uninitialised global symbol like symex_dynamic::dynamic_object*
7571
// or *$object
7672
if(!rf_choice_symbols.empty())
@@ -79,7 +75,7 @@ void memory_model_baset::read_from(symex_target_equationt &equation)
7975
// by each entry in rf_some
8076
add_constraint(
8177
equation,
82-
implies_exprt(read_event->guard, rf_some),
78+
implies_exprt{read_event->guard, disjunction(rf_choice_symbols)},
8379
"rf-some",
8480
read_event->source);
8581
}
@@ -98,23 +94,21 @@ symbol_exprt memory_model_baset::register_read_from_choice_symbol(
9894
choice_symbols.emplace(std::make_pair(r, w), s);
9995

10096
bool is_rfi = w->source.thread_nr == r->source.thread_nr;
101-
// We rely on the fact that there is at least
102-
// one write event that has guard 'true'.
103-
implies_exprt read_from(s,
104-
and_exprt(w->guard,
105-
equal_exprt(r->ssa_lhs, w->ssa_lhs)));
106-
10797
// Uses only the write's guard as precondition, read's guard
10898
// follows from rf_some
109-
add_constraint(equation,
110-
read_from, is_rfi?"rfi":"rf", r->source);
99+
add_constraint(
100+
equation,
101+
// We rely on the fact that there is at least
102+
// one write event that has guard 'true'.
103+
implies_exprt{s, and_exprt{w->guard, equal_exprt{r->ssa_lhs, w->ssa_lhs}}},
104+
is_rfi ? "rfi" : "rf",
105+
r->source);
111106

112107
if(!is_rfi)
113108
{
114109
// if r reads from w, then w must have happened before r
115-
const implies_exprt cond(s, before(w, r));
116-
add_constraint(equation,
117-
cond, "rf-order", r->source);
110+
add_constraint(
111+
equation, implies_exprt{s, before(w, r)}, "rf-order", r->source);
118112
}
119113

120114
return s;

0 commit comments

Comments
 (0)