[llvm-mca] Split the InstructionInfoView from the SummaryView.
llvm-svn: 328358
diff --git a/llvm/tools/llvm-mca/SummaryView.cpp b/llvm/tools/llvm-mca/SummaryView.cpp
index ccc7e5d..f7d0900 100644
--- a/llvm/tools/llvm-mca/SummaryView.cpp
+++ b/llvm/tools/llvm-mca/SummaryView.cpp
@@ -14,13 +14,15 @@
//===----------------------------------------------------------------------===//
#include "SummaryView.h"
-#include "llvm/CodeGen/TargetSchedule.h"
+#include "llvm/Support/Format.h"
namespace mca {
+#define DEBUG_TYPE "llvm-mca"
+
using namespace llvm;
-void SummaryView::printSummary(raw_ostream &OS) const {
+void SummaryView::printView(raw_ostream &OS) const {
unsigned Iterations = Source.getNumIterations();
unsigned Instructions = Source.size();
unsigned TotalInstructions = Instructions * Iterations;
@@ -37,58 +39,4 @@
OS << Buffer;
}
-void SummaryView::printInstructionInfo(raw_ostream &OS) const {
- std::string Buffer;
- raw_string_ostream TempStream(Buffer);
- const MCSchedModel &SM = STI.getSchedModel();
- unsigned Instructions = Source.size();
-
- TempStream << "\n\nInstruction Info:\n";
- TempStream << "[1]: #uOps\n[2]: Latency\n[3]: RThroughput\n"
- << "[4]: MayLoad\n[5]: MayStore\n[6]: HasSideEffects\n\n";
-
- TempStream << "[1] [2] [3] [4] [5] [6]\tInstructions:\n";
- for (unsigned I = 0, E = Instructions; I < E; ++I) {
- const MCInst &Inst = Source.getMCInstFromIndex(I);
- const MCInstrDesc &MCDesc = MCII.get(Inst.getOpcode());
- const MCSchedClassDesc &SCDesc =
- *SM.getSchedClassDesc(MCDesc.getSchedClass());
-
- unsigned NumMicroOpcodes = SCDesc.NumMicroOps;
- unsigned Latency = MCSchedModel::computeInstrLatency(STI, SCDesc);
- Optional<double> RThroughput =
- MCSchedModel::getReciprocalThroughput(STI, SCDesc);
-
- TempStream << ' ' << NumMicroOpcodes << " ";
- if (NumMicroOpcodes < 10)
- TempStream << " ";
- else if (NumMicroOpcodes < 100)
- TempStream << ' ';
- TempStream << Latency << " ";
- if (Latency < 10)
- TempStream << " ";
- else if (Latency < 100)
- TempStream << ' ';
-
- if (RThroughput.hasValue()) {
- double RT = RThroughput.getValue();
- TempStream << format("%.2f", RT) << ' ';
- if (RT < 10.0)
- TempStream << " ";
- else if (RT < 100.0)
- TempStream << ' ';
- } else {
- TempStream << " - ";
- }
- TempStream << (MCDesc.mayLoad() ? " * " : " ");
- TempStream << (MCDesc.mayStore() ? " * " : " ");
- TempStream << (MCDesc.hasUnmodeledSideEffects() ? " * " : " ");
- MCIP.printInst(&Inst, TempStream, "", STI);
- TempStream << '\n';
- }
-
- TempStream.flush();
- OS << Buffer;
-}
-
} // namespace mca.