@@ -97,7 +97,7 @@ bool boolbvt::literal(
9797 const typet &subtype = c.type ();
9898
9999 if (c.get_name () == component_name)
100- return literal (expr. op0 (), bit+ offset, dest);
100+ return literal (member_expr. struct_op (), bit + offset, dest);
101101
102102 std::size_t element_width=boolbv_width (subtype);
103103 CHECK_RETURN (element_width != 0 );
@@ -190,7 +190,7 @@ bvt boolbvt::convert_bitvector(const exprt &expr)
190190 else if (expr.id ()==ID_with)
191191 return convert_with (to_with_expr (expr));
192192 else if (expr.id ()==ID_update)
193- return convert_update (expr);
193+ return convert_update (to_update_expr ( expr) );
194194 else if (expr.id ()==ID_width)
195195 {
196196 std::size_t result_width=boolbv_width (expr.type ());
@@ -201,7 +201,7 @@ bvt boolbvt::convert_bitvector(const exprt &expr)
201201 if (expr.operands ().size ()!=1 )
202202 return conversion_failed (expr);
203203
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 ());
205205
206206 if (op_width==0 )
207207 return conversion_failed (expr);
@@ -240,7 +240,9 @@ bvt boolbvt::convert_bitvector(const exprt &expr)
240240 else if (expr.id ()==ID_floatbv_plus || expr.id ()==ID_floatbv_minus ||
241241 expr.id ()==ID_floatbv_mult || expr.id ()==ID_floatbv_div ||
242242 expr.id ()==ID_floatbv_rem)
243- return convert_floatbv_op (expr);
243+ {
244+ return convert_floatbv_op (to_ieee_float_op_expr (expr));
245+ }
244246 else if (expr.id ()==ID_floatbv_typecast)
245247 return convert_floatbv_typecast (to_floatbv_typecast_expr (expr));
246248 else if (expr.id ()==ID_concatenation)
@@ -425,7 +427,6 @@ bvt boolbvt::convert_function_application(
425427literalt boolbvt::convert_rest (const exprt &expr)
426428{
427429 PRECONDITION (expr.type ().id () == ID_bool);
428- const exprt::operandst &operands=expr.operands ();
429430
430431 if (expr.id ()==ID_typecast)
431432 return convert_typecast (to_typecast_expr (expr));
@@ -436,15 +437,20 @@ literalt boolbvt::convert_rest(const exprt &expr)
436437 return convert_verilog_case_equality (to_binary_relation_expr (expr));
437438 else if (expr.id ()==ID_notequal)
438439 {
439- DATA_INVARIANT (expr.operands ().size () == 2 , " notequal expects two operands" );
440- return !convert_equality (equal_exprt (expr.op0 (), expr.op1 ()));
440+ const auto ¬equal_expr = to_notequal_expr (expr);
441+ return !convert_equality (
442+ equal_exprt (notequal_expr.lhs (), notequal_expr.rhs ()));
441443 }
442444 else if (expr.id ()==ID_ieee_float_equal ||
443445 expr.id ()==ID_ieee_float_notequal)
444- return convert_ieee_float_rel (expr);
446+ {
447+ return convert_ieee_float_rel (to_binary_relation_expr (expr));
448+ }
445449 else if (expr.id ()==ID_le || expr.id ()==ID_ge ||
446450 expr.id ()==ID_lt || expr.id ()==ID_gt)
447- return convert_bv_rel (expr);
451+ {
452+ return convert_bv_rel (to_binary_relation_expr (expr));
453+ }
448454 else if (expr.id ()==ID_extractbit)
449455 return convert_extractbit (to_extractbit_expr (expr));
450456 else if (expr.id ()==ID_forall)
@@ -486,10 +492,10 @@ literalt boolbvt::convert_rest(const exprt &expr)
486492 }
487493 else if (expr.id ()==ID_sign)
488494 {
489- DATA_INVARIANT (expr. operands (). size () == 1 , " sign expects one operand " );
490- const bvt &bv= convert_bv (operands[ 0 ] );
495+ const auto &op = to_sign_expr (expr). op ( );
496+ const bvt &bv = convert_bv (op );
491497 CHECK_RETURN (!bv.empty ());
492- const irep_idt type_id = operands[ 0 ] .type ().id ();
498+ const irep_idt type_id = op .type ().id ();
493499 if (type_id == ID_signedbv || type_id == ID_fixedbv || type_id == ID_floatbv)
494500 return bv[bv.size ()-1 ];
495501 if (type_id == ID_unsignedbv)
@@ -505,53 +511,56 @@ literalt boolbvt::convert_rest(const exprt &expr)
505511 return convert_overflow (expr);
506512 else if (expr.id ()==ID_isnan)
507513 {
508- DATA_INVARIANT (expr. operands (). size () == 1 , " isnan expects one operand " );
509- const bvt &bv= convert_bv (operands[ 0 ] );
514+ const auto &op = to_unary_expr (expr). op ( );
515+ const bvt &bv = convert_bv (op );
510516
511- if (expr. op0 (). type ().id ()== ID_floatbv)
517+ if (op. type ().id () == ID_floatbv)
512518 {
513- float_utilst float_utils (prop, to_floatbv_type (expr. op0 () .type ()));
519+ float_utilst float_utils (prop, to_floatbv_type (op .type ()));
514520 return float_utils.is_NaN (bv);
515521 }
516- else if (expr. op0 () .type ().id () == ID_fixedbv)
522+ else if (op .type ().id () == ID_fixedbv)
517523 return const_literal (false );
518524 }
519525 else if (expr.id ()==ID_isfinite)
520526 {
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)
527+ const auto &op = to_unary_expr (expr).op ();
528+ const bvt &bv = convert_bv (op);
529+
530+ if (op.type ().id () == ID_floatbv)
524531 {
525- float_utilst float_utils (prop, to_floatbv_type (expr. op0 () .type ()));
532+ float_utilst float_utils (prop, to_floatbv_type (op .type ()));
526533 return prop.land (
527534 !float_utils.is_infinity (bv),
528535 !float_utils.is_NaN (bv));
529536 }
530- else if (expr. op0 (). type () .id () == ID_fixedbv)
537+ else if (op .id () == ID_fixedbv)
531538 return const_literal (true );
532539 }
533540 else if (expr.id ()==ID_isinf)
534541 {
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)
542+ const auto &op = to_unary_expr (expr).op ();
543+ const bvt &bv = convert_bv (op);
544+
545+ if (op.type ().id () == ID_floatbv)
538546 {
539- float_utilst float_utils (prop, to_floatbv_type (expr. op0 () .type ()));
547+ float_utilst float_utils (prop, to_floatbv_type (op .type ()));
540548 return float_utils.is_infinity (bv);
541549 }
542- else if (expr. op0 () .type ().id () == ID_fixedbv)
550+ else if (op .type ().id () == ID_fixedbv)
543551 return const_literal (false );
544552 }
545553 else if (expr.id ()==ID_isnormal)
546554 {
547- DATA_INVARIANT (expr.operands ().size () == 1 , " isnormal expects one operand" );
548- if (expr.op0 ().type ().id ()==ID_floatbv)
555+ const auto &op = to_unary_expr (expr).op ();
556+
557+ if (op.type ().id () == ID_floatbv)
549558 {
550- const bvt &bv = convert_bv (operands[ 0 ] );
551- float_utilst float_utils (prop, to_floatbv_type (expr. op0 () .type ()));
559+ const bvt &bv = convert_bv (op );
560+ float_utilst float_utils (prop, to_floatbv_type (op .type ()));
552561 return float_utils.is_normal (bv);
553562 }
554- else if (expr. op0 () .type ().id () == ID_fixedbv)
563+ else if (op .type ().id () == ID_fixedbv)
555564 return const_literal (true );
556565 }
557566
0 commit comments