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-09-13 07:40:53 +00:00
|
|
|
#include "SnippetGenerator.h"
|
2018-04-04 11:37:06 +00:00
|
|
|
|
|
|
|
namespace exegesis {
|
|
|
|
|
2018-09-13 07:40:53 +00:00
|
|
|
class LatencySnippetGenerator : public SnippetGenerator {
|
2018-04-04 11:37:06 +00:00
|
|
|
public:
|
2018-09-13 07:40:53 +00:00
|
|
|
LatencySnippetGenerator(const LLVMState &State) : SnippetGenerator(State) {}
|
|
|
|
~LatencySnippetGenerator() override;
|
2018-04-04 11:37:06 +00:00
|
|
|
|
2018-10-15 09:09:19 +00:00
|
|
|
llvm::Expected<std::vector<CodeTemplate>>
|
|
|
|
generateCodeTemplates(const Instruction &Instr) const override;
|
2018-09-13 07:40:53 +00:00
|
|
|
};
|
2018-06-13 13:24:41 +00:00
|
|
|
|
2018-09-13 07:40:53 +00:00
|
|
|
class LatencyBenchmarkRunner : public BenchmarkRunner {
|
|
|
|
public:
|
|
|
|
LatencyBenchmarkRunner(const LLVMState &State)
|
|
|
|
: BenchmarkRunner(State, InstructionBenchmark::Latency) {}
|
|
|
|
~LatencyBenchmarkRunner() override;
|
|
|
|
|
|
|
|
private:
|
2018-10-17 15:04:15 +00:00
|
|
|
llvm::Expected<std::vector<BenchmarkMeasure>>
|
|
|
|
runMeasurements(const FunctionExecutor &Executor) 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
|