[llvm] r329796 - [llvm-mca] Minor code cleanup. NFC
Andrea Di Biagio via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 11 05:31:45 PDT 2018
Author: adibiagio
Date: Wed Apr 11 05:31:44 2018
New Revision: 329796
URL: http://llvm.org/viewvc/llvm-project?rev=329796&view=rev
Log:
[llvm-mca] Minor code cleanup. NFC
Modified:
llvm/trunk/tools/llvm-mca/DispatchStatistics.cpp
llvm/trunk/tools/llvm-mca/DispatchStatistics.h
llvm/trunk/tools/llvm-mca/SchedulerStatistics.cpp
llvm/trunk/tools/llvm-mca/SchedulerStatistics.h
llvm/trunk/tools/llvm-mca/llvm-mca.cpp
Modified: llvm/trunk/tools/llvm-mca/DispatchStatistics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/DispatchStatistics.cpp?rev=329796&r1=329795&r2=329796&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/DispatchStatistics.cpp (original)
+++ llvm/trunk/tools/llvm-mca/DispatchStatistics.cpp Wed Apr 11 05:31:44 2018
@@ -20,6 +20,11 @@ using namespace llvm;
namespace mca {
+void DispatchStatistics::onStallEvent(const HWStallEvent &Event) {
+ if (Event.Type < HWStallEvent::LastGenericEvent)
+ HWStalls[Event.Type]++;
+}
+
void DispatchStatistics::onInstructionEvent(const HWInstructionEvent &Event) {
if (Event.Type == HWInstructionEvent::Dispatched)
++NumDispatched;
Modified: llvm/trunk/tools/llvm-mca/DispatchStatistics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/DispatchStatistics.h?rev=329796&r1=329795&r2=329796&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/DispatchStatistics.h (original)
+++ llvm/trunk/tools/llvm-mca/DispatchStatistics.h Wed Apr 11 05:31:44 2018
@@ -42,11 +42,6 @@
namespace mca {
class DispatchStatistics : public View {
- const llvm::MCSubtargetInfo &STI;
-
- using Histogram = llvm::DenseMap<unsigned, unsigned>;
- Histogram DispatchGroupSizePerCycle;
-
unsigned NumDispatched;
unsigned NumCycles;
@@ -54,6 +49,9 @@ class DispatchStatistics : public View {
// is one counter for every generic stall kind (see class HWStallEvent).
llvm::SmallVector<unsigned, 8> HWStalls;
+ using Histogram = llvm::DenseMap<unsigned, unsigned>;
+ Histogram DispatchGroupSizePerCycle;
+
void updateHistograms() {
DispatchGroupSizePerCycle[NumDispatched]++;
NumDispatched = 0;
@@ -62,12 +60,9 @@ class DispatchStatistics : public View {
void printDispatchHistogram(llvm::raw_ostream &OS) const;
void printDispatchStalls(llvm::raw_ostream &OS) const;
- void printDispatchUnitUsage(llvm::raw_ostream &OS, const Histogram &Stats,
- unsigned Cycles) const;
public:
- DispatchStatistics(const llvm::MCSubtargetInfo &sti)
- : STI(sti), NumDispatched(0), NumCycles(0),
+ DispatchStatistics() : NumDispatched(0), NumCycles(0),
HWStalls(HWStallEvent::LastGenericEvent) {}
void onInstructionEvent(const HWInstructionEvent &Event) override;
@@ -76,10 +71,7 @@ public:
void onCycleEnd(unsigned Cycle) override { updateHistograms(); }
- void onStallEvent(const HWStallEvent &Event) override {
- if (Event.Type < HWStallEvent::LastGenericEvent)
- HWStalls[Event.Type]++;
- }
+ void onStallEvent(const HWStallEvent &Event) override;
void printView(llvm::raw_ostream &OS) const override {
printDispatchStalls(OS);
Modified: llvm/trunk/tools/llvm-mca/SchedulerStatistics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/SchedulerStatistics.cpp?rev=329796&r1=329795&r2=329796&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/SchedulerStatistics.cpp (original)
+++ llvm/trunk/tools/llvm-mca/SchedulerStatistics.cpp Wed Apr 11 05:31:44 2018
@@ -47,7 +47,8 @@ void SchedulerStatistics::onReleasedBuff
}
}
-void SchedulerStatistics::printSchedulerStatistics(llvm::raw_ostream &OS) const {
+void SchedulerStatistics::printSchedulerStatistics(
+ llvm::raw_ostream &OS) const {
std::string Buffer;
raw_string_ostream TempStream(Buffer);
TempStream << "\n\nSchedulers - number of cycles where we saw N instructions "
@@ -63,8 +64,7 @@ void SchedulerStatistics::printScheduler
OS << Buffer;
}
-void SchedulerStatistics::printSchedulerUsage(raw_ostream &OS,
- const MCSchedModel &SM) const {
+void SchedulerStatistics::printSchedulerUsage(raw_ostream &OS) const {
std::string Buffer;
raw_string_ostream TempStream(Buffer);
TempStream << "\n\nScheduler's queue usage:\n";
Modified: llvm/trunk/tools/llvm-mca/SchedulerStatistics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/SchedulerStatistics.h?rev=329796&r1=329795&r2=329796&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/SchedulerStatistics.h (original)
+++ llvm/trunk/tools/llvm-mca/SchedulerStatistics.h Wed Apr 11 05:31:44 2018
@@ -39,7 +39,7 @@
namespace mca {
class SchedulerStatistics : public View {
- const llvm::MCSubtargetInfo &STI;
+ const llvm::MCSchedModel &SM;
using Histogram = llvm::DenseMap<unsigned, unsigned>;
Histogram IssuedPerCycle;
@@ -61,15 +61,11 @@ class SchedulerStatistics : public View
}
void printSchedulerStatistics(llvm::raw_ostream &OS) const;
-
- void printIssuePerCycle(const Histogram &IssuePerCycle,
- unsigned TotalCycles) const;
- void printSchedulerUsage(llvm::raw_ostream &OS,
- const llvm::MCSchedModel &SM) const;
+ void printSchedulerUsage(llvm::raw_ostream &OS) const;
public:
- SchedulerStatistics(const llvm::MCSubtargetInfo &sti)
- : STI(sti), NumIssued(0), NumCycles(0) { }
+ SchedulerStatistics(const llvm::MCSubtargetInfo &STI)
+ : SM(STI.getSchedModel()), NumIssued(0), NumCycles(0) { }
void onInstructionEvent(const HWInstructionEvent &Event) override;
@@ -87,7 +83,7 @@ public:
void printView(llvm::raw_ostream &OS) const override {
printSchedulerStatistics(OS);
- printSchedulerUsage(OS, STI.getSchedModel());
+ printSchedulerUsage(OS);
}
};
} // namespace mca
Modified: llvm/trunk/tools/llvm-mca/llvm-mca.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/llvm-mca.cpp?rev=329796&r1=329795&r2=329796&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/llvm-mca.cpp (original)
+++ llvm/trunk/tools/llvm-mca/llvm-mca.cpp Wed Apr 11 05:31:44 2018
@@ -441,7 +441,7 @@ int main(int argc, char **argv) {
llvm::make_unique<mca::InstructionInfoView>(*STI, *MCII, S, *IP));
if (PrintDispatchStats)
- Printer.addView(llvm::make_unique<mca::DispatchStatistics>(*STI));
+ Printer.addView(llvm::make_unique<mca::DispatchStatistics>());
if (PrintSchedulerStats)
Printer.addView(llvm::make_unique<mca::SchedulerStatistics>(*STI));
More information about the llvm-commits
mailing list