[llvm-exegesis] move Mode from Key to BenchmarResult.
Moves the Mode field out of the Key. The existing yaml benchmark results can be fixed with the following script:
```
readonly FILE=$1
readonly MODE=latency # Change to uops to fix a uops benchmark.
cat $FILE | \
sed "/^\ \+mode:\ \+$MODE$/d" | \
sed "/^cpu_name.*$/i mode: $MODE"
```
Differential Revision: https://reviews.llvm.org/D47813
Authored by: Guillaume Chatelet
llvm-svn: 334079
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
index 441aee0..87b25b4 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
@@ -68,12 +68,12 @@
};
template <>
-struct ScalarEnumerationTraits<exegesis::InstructionBenchmarkKey::ModeE> {
+struct ScalarEnumerationTraits<exegesis::InstructionBenchmark::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);
+ exegesis::InstructionBenchmark::ModeE &Value) {
+ Io.enumCase(Value, "", exegesis::InstructionBenchmark::Unknown);
+ Io.enumCase(Value, "latency", exegesis::InstructionBenchmark::Latency);
+ Io.enumCase(Value, "uops", exegesis::InstructionBenchmark::Uops);
}
};
@@ -81,13 +81,13 @@
static void mapping(IO &Io, exegesis::InstructionBenchmarkKey &Obj) {
Io.mapRequired("opcode_name", Obj.OpcodeName);
Io.mapOptional("instructions", Obj.Instructions);
- Io.mapRequired("mode", Obj.Mode);
Io.mapOptional("config", Obj.Config);
}
};
template <> struct MappingTraits<exegesis::InstructionBenchmark> {
static void mapping(IO &Io, exegesis::InstructionBenchmark &Obj) {
+ Io.mapRequired("mode", Obj.Mode);
Io.mapRequired("key", Obj.Key);
Io.mapRequired("cpu_name", Obj.CpuName);
Io.mapRequired("llvm_triple", Obj.LLVMTriple);