Allow SymbolUserOpInterface operators to be used in RemoveDeadValues Pass (#117405)
[llvm-project.git] / llvm / tools / llvm-exegesis / lib / ValidationEvent.h
blob8a9f3af57dca97330989d72fc361f2a4560d4c94
1 //===-- ValidationEvent.h ---------------------------------------*- C++ -*-===//
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 /// \file
10 /// Definitions and utilities for Validation Events.
11 ///
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TOOLS_LLVM_EXEGESIS_VALIDATIONEVENT_H
15 #define LLVM_TOOLS_LLVM_EXEGESIS_VALIDATIONEVENT_H
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Support/Error.h"
20 namespace llvm {
22 namespace exegesis {
24 // The main list of supported validation events. The mapping between validation
25 // events and pfm counters is defined in TableDef files for each target.
26 enum ValidationEvent {
27 InstructionRetired,
28 L1DCacheLoadMiss,
29 L1DCacheStoreMiss,
30 L1ICacheLoadMiss,
31 DataTLBLoadMiss,
32 DataTLBStoreMiss,
33 InstructionTLBLoadMiss,
34 BranchPredictionMiss,
35 // Number of events.
36 NumValidationEvents,
39 // Returns the name/description of the given event.
40 const char *getValidationEventName(ValidationEvent VE);
41 const char *getValidationEventDescription(ValidationEvent VE);
43 // Returns the ValidationEvent with the given name.
44 Expected<ValidationEvent> getValidationEventByName(StringRef Name);
46 // Command-line options for validation events.
47 struct ValidationEventOptions {
48 template <class Opt> void apply(Opt &O) const {
49 for (int I = 0; I < NumValidationEvents; ++I) {
50 const auto VE = static_cast<ValidationEvent>(I);
51 O.getParser().addLiteralOption(getValidationEventName(VE), VE,
52 getValidationEventDescription(VE));
57 } // namespace exegesis
58 } // namespace llvm
60 #endif