Skip to content

Commit 3c3fbad

Browse files
Extract a rename_level0_ssa function
The rename<L0> function will normally be used with ssa symbols, we add that function to avoid unecessary decision making.
1 parent b8678a4 commit 3c3fbad

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/goto-symex/goto_symex_state.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,15 @@ void goto_symex_statet::set_l2_indices(
262262
ssa_expr.set_level_2(level2.current_count(ssa_expr.get_identifier()));
263263
}
264264

265+
ssa_exprt
266+
goto_symex_statet::rename_level0_ssa(ssa_exprt ssa, const namespacet &ns)
267+
{
268+
set_l0_indices(ssa, ns);
269+
rename(ssa.type(), ssa.get_identifier(), ns, L0);
270+
ssa.update_type();
271+
return ssa;
272+
}
273+
265274
void goto_symex_statet::rename(
266275
exprt &expr,
267276
const namespacet &ns,
@@ -276,9 +285,7 @@ void goto_symex_statet::rename(
276285

277286
if(level == L0)
278287
{
279-
set_l0_indices(ssa, ns);
280-
rename(expr.type(), ssa.get_identifier(), ns, level);
281-
ssa.update_type();
288+
ssa = rename_level0_ssa(std::move(ssa), ns);
282289
}
283290
else if(level == L1)
284291
{

src/goto-symex/goto_symex_state.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ class goto_symex_statet final : public goto_statet
180180
/// A full explanation of SSA (which is why we do this renaming) is in
181181
/// the SSA section of background-concepts.md.
182182
void rename(exprt &expr, const namespacet &ns, levelt level=L2);
183+
184+
ssa_exprt rename_level0_ssa(ssa_exprt ssa, const namespacet &ns);
185+
183186
void rename(
184187
typet &type,
185188
const irep_idt &l1_identifier,

src/goto-symex/symex_function_call.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ static void locality(
395395
it++)
396396
{
397397
// get L0 name
398-
ssa_exprt ssa(ns.lookup(*it).symbol_expr());
399-
state.rename(ssa, ns, goto_symex_statet::L0);
398+
ssa_exprt ssa =
399+
state.rename_level0_ssa(ssa_exprt(ns.lookup(*it).symbol_expr()), ns);
400400
const irep_idt l0_name=ssa.get_identifier();
401401

402402
// save old L1 name for popping the frame

0 commit comments

Comments
 (0)