void logRegisterPressure(Code& code) { const unsigned totalColumns = 200; const unsigned registerColumns = 100; RegLiveness liveness(code); for (BasicBlock* block : code) { RegLiveness::LocalCalc localCalc(liveness, block); block->dumpHeader(WTF::dataFile()); Vector<CString> instDumps; for (unsigned instIndex = block->size(); instIndex--;) { Inst& inst = block->at(instIndex); Inst* prevInst = block->get(instIndex - 1); localCalc.execute(instIndex); RegisterSet set; set.setAll(localCalc.live()); Inst::forEachDefWithExtraClobberedRegs<Reg>( prevInst, &inst, [&] (Reg reg, Arg::Role, Arg::Type, Arg::Width) { set.set(reg); }); StringPrintStream instOut; StringPrintStream lineOut; lineOut.print(" "); if (set.numberOfSetRegisters()) { set.forEach( [&] (Reg reg) { CString text = toCString(" ", reg); if (text.length() + lineOut.length() > totalColumns) { instOut.print(lineOut.toCString(), "\n"); lineOut.reset(); lineOut.print(" "); } lineOut.print(text); }); lineOut.print(":"); } if (lineOut.length() > registerColumns) { instOut.print(lineOut.toCString(), "\n"); lineOut.reset(); } while (lineOut.length() < registerColumns) lineOut.print(" "); lineOut.print(" "); lineOut.print(inst); instOut.print(lineOut.toCString(), "\n"); instDumps.append(instOut.toCString()); } for (unsigned i = instDumps.size(); i--;) dataLog(instDumps[i]); block->dumpFooter(WTF::dataFile()); } }