aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
diff options
context:
space:
mode:
authorAiden Grossman <agrossman154@yahoo.com>2023-03-27 08:14:18 +0000
committerAiden Grossman <agrossman154@yahoo.com>2023-03-27 08:14:36 +0000
commit389bf5d870b3bc014b004a750c539786eba8c543 (patch)
tree606bd882a523b34f5caefa2596716306819cc829 /llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
parent4a9dc94d336ab0c68d718db21d1666ac19868642 (diff)
downloadllvm-389bf5d870b3bc014b004a750c539786eba8c543.zip
llvm-389bf5d870b3bc014b004a750c539786eba8c543.tar.gz
llvm-389bf5d870b3bc014b004a750c539786eba8c543.tar.bz2
[llvm-exegesis] Refactor InstructionBenchmark to Benchmark
When llvm-exegesis was first introduced, it only supported benchmarking individual instructions, hence the name for the data structure storing the data corresponding to a benchmark being called InstructionBenchmark made sense. However, now that benchmarking arbitrary snippets is supported, InstructionBenchmark doesn't correspond to a single instruction. This patch refactors InstructionBenchmark to be called Benchmark to clean up this little bit of technical debt. Reviewed By: courbet Differential Revision: https://reviews.llvm.org/D146884
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp')
-rw-r--r--llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
index 673221e..b8e53de 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
@@ -209,14 +209,14 @@ template <> struct MappingTraits<exegesis::BenchmarkMeasure> {
};
template <>
-struct ScalarEnumerationTraits<exegesis::InstructionBenchmark::ModeE> {
+struct ScalarEnumerationTraits<exegesis::Benchmark::ModeE> {
static void enumeration(IO &Io,
- exegesis::InstructionBenchmark::ModeE &Value) {
- Io.enumCase(Value, "", exegesis::InstructionBenchmark::Unknown);
- Io.enumCase(Value, "latency", exegesis::InstructionBenchmark::Latency);
- Io.enumCase(Value, "uops", exegesis::InstructionBenchmark::Uops);
+ exegesis::Benchmark::ModeE &Value) {
+ Io.enumCase(Value, "", exegesis::Benchmark::Unknown);
+ Io.enumCase(Value, "latency", exegesis::Benchmark::Latency);
+ Io.enumCase(Value, "uops", exegesis::Benchmark::Uops);
Io.enumCase(Value, "inverse_throughput",
- exegesis::InstructionBenchmark::InverseThroughput);
+ exegesis::Benchmark::InverseThroughput);
}
};
@@ -260,8 +260,8 @@ template <> struct ScalarTraits<exegesis::RegisterValue> {
};
template <>
-struct MappingContextTraits<exegesis::InstructionBenchmarkKey, YamlContext> {
- static void mapping(IO &Io, exegesis::InstructionBenchmarkKey &Obj,
+struct MappingContextTraits<exegesis::BenchmarkKey, YamlContext> {
+ static void mapping(IO &Io, exegesis::BenchmarkKey &Obj,
YamlContext &Context) {
Io.setContext(&Context);
Io.mapRequired("instructions", Obj.Instructions);
@@ -271,7 +271,7 @@ struct MappingContextTraits<exegesis::InstructionBenchmarkKey, YamlContext> {
};
template <>
-struct MappingContextTraits<exegesis::InstructionBenchmark, YamlContext> {
+struct MappingContextTraits<exegesis::Benchmark, YamlContext> {
struct NormalizedBinary {
NormalizedBinary(IO &io) {}
NormalizedBinary(IO &, std::vector<uint8_t> &Data) : Binary(Data) {}
@@ -288,7 +288,7 @@ struct MappingContextTraits<exegesis::InstructionBenchmark, YamlContext> {
BinaryRef Binary;
};
- static void mapping(IO &Io, exegesis::InstructionBenchmark &Obj,
+ static void mapping(IO &Io, exegesis::Benchmark &Obj,
YamlContext &Context) {
Io.mapRequired("mode", Obj.Mode);
Io.mapRequired("key", Obj.Key, Context);
@@ -305,9 +305,9 @@ struct MappingContextTraits<exegesis::InstructionBenchmark, YamlContext> {
}
};
-template <> struct MappingTraits<exegesis::InstructionBenchmark::TripleAndCpu> {
+template <> struct MappingTraits<exegesis::Benchmark::TripleAndCpu> {
static void mapping(IO &Io,
- exegesis::InstructionBenchmark::TripleAndCpu &Obj) {
+ exegesis::Benchmark::TripleAndCpu &Obj) {
assert(!Io.outputting() && "can only read TripleAndCpu");
// Read triple.
Io.mapRequired("llvm_triple", Obj.LLVMTriple);
@@ -320,8 +320,8 @@ template <> struct MappingTraits<exegesis::InstructionBenchmark::TripleAndCpu> {
namespace exegesis {
-Expected<std::set<InstructionBenchmark::TripleAndCpu>>
-InstructionBenchmark::readTriplesAndCpusFromYamls(MemoryBufferRef Buffer) {
+Expected<std::set<Benchmark::TripleAndCpu>>
+Benchmark::readTriplesAndCpusFromYamls(MemoryBufferRef Buffer) {
// We're only mapping a field, drop other fields and silence the corresponding
// warnings.
yaml::Input Yin(
@@ -340,11 +340,11 @@ InstructionBenchmark::readTriplesAndCpusFromYamls(MemoryBufferRef Buffer) {
return Result;
}
-Expected<InstructionBenchmark>
-InstructionBenchmark::readYaml(const LLVMState &State, MemoryBufferRef Buffer) {
+Expected<Benchmark>
+Benchmark::readYaml(const LLVMState &State, MemoryBufferRef Buffer) {
yaml::Input Yin(Buffer);
YamlContext Context(State);
- InstructionBenchmark Benchmark;
+ Benchmark Benchmark;
if (Yin.setCurrentDocument())
yaml::yamlize(Yin, Benchmark, /*unused*/ true, Context);
if (!Context.getLastError().empty())
@@ -352,12 +352,12 @@ InstructionBenchmark::readYaml(const LLVMState &State, MemoryBufferRef Buffer) {
return std::move(Benchmark);
}
-Expected<std::vector<InstructionBenchmark>>
-InstructionBenchmark::readYamls(const LLVMState &State,
+Expected<std::vector<Benchmark>>
+Benchmark::readYamls(const LLVMState &State,
MemoryBufferRef Buffer) {
yaml::Input Yin(Buffer);
YamlContext Context(State);
- std::vector<InstructionBenchmark> Benchmarks;
+ std::vector<Benchmark> Benchmarks;
while (Yin.setCurrentDocument()) {
Benchmarks.emplace_back();
yamlize(Yin, Benchmarks.back(), /*unused*/ true, Context);
@@ -370,7 +370,7 @@ InstructionBenchmark::readYamls(const LLVMState &State,
return std::move(Benchmarks);
}
-Error InstructionBenchmark::writeYamlTo(const LLVMState &State,
+Error Benchmark::writeYamlTo(const LLVMState &State,
raw_ostream &OS) {
auto Cleanup = make_scope_exit([&] { OS.flush(); });
yaml::Output Yout(OS, nullptr /*Ctx*/, 200 /*WrapColumn*/);
@@ -383,7 +383,7 @@ Error InstructionBenchmark::writeYamlTo(const LLVMState &State,
return Error::success();
}
-Error InstructionBenchmark::readYamlFrom(const LLVMState &State,
+Error Benchmark::readYamlFrom(const LLVMState &State,
StringRef InputContent) {
yaml::Input Yin(InputContent);
YamlContext Context(State);