[llvm] r331540 - [llvm-mca] Add descriptive names for the TimelineView report characters. NFC.

Matt Davis via llvm-commits llvm-commits at lists.llvm.org
Fri May 4 10:19:40 PDT 2018


Author: mattd
Date: Fri May  4 10:19:40 2018
New Revision: 331540

URL: http://llvm.org/viewvc/llvm-project?rev=331540&view=rev
Log:
[llvm-mca] Add descriptive names for the TimelineView report characters. NFC.

Summary:
This change makes the TimelineView source simpler to read and easier to modify in the future.
This patch introduces a class of static chars used as the display values in the TimelineView report, this change just eliminates a few magic characters.

Reviewers: andreadb, courbet, RKSimon

Reviewed By: andreadb

Subscribers: tschuett, gbedwell, llvm-commits

Differential Revision: https://reviews.llvm.org/D46409

Modified:
    llvm/trunk/tools/llvm-mca/TimelineView.cpp
    llvm/trunk/tools/llvm-mca/TimelineView.h

Modified: llvm/trunk/tools/llvm-mca/TimelineView.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/TimelineView.cpp?rev=331540&r1=331539&r2=331540&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/TimelineView.cpp (original)
+++ llvm/trunk/tools/llvm-mca/TimelineView.cpp Fri May  4 10:19:40 2018
@@ -153,28 +153,28 @@ void TimelineView::printTimelineViewEntr
   OS << '[' << Iteration << ',' << SourceIndex << "]\t";
   for (unsigned I = 0, E = Entry.CycleDispatched; I < E; ++I)
     OS << ((I % 5 == 0) ? '.' : ' ');
-  OS << 'D';
+  OS << TimelineView::DisplayChar::Dispatched;
   if (Entry.CycleDispatched != Entry.CycleExecuted) {
     // Zero latency instructions have the same value for CycleDispatched,
     // CycleIssued and CycleExecuted.
     for (unsigned I = Entry.CycleDispatched + 1, E = Entry.CycleIssued; I < E;
          ++I)
-      OS << '=';
+      OS << TimelineView::DisplayChar::Waiting;
     if (Entry.CycleIssued == Entry.CycleExecuted)
-      OS << 'E';
+      OS << TimelineView::DisplayChar::DisplayChar::Executed;
     else {
       if (Entry.CycleDispatched != Entry.CycleIssued)
-        OS << 'e';
+        OS << TimelineView::DisplayChar::Executing;
       for (unsigned I = Entry.CycleIssued + 1, E = Entry.CycleExecuted; I < E;
            ++I)
-        OS << 'e';
-      OS << 'E';
+        OS << TimelineView::DisplayChar::Executing;
+      OS << TimelineView::DisplayChar::Executed;
     }
   }
 
   for (unsigned I = Entry.CycleExecuted + 1, E = Entry.CycleRetired; I < E; ++I)
-    OS << '-';
-  OS << 'R';
+    OS << TimelineView::DisplayChar::RetireLag;
+  OS << TimelineView::DisplayChar::Retired;
 
   // Skip other columns.
   for (unsigned I = Entry.CycleRetired + 1, E = LastCycle; I <= E; ++I)

Modified: llvm/trunk/tools/llvm-mca/TimelineView.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/TimelineView.h?rev=331540&r1=331539&r2=331540&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/TimelineView.h (original)
+++ llvm/trunk/tools/llvm-mca/TimelineView.h Fri May  4 10:19:40 2018
@@ -152,6 +152,16 @@ class TimelineView : public View {
 
   void initialize(unsigned MaxIterations);
 
+  // Display characters for the TimelineView report output.
+  struct DisplayChar {
+    static const char Dispatched = 'D';
+    static const char Executed = 'E';
+    static const char Retired = 'R';
+    static const char Waiting = '='; // Instruction is waiting in the scheduler.
+    static const char Executing = 'e';
+    static const char RetireLag = '-'; // The instruction is waiting to retire.
+  };
+
 public:
   TimelineView(const llvm::MCSubtargetInfo &sti, llvm::MCInstPrinter &Printer,
                const SourceMgr &Sequence, unsigned MaxIterations,




More information about the llvm-commits mailing list