|
| 1 | +/*******************************************************************\ |
| 2 | +
|
| 3 | +Module: SMV Expressions |
| 4 | +
|
| 5 | +Author: Daniel Kroening, [email protected] |
| 6 | +
|
| 7 | +\*******************************************************************/ |
| 8 | + |
| 9 | +#ifndef CPROVER_SMV_EXPR_H |
| 10 | +#define CPROVER_SMV_EXPR_H |
| 11 | + |
| 12 | +class smv_resize_exprt : public binary_exprt |
| 13 | +{ |
| 14 | +public: |
| 15 | + smv_resize_exprt(exprt __op, constant_exprt __size, typet __type) |
| 16 | + : binary_exprt{ |
| 17 | + std::move(__op), |
| 18 | + ID_smv_resize, |
| 19 | + std::move(__size), |
| 20 | + std::move(__type)} |
| 21 | + { |
| 22 | + } |
| 23 | + |
| 24 | + const exprt &op() const |
| 25 | + { |
| 26 | + return op0(); |
| 27 | + } |
| 28 | + |
| 29 | + exprt &op() |
| 30 | + { |
| 31 | + return op0(); |
| 32 | + } |
| 33 | + |
| 34 | + const constant_exprt &size() const |
| 35 | + { |
| 36 | + return static_cast<const constant_exprt &>(op1()); |
| 37 | + } |
| 38 | + |
| 39 | + constant_exprt &size() |
| 40 | + { |
| 41 | + return static_cast<constant_exprt &>(op1()); |
| 42 | + } |
| 43 | + |
| 44 | +protected: |
| 45 | + using binary_exprt::op0; |
| 46 | + using binary_exprt::op1; |
| 47 | +}; |
| 48 | + |
| 49 | +inline const smv_resize_exprt &to_smv_resize_expr(const exprt &expr) |
| 50 | +{ |
| 51 | + PRECONDITION(expr.id() == ID_smv_resize); |
| 52 | + smv_resize_exprt::check(expr); |
| 53 | + return static_cast<const smv_resize_exprt &>(expr); |
| 54 | +} |
| 55 | + |
| 56 | +inline smv_resize_exprt &to_smv_resize_expr(exprt &expr) |
| 57 | +{ |
| 58 | + PRECONDITION(expr.id() == ID_smv_resize); |
| 59 | + smv_resize_exprt::check(expr); |
| 60 | + return static_cast<smv_resize_exprt &>(expr); |
| 61 | +} |
| 62 | + |
| 63 | +class smv_extend_exprt : public binary_exprt |
| 64 | +{ |
| 65 | +public: |
| 66 | + smv_extend_exprt(exprt __op, constant_exprt __size, typet __type) |
| 67 | + : binary_exprt{ |
| 68 | + std::move(__op), |
| 69 | + ID_smv_extend, |
| 70 | + std::move(__size), |
| 71 | + std::move(__type)} |
| 72 | + { |
| 73 | + } |
| 74 | + |
| 75 | + const exprt &op() const |
| 76 | + { |
| 77 | + return op0(); |
| 78 | + } |
| 79 | + |
| 80 | + exprt &op() |
| 81 | + { |
| 82 | + return op0(); |
| 83 | + } |
| 84 | + |
| 85 | + const constant_exprt &size() const |
| 86 | + { |
| 87 | + return static_cast<const constant_exprt &>(op1()); |
| 88 | + } |
| 89 | + |
| 90 | + constant_exprt &size() |
| 91 | + { |
| 92 | + return static_cast<constant_exprt &>(op1()); |
| 93 | + } |
| 94 | + |
| 95 | +protected: |
| 96 | + using binary_exprt::op0; |
| 97 | + using binary_exprt::op1; |
| 98 | +}; |
| 99 | + |
| 100 | +inline const smv_extend_exprt &to_smv_extend_expr(const exprt &expr) |
| 101 | +{ |
| 102 | + PRECONDITION(expr.id() == ID_smv_extend); |
| 103 | + smv_extend_exprt::check(expr); |
| 104 | + return static_cast<const smv_extend_exprt &>(expr); |
| 105 | +} |
| 106 | + |
| 107 | +inline smv_extend_exprt &to_smv_extend_expr(exprt &expr) |
| 108 | +{ |
| 109 | + PRECONDITION(expr.id() == ID_smv_extend); |
| 110 | + smv_extend_exprt::check(expr); |
| 111 | + return static_cast<smv_extend_exprt &>(expr); |
| 112 | +} |
| 113 | + |
| 114 | +class smv_unsigned_cast_exprt : public unary_exprt |
| 115 | +{ |
| 116 | +public: |
| 117 | + smv_unsigned_cast_exprt(exprt __op, typet __type) |
| 118 | + : unary_exprt{ID_smv_unsigned_cast, std::move(__op), std::move(__type)} |
| 119 | + { |
| 120 | + } |
| 121 | +}; |
| 122 | + |
| 123 | +inline const smv_unsigned_cast_exprt & |
| 124 | +to_smv_unsigned_cast_expr(const exprt &expr) |
| 125 | +{ |
| 126 | + PRECONDITION(expr.id() == ID_smv_unsigned_cast); |
| 127 | + smv_unsigned_cast_exprt::check(expr); |
| 128 | + return static_cast<const smv_unsigned_cast_exprt &>(expr); |
| 129 | +} |
| 130 | + |
| 131 | +inline smv_unsigned_cast_exprt &to_smv_unsigned_cast_expr(exprt &expr) |
| 132 | +{ |
| 133 | + PRECONDITION(expr.id() == ID_smv_unsigned_cast); |
| 134 | + smv_unsigned_cast_exprt::check(expr); |
| 135 | + return static_cast<smv_unsigned_cast_exprt &>(expr); |
| 136 | +} |
| 137 | + |
| 138 | +class smv_signed_cast_exprt : public unary_exprt |
| 139 | +{ |
| 140 | +public: |
| 141 | + smv_signed_cast_exprt(exprt __op, typet __type) |
| 142 | + : unary_exprt{ID_smv_signed_cast, std::move(__op), std::move(__type)} |
| 143 | + { |
| 144 | + } |
| 145 | +}; |
| 146 | + |
| 147 | +inline const smv_signed_cast_exprt &to_smv_signed_cast_expr(const exprt &expr) |
| 148 | +{ |
| 149 | + PRECONDITION(expr.id() == ID_smv_signed_cast); |
| 150 | + smv_signed_cast_exprt::check(expr); |
| 151 | + return static_cast<const smv_signed_cast_exprt &>(expr); |
| 152 | +} |
| 153 | + |
| 154 | +inline smv_signed_cast_exprt &to_smv_signed_cast_expr(exprt &expr) |
| 155 | +{ |
| 156 | + PRECONDITION(expr.id() == ID_smv_signed_cast); |
| 157 | + smv_signed_cast_exprt::check(expr); |
| 158 | + return static_cast<smv_signed_cast_exprt &>(expr); |
| 159 | +} |
| 160 | + |
| 161 | +#endif // CPROVER_SMV_EXPR_H |
0 commit comments