Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 14 | pmbaty | 1 | //===- TargetPfmCounters.td - Target Pfm Counters -*- tablegen ----------*-===// | 
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | // | ||
| 9 | // This file defines the target-independent interfaces for performance counters. | ||
| 10 | // | ||
| 11 | //===----------------------------------------------------------------------===// | ||
| 12 | |||
| 13 | // Definition of a hardware counters from libpfm identifiers. | ||
| 14 | class PfmCounter<string counter> { | ||
| 15 | // The name of the counter that measures events. | ||
| 16 | // The name can be "some_counter + some_other_counter", in which case the | ||
| 17 | // measured value is the sum of events on these counters. | ||
| 18 | string Counter = counter; | ||
| 19 | } | ||
| 20 | |||
| 21 | // Issue counters can be tied to a ProcResource | ||
| 22 | class PfmIssueCounter<string resource_name, string counter> | ||
| 23 |     : PfmCounter<counter> { | ||
| 24 | // The name of the ProcResource on which uops are issued. This is used by | ||
| 25 | // llvm-exegesis to compare measurements with values in the SchedModels. | ||
| 26 | // If the CPU has a sched model, this should correspond to the name of a | ||
| 27 | // ProcResource. | ||
| 28 | string ResourceName = resource_name; | ||
| 29 | } | ||
| 30 | |||
| 31 | def NoPfmCounter : PfmCounter <""> {} | ||
| 32 | |||
| 33 | // Set of PfmCounters for measuring sched model characteristics. | ||
| 34 | class ProcPfmCounters { | ||
| 35 | // Processors can define how to measure cycles by defining a CycleCounter. | ||
| 36 | PfmCounter CycleCounter = NoPfmCounter; | ||
| 37 | // Processors can define how to measure uops by defining a UopsCounter. | ||
| 38 | PfmCounter UopsCounter = NoPfmCounter; | ||
| 39 | // Processors can define how to measure issued uops by defining IssueCounters. | ||
| 40 | list<PfmIssueCounter> IssueCounters = []; | ||
| 41 | } | ||
| 42 | |||
| 43 | // A binding of a set of counters to a CPU. | ||
| 44 | class PfmCountersBinding<string cpu_name, ProcPfmCounters counters> { | ||
| 45 | string CpuName = cpu_name; | ||
| 46 | ProcPfmCounters Counters = counters; | ||
| 47 | } | ||
| 48 | |||
| 49 | // Declares the default binding for unbound CPUs for the target. | ||
| 50 | class PfmCountersDefaultBinding<ProcPfmCounters counters> | ||
| 51 |     : PfmCountersBinding<"", counters> {} |