[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/Uops.cpp b/llvm/tools/llvm-exegesis/lib/Uops.cpp
index b90ab1a..7f1079e 100644
--- a/llvm/tools/llvm-exegesis/lib/Uops.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Uops.cpp
@@ -145,11 +145,12 @@
return InstructionBenchmark::Uops;
}
-llvm::Expected<std::vector<llvm::MCInst>>
-UopsBenchmarkRunner::createSnippet(RegisterAliasingTrackerCache &RATC,
- unsigned Opcode,
- llvm::raw_ostream &Info) const {
- std::vector<llvm::MCInst> Snippet;
+llvm::Expected<BenchmarkConfiguration>
+UopsBenchmarkRunner::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 Instruction(MCInstrDesc, RATC);
@@ -162,12 +163,12 @@
if (SelfAliasing.empty()) {
Info << "instruction is parallel, repeating a random one.\n";
Snippet.push_back(randomizeUnsetVariablesAndBuild(Instruction));
- return Snippet;
+ return Configuration;
}
if (SelfAliasing.hasImplicitAliasing()) {
Info << "instruction is serial, repeating a random one.\n";
Snippet.push_back(randomizeUnsetVariablesAndBuild(Instruction));
- return Snippet;
+ return Configuration;
}
const auto TiedVariables = getTiedVariables(Instruction);
if (!TiedVariables.empty()) {
@@ -188,7 +189,7 @@
Var->AssignedValue = llvm::MCOperand::createReg(Reg);
Snippet.push_back(randomizeUnsetVariablesAndBuild(Instruction));
}
- return Snippet;
+ return Configuration;
}
// No tied variables, we pick random values for defs.
llvm::BitVector Defs(MCRegisterInfo.getNumRegs());
@@ -219,7 +220,7 @@
Info
<< "instruction has no tied variables picking Uses different from defs\n";
Snippet.push_back(randomizeUnsetVariablesAndBuild(Instruction));
- return Snippet;
+ return Configuration;
}
std::vector<BenchmarkMeasure>