[llvm-exegesis][NFC] Use an enum instead of a string for benchmark mode.
Summary: YAML encoding is backwards-compatible.
Reviewers: gchatelet
Subscribers: tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D47705
llvm-svn: 333886
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
index ed449db..fd5b350 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
@@ -34,6 +34,16 @@
static const bool flow = true;
};
+template <>
+struct ScalarEnumerationTraits<exegesis::InstructionBenchmarkKey::ModeE> {
+ static void enumeration(IO &Io,
+ exegesis::InstructionBenchmarkKey::ModeE &Value) {
+ Io.enumCase(Value, "", exegesis::InstructionBenchmarkKey::Unknown);
+ Io.enumCase(Value, "latency", exegesis::InstructionBenchmarkKey::Latency);
+ Io.enumCase(Value, "uops", exegesis::InstructionBenchmarkKey::Uops);
+ }
+};
+
template <> struct MappingTraits<exegesis::InstructionBenchmarkKey> {
static void mapping(IO &Io, exegesis::InstructionBenchmarkKey &Obj) {
Io.mapRequired("opcode_name", Obj.OpcodeName);