Returns a constants with the value INF of the given type. Only works for 32-bit and 64-bit float point types. Returns |nullptr| if an error occurs.
| 46 | // Returns a constants with the value INF of the given type. Only works for |
| 47 | // 32-bit and 64-bit float point types. Returns |nullptr| if an error occurs. |
| 48 | const analysis::Constant* GetInf(const analysis::Type* type, |
| 49 | analysis::ConstantManager* const_mgr) { |
| 50 | const analysis::Float* float_type = type->AsFloat(); |
| 51 | if (float_type == nullptr) { |
| 52 | return nullptr; |
| 53 | } |
| 54 | |
| 55 | switch (float_type->width()) { |
| 56 | case 32: |
| 57 | return const_mgr->GetFloatConst(std::numeric_limits<float>::infinity()); |
| 58 | case 64: |
| 59 | return const_mgr->GetDoubleConst(std::numeric_limits<double>::infinity()); |
| 60 | default: |
| 61 | return nullptr; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | // Returns true if |type| is Float or a vector of Float. |
| 66 | bool HasFloatingPoint(const analysis::Type* type) { |
no test coverage detected