[llvm-exegesis] Add a Configuration object for Benchmark.
Summary: This is the first step to have the BenchmarkRunner create and measure many different configurations (different initial values for instance).
Reviewers: courbet
Subscribers: tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D47826
llvm-svn: 334169
diff --git a/llvm/tools/llvm-exegesis/lib/Latency.cpp b/llvm/tools/llvm-exegesis/lib/Latency.cpp
index 9c4ed56..59097e1 100644
--- a/llvm/tools/llvm-exegesis/lib/Latency.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Latency.cpp
@@ -56,11 +56,12 @@
return InstructionBenchmark::Latency;
}
-llvm::Expected<std::vector<llvm::MCInst>>
-LatencyBenchmarkRunner::createSnippet(RegisterAliasingTrackerCache &RATC,
- unsigned Opcode,
- llvm::raw_ostream &Info) const {
- std::vector<llvm::MCInst> Snippet;
+llvm::Expected<BenchmarkConfiguration>
+LatencyBenchmarkRunner::createConfiguration(RegisterAliasingTrackerCache &RATC,
+ unsigned Opcode,
+ llvm::raw_ostream &Info) const {
+ BenchmarkConfiguration Configuration;
+ std::vector<llvm::MCInst> &Snippet = Configuration.Snippet;
const llvm::MCInstrDesc &MCInstrDesc = MCInstrInfo.get(Opcode);
const Instruction ThisInstruction(MCInstrDesc, RATC);
@@ -77,7 +78,7 @@
Info << "implicit Self cycles, picking random values.\n";
}
Snippet.push_back(randomizeUnsetVariablesAndBuild(ThisInstruction));
- return Snippet;
+ return Configuration;
}
// Let's try to create a dependency through another opcode.
@@ -102,7 +103,7 @@
<< ".\n";
Snippet.push_back(randomizeUnsetVariablesAndBuild(ThisInstruction));
Snippet.push_back(randomizeUnsetVariablesAndBuild(OtherInstruction));
- return Snippet;
+ return Configuration;
}
return makeError(