@@ -662,7 +662,7 @@ simplify_exprt::simplify_minus(const minus_exprt &expr)
662
662
simplify_exprt::resultt<>
663
663
simplify_exprt::simplify_bitwise (const multi_ary_exprt &expr)
664
664
{
665
- if (!is_bitvector_type (expr.type ()))
665
+ if (!can_cast_type<bitvector_typet> (expr.type ()))
666
666
return unchanged (expr);
667
667
668
668
// check if these are really boolean
@@ -838,7 +838,7 @@ simplify_exprt::simplify_extractbit(const extractbit_exprt &expr)
838
838
{
839
839
const typet &src_type = expr.src ().type ();
840
840
841
- if (!is_bitvector_type (src_type))
841
+ if (!can_cast_type<bitvector_typet> (src_type))
842
842
return unchanged (expr);
843
843
844
844
const std::size_t src_bit_width = to_bitvector_type (src_type).get_width ();
@@ -869,7 +869,7 @@ simplify_exprt::simplify_concatenation(const concatenation_exprt &expr)
869
869
870
870
concatenation_exprt new_expr = expr;
871
871
872
- if (is_bitvector_type (new_expr.type ()))
872
+ if (can_cast_type<bitvector_typet> (new_expr.type ()))
873
873
{
874
874
// first, turn bool into bvec[1]
875
875
Forall_operands (it, new_expr)
@@ -891,10 +891,10 @@ simplify_exprt::simplify_concatenation(const concatenation_exprt &expr)
891
891
exprt &opi = new_expr.operands ()[i];
892
892
exprt &opn = new_expr.operands ()[i + 1 ];
893
893
894
- if (opi. is_constant () &&
895
- opn.is_constant () &&
896
- is_bitvector_type (opi.type ()) &&
897
- is_bitvector_type (opn.type ()))
894
+ if (
895
+ opi. is_constant () && opn.is_constant () &&
896
+ can_cast_type<bitvector_typet> (opi.type ()) &&
897
+ can_cast_type<bitvector_typet> (opn.type ()))
898
898
{
899
899
// merge!
900
900
const auto &value_i = to_constant_expr (opi).get_value ();
@@ -963,12 +963,10 @@ simplify_exprt::simplify_concatenation(const concatenation_exprt &expr)
963
963
exprt &opi = new_expr.operands ()[i];
964
964
exprt &opn = new_expr.operands ()[i + 1 ];
965
965
966
- if (opi.is_constant () &&
967
- opn.is_constant () &&
968
- (opi.type ().id ()==ID_verilog_unsignedbv ||
969
- is_bitvector_type (opi.type ())) &&
970
- (opn.type ().id ()==ID_verilog_unsignedbv ||
971
- is_bitvector_type (opn.type ())))
966
+ if (
967
+ opi.is_constant () && opn.is_constant () &&
968
+ can_cast_type<bitvector_typet>(opi.type ()) &&
969
+ can_cast_type<bitvector_typet>(opn.type ()))
972
970
{
973
971
// merge!
974
972
const std::string new_value=
@@ -1001,7 +999,7 @@ simplify_exprt::simplify_concatenation(const concatenation_exprt &expr)
1001
999
simplify_exprt::resultt<>
1002
1000
simplify_exprt::simplify_shifts (const shift_exprt &expr)
1003
1001
{
1004
- if (!is_bitvector_type (expr.type ()))
1002
+ if (!can_cast_type<bitvector_typet> (expr.type ()))
1005
1003
return unchanged (expr);
1006
1004
1007
1005
const auto distance = numeric_cast<mp_integer>(expr.distance ());
@@ -1132,8 +1130,9 @@ simplify_exprt::simplify_extractbits(const extractbits_exprt &expr)
1132
1130
{
1133
1131
const typet &op0_type = expr.src ().type ();
1134
1132
1135
- if (!is_bitvector_type (op0_type) &&
1136
- !is_bitvector_type (expr.type ()))
1133
+ if (
1134
+ !can_cast_type<bitvector_typet>(op0_type) &&
1135
+ !can_cast_type<bitvector_typet>(expr.type ()))
1137
1136
{
1138
1137
return unchanged (expr);
1139
1138
}
0 commit comments