summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-exegesis/lib/Latency.cpp
diff options
context:
space:
mode:
authorClement Courbet <courbet@google.com>2018-09-13 07:40:53 +0000
committerClement Courbet <courbet@google.com>2018-09-13 07:40:53 +0000
commitd939f6d01396201d1b8fb5dba652e9528276e79e (patch)
treea6a1ce6223ee509273ef8b3f6d7c9a080ee6034a /llvm/tools/llvm-exegesis/lib/Latency.cpp
parent58c3dee3b3cdf103680d80b61167dda9612d3e0d (diff)
downloadbcm5719-llvm-d939f6d01396201d1b8fb5dba652e9528276e79e.tar.gz
bcm5719-llvm-d939f6d01396201d1b8fb5dba652e9528276e79e.zip
[llvm-exegesis][NFC] Split BenchmarkRunner class
Summary: The snippet-generation part goes to the SnippetGenerator class. This will allow benchmarking arbitrary code (see PR38437). Reviewers: gchatelet Subscribers: mgorny, tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D51979 llvm-svn: 342117
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/Latency.cpp')
-rw-r--r--llvm/tools/llvm-exegesis/lib/Latency.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/Latency.cpp b/llvm/tools/llvm-exegesis/lib/Latency.cpp
index b8452ac35a8..d09cdc597fd 100644
--- a/llvm/tools/llvm-exegesis/lib/Latency.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Latency.cpp
@@ -29,9 +29,9 @@ static bool hasMemoryOperand(const llvm::MCOperandInfo &OpInfo) {
return OpInfo.OperandType == llvm::MCOI::OPERAND_MEMORY;
}
-LatencyBenchmarkRunner::~LatencyBenchmarkRunner() = default;
+LatencySnippetGenerator::~LatencySnippetGenerator() = default;
-llvm::Error LatencyBenchmarkRunner::isInfeasible(
+llvm::Error LatencySnippetGenerator::isInfeasible(
const llvm::MCInstrDesc &MCInstrDesc) const {
if (llvm::any_of(MCInstrDesc.operands(), hasUnknownOperand))
return llvm::make_error<BenchmarkFailure>(
@@ -43,7 +43,7 @@ llvm::Error LatencyBenchmarkRunner::isInfeasible(
}
llvm::Expected<CodeTemplate>
-LatencyBenchmarkRunner::generateTwoInstructionPrototype(
+LatencySnippetGenerator::generateTwoInstructionPrototype(
const Instruction &Instr) const {
std::vector<unsigned> Opcodes;
Opcodes.resize(State.getInstrInfo().getNumOpcodes());
@@ -80,7 +80,7 @@ LatencyBenchmarkRunner::generateTwoInstructionPrototype(
}
llvm::Expected<CodeTemplate>
-LatencyBenchmarkRunner::generateCodeTemplate(unsigned Opcode) const {
+LatencySnippetGenerator::generateCodeTemplate(unsigned Opcode) const {
const auto &InstrDesc = State.getInstrInfo().get(Opcode);
if (auto E = isInfeasible(InstrDesc))
return std::move(E);
@@ -105,6 +105,8 @@ const char *LatencyBenchmarkRunner::getCounterName() const {
return CounterName;
}
+LatencyBenchmarkRunner::~LatencyBenchmarkRunner() = default;
+
std::vector<BenchmarkMeasure>
LatencyBenchmarkRunner::runMeasurements(const ExecutableFunction &Function,
ScratchSpace &Scratch,
OpenPOWER on IntegriCloud