2018-04-04 11:37:06 +00:00
|
|
|
//===-- Latency.h -----------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// \file
|
|
|
|
/// A BenchmarkRunner implementation to measure instruction latencies.
|
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H
|
|
|
|
#define LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H
|
|
|
|
|
|
|
|
#include "BenchmarkRunner.h"
|
2018-06-13 13:24:41 +00:00
|
|
|
#include "MCInstrDescView.h"
|
2018-04-04 11:37:06 +00:00
|
|
|
|
|
|
|
namespace exegesis {
|
|
|
|
|
|
|
|
class LatencyBenchmarkRunner : public BenchmarkRunner {
|
|
|
|
public:
|
2018-06-26 08:49:30 +00:00
|
|
|
LatencyBenchmarkRunner(const LLVMState &State)
|
|
|
|
: BenchmarkRunner(State, InstructionBenchmark::Latency) {}
|
2018-04-04 11:37:06 +00:00
|
|
|
~LatencyBenchmarkRunner() override;
|
|
|
|
|
2018-08-03 09:29:38 +00:00
|
|
|
llvm::Expected<CodeTemplate>
|
|
|
|
generateCodeTemplate(unsigned Opcode) const override;
|
2018-06-13 13:24:41 +00:00
|
|
|
|
2018-04-04 11:37:06 +00:00
|
|
|
private:
|
2018-06-13 13:24:41 +00:00
|
|
|
llvm::Error isInfeasible(const llvm::MCInstrDesc &MCInstrDesc) const;
|
|
|
|
|
2018-08-03 09:29:38 +00:00
|
|
|
llvm::Expected<CodeTemplate>
|
|
|
|
generateTwoInstructionPrototype(const Instruction &Instr) const;
|
2018-06-13 13:24:41 +00:00
|
|
|
|
2018-04-04 11:37:06 +00:00
|
|
|
std::vector<BenchmarkMeasure>
|
2018-08-01 14:41:45 +00:00
|
|
|
runMeasurements(const ExecutableFunction &EF, ScratchSpace &Scratch,
|
2018-05-17 10:52:18 +00:00
|
|
|
const unsigned NumRepetitions) const override;
|
2018-07-02 13:14:49 +00:00
|
|
|
|
|
|
|
virtual const char *getCounterName() const;
|
2018-04-04 11:37:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace exegesis
|
|
|
|
|
|
|
|
#endif // LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H
|