1 //===--------------------- RegisterFileStatistics.h -------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// This view collects and prints register file usage statistics.
13 /// Example (-mcpu=btver2):
14 /// ========================
16 /// Register File statistics:
17 /// Total number of mappings created: 6
18 /// Max number of mappings used: 3
20 /// * Register File #1 -- FpuPRF:
21 /// Number of physical registers: 72
22 /// Total number of mappings created: 0
23 /// Max number of mappings used: 0
25 /// * Register File #2 -- IntegerPRF:
26 /// Number of physical registers: 64
27 /// Total number of mappings created: 6
28 /// Max number of mappings used: 3
30 //===----------------------------------------------------------------------===//
32 #ifndef LLVM_TOOLS_LLVM_MCA_REGISTERFILESTATISTICS_H
33 #define LLVM_TOOLS_LLVM_MCA_REGISTERFILESTATISTICS_H
35 #include "Views/View.h"
36 #include "llvm/ADT/SmallVector.h"
37 #include "llvm/MC/MCSubtargetInfo.h"
41 class RegisterFileStatistics
: public View
{
42 const llvm::MCSubtargetInfo
&STI
;
44 // Used to track the number of physical registers used in a register file.
45 struct RegisterFileUsage
{
46 unsigned TotalMappings
;
47 unsigned MaxUsedMappings
;
48 unsigned CurrentlyUsedMappings
;
51 // There is one entry for each register file implemented by the processor.
52 llvm::SmallVector
<RegisterFileUsage
, 4> RegisterFiles
;
55 RegisterFileStatistics(const llvm::MCSubtargetInfo
&sti
);
57 void onEvent(const HWInstructionEvent
&Event
) override
;
58 void printView(llvm::raw_ostream
&OS
) const override
;