@@ -47,90 +47,6 @@ goto_symex_statet::goto_symex_statet(
47
47
48
48
goto_symex_statet::~goto_symex_statet ()=default ;
49
49
50
- // / Check that \p expr is correctly renamed to level 2 and return true in case
51
- // / an error is detected.
52
- static bool check_renaming (const exprt &expr);
53
-
54
- static bool check_renaming (const typet &type)
55
- {
56
- if (type.id ()==ID_array)
57
- return check_renaming (to_array_type (type).size ());
58
- else if (type.id () == ID_struct || type.id () == ID_union)
59
- {
60
- for (const auto &c : to_struct_union_type (type).components ())
61
- if (check_renaming (c.type ()))
62
- return true ;
63
- }
64
- else if (type.has_subtype ())
65
- return check_renaming (to_type_with_subtype (type).subtype ());
66
-
67
- return false ;
68
- }
69
-
70
- static bool check_renaming_l1 (const exprt &expr)
71
- {
72
- if (check_renaming (expr.type ()))
73
- return true ;
74
-
75
- if (expr.id ()==ID_symbol)
76
- {
77
- const auto &type = expr.type ();
78
- if (!expr.get_bool (ID_C_SSA_symbol))
79
- return type.id () != ID_code && type.id () != ID_mathematical_function;
80
- if (!to_ssa_expr (expr).get_level_2 ().empty ())
81
- return true ;
82
- if (to_ssa_expr (expr).get_original_expr ().type () != type)
83
- return true ;
84
- }
85
- else
86
- {
87
- forall_operands (it, expr)
88
- if (check_renaming_l1 (*it))
89
- return true ;
90
- }
91
-
92
- return false ;
93
- }
94
-
95
- static bool check_renaming (const exprt &expr)
96
- {
97
- if (check_renaming (expr.type ()))
98
- return true ;
99
-
100
- if (
101
- expr.id () == ID_address_of &&
102
- to_address_of_expr (expr).object ().id () == ID_symbol)
103
- {
104
- return check_renaming_l1 (to_address_of_expr (expr).object ());
105
- }
106
- else if (
107
- expr.id () == ID_address_of &&
108
- to_address_of_expr (expr).object ().id () == ID_index)
109
- {
110
- const auto index_expr = to_index_expr (to_address_of_expr (expr).object ());
111
- return check_renaming_l1 (index_expr.array ()) ||
112
- check_renaming (index_expr.index ());
113
- }
114
- else if (expr.id ()==ID_symbol)
115
- {
116
- const auto &type = expr.type ();
117
- if (!expr.get_bool (ID_C_SSA_symbol))
118
- return type.id () != ID_code && type.id () != ID_mathematical_function;
119
- if (to_ssa_expr (expr).get_level_2 ().empty ())
120
- return true ;
121
- if (to_ssa_expr (expr).get_original_expr ().type () != type)
122
- return true ;
123
- }
124
- else
125
- {
126
- forall_operands (it, expr)
127
- if (check_renaming (*it))
128
- return true ;
129
- }
130
-
131
- return false ;
132
- }
133
-
134
50
template <>
135
51
renamedt<ssa_exprt, L0>
136
52
goto_symex_statet::set_indices<L0>(ssa_exprt ssa_expr, const namespacet &ns)
@@ -170,7 +86,7 @@ renamedt<ssa_exprt, L2> goto_symex_statet::assignment(
170
86
lhs.update_type ();
171
87
if (run_validation_checks)
172
88
{
173
- DATA_INVARIANT (! check_renaming_l1 (lhs), " lhs renaming failed on l1" );
89
+ DATA_INVARIANT (is_l1_renamed (lhs), " lhs renaming failed on l1" );
174
90
}
175
91
const ssa_exprt l1_lhs = lhs;
176
92
@@ -192,8 +108,8 @@ renamedt<ssa_exprt, L2> goto_symex_statet::assignment(
192
108
193
109
if (run_validation_checks)
194
110
{
195
- DATA_INVARIANT (! check_renaming (lhs), " lhs renaming failed on l2" );
196
- DATA_INVARIANT (! check_renaming (rhs), " rhs renaming failed on l2" );
111
+ DATA_INVARIANT (is_l2_renamed (lhs), " lhs renaming failed on l2" );
112
+ DATA_INVARIANT (is_l2_renamed (rhs), " rhs renaming failed on l2" );
197
113
}
198
114
199
115
// see #305 on GitHub for a simple example and possible discussion
@@ -224,8 +140,8 @@ renamedt<ssa_exprt, L2> goto_symex_statet::assignment(
224
140
225
141
if (run_validation_checks)
226
142
{
227
- DATA_INVARIANT (! check_renaming_l1 (l1_lhs), " lhs renaming failed on l1" );
228
- DATA_INVARIANT (! check_renaming_l1 (l1_rhs), " rhs renaming failed on l1" );
143
+ DATA_INVARIANT (is_l1_renamed (l1_lhs), " lhs renaming failed on l1" );
144
+ DATA_INVARIANT (is_l1_renamed (l1_rhs), " rhs renaming failed on l1" );
229
145
}
230
146
231
147
value_set.assign (l1_lhs, l1_rhs, ns, rhs_is_simplified, is_shared);
@@ -461,7 +377,7 @@ bool goto_symex_statet::l2_thread_read_encoding(
461
377
source,
462
378
symex_targett::assignment_typet::PHI);
463
379
464
- INVARIANT (! check_renaming (ssa_l2), " expr should be renamed to L2" );
380
+ INVARIANT (is_l2_renamed (ssa_l2), " expr should be renamed to L2" );
465
381
expr = std::move (ssa_l2);
466
382
467
383
a_s_read.second .push_back (guard);
0 commit comments