1 //===-- ValidationEvent.h ---------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
10 /// Definitions and utilities for Validation Events.
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"
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
{
33 InstructionTLBLoadMiss
,
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