Skip to content

Commit 6758d92

Browse files
Rename rename_level2 and remove optional argument
The rename function is now only used with level2, so the optional argument becomes useless. We rename it to a more explicit name, which is also uniform with the other levels.
1 parent fe6257e commit 6758d92

9 files changed

+25
-30
lines changed

src/goto-instrument/accelerate/scratch_program.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ exprt scratch_programt::eval(const exprt &e)
6464
{
6565
exprt ssa=e;
6666

67-
symex_state.rename(ssa, ns);
67+
symex_state.rename_level2(ssa, ns);
6868

6969
return checker->get(ssa);
7070
}

src/goto-symex/goto_symex_state.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,9 @@ void goto_symex_statet::rename_level1(exprt &expr, const namespacet &ns)
359359
}
360360
}
361361

362-
void goto_symex_statet::rename(
363-
exprt &expr,
364-
const namespacet &ns,
365-
levelt level)
362+
void goto_symex_statet::rename_level2(exprt &expr, const namespacet &ns)
366363
{
367364
// rename all the symbols with their last known value
368-
PRECONDITION(level == L2);
369-
370365
if(expr.id()==ID_symbol &&
371366
expr.get_bool(ID_C_SSA_symbol))
372367
{
@@ -406,7 +401,7 @@ void goto_symex_statet::rename(
406401
}
407402

408403
expr=ssa_exprt(expr);
409-
rename(expr, ns);
404+
rename_level2(expr, ns);
410405
}
411406
else if(expr.id()==ID_address_of)
412407
{
@@ -421,7 +416,7 @@ void goto_symex_statet::rename(
421416

422417
// do this recursively
423418
Forall_operands(it, expr)
424-
rename(*it, ns);
419+
rename_level2(*it, ns);
425420

426421
// some fixes
427422
if(expr.id()==ID_with)
@@ -623,7 +618,7 @@ void goto_symex_statet::rename_address(
623618
else if(level == L1)
624619
rename_level1(e, ns);
625620
else
626-
rename(e, ns);
621+
rename_level2(e, ns);
627622
};
628623

629624
if(expr.id()==ID_symbol &&
@@ -727,7 +722,7 @@ void goto_symex_statet::rename(
727722
else if(level == L1)
728723
rename_level1(e, ns);
729724
else
730-
rename(e, ns);
725+
rename_level2(e, ns);
731726
};
732727

733728
// rename all the symbols with their last known value

src/goto-symex/goto_symex_state.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ class goto_symex_statet final
7171
enum levelt { L0=0, L1=1, L2=2 };
7272

7373
// performs renaming _up to_ the given level
74-
void rename(exprt &expr, const namespacet &ns, levelt level=L2);
7574
void rename_level0(exprt &expr, const namespacet &ns);
7675
void rename_level1(exprt &expr, const namespacet &ns);
76+
void rename_level2(exprt &expr, const namespacet &ns);
7777
void rename(
7878
typet &type,
7979
const irep_idt &l1_identifier,

src/goto-symex/symex_assign.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ void goto_symext::symex_assign_symbol(
212212
tmp_ssa_rhs.swap(ssa_rhs);
213213
}
214214

215-
state.rename(ssa_rhs, ns);
215+
state.rename_level2(ssa_rhs, ns);
216216
do_simplify(ssa_rhs);
217217

218218
ssa_exprt ssa_lhs=lhs;
@@ -228,7 +228,7 @@ void goto_symext::symex_assign_symbol(
228228
ssa_full_lhs=add_to_lhs(ssa_full_lhs, ssa_lhs);
229229
const bool record_events=state.record_events;
230230
state.record_events=false;
231-
state.rename(ssa_full_lhs, ns);
231+
state.rename_level2(ssa_full_lhs, ns);
232232
state.record_events=record_events;
233233

234234
guardt tmp_guard(state.guard);
@@ -408,7 +408,7 @@ void goto_symext::symex_assign_if(
408408
guardt old_guard=guard;
409409

410410
exprt renamed_guard=lhs.cond();
411-
state.rename(renamed_guard, ns);
411+
state.rename_level2(renamed_guard, ns);
412412
do_simplify(renamed_guard);
413413

414414
if(!renamed_guard.is_false())

src/goto-symex/symex_builtin_functions.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void goto_symext::symex_allocate(
7070
else
7171
{
7272
exprt tmp_size=size;
73-
state.rename(tmp_size, ns); // to allow constant propagation
73+
state.rename_level2(tmp_size, ns); // to allow constant propagation
7474
simplify(tmp_size, ns);
7575

7676
// special treatment for sizeof(T)*x
@@ -162,7 +162,7 @@ void goto_symext::symex_allocate(
162162
state.symbol_table.add(value_symbol);
163163

164164
exprt zero_init=code.op1();
165-
state.rename(zero_init, ns); // to allow constant propagation
165+
state.rename_level2(zero_init, ns); // to allow constant propagation
166166
simplify(zero_init, ns);
167167

168168
INVARIANT(
@@ -232,7 +232,7 @@ void goto_symext::symex_gcc_builtin_va_arg_next(
232232
return; // ignore
233233

234234
exprt tmp=code.op0();
235-
state.rename(tmp, ns); // to allow constant propagation
235+
state.rename_level2(tmp, ns); // to allow constant propagation
236236
do_simplify(tmp);
237237
irep_idt id=get_symbol(tmp);
238238

@@ -310,7 +310,7 @@ void goto_symext::symex_printf(
310310
PRECONDITION(!rhs.operands().empty());
311311

312312
exprt tmp_rhs=rhs;
313-
state.rename(tmp_rhs, ns);
313+
state.rename_level2(tmp_rhs, ns);
314314
do_simplify(tmp_rhs);
315315

316316
const exprt::operandst &operands=tmp_rhs.operands();
@@ -336,14 +336,14 @@ void goto_symext::symex_input(
336336

337337
exprt id_arg=code.op0();
338338

339-
state.rename(id_arg, ns);
339+
state.rename_level2(id_arg, ns);
340340

341341
std::list<exprt> args;
342342

343343
for(std::size_t i=1; i<code.operands().size(); i++)
344344
{
345345
args.push_back(code.operands()[i]);
346-
state.rename(args.back(), ns);
346+
state.rename_level2(args.back(), ns);
347347
do_simplify(args.back());
348348
}
349349

@@ -360,14 +360,14 @@ void goto_symext::symex_output(
360360

361361
exprt id_arg=code.op0();
362362

363-
state.rename(id_arg, ns);
363+
state.rename_level2(id_arg, ns);
364364

365365
std::list<exprt> args;
366366

367367
for(std::size_t i=1; i<code.operands().size(); i++)
368368
{
369369
args.push_back(code.operands()[i]);
370-
state.rename(args.back(), ns);
370+
state.rename_level2(args.back(), ns);
371371
do_simplify(args.back());
372372
}
373373

@@ -481,7 +481,7 @@ void goto_symext::symex_trace(
481481
for(std::size_t j=2; j<code.arguments().size(); j++)
482482
{
483483
exprt var(code.arguments()[j]);
484-
state.rename(var, ns);
484+
state.rename_level2(var, ns);
485485
vars.push_back(var);
486486
}
487487

src/goto-symex/symex_decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void goto_symext::symex_decl(statet &state, const symbol_exprt &expr)
7070
symex_renaming_levelt::increase_counter(level2_it);
7171
const bool record_events=state.record_events;
7272
state.record_events=false;
73-
state.rename(ssa, ns);
73+
state.rename_level2(ssa, ns);
7474
state.record_events=record_events;
7575

7676
// we hide the declaration of auxiliary variables

src/goto-symex/symex_function_call.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ void goto_symext::symex_function_call_code(
267267
// read the arguments -- before the locality renaming
268268
exprt::operandst arguments = call.arguments();
269269
for(auto &a : arguments)
270-
state.rename(a, ns);
270+
state.rename_level2(a, ns);
271271

272272
// we hide the call if the caller and callee are both hidden
273273
const bool hidden = state.top().hidden_function && goto_function.is_hidden();

src/goto-symex/symex_goto.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void goto_symext::symex_goto(statet &state)
3838
clean_expr(old_guard, state, false);
3939

4040
exprt new_guard=old_guard;
41-
state.rename(new_guard, ns);
41+
state.rename_level2(new_guard, ns);
4242
do_simplify(new_guard);
4343

4444
if(new_guard.is_false())
@@ -269,7 +269,7 @@ void goto_symext::symex_goto(statet &state)
269269
symex_targett::assignment_typet::GUARD);
270270

271271
guard_expr = boolean_negate(guard_symbol_expr);
272-
state.rename(guard_expr, ns);
272+
state.rename_level2(guard_expr, ns);
273273
}
274274

275275
if(state.has_saved_jump_target)

src/goto-symex/symex_main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void goto_symext::vcc(
9595
}
9696

9797
// now rename, enables propagation
98-
state.rename(expr, ns);
98+
state.rename_level2(expr, ns);
9999

100100
// now try simplifier on it
101101
do_simplify(expr);
@@ -410,7 +410,7 @@ void goto_symext::symex_step(
410410
{
411411
exprt tmp=instruction.guard;
412412
clean_expr(tmp, state, false);
413-
state.rename(tmp, ns);
413+
state.rename_level2(tmp, ns);
414414
symex_assume(state, tmp);
415415
}
416416

0 commit comments

Comments
 (0)