summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2018-09-25 12:18:08 +0000
committerGuillaume Chatelet <gchatelet@google.com>2018-09-25 12:18:08 +0000
commit55ad087a4c2ff29ef54f28edeb7b2394046ccbdf (patch)
treee9f465fa5f470f287e0382df3bf38c321254b78f /llvm/tools/llvm-exegesis/llvm-exegesis.cpp
parent99d98ed2b246b013fcd9769f783af880c80c7e5f (diff)
downloadbcm5719-llvm-55ad087a4c2ff29ef54f28edeb7b2394046ccbdf.tar.gz
bcm5719-llvm-55ad087a4c2ff29ef54f28edeb7b2394046ccbdf.zip
[llvm-exegesis][NFC] Rewrite of the YAML serialization.
Summary: This is a NFC in preparation of exporting the initial registers as part of the YAML dump Reviewers: courbet Reviewed By: courbet Subscribers: mgorny, tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D52427 llvm-svn: 342967
Diffstat (limited to 'llvm/tools/llvm-exegesis/llvm-exegesis.cpp')
-rw-r--r--llvm/tools/llvm-exegesis/llvm-exegesis.cpp22
1 files changed, 2 insertions, 20 deletions
diff --git a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
index d338be235fc..a91e5fa5963 100644
--- a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
+++ b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
@@ -123,21 +123,6 @@ static unsigned getOpcodeOrDie(const llvm::MCInstrInfo &MCInstrInfo) {
llvm::report_fatal_error(llvm::Twine("unknown opcode ").concat(OpcodeName));
}
-static BenchmarkResultContext
-getBenchmarkResultContext(const LLVMState &State) {
- BenchmarkResultContext Ctx;
-
- const llvm::MCInstrInfo &InstrInfo = State.getInstrInfo();
- for (unsigned E = InstrInfo.getNumOpcodes(), I = 0; I < E; ++I)
- Ctx.addInstrEntry(I, InstrInfo.getName(I).data());
-
- const llvm::MCRegisterInfo &RegInfo = State.getRegInfo();
- for (unsigned E = RegInfo.getNumRegs(), I = 0; I < E; ++I)
- Ctx.addRegEntry(I, RegInfo.getName(I));
-
- return Ctx;
-}
-
// Generates code snippets for opcode `Opcode`.
static llvm::Expected<std::vector<BenchmarkCode>>
generateSnippets(const LLVMState &State, unsigned Opcode) {
@@ -345,12 +330,10 @@ void benchmarkMain() {
if (BenchmarkFile.empty())
BenchmarkFile = "-";
- const BenchmarkResultContext Context = getBenchmarkResultContext(State);
-
for (const BenchmarkCode &Conf : Configurations) {
InstructionBenchmark Result =
Runner->runConfiguration(Conf, NumRepetitions);
- ExitOnErr(Result.writeYaml(Context, BenchmarkFile));
+ ExitOnErr(Result.writeYaml(State, BenchmarkFile));
}
exegesis::pfm::pfmTerminate();
}
@@ -386,8 +369,7 @@ static void analysisMain() {
// Read benchmarks.
const LLVMState State;
const std::vector<InstructionBenchmark> Points =
- ExitOnErr(InstructionBenchmark::readYamls(
- getBenchmarkResultContext(State), BenchmarkFile));
+ ExitOnErr(InstructionBenchmark::readYamls(State, BenchmarkFile));
llvm::outs() << "Parsed " << Points.size() << " benchmark points\n";
if (Points.empty()) {
llvm::errs() << "no benchmarks to analyze\n";
OpenPOWER on IntegriCloud