Skip to content

Commit 026418f

Browse files
author
Daniel Kroening
committed
goto_unwindt now takes function identifier
1 parent a9d181f commit 026418f

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

src/goto-instrument/k_induction.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ Author: Daniel Kroening, [email protected]
2424
class k_inductiont
2525
{
2626
public:
27-
typedef goto_functionst::goto_functiont goto_functiont;
28-
2927
k_inductiont(
28+
const irep_idt &_function_identifier,
3029
goto_functiont &_goto_function,
3130
bool _base_case, bool _step_case,
3231
unsigned _k):
32+
function_identifier(_function_identifier),
3333
goto_function(_goto_function),
3434
local_may_alias(_goto_function),
3535
natural_loops(_goto_function.body),
@@ -39,6 +39,7 @@ class k_inductiont
3939
}
4040

4141
protected:
42+
const irep_idt &function_identifier;
4243
goto_functiont &goto_function;
4344
local_may_aliast local_may_alias;
4445
natural_loops_mutablet natural_loops;
@@ -70,7 +71,8 @@ void k_inductiont::process_loop(
7071
{
7172
// now unwind k times
7273
goto_unwindt goto_unwind;
73-
goto_unwind.unwind(goto_function.body, loop_head, loop_exit, k,
74+
goto_unwind.unwind(function_identifier,
75+
goto_function.body, loop_head, loop_exit, k,
7476
goto_unwindt::unwind_strategyt::PARTIAL);
7577

7678
// assume the loop condition has become false
@@ -96,6 +98,7 @@ void k_inductiont::process_loop(
9698

9799
goto_unwindt goto_unwind;
98100
goto_unwind.unwind(
101+
function_identifier,
99102
goto_function.body,
100103
loop_head,
101104
loop_exit,
@@ -155,5 +158,5 @@ void k_induction(
155158
unsigned k)
156159
{
157160
Forall_goto_functions(it, goto_model.goto_functions)
158-
k_inductiont(it->second, base_case, step_case, k);
161+
k_inductiont(it->first, it->second, base_case, step_case, k);
159162
}

src/goto-instrument/unwind.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,20 @@ void goto_unwindt::copy_segment(
7777
}
7878

7979
void goto_unwindt::unwind(
80+
const irep_idt &function_identifier,
8081
goto_programt &goto_program,
8182
const goto_programt::const_targett loop_head,
8283
const goto_programt::const_targett loop_exit,
8384
const unsigned k,
8485
const unwind_strategyt unwind_strategy)
8586
{
8687
std::vector<goto_programt::targett> iteration_points;
87-
unwind(goto_program, loop_head, loop_exit, k, unwind_strategy,
88+
unwind(function_identifier, goto_program, loop_head, loop_exit, k, unwind_strategy,
8889
iteration_points);
8990
}
9091

9192
void goto_unwindt::unwind(
93+
const irep_idt &function_identifier,
9294
goto_programt &goto_program,
9395
const goto_programt::const_targett loop_head,
9496
const goto_programt::const_targett loop_exit,
@@ -257,6 +259,7 @@ void goto_unwindt::unwind(
257259
}
258260

259261
void goto_unwindt::unwind(
262+
const irep_idt &function_identifier,
260263
goto_programt &goto_program,
261264
const unwindsett &unwindset,
262265
const unwind_strategyt unwind_strategy)
@@ -277,7 +280,7 @@ void goto_unwindt::unwind(
277280
continue;
278281
}
279282

280-
const irep_idt func=i_it->function;
283+
const irep_idt func=function_identifier;
281284
assert(!func.empty());
282285

283286
const irep_idt loop_id=
@@ -297,7 +300,7 @@ void goto_unwindt::unwind(
297300
loop_exit++;
298301
assert(loop_exit!=goto_program.instructions.end());
299302

300-
unwind(goto_program, loop_head, loop_exit, *limit, unwind_strategy);
303+
unwind(function_identifier, goto_program, loop_head, loop_exit, *limit, unwind_strategy);
301304

302305
// necessary as we change the goto program in the previous line
303306
i_it=loop_exit;
@@ -322,7 +325,7 @@ void goto_unwindt::operator()(
322325

323326
goto_programt &goto_program=goto_function.body;
324327

325-
unwind(goto_program, unwindset, unwind_strategy);
328+
unwind(it->first, goto_program, unwindset, unwind_strategy);
326329
}
327330
}
328331

src/goto-instrument/unwind.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ class goto_unwindt
2929
// unwind loop
3030

3131
void unwind(
32+
const irep_idt &function_identifier,
3233
goto_programt &goto_program,
3334
const goto_programt::const_targett loop_head,
3435
const goto_programt::const_targett loop_exit,
3536
const unsigned k, // bound for given loop
3637
const unwind_strategyt unwind_strategy);
3738

3839
void unwind(
40+
const irep_idt &function_identifier,
3941
goto_programt &goto_program,
4042
const goto_programt::const_targett loop_head,
4143
const goto_programt::const_targett loop_exit,
@@ -46,6 +48,7 @@ class goto_unwindt
4648
// unwind function
4749

4850
void unwind(
51+
const irep_idt &function_identifier,
4952
goto_programt &goto_program,
5053
const unwindsett &unwindset,
5154
const unwind_strategyt unwind_strategy=unwind_strategyt::PARTIAL);

0 commit comments

Comments
 (0)