예제 #1
0
void print(std::ostream& ostream, const IRInstruction* inst,
           const RegAllocInfo* regs, const LifetimeInfo* lifetime) {
  if (inst->op() == Marker) {
    auto* marker = inst->extra<Marker>();
    ostream << color(ANSI_COLOR_BLUE)
            << marker->show()
            << color(ANSI_COLOR_END);
    return;
  }

  if (!inst->isTransient()) {
    ostream << color(ANSI_COLOR_YELLOW);
    if (!lifetime || !lifetime->linear[inst]) {
      ostream << folly::format("({:02d}) ", inst->id());
    } else {
      ostream << folly::format("({:02d}@{:02d}) ", inst->id(),
                               lifetime->linear[inst]);
    }
    ostream << color(ANSI_COLOR_END);
  }
  printDst(ostream, inst, regs, lifetime);
  printOpcode(ostream, inst);
  printSrcs(ostream, inst, regs, lifetime);

  if (Block* taken = inst->taken()) {
    ostream << punc(" -> ");
    printLabel(ostream, taken);
  }
}
예제 #2
0
void print(std::ostream& ostream, const IRInstruction* inst,
           const RegAllocInfo* regs, const LifetimeInfo* lifetime) {
  if (inst->op() == Marker) {
    auto* marker = inst->getExtra<Marker>();
    ostream << color(ANSI_COLOR_BLUE)
            << folly::format("--- bc {}, spOff {} ({})",
                             marker->bcOff,
                             marker->stackOff,
                             marker->func->fullName()->data())
            << color(ANSI_COLOR_END);
    return;
  }

  if (!inst->isTransient()) {
    ostream << color(ANSI_COLOR_YELLOW);
    if (!lifetime || !lifetime->linear[inst]) {
      ostream << folly::format("({:02d}) ", inst->getId());
    } else {
      ostream << folly::format("({:02d}@{:02d}) ", inst->getId(),
                               lifetime->linear[inst]);
    }
    ostream << color(ANSI_COLOR_END);
  }
  printDst(ostream, inst, regs, lifetime);
  printOpcode(ostream, inst);
  printSrcs(ostream, inst, regs, lifetime);

  if (Block* taken = inst->getTaken()) {
    ostream << punc(" -> ");
    printLabel(ostream, taken);
  }

  if (TCA tca = inst->getTCA()) {
    ostream << punc(", ");
    if (tca == kIRDirectJccJmpActive) {
      ostream << "JccJmp_Exit ";
    }
    else if (tca == kIRDirectJccActive) {
      ostream << "Jcc_Exit ";
    }
    else if (tca == kIRDirectGuardActive) {
      ostream << "Guard_Exit ";
    }
    else {
      ostream << (void*)tca;
    }
  }
}