void print(std::ostream& os, const SSATmp* tmp) { if (tmp->inst()->is(DefConst)) { os << constToString(tmp->type()); return; } os << color(ANSI_COLOR_WHITE); os << "t" << tmp->id(); os << color(ANSI_COLOR_END); os << punc(":") << color(ANSI_COLOR_GREEN) << tmp->type().toString() << color(ANSI_COLOR_END) ; }
void printOpcode(std::ostream& os, const IRInstruction* inst, const GuardConstraints* guards) { os << color(ANSI_COLOR_CYAN) << opcodeName(inst->op()) << color(ANSI_COLOR_END) ; auto const typeParam = inst->typeParam(); auto const hasTypeParam = !typeParam.equals(Type::None); auto const hasExtra = inst->hasExtra(); auto const isGuard = guards && !inst->isTransient() && isGuardOp(inst->op()); if (!hasTypeParam && !hasExtra && !isGuard) return; os << color(ANSI_COLOR_LIGHT_BLUE) << '<' << color(ANSI_COLOR_END); if (hasTypeParam) { os << color(ANSI_COLOR_GREEN) << typeParam.toString() << color(ANSI_COLOR_END) ; if (hasExtra || isGuard) os << punc(","); } if (inst->op() == LdConst) { os << constToString(inst->typeParam(), inst->extra<LdConst>()); } else { if (hasExtra) { os << color(ANSI_COLOR_GREEN) << showExtra(inst->op(), inst->rawExtra()) << color(ANSI_COLOR_END); if (isGuard) os << punc(","); } } if (isGuard) { auto it = guards->find(inst); os << (it == guards->end() ? "unused" : it->second.toString()); } os << color(ANSI_COLOR_LIGHT_BLUE) << '>' << color(ANSI_COLOR_END); }