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