Exemplo n.º 1
0
void print_unit(Output& out, const Unit* unit) {
  out.fmtln("# {} starts here", unit->filepath());
  out.nl();
  print_unit_metadata(out, unit);
  for (auto* func : unit->funcs())        print_func(out, func);
  for (auto& cls : unit->preclasses())    print_cls(out, cls.get());
  for (auto& alias : unit->typeAliases()) print_alias(out, alias);
  out.fmtln("# {} ends here", unit->filepath());
}
void InstructionPrinter::print_phi(int i, Value v, BlockBegin* b) {
  Phi* phi = v->as_Phi();
  output()->print("%2d  ", i);
  print_value(v);
  // print phi operands
  if (phi && phi->block() == b) {
    output()->print(" [");
    for (int j = 0; j < phi->operand_count(); j ++) {
      output()->print(" ");
      Value opd = phi->operand_at(j);
      if (opd) print_value(opd);
      else output()->print("NULL");
    }
    output()->print("] ");
  }
  print_alias(v);
}