Returns a constants with the value |-val| of the given type.
| 92 | |
| 93 | // Returns a constants with the value |-val| of the given type. |
| 94 | const analysis::Constant* NegateIntConst(const analysis::Type* result_type, |
| 95 | const analysis::Constant* val, |
| 96 | analysis::ConstantManager* const_mgr) { |
| 97 | const analysis::Integer* int_type = result_type->AsInteger(); |
| 98 | assert(int_type != nullptr); |
| 99 | |
| 100 | if (val->AsNullConstant()) { |
| 101 | return val; |
| 102 | } |
| 103 | |
| 104 | uint64_t new_value = static_cast<uint64_t>(-val->GetSignExtendedValue()); |
| 105 | return const_mgr->GetIntConst(new_value, int_type->width(), |
| 106 | int_type->IsSigned()); |
| 107 | } |
| 108 | |
| 109 | // Folds an OpcompositeExtract where input is a composite constant. |
| 110 | ConstantFoldingRule FoldExtractWithConstants() { |
nothing calls this directly
no test coverage detected