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

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 01:47:26 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"},
----------------
boomanaiden154 wrote:

I looked into doing that, but the way the Exegesis TableGen is setup, everything that gets TableGened ends up in a target-specific `ExegesisTarget` implementation. Moving it there naively would mean duplication across the targets and move this code somewhere where it makes less sense.

We could probably make some TableGen/build system changes to get a target-independent `.inc` with this information, but that seemed excessive to me, unless I'm overthinking it and it's a lot simpler than that.

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


More information about the llvm-commits mailing list