[InstCombine] Signed saturation patterns
[llvm-core.git] / tools / llvm-exegesis / lib / Latency.h
blob83d754d25d1069d2361a69f2b34930156e3ad92e
1 //===-- Latency.h -----------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// A BenchmarkRunner implementation to measure instruction latencies.
11 ///
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H
15 #define LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H
17 #include "BenchmarkRunner.h"
18 #include "Error.h"
19 #include "MCInstrDescView.h"
20 #include "SnippetGenerator.h"
22 namespace llvm {
23 namespace exegesis {
25 class LatencySnippetGenerator : public SnippetGenerator {
26 public:
27 using SnippetGenerator::SnippetGenerator;
28 ~LatencySnippetGenerator() override;
30 Expected<std::vector<CodeTemplate>>
31 generateCodeTemplates(const Instruction &Instr,
32 const BitVector &ForbiddenRegisters) const override;
35 class LatencyBenchmarkRunner : public BenchmarkRunner {
36 public:
37 LatencyBenchmarkRunner(const LLVMState &State,
38 InstructionBenchmark::ModeE Mode);
39 ~LatencyBenchmarkRunner() override;
41 private:
42 Expected<std::vector<BenchmarkMeasure>>
43 runMeasurements(const FunctionExecutor &Executor) const override;
45 } // namespace exegesis
46 } // namespace llvm
48 #endif // LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H