]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/llvm/Target/TargetPfmCounters.td
Vendor import of llvm trunk r351319 (just before the release_80 branch
[FreeBSD/FreeBSD.git] / include / llvm / Target / TargetPfmCounters.td
1 //===- TargetPfmCounters.td - Target Pfm Counters -*- tablegen ----------*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the target-independent interfaces for performance counters.
11
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;
18 }
19
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
26   // ProcResource.
27   string ResourceName = resource_name;
28 }
29
30 def NoPfmCounter : PfmCounter <""> {}
31
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 = [];
40 }
41
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;
46 }
47
48 // Declares the default binding for unbound CPUs for the target.
49 class PfmCountersDefaultBinding<ProcPfmCounters counters>
50     : PfmCountersBinding<"", counters> {}