| 2942 | } while(0) |
| 2943 | |
| 2944 | void Memory::print_array(ostream &os, const expr &a, unsigned indent) const { |
| 2945 | expr idx, val, a2, cond, then, els; |
| 2946 | if (a.isConstArray(val)) { |
| 2947 | os << "*: " << Byte(*this, std::move(val)) << '\n'; |
| 2948 | } |
| 2949 | else if (a.isStore(a2, idx, val)) { |
| 2950 | idx.printUnsigned(os); |
| 2951 | os << ": " << Byte(*this, std::move(val)) << '\n'; |
| 2952 | print_array(os, a2); |
| 2953 | } |
| 2954 | else if (a.isLambda(val)) { |
| 2955 | print_array(os, val.subst_var(expr::mkVar("idx", a.lambdaIdxType()))); |
| 2956 | } |
| 2957 | else if (a.isBV() && a.isConst() && a.bits() == Byte::bitsByte()) { |
| 2958 | os << Byte(*this, expr(a)) << '\n'; |
| 2959 | } |
| 2960 | else if (a.isIf(cond, then, els)) { |
| 2961 | auto print_spaces = [&](unsigned limit) { |
| 2962 | for (unsigned i = 0; i < limit; ++i) { |
| 2963 | os << " "; |
| 2964 | } |
| 2965 | }; |
| 2966 | os << "if " << cond << '\n'; |
| 2967 | print_spaces(indent + 1); |
| 2968 | print_array(os, then, indent + 1); |
| 2969 | print_spaces(indent); |
| 2970 | os << "else\n"; |
| 2971 | print_spaces(indent + 1); |
| 2972 | print_array(os, els, indent + 1); |
| 2973 | } |
| 2974 | else { |
| 2975 | os << a << '\n'; |
| 2976 | } |
| 2977 | } |
| 2978 | |
| 2979 | void Memory::print(ostream &os, const Model &m) const { |
| 2980 | if (memory_unused()) |
nothing calls this directly
no test coverage detected