1 //===- TargetPfmCounters.td - Target Pfm Counters -*- tablegen ----------*-===//
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 //===----------------------------------------------------------------------===//
10 // This file defines the target-independent interfaces for performance counters.
12 // Definition of a hardware counters from libpfm identifiers.
13 class PfmCounter<string counter> {
14 // The name of the counter that measures events.
15 // The name can be "some_counter + some_other_counter", in which case the
16 // measured value is the sum of events on these counters.
17 string Counter = counter;
20 // Issue counters can be tied to a ProcResource
21 class PfmIssueCounter<string resource_name, string counter>
22 : PfmCounter<counter> {
23 // The name of the ProcResource on which uops are issued. This is used by
24 // llvm-exegesis to compare measurements with values in the SchedModels.
25 // If the CPU has a sched model, this should correspond to the name of a
27 string ResourceName = resource_name;
30 def NoPfmCounter : PfmCounter <""> {}
32 // Set of PfmCounters for measuring sched model characteristics.
33 class ProcPfmCounters {
34 // Processors can define how to measure cycles by defining a CycleCounter.
35 PfmCounter CycleCounter = NoPfmCounter;
36 // Processors can define how to measure uops by defining a UopsCounter.
37 PfmCounter UopsCounter = NoPfmCounter;
38 // Processors can define how to measure issued uops by defining IssueCounters.
39 list<PfmIssueCounter> IssueCounters = [];
42 // A binding of a set of counters to a CPU.
43 class PfmCountersBinding<string cpu_name, ProcPfmCounters counters> {
44 string CpuName = cpu_name;
45 ProcPfmCounters Counters = counters;
48 // Declares the default binding for unbound CPUs for the target.
49 class PfmCountersDefaultBinding<ProcPfmCounters counters>
50 : PfmCountersBinding<"", counters> {}