@@ -143,8 +143,8 @@ void value_set_fivrt::output(
143
143
{
144
144
result+=from_expr (ns, identifier, o)+" , " ;
145
145
146
- if (o_it->second . offset_is_set )
147
- result+= integer2string (o_it->second . offset )+ " " ;
146
+ if (o_it->second )
147
+ result += integer2string (* o_it->second ) + " " ;
148
148
else
149
149
result+=' *' ;
150
150
@@ -301,13 +301,12 @@ void value_set_fivrt::flatten_rec(
301
301
t_it!=temp.write ().end ();
302
302
t_it++)
303
303
{
304
- if (t_it->second .offset_is_set &&
305
- it->second .offset_is_set )
304
+ if (t_it->second && it->second )
306
305
{
307
- t_it->second . offset += it->second . offset ;
306
+ * t_it->second += * it->second ;
308
307
}
309
308
else
310
- t_it->second .offset_is_set = false ;
309
+ t_it->second .reset () ;
311
310
}
312
311
313
312
forall_objects (oit, temp.read ())
@@ -325,7 +324,7 @@ void value_set_fivrt::flatten_rec(
325
324
{
326
325
Forall_objects (it, dest.write ())
327
326
{
328
- it->second .offset_is_set = false ;
327
+ it->second .reset () ;
329
328
for (std::list<const object_map_dt::vrange_listt*>::const_iterator vit =
330
329
add_ranges.begin ();
331
330
vit!=add_ranges.end ();
@@ -355,8 +354,8 @@ exprt value_set_fivrt::to_expr(object_map_dt::const_iterator it) const
355
354
356
355
od.object ()=object;
357
356
358
- if (it->second . offset_is_set )
359
- od.offset ()= from_integer (it->second . offset , index_type ());
357
+ if (it->second )
358
+ od.offset () = from_integer (* it->second , index_type ());
360
359
361
360
od.type ()=od.object ().type ();
362
361
@@ -436,13 +435,12 @@ void value_set_fivrt::get_value_set(
436
435
t_it!=temp.write ().end ();
437
436
t_it++)
438
437
{
439
- if (t_it->second .offset_is_set &&
440
- it->second .offset_is_set )
438
+ if (t_it->second && it->second )
441
439
{
442
- t_it->second . offset += it->second . offset ;
440
+ * t_it->second += * it->second ;
443
441
}
444
442
else
445
- t_it->second .offset_is_set = false ;
443
+ t_it->second .reset () ;
446
444
447
445
flat_map.write ()[t_it->first ]=t_it->second ;
448
446
}
@@ -690,32 +688,31 @@ void value_set_fivrt::get_value_set_rec(
690
688
691
689
forall_objects (it, pointer_expr_set.read ())
692
690
{
693
- objectt object= it->second ;
691
+ offsett offset = it->second ;
694
692
695
- if (object.offset_is_zero () &&
696
- expr.operands ().size ()==2 )
693
+ if (offset_is_zero (offset) && expr.operands ().size () == 2 )
697
694
{
698
695
if (expr.op0 ().type ().id ()!=ID_pointer)
699
696
{
700
697
mp_integer i;
701
698
if (to_integer (expr.op0 (), i))
702
- object. offset_is_set = false ;
699
+ offset. reset () ;
703
700
else
704
- object. offset = (expr.id ()== ID_plus)? i : -i;
701
+ * offset = (expr.id () == ID_plus) ? i : -i;
705
702
}
706
703
else
707
704
{
708
705
mp_integer i;
709
706
if (to_integer (expr.op1 (), i))
710
- object. offset_is_set = false ;
707
+ offset. reset () ;
711
708
else
712
- object. offset = (expr.id ()== ID_plus)? i : -i;
709
+ * offset = (expr.id () == ID_plus) ? i : -i;
713
710
}
714
711
}
715
712
else
716
- object. offset_is_set = false ;
713
+ offset. reset () ;
717
714
718
- insert_from (dest, it->first , object );
715
+ insert_from (dest, it->first , offset );
719
716
}
720
717
721
718
return ;
@@ -850,13 +847,12 @@ void value_set_fivrt::get_reference_set(
850
847
t_it!=omt.write ().end ();
851
848
t_it++)
852
849
{
853
- if (t_it->second .offset_is_set &&
854
- it->second .offset_is_set )
850
+ if (t_it->second && it->second )
855
851
{
856
- t_it->second . offset += it->second . offset ;
852
+ * t_it->second += * it->second ;
857
853
}
858
854
else
859
- t_it->second .offset_is_set = false ;
855
+ t_it->second .reset () ;
860
856
}
861
857
862
858
forall_objects (it, omt.read ())
@@ -939,13 +935,12 @@ void value_set_fivrt::get_reference_set_sharing_rec(
939
935
t_it!=t2.write ().end ();
940
936
t_it++)
941
937
{
942
- if (t_it->second .offset_is_set &&
943
- it->second .offset_is_set )
938
+ if (t_it->second && it->second )
944
939
{
945
- t_it->second . offset += it->second . offset ;
940
+ * t_it->second += * it->second ;
946
941
}
947
942
else
948
- t_it->second .offset_is_set = false ;
943
+ t_it->second .reset () ;
949
944
}
950
945
951
946
forall_objects (it2, t2.read ())
@@ -1002,17 +997,16 @@ void value_set_fivrt::get_reference_set_sharing_rec(
1002
997
ns.follow (object.type ())!=array_type)
1003
998
index_expr.make_typecast (array.type ());
1004
999
1005
- objectt o= a_it->second ;
1000
+ offsett o = a_it->second ;
1006
1001
mp_integer i;
1007
1002
1008
1003
if (offset.is_zero ())
1009
1004
{
1010
1005
}
1011
- else if (!to_integer (offset, i) &&
1012
- o.offset_is_zero ())
1013
- o.offset =i;
1006
+ else if (!to_integer (offset, i) && offset_is_zero (o))
1007
+ *o = i;
1014
1008
else
1015
- o.offset_is_set = false ;
1009
+ o.reset () ;
1016
1010
1017
1011
insert_from (dest, index_expr, o);
1018
1012
}
@@ -1051,7 +1045,7 @@ void value_set_fivrt::get_reference_set_sharing_rec(
1051
1045
}
1052
1046
else
1053
1047
{
1054
- objectt o= it->second ;
1048
+ offsett o = it->second ;
1055
1049
1056
1050
exprt member_expr (ID_member, expr.type ());
1057
1051
member_expr.copy_to_operands (object);
@@ -1300,7 +1294,7 @@ void value_set_fivrt::do_free(
1300
1294
else
1301
1295
{
1302
1296
// adjust
1303
- objectt o= o_it->second ;
1297
+ offsett o = o_it->second ;
1304
1298
exprt tmp (object);
1305
1299
to_dynamic_object_expr (tmp).valid ()=exprt (ID_unknown);
1306
1300
insert_to (new_object_map, tmp, o);
@@ -1675,39 +1669,39 @@ void value_set_fivrt::apply_code(
1675
1669
bool value_set_fivrt::insert_to (
1676
1670
object_mapt &dest,
1677
1671
object_numberingt::number_type n,
1678
- const objectt &object ) const
1672
+ const offsett &offset ) const
1679
1673
{
1680
1674
object_map_dt &map=dest.write ();
1681
1675
if (map.find (n)==map.end ())
1682
1676
{
1683
- // std::cout << "NEW(" << n << "): " << object_numbering[n] << '\n';
1677
+ // std::cout << "NEW(" << n << "): " << object_numbering[n] << '\n';
1684
1678
// new
1685
- map[n]=object ;
1679
+ map[n] = offset ;
1686
1680
map.set_valid_at (n, to_function, to_target_index);
1687
1681
return true ;
1688
1682
}
1689
1683
else
1690
1684
{
1691
- // std::cout << "UPD " << n << '\n';
1692
- objectt &old= map[n];
1685
+ // std::cout << "UPD " << n << '\n';
1686
+ offsett &old_offset = map[n];
1693
1687
1694
- bool res= map.set_valid_at (n, to_function, to_target_index);
1688
+ bool res = map.set_valid_at (n, to_function, to_target_index);
1695
1689
1696
- if (old. offset_is_set && object. offset_is_set )
1690
+ if (old_offset && offset )
1697
1691
{
1698
- if (old. offset ==object. offset )
1692
+ if (*old_offset == * offset)
1699
1693
return res;
1700
1694
else
1701
1695
{
1702
- old. offset_is_set = false ;
1696
+ old_offset. reset () ;
1703
1697
return true ;
1704
1698
}
1705
1699
}
1706
- else if (!old. offset_is_set )
1700
+ else if (!old_offset )
1707
1701
return res;
1708
1702
else
1709
1703
{
1710
- old. offset_is_set = false ;
1704
+ old_offset. reset () ;
1711
1705
return true ;
1712
1706
}
1713
1707
}
@@ -1716,39 +1710,39 @@ bool value_set_fivrt::insert_to(
1716
1710
bool value_set_fivrt::insert_from (
1717
1711
object_mapt &dest,
1718
1712
object_numberingt::number_type n,
1719
- const objectt &object ) const
1713
+ const offsett &offset ) const
1720
1714
{
1721
1715
object_map_dt &map=dest.write ();
1722
1716
if (map.find (n)==map.end ())
1723
1717
{
1724
- // std::cout << "NEW(" << n << "): " << object_numbering[n] << '\n';
1718
+ // std::cout << "NEW(" << n << "): " << object_numbering[n] << '\n';
1725
1719
// new
1726
- map[n]=object ;
1720
+ map[n] = offset ;
1727
1721
map.set_valid_at (n, from_function, from_target_index);
1728
1722
return true ;
1729
1723
}
1730
1724
else
1731
1725
{
1732
- // std::cout << "UPD " << n << '\n';
1733
- objectt &old= map[n];
1726
+ // std::cout << "UPD " << n << '\n';
1727
+ offsett &old_offset = map[n];
1734
1728
1735
- bool res= map.set_valid_at (n, from_function, from_target_index);
1729
+ bool res = map.set_valid_at (n, from_function, from_target_index);
1736
1730
1737
- if (old. offset_is_set && object. offset_is_set )
1731
+ if (old_offset && offset )
1738
1732
{
1739
- if (old. offset ==object. offset )
1733
+ if (*old_offset == * offset)
1740
1734
return res;
1741
1735
else
1742
1736
{
1743
- old. offset_is_set = false ;
1737
+ old_offset. reset () ;
1744
1738
return true ;
1745
1739
}
1746
1740
}
1747
- else if (!old. offset_is_set )
1741
+ else if (!old_offset )
1748
1742
return res;
1749
1743
else
1750
1744
{
1751
- old. offset_is_set = false ;
1745
+ old_offset. reset () ;
1752
1746
return true ;
1753
1747
}
1754
1748
}
0 commit comments