[llvm] [llvm-exegesis] Simplify validation event string conversion functions (PR #82092)

Clement Courbet via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 01:09:01 PST 2024


================
@@ -24,6 +24,24 @@ static constexpr const char kIntegerPrefix[] = "i_0x";
 static constexpr const char kDoublePrefix[] = "f_";
 static constexpr const char kInvalidOperand[] = "INVALID";
 
+// When adding a new validation counter, a new event type needs to be added
+// to llvm::exegesis::ValidationEvent, a mapping needs to be added below,
+// a command line option needs to be added in llvm-exegesis.cpp, and the
+// event type needs to be added (with matching naming) in TargetPfmCounters.td
+// and appropriate mappings need to be added in the relevant architecture
+// Pfm descriptions.
+static constexpr const std::pair<llvm::exegesis::ValidationEvent,
+                                 llvm::StringRef>
+    kValidationEventNames[] = {
+        {llvm::exegesis::InstructionRetired, "instructions-retired"},
----------------
legrosbuffle wrote:

What about putting the name (e.g. "instructions-retired") in the tabledef `ValidationEvent` class ? This would avoid any kind of synchronization to have to be done manually.

https://github.com/llvm/llvm-project/pull/82092


More information about the llvm-commits mailing list