File tree Expand file tree Collapse file tree 5 files changed +37
-2
lines changed
tools/llvm-exegesis/lib/RISCV
unittests/tools/llvm-exegesis/RISCV Expand file tree Collapse file tree 5 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ tablegen(LLVM RISCVGenRegisterBank.inc -gen-register-bank)
15
15
tablegen (LLVM RISCVGenRegisterInfo.inc -gen-register-info )
16
16
tablegen (LLVM RISCVGenSearchableTables.inc -gen-searchable-tables )
17
17
tablegen (LLVM RISCVGenSubtargetInfo.inc -gen-subtarget )
18
+ tablegen (LLVM RISCVGenExegesis.inc -gen-exegesis )
18
19
19
20
set (LLVM_TARGET_DEFINITIONS RISCVGISel.td )
20
21
tablegen (LLVM RISCVGenGlobalISel.inc -gen-global-isel )
Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ include "RISCVSchedXiangShanNanHu.td"
63
63
64
64
include "RISCVProcessors.td"
65
65
66
+ //===----------------------------------------------------------------------===//
67
+ // Pfm Counters
68
+ //===----------------------------------------------------------------------===//
69
+
70
+ include "RISCVPfmCounters.td"
71
+
66
72
//===----------------------------------------------------------------------===//
67
73
// Define the RISC-V target.
68
74
//===----------------------------------------------------------------------===//
Original file line number Diff line number Diff line change
1
+ //===---- RISCVPfmCounters.td - RISC-V Hardware 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 describes the available hardware counters for RISC-V.
10
+ //
11
+ //===----------------------------------------------------------------------===//
12
+
13
+ def CpuCyclesPfmCounter : PfmCounter<"CYCLES">;
14
+
15
+ def DefaultPfmCounters : ProcPfmCounters {
16
+ let CycleCounter = CpuCyclesPfmCounter;
17
+ }
18
+ def : PfmCountersDefaultBinding<DefaultPfmCounters>;
Original file line number Diff line number Diff line change 24
24
namespace llvm {
25
25
namespace exegesis {
26
26
27
+ #include " RISCVGenExegesis.inc"
28
+
27
29
namespace {
28
30
29
31
// Stores constant value to a general-purpose (integer) register.
@@ -132,8 +134,7 @@ class ExegesisRISCVTarget : public ExegesisTarget {
132
134
};
133
135
134
136
ExegesisRISCVTarget::ExegesisRISCVTarget ()
135
- : ExegesisTarget(ArrayRef<CpuAndPfmCounters>{},
136
- RISCV_MC::isOpcodeAvailable) {}
137
+ : ExegesisTarget(RISCVCpuPfmCounters, RISCV_MC::isOpcodeAvailable) {}
137
138
138
139
bool ExegesisRISCVTarget::matchesArch (Triple::ArchType Arch) const {
139
140
return Arch == Triple::riscv32 || Arch == Triple::riscv64;
Original file line number Diff line number Diff line change @@ -42,6 +42,15 @@ TEST_F(RISCVTargetTest, SetRegToConstant) {
42
42
EXPECT_THAT (Insts, Not (IsEmpty ()));
43
43
}
44
44
45
+ TEST_F (RISCVTargetTest, DefaultPfmCounters) {
46
+ const std::string Expected = " CYCLES" ;
47
+ EXPECT_EQ (State.getExegesisTarget ().getPfmCounters (" " ).CycleCounter ,
48
+ Expected);
49
+ EXPECT_EQ (
50
+ State.getExegesisTarget ().getPfmCounters (" unknown_cpu" ).CycleCounter ,
51
+ Expected);
52
+ }
53
+
45
54
} // namespace
46
55
} // namespace exegesis
47
56
} // namespace llvm
You can’t perform that action at this time.
0 commit comments