@@ -199,7 +199,7 @@ goto_programt::const_targett goto_program2codet::convert_instruction(
199
199
return target;
200
200
201
201
case ASSUME:
202
- dest.add (code_assumet (target->guard ));
202
+ dest.add (code_assumet (target->condition () ));
203
203
return target;
204
204
205
205
case GOTO:
@@ -514,7 +514,7 @@ goto_programt::const_targett goto_program2codet::convert_do_while(
514
514
{
515
515
assert (loop_end->is_goto () && loop_end->is_backwards_goto ());
516
516
517
- code_dowhilet d (loop_end->guard , code_blockt ());
517
+ code_dowhilet d (loop_end->condition () , code_blockt ());
518
518
simplify (d.cond (), ns);
519
519
520
520
copy_source_location (loop_end->targets .front (), d);
@@ -547,7 +547,7 @@ goto_programt::const_targett goto_program2codet::convert_goto(
547
547
(upper_bound==goto_program.instructions .end () ||
548
548
upper_bound->location_number > loop_entry->second ->location_number ))
549
549
return convert_goto_while (target, loop_entry->second , dest);
550
- else if (!target->guard .is_true ())
550
+ else if (!target->condition () .is_true ())
551
551
return convert_goto_switch (target, upper_bound, dest);
552
552
else if (!loop_last_stack.empty ())
553
553
return convert_goto_break_continue (target, upper_bound, dest);
@@ -574,10 +574,10 @@ goto_programt::const_targett goto_program2codet::convert_goto_while(
574
574
575
575
if (target->get_target ()==after_loop)
576
576
{
577
- w.cond ()= not_exprt (target->guard );
577
+ w.cond () = not_exprt (target->condition () );
578
578
simplify (w.cond (), ns);
579
579
}
580
- else if (target->guard .is_true ())
580
+ else if (target->condition () .is_true ())
581
581
{
582
582
target = convert_goto_goto (target, to_code_block (w.body ()));
583
583
}
@@ -594,13 +594,13 @@ goto_programt::const_targett goto_program2codet::convert_goto_while(
594
594
loop_last_stack.pop_back ();
595
595
596
596
convert_labels (loop_end, to_code_block (w.body ()));
597
- if (loop_end->guard .is_false ())
597
+ if (loop_end->condition () .is_false ())
598
598
{
599
599
to_code_block (w.body ()).add (code_breakt ());
600
600
}
601
- else if (!loop_end->guard .is_true ())
601
+ else if (!loop_end->condition () .is_true ())
602
602
{
603
- code_ifthenelset i (not_exprt (loop_end->guard ), code_breakt ());
603
+ code_ifthenelset i (not_exprt (loop_end->condition () ), code_breakt ());
604
604
simplify (i.cond (), ns);
605
605
606
606
copy_source_location (target, i);
@@ -661,9 +661,9 @@ goto_programt::const_targett goto_program2codet::get_cases(
661
661
cases_it!=upper_bound && cases_it!=first_target;
662
662
++cases_it)
663
663
{
664
- if (cases_it-> is_goto () &&
665
- !cases_it->is_backwards_goto () &&
666
- cases_it->guard .is_true ())
664
+ if (
665
+ cases_it-> is_goto () && !cases_it->is_backwards_goto () &&
666
+ cases_it->condition () .is_true ())
667
667
{
668
668
default_target=cases_it->get_target ();
669
669
@@ -684,16 +684,16 @@ goto_programt::const_targett goto_program2codet::get_cases(
684
684
++cases_it;
685
685
break ;
686
686
}
687
- else if (cases_it-> is_goto () &&
688
- !cases_it->is_backwards_goto () &&
689
- (cases_it->guard .id ()== ID_equal ||
690
- cases_it->guard .id ()== ID_or))
687
+ else if (
688
+ cases_it-> is_goto () && !cases_it->is_backwards_goto () &&
689
+ (cases_it->condition () .id () == ID_equal ||
690
+ cases_it->condition () .id () == ID_or))
691
691
{
692
692
exprt::operandst eqs;
693
- if (cases_it->guard .id ()== ID_equal)
694
- eqs.push_back (cases_it->guard );
693
+ if (cases_it->condition () .id () == ID_equal)
694
+ eqs.push_back (cases_it->condition () );
695
695
else
696
- eqs= cases_it->guard .operands ();
696
+ eqs = cases_it->condition () .operands ();
697
697
698
698
// goto conversion builds disjunctions in reverse order
699
699
// to ensure convergence, we turn this around again
@@ -839,9 +839,9 @@ bool goto_program2codet::remove_default(
839
839
}
840
840
841
841
// jumps to default are ok
842
- if (it-> case_last -> is_goto () &&
843
- it->case_last ->guard .is_true () &&
844
- it->case_last ->get_target ()== default_target)
842
+ if (
843
+ it-> case_last -> is_goto () && it->case_last ->condition () .is_true () &&
844
+ it->case_last ->get_target () == default_target)
845
845
continue ;
846
846
847
847
// fall-through is ok
@@ -860,7 +860,7 @@ goto_programt::const_targett goto_program2codet::convert_goto_switch(
860
860
code_blockt &dest)
861
861
{
862
862
// try to figure out whether this was a switch/case
863
- exprt eq_cand= target->guard ;
863
+ exprt eq_cand = target->condition () ;
864
864
if (eq_cand.id ()==ID_or)
865
865
eq_cand = to_or_expr (eq_cand).op0 ();
866
866
@@ -985,7 +985,7 @@ goto_programt::const_targett goto_program2codet::convert_goto_switch(
985
985
{
986
986
UNREACHABLE;
987
987
goto_programt::instructiont i=*(it->case_selector );
988
- i.guard = true_exprt ();
988
+ i.condition_nonconst () = true_exprt ();
989
989
goto_programt tmp;
990
990
tmp.insert_before_swap (tmp.insert_before (tmp.instructions .end ()), i);
991
991
convert_goto_goto (tmp.instructions .begin (), c);
@@ -1048,13 +1048,13 @@ goto_programt::const_targett goto_program2codet::convert_goto_if(
1048
1048
return target;
1049
1049
}
1050
1050
1051
- has_else=
1051
+ has_else =
1052
1052
before_else->is_goto () &&
1053
1053
before_else->get_target ()->location_number > end_if->location_number &&
1054
- before_else->guard .is_true () &&
1055
- (upper_bound== goto_program.instructions .end () ||
1056
- upper_bound->location_number >=
1057
- before_else->get_target ()->location_number );
1054
+ before_else->condition () .is_true () &&
1055
+ (upper_bound == goto_program.instructions .end () ||
1056
+ upper_bound->location_number >=
1057
+ before_else->get_target ()->location_number );
1058
1058
1059
1059
if (has_else)
1060
1060
end_if=before_else->get_target ();
@@ -1071,7 +1071,7 @@ goto_programt::const_targett goto_program2codet::convert_goto_if(
1071
1071
return convert_goto_goto (target, dest);
1072
1072
}
1073
1073
1074
- code_ifthenelset i (not_exprt (target->guard ), code_blockt ());
1074
+ code_ifthenelset i (not_exprt (target->condition () ), code_blockt ());
1075
1075
copy_source_location (target, i);
1076
1076
simplify (i.cond (), ns);
1077
1077
@@ -1132,7 +1132,7 @@ goto_programt::const_targett goto_program2codet::convert_goto_break_continue(
1132
1132
if (target->get_target ()==loop_end &&
1133
1133
loop_last_stack.back ().second )
1134
1134
{
1135
- code_ifthenelset i (target->guard , code_continuet ());
1135
+ code_ifthenelset i (target->condition () , code_continuet ());
1136
1136
simplify (i.cond (), ns);
1137
1137
1138
1138
copy_source_location (target, i);
@@ -1156,7 +1156,7 @@ goto_programt::const_targett goto_program2codet::convert_goto_break_continue(
1156
1156
1157
1157
if (target->get_target ()==after_loop)
1158
1158
{
1159
- code_ifthenelset i (target->guard , code_breakt ());
1159
+ code_ifthenelset i (target->condition () , code_breakt ());
1160
1160
simplify (i.cond (), ns);
1161
1161
1162
1162
copy_source_location (target, i);
@@ -1214,7 +1214,7 @@ goto_programt::const_targett goto_program2codet::convert_goto_goto(
1214
1214
1215
1215
code_gotot goto_code (label.str ());
1216
1216
1217
- code_ifthenelset i (target->guard , std::move (goto_code));
1217
+ code_ifthenelset i (target->condition () , std::move (goto_code));
1218
1218
simplify (i.cond (), ns);
1219
1219
1220
1220
copy_source_location (target, i);
@@ -1281,9 +1281,12 @@ goto_programt::const_targett goto_program2codet::convert_start_thread(
1281
1281
// END THREAD
1282
1282
// 2: code in existing thread
1283
1283
/* check the structure and compute the iterators */
1284
- assert (next->is_goto () && next->guard .is_true ());
1285
- assert (!next->is_backwards_goto ());
1286
- assert (thread_start->location_number < next->get_target ()->location_number );
1284
+ DATA_INVARIANT (
1285
+ next->is_goto () && next->condition ().is_true (), " START THREAD pattern" );
1286
+ DATA_INVARIANT (!next->is_backwards_goto (), " START THREAD pattern" );
1287
+ DATA_INVARIANT (
1288
+ thread_start->location_number < next->get_target ()->location_number ,
1289
+ " START THREAD pattern" );
1287
1290
goto_programt::const_targett after_thread_start=thread_start;
1288
1291
++after_thread_start;
1289
1292
0 commit comments