Skip to content

Commit a786ee0

Browse files
committed
goto_rw/range_spect: wrap in a class instead of using just a typedef
This helps avoiding magic "-1" constants in this code (which now is range_spect::unknown()).
1 parent e4d26e0 commit a786ee0

File tree

5 files changed

+280
-125
lines changed

5 files changed

+280
-125
lines changed

src/analyses/dependence_graph.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,22 +125,28 @@ void dep_graph_domaint::control_dependencies(
125125
}
126126

127127
static bool may_be_def_use_pair(
128-
const mp_integer &w_start,
129-
const mp_integer &w_end,
130-
const mp_integer &r_start,
131-
const mp_integer &r_end)
128+
const range_spect &w_start,
129+
const range_spect &w_end,
130+
const range_spect &r_start,
131+
const range_spect &r_end)
132132
{
133-
assert(w_start>=0);
134-
assert(r_start>=0);
133+
PRECONDITION(w_start >= range_spect{0});
134+
PRECONDITION(r_start >= range_spect{0});
135135

136-
if((w_end!=-1 && w_end <= r_start) || // we < rs
137-
(r_end!=-1 && w_start >= r_end)) // re < we
136+
if(
137+
(!w_end.is_unknown() && w_end <= r_start) || // we < rs
138+
(!r_end.is_unknown() && w_start >= r_end)) // re < we
139+
{
138140
return false;
141+
}
139142
else if(w_start >= r_start) // rs <= ws < we,re
140143
return true;
141-
else if(w_end==-1 ||
142-
(r_end!=-1 && w_end > r_start)) // ws <= rs < we,re
144+
else if(
145+
w_end.is_unknown() ||
146+
(!r_end.is_unknown() && w_end > r_start)) // ws <= rs < we,re
147+
{
143148
return true;
149+
}
144150
else
145151
return false;
146152
}

0 commit comments

Comments
 (0)