diff options
Diffstat (limited to 'llvm/tools/llvm-mca/BackendStatistics.h')
| -rw-r--r-- | llvm/tools/llvm-mca/BackendStatistics.h | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/llvm/tools/llvm-mca/BackendStatistics.h b/llvm/tools/llvm-mca/BackendStatistics.h index 77bd089196c..aff3bdeb736 100644 --- a/llvm/tools/llvm-mca/BackendStatistics.h +++ b/llvm/tools/llvm-mca/BackendStatistics.h @@ -67,8 +67,6 @@ namespace mca { class BackendStatistics : public View { - // TODO: remove the dependency from Backend. - const Backend &B; const llvm::MCSubtargetInfo &STI; using Histogram = std::map<unsigned, unsigned>; @@ -105,13 +103,22 @@ class BackendStatistics : public View { NumRetired = 0; } + // Used to track the number of physical registers used in a register file. + struct RegisterFileUsage { + unsigned TotalMappings; + unsigned MaxUsedMappings; + unsigned CurrentlyUsedMappings; + }; + + // There is one entry for each register file implemented by the processor. + llvm::SmallVector<RegisterFileUsage, 4> RegisterFiles; + void printRetireUnitStatistics(llvm::raw_ostream &OS) const; void printDispatchUnitStatistics(llvm::raw_ostream &OS) const; void printSchedulerStatistics(llvm::raw_ostream &OS) const; void printDispatchStalls(llvm::raw_ostream &OS) const; - void printRATStatistics(llvm::raw_ostream &OS, unsigned Mappings, - unsigned MaxUsedMappings) const; + void printRATStatistics(llvm::raw_ostream &OS) const; void printRCUStatistics(llvm::raw_ostream &OS, const Histogram &Histogram, unsigned Cycles) const; void printDispatchUnitUsage(llvm::raw_ostream &OS, const Histogram &Stats, @@ -122,9 +129,12 @@ class BackendStatistics : public View { const llvm::MCSchedModel &SM) const; public: - BackendStatistics(const Backend &backend, const llvm::MCSubtargetInfo &sti) - : B(backend), STI(sti), NumDispatched(0), NumIssued(0), NumRetired(0), - NumCycles(0), HWStalls(HWStallEvent::LastGenericEvent) {} + BackendStatistics(const llvm::MCSubtargetInfo &sti) + : STI(sti), NumDispatched(0), NumIssued(0), NumRetired(0), + NumCycles(0), HWStalls(HWStallEvent::LastGenericEvent), + // TODO: The view currently assumes a single register file. This will + // change in future. + RegisterFiles(1) {} void onInstructionEvent(const HWInstructionEvent &Event) override; @@ -147,12 +157,10 @@ public: void printView(llvm::raw_ostream &OS) const override { printDispatchStalls(OS); - printRATStatistics(OS, B.getTotalRegisterMappingsCreated(), - B.getMaxUsedRegisterMappings()); + printRATStatistics(OS); printDispatchUnitStatistics(OS); printSchedulerStatistics(OS); printRetireUnitStatistics(OS); - printSchedulerUsage(OS, STI.getSchedModel()); } }; |

