@@ -97,7 +97,7 @@ bool boolbvt::literal(
97
97
const typet &subtype = c.type ();
98
98
99
99
if (c.get_name () == component_name)
100
- return literal (expr. op0 (), bit+ offset, dest);
100
+ return literal (member_expr. struct_op (), bit + offset, dest);
101
101
102
102
std::size_t element_width=boolbv_width (subtype);
103
103
CHECK_RETURN (element_width != 0 );
@@ -190,7 +190,7 @@ bvt boolbvt::convert_bitvector(const exprt &expr)
190
190
else if (expr.id ()==ID_with)
191
191
return convert_with (to_with_expr (expr));
192
192
else if (expr.id ()==ID_update)
193
- return convert_update (expr);
193
+ return convert_update (to_update_expr ( expr) );
194
194
else if (expr.id ()==ID_width)
195
195
{
196
196
std::size_t result_width=boolbv_width (expr.type ());
@@ -201,7 +201,7 @@ bvt boolbvt::convert_bitvector(const exprt &expr)
201
201
if (expr.operands ().size ()!=1 )
202
202
return conversion_failed (expr);
203
203
204
- std::size_t op_width= boolbv_width (expr. op0 ().type ());
204
+ std::size_t op_width = boolbv_width (to_unary_expr ( expr). op ().type ());
205
205
206
206
if (op_width==0 )
207
207
return conversion_failed (expr);
@@ -240,7 +240,9 @@ bvt boolbvt::convert_bitvector(const exprt &expr)
240
240
else if (expr.id ()==ID_floatbv_plus || expr.id ()==ID_floatbv_minus ||
241
241
expr.id ()==ID_floatbv_mult || expr.id ()==ID_floatbv_div ||
242
242
expr.id ()==ID_floatbv_rem)
243
- return convert_floatbv_op (expr);
243
+ {
244
+ return convert_floatbv_op (to_ieee_float_op_expr (expr));
245
+ }
244
246
else if (expr.id ()==ID_floatbv_typecast)
245
247
return convert_floatbv_typecast (to_floatbv_typecast_expr (expr));
246
248
else if (expr.id ()==ID_concatenation)
@@ -436,15 +438,20 @@ literalt boolbvt::convert_rest(const exprt &expr)
436
438
return convert_verilog_case_equality (to_binary_relation_expr (expr));
437
439
else if (expr.id ()==ID_notequal)
438
440
{
439
- DATA_INVARIANT (expr.operands ().size () == 2 , " notequal expects two operands" );
440
- return !convert_equality (equal_exprt (expr.op0 (), expr.op1 ()));
441
+ const auto ¬equal_expr = to_notequal_expr (expr);
442
+ return !convert_equality (
443
+ equal_exprt (notequal_expr.lhs (), notequal_expr.rhs ()));
441
444
}
442
445
else if (expr.id ()==ID_ieee_float_equal ||
443
446
expr.id ()==ID_ieee_float_notequal)
444
- return convert_ieee_float_rel (expr);
447
+ {
448
+ return convert_ieee_float_rel (to_binary_relation_expr (expr));
449
+ }
445
450
else if (expr.id ()==ID_le || expr.id ()==ID_ge ||
446
451
expr.id ()==ID_lt || expr.id ()==ID_gt)
447
- return convert_bv_rel (expr);
452
+ {
453
+ return convert_bv_rel (to_binary_relation_expr (expr));
454
+ }
448
455
else if (expr.id ()==ID_extractbit)
449
456
return convert_extractbit (to_extractbit_expr (expr));
450
457
else if (expr.id ()==ID_forall)
@@ -505,53 +512,56 @@ literalt boolbvt::convert_rest(const exprt &expr)
505
512
return convert_overflow (expr);
506
513
else if (expr.id ()==ID_isnan)
507
514
{
508
- DATA_INVARIANT (expr. operands (). size () == 1 , " isnan expects one operand " );
509
- const bvt &bv= convert_bv (operands[ 0 ] );
515
+ const auto &op = to_unary_expr (expr). op ( );
516
+ const bvt &bv = convert_bv (op );
510
517
511
- if (expr. op0 (). type ().id ()== ID_floatbv)
518
+ if (op. type ().id () == ID_floatbv)
512
519
{
513
- float_utilst float_utils (prop, to_floatbv_type (expr. op0 () .type ()));
520
+ float_utilst float_utils (prop, to_floatbv_type (op .type ()));
514
521
return float_utils.is_NaN (bv);
515
522
}
516
- else if (expr. op0 () .type ().id () == ID_fixedbv)
523
+ else if (op .type ().id () == ID_fixedbv)
517
524
return const_literal (false );
518
525
}
519
526
else if (expr.id ()==ID_isfinite)
520
527
{
521
- DATA_INVARIANT (expr.operands ().size () == 1 , " isfinite expects one operand" );
522
- const bvt &bv=convert_bv (operands[0 ]);
523
- if (expr.op0 ().type ().id ()==ID_floatbv)
528
+ const auto &op = to_unary_expr (expr).op ();
529
+ const bvt &bv = convert_bv (op);
530
+
531
+ if (op.type ().id () == ID_floatbv)
524
532
{
525
- float_utilst float_utils (prop, to_floatbv_type (expr. op0 () .type ()));
533
+ float_utilst float_utils (prop, to_floatbv_type (op .type ()));
526
534
return prop.land (
527
535
!float_utils.is_infinity (bv),
528
536
!float_utils.is_NaN (bv));
529
537
}
530
- else if (expr. op0 (). type () .id () == ID_fixedbv)
538
+ else if (op .id () == ID_fixedbv)
531
539
return const_literal (true );
532
540
}
533
541
else if (expr.id ()==ID_isinf)
534
542
{
535
- DATA_INVARIANT (expr.operands ().size () == 1 , " isinf expects one operand" );
536
- const bvt &bv=convert_bv (operands[0 ]);
537
- if (expr.op0 ().type ().id ()==ID_floatbv)
543
+ const auto &op = to_unary_expr (expr).op ();
544
+ const bvt &bv = convert_bv (op);
545
+
546
+ if (op.type ().id () == ID_floatbv)
538
547
{
539
- float_utilst float_utils (prop, to_floatbv_type (expr. op0 () .type ()));
548
+ float_utilst float_utils (prop, to_floatbv_type (op .type ()));
540
549
return float_utils.is_infinity (bv);
541
550
}
542
- else if (expr. op0 () .type ().id () == ID_fixedbv)
551
+ else if (op .type ().id () == ID_fixedbv)
543
552
return const_literal (false );
544
553
}
545
554
else if (expr.id ()==ID_isnormal)
546
555
{
547
- DATA_INVARIANT (expr.operands ().size () == 1 , " isnormal expects one operand" );
548
- if (expr.op0 ().type ().id ()==ID_floatbv)
556
+ const auto &op = to_unary_expr (expr).op ();
557
+
558
+ if (op.type ().id () == ID_floatbv)
549
559
{
550
- const bvt &bv = convert_bv (operands[ 0 ] );
551
- float_utilst float_utils (prop, to_floatbv_type (expr. op0 () .type ()));
560
+ const bvt &bv = convert_bv (op );
561
+ float_utilst float_utils (prop, to_floatbv_type (op .type ()));
552
562
return float_utils.is_normal (bv);
553
563
}
554
- else if (expr. op0 () .type ().id () == ID_fixedbv)
564
+ else if (op .type ().id () == ID_fixedbv)
555
565
return const_literal (true );
556
566
}
557
567
0 commit comments