diff options
Diffstat (limited to 'llvm/tools/llvm-mca/Views')
| -rw-r--r-- | llvm/tools/llvm-mca/Views/ResourcePressureView.cpp | 13 | ||||
| -rw-r--r-- | llvm/tools/llvm-mca/Views/ResourcePressureView.h | 19 | ||||
| -rw-r--r-- | llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.h | 2 | ||||
| -rw-r--r-- | llvm/tools/llvm-mca/Views/SchedulerStatistics.h | 2 | ||||
| -rw-r--r-- | llvm/tools/llvm-mca/Views/SummaryView.h | 1 | 
5 files changed, 13 insertions, 24 deletions
diff --git a/llvm/tools/llvm-mca/Views/ResourcePressureView.cpp b/llvm/tools/llvm-mca/Views/ResourcePressureView.cpp index 17c801259d9..e71825b07c7 100644 --- a/llvm/tools/llvm-mca/Views/ResourcePressureView.cpp +++ b/llvm/tools/llvm-mca/Views/ResourcePressureView.cpp @@ -20,7 +20,10 @@ namespace mca {  using namespace llvm; -void ResourcePressureView::initialize() { +ResourcePressureView::ResourcePressureView(const llvm::MCSubtargetInfo &sti, +                                           llvm::MCInstPrinter &Printer, +                                           const SourceMgr &Sequence) +    : STI(sti), MCIP(Printer), Source(Sequence) {    // Populate the map of resource descriptors.    unsigned R2VIndex = 0;    const MCSchedModel &SM = STI.getSchedModel(); @@ -92,8 +95,7 @@ static void printResourcePressure(formatted_raw_ostream &OS, double Pressure,    OS.PadToColumn(Col);  } -void ResourcePressureView::printResourcePressurePerIteration( -    raw_ostream &OS, unsigned Executions) const { +void ResourcePressureView::printResourcePressurePerIter(raw_ostream &OS) const {    std::string Buffer;    raw_string_ostream TempStream(Buffer);    formatted_raw_ostream FOS(TempStream); @@ -126,6 +128,7 @@ void ResourcePressureView::printResourcePressurePerIteration(    FOS << '\n';    FOS.flush(); +  const unsigned Executions = Source.getNumIterations();    for (unsigned I = 0, E = NumResourceUnits; I < E; ++I) {      double Usage = ResourceUsage[I + Source.size() * E];      printResourcePressure(FOS, Usage / Executions, (I + 1) * 7); @@ -135,8 +138,7 @@ void ResourcePressureView::printResourcePressurePerIteration(    OS << Buffer;  } -void ResourcePressureView::printResourcePressurePerInstruction( -    raw_ostream &OS, unsigned Executions) const { +void ResourcePressureView::printResourcePressurePerInst(raw_ostream &OS) const {    std::string Buffer;    raw_string_ostream TempStream(Buffer);    formatted_raw_ostream FOS(TempStream); @@ -149,6 +151,7 @@ void ResourcePressureView::printResourcePressurePerInstruction(    raw_string_ostream InstrStream(Instruction);    unsigned InstrIndex = 0; +  const unsigned Executions = Source.getNumIterations();    for (const MCInst &MCI : Source) {      unsigned BaseEltIdx = InstrIndex * NumResourceUnits;      for (unsigned J = 0; J < NumResourceUnits; ++J) { diff --git a/llvm/tools/llvm-mca/Views/ResourcePressureView.h b/llvm/tools/llvm-mca/Views/ResourcePressureView.h index ad9c29a55e5..d413bcd80fd 100644 --- a/llvm/tools/llvm-mca/Views/ResourcePressureView.h +++ b/llvm/tools/llvm-mca/Views/ResourcePressureView.h @@ -82,26 +82,17 @@ class ResourcePressureView : public View {    std::vector<ResourceCycles> ResourceUsage;    unsigned NumResourceUnits; -  const llvm::MCInst &GetMCInstFromIndex(unsigned Index) const; -  void printResourcePressurePerIteration(llvm::raw_ostream &OS, -                                         unsigned Executions) const; -  void printResourcePressurePerInstruction(llvm::raw_ostream &OS, -                                           unsigned Executions) const; -  void initialize(); +  void printResourcePressurePerIter(llvm::raw_ostream &OS) const; +  void printResourcePressurePerInst(llvm::raw_ostream &OS) const;  public:    ResourcePressureView(const llvm::MCSubtargetInfo &sti, -                       llvm::MCInstPrinter &Printer, const SourceMgr &SM) -      : STI(sti), MCIP(Printer), Source(SM) { -    initialize(); -  } +                       llvm::MCInstPrinter &Printer, const SourceMgr &SM);    void onEvent(const HWInstructionEvent &Event) override; -    void printView(llvm::raw_ostream &OS) const override { -    unsigned Executions = Source.getNumIterations(); -    printResourcePressurePerIteration(OS, Executions); -    printResourcePressurePerInstruction(OS, Executions); +    printResourcePressurePerIter(OS); +    printResourcePressurePerInst(OS);    }  };  } // namespace mca diff --git a/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.h b/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.h index 0531e389c90..e9be542a786 100644 --- a/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.h +++ b/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.h @@ -48,9 +48,7 @@ public:    RetireControlUnitStatistics() : NumRetired(0), NumCycles(0) {}    void onEvent(const HWInstructionEvent &Event) override; -    void onCycleBegin() override { NumCycles++; } -    void onCycleEnd() override { updateHistograms(); }    void printView(llvm::raw_ostream &OS) const override; diff --git a/llvm/tools/llvm-mca/Views/SchedulerStatistics.h b/llvm/tools/llvm-mca/Views/SchedulerStatistics.h index de70db26ed4..3515546f083 100644 --- a/llvm/tools/llvm-mca/Views/SchedulerStatistics.h +++ b/llvm/tools/llvm-mca/Views/SchedulerStatistics.h @@ -70,9 +70,7 @@ public:          Usage(STI.getSchedModel().NumProcResourceKinds, {0, 0, 0}) {}    void onEvent(const HWInstructionEvent &Event) override; -    void onCycleBegin() override { NumCycles++; } -    void onCycleEnd() override { updateHistograms(); }    // Increases the number of used scheduler queue slots of every buffered diff --git a/llvm/tools/llvm-mca/Views/SummaryView.h b/llvm/tools/llvm-mca/Views/SummaryView.h index 13875976d39..3d4585e1d5a 100644 --- a/llvm/tools/llvm-mca/Views/SummaryView.h +++ b/llvm/tools/llvm-mca/Views/SummaryView.h @@ -66,7 +66,6 @@ public:                unsigned Width);    void onCycleEnd() override { ++TotalCycles; } -    void onEvent(const HWInstructionEvent &Event) override;    void printView(llvm::raw_ostream &OS) const override;  | 

