summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mca/BackendPrinter.cpp
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2018-03-09 13:52:03 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2018-03-09 13:52:03 +0000
commit0cc66c7954144fc640b363abf57c67052c0efab2 (patch)
treed0cdc5fa9e5fdf54f7ab94119f46ed1b558e38b3 /llvm/tools/llvm-mca/BackendPrinter.cpp
parent824913bdb71024a9d90942c0249e674c01001214 (diff)
downloadbcm5719-llvm-0cc66c7954144fc640b363abf57c67052c0efab2.tar.gz
bcm5719-llvm-0cc66c7954144fc640b363abf57c67052c0efab2.zip
[llvm-mca] Move the logic that prints the summary into its own view. NFCI
llvm-svn: 327128
Diffstat (limited to 'llvm/tools/llvm-mca/BackendPrinter.cpp')
-rw-r--r--llvm/tools/llvm-mca/BackendPrinter.cpp69
1 files changed, 0 insertions, 69 deletions
diff --git a/llvm/tools/llvm-mca/BackendPrinter.cpp b/llvm/tools/llvm-mca/BackendPrinter.cpp
index d98082ad237..7772903a3d7 100644
--- a/llvm/tools/llvm-mca/BackendPrinter.cpp
+++ b/llvm/tools/llvm-mca/BackendPrinter.cpp
@@ -20,76 +20,7 @@ namespace mca {
using namespace llvm;
-void BackendPrinter::printGeneralStatistics(raw_ostream &OS,
- unsigned Iterations,
- unsigned Cycles,
- unsigned Instructions,
- unsigned DispatchWidth) const {
- unsigned TotalInstructions = Instructions * Iterations;
- double IPC = (double)TotalInstructions / Cycles;
-
- std::string Buffer;
- raw_string_ostream TempStream(Buffer);
- TempStream << "Iterations: " << Iterations;
- TempStream << "\nInstructions: " << TotalInstructions;
- TempStream << "\nTotal Cycles: " << Cycles;
- TempStream << "\nDispatch Width: " << DispatchWidth;
- TempStream << "\nIPC: " << format("%.2f", IPC) << '\n';
- TempStream.flush();
- OS << Buffer;
-}
-
-void BackendPrinter::printInstructionInfo(raw_ostream &OS) const {
- std::string Buffer;
- raw_string_ostream TempStream(Buffer);
-
- 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 = B.getNumInstructions(); I < E; ++I) {
- const MCInst &Inst = B.getMCInstFromIndex(I);
- const InstrDesc &ID = B.getInstrDesc(Inst);
- unsigned NumMicroOpcodes = ID.NumMicroOps;
- unsigned Latency = ID.MaxLatency;
- double RThroughput = B.getRThroughput(ID);
- TempStream << ' ' << NumMicroOpcodes << " ";
- if (NumMicroOpcodes < 10)
- TempStream << " ";
- else if (NumMicroOpcodes < 100)
- TempStream << ' ';
- TempStream << Latency << " ";
- if (Latency < 10.0)
- TempStream << " ";
- else if (Latency < 100.0)
- TempStream << ' ';
- if (RThroughput) {
- TempStream << format("%.2f", RThroughput) << ' ';
- if (RThroughput < 10.0)
- TempStream << " ";
- else if (RThroughput < 100.0)
- TempStream << ' ';
- } else {
- TempStream << " - ";
- }
- TempStream << (ID.MayLoad ? " * " : " ");
- TempStream << (ID.MayStore ? " * " : " ");
- TempStream << (ID.HasSideEffects ? " * " : " ");
- MCIP.printInst(&Inst, TempStream, "", B.getSTI());
- TempStream << '\n';
- }
-
- TempStream.flush();
- OS << Buffer;
-}
-
void BackendPrinter::printReport(llvm::raw_ostream &OS) const {
- unsigned Cycles = B.getNumCycles();
- printGeneralStatistics(OS, B.getNumIterations(), Cycles, B.getNumInstructions(),
- B.getDispatchWidth());
- printInstructionInfo(OS);
-
for (const auto &V : Views)
V->printView(OS);
}
OpenPOWER on IntegriCloud