1 //===-- Uops.h --------------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// A BenchmarkRunner implementation to measure uop decomposition.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TOOLS_LLVM_EXEGESIS_UOPS_H
16 #define LLVM_TOOLS_LLVM_EXEGESIS_UOPS_H
18 #include "BenchmarkRunner.h"
22 class UopsBenchmarkRunner
: public BenchmarkRunner
{
24 UopsBenchmarkRunner(const LLVMState
&State
)
25 : BenchmarkRunner(State
, InstructionBenchmark::Uops
) {}
26 ~UopsBenchmarkRunner() override
;
28 llvm::Expected
<SnippetPrototype
>
29 generatePrototype(unsigned Opcode
) const override
;
31 static constexpr const size_t kMinNumDifferentAddresses
= 6;
34 llvm::Error
isInfeasible(const llvm::MCInstrDesc
&MCInstrDesc
) const;
36 std::vector
<BenchmarkMeasure
>
37 runMeasurements(const ExecutableFunction
&EF
, ScratchSpace
&Scratch
,
38 const unsigned NumRepetitions
) const override
;
40 // Instantiates memory operands within a snippet.
41 // To make computations as parallel as possible, we generate independant
42 // memory locations for instructions that load and store. If there are less
43 // than kMinNumDifferentAddresses in the original snippet, we duplicate
44 // instructions until there are this number of instructions.
45 // For example, assuming kMinNumDifferentAddresses=5 and
46 // getMaxMemoryAccessSize()=64, if the original snippet is:
50 // mov eax, [rdi + 64]
51 // mov eax, [rdi + 128]
52 // mov eax, [rdi + 192]
53 // mov eax, [rdi + 256]
54 // If the original snippet is:
59 // add eax, [rdi + 64]
60 // mov eax, [rdi + 128]
61 // add eax, [rdi + 192]
62 // mov eax, [rdi + 256]
64 instantiateMemoryOperands(unsigned ScratchSpaceReg
,
65 std::vector
<InstructionInstance
> &Snippet
) const;
68 } // namespace exegesis
70 #endif // LLVM_TOOLS_LLVM_EXEGESIS_UOPS_H