OSDN Git Service

Re-land r329156 "Add llvm-exegesis tool."
[android-x86/external-llvm.git] / tools / llvm-exegesis / lib / Latency.h
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 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H
16 #define LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H
17
18 #include "BenchmarkRunner.h"
19
20 namespace exegesis {
21
22 class LatencyBenchmarkRunner : public BenchmarkRunner {
23 public:
24   ~LatencyBenchmarkRunner() override;
25
26 private:
27   const char *getDisplayName() const override;
28
29   llvm::Expected<std::vector<llvm::MCInst>>
30   createCode(const LLVMState &State, unsigned OpcodeIndex,
31              unsigned NumRepetitions,
32              const JitFunctionContext &Context) const override;
33
34   std::vector<BenchmarkMeasure>
35   runMeasurements(const LLVMState &State, const JitFunction &Function,
36                   unsigned NumRepetitions) const override;
37 };
38
39 } // namespace exegesis
40
41 #endif // LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H