[llvm-exegesis][NFC] Return many CodeTemplates instead of one.
[llvm-core.git] / tools / llvm-exegesis / lib / Latency.h
blobf78f12615c7316151a93c887667de0d24d2f3b8c
1 //===-- Latency.h -----------------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// A BenchmarkRunner implementation to measure instruction latencies.
12 ///
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H
16 #define LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H
18 #include "BenchmarkRunner.h"
19 #include "MCInstrDescView.h"
20 #include "SnippetGenerator.h"
22 namespace exegesis {
24 class LatencySnippetGenerator : public SnippetGenerator {
25 public:
26 LatencySnippetGenerator(const LLVMState &State) : SnippetGenerator(State) {}
27 ~LatencySnippetGenerator() override;
29 llvm::Expected<std::vector<CodeTemplate>>
30 generateCodeTemplates(const Instruction &Instr) const override;
33 class LatencyBenchmarkRunner : public BenchmarkRunner {
34 public:
35 LatencyBenchmarkRunner(const LLVMState &State)
36 : BenchmarkRunner(State, InstructionBenchmark::Latency) {}
37 ~LatencyBenchmarkRunner() override;
39 private:
40 std::vector<BenchmarkMeasure>
41 runMeasurements(const ExecutableFunction &EF,
42 ScratchSpace &Scratch) const override;
44 virtual const char *getCounterName() const;
46 } // namespace exegesis
48 #endif // LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H