MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / print_array

Method print_array

ir/memory.cpp:2944–2977  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2942 } while(0)
2943
2944void 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
2979void Memory::print(ostream &os, const Model &m) const {
2980 if (memory_unused())

Callers

nothing calls this directly

Calls 13

ByteClass · 0.85
mkVarFunction · 0.85
isConstArrayMethod · 0.80
isStoreMethod · 0.80
printUnsignedMethod · 0.80
isLambdaMethod · 0.80
subst_varMethod · 0.80
lambdaIdxTypeMethod · 0.80
isBVMethod · 0.80
isIfMethod · 0.80
exprClass · 0.70
isConstMethod · 0.45

Tested by

no test coverage detected