summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp')
-rw-r--r--llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index 188ee2d3731..e5b62255c1e 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -47,7 +47,7 @@ BenchmarkRunner::run(unsigned Opcode, const InstructionFilter &Filter,
return std::move(E);
llvm::Expected<std::vector<BenchmarkConfiguration>> ConfigurationOrError =
- createConfigurations(Opcode);
+ generateConfigurations(Opcode);
if (llvm::Error E = ConfigurationOrError.takeError())
return std::move(E);
@@ -113,6 +113,20 @@ BenchmarkRunner::runOne(const BenchmarkConfiguration &Configuration,
return InstrBenchmark;
}
+llvm::Expected<std::vector<BenchmarkConfiguration>>
+BenchmarkRunner::generateConfigurations(unsigned Opcode) const {
+ if (auto E = generatePrototype(Opcode)) {
+ SnippetPrototype &Prototype = E.get();
+ // TODO: Generate as many configurations as needed here.
+ BenchmarkConfiguration Configuration;
+ Configuration.Info = Prototype.Explanation;
+ for (InstructionInstance &II : Prototype.Snippet)
+ Configuration.Snippet.push_back(II.randomizeUnsetVariablesAndBuild());
+ return std::vector<BenchmarkConfiguration>{Configuration};
+ } else
+ return E.takeError();
+}
+
llvm::Expected<std::string>
BenchmarkRunner::writeObjectFile(llvm::ArrayRef<llvm::MCInst> Code) const {
int ResultFD = 0;
OpenPOWER on IntegriCloud