diff options
| author | Clement Courbet <courbet@google.com> | 2018-09-13 07:40:53 +0000 |
|---|---|---|
| committer | Clement Courbet <courbet@google.com> | 2018-09-13 07:40:53 +0000 |
| commit | d939f6d01396201d1b8fb5dba652e9528276e79e (patch) | |
| tree | a6a1ce6223ee509273ef8b3f6d7c9a080ee6034a /llvm/tools/llvm-exegesis/lib/Uops.h | |
| parent | 58c3dee3b3cdf103680d80b61167dda9612d3e0d (diff) | |
| download | bcm5719-llvm-d939f6d01396201d1b8fb5dba652e9528276e79e.tar.gz bcm5719-llvm-d939f6d01396201d1b8fb5dba652e9528276e79e.zip | |
[llvm-exegesis][NFC] Split BenchmarkRunner class
Summary:
The snippet-generation part goes to the SnippetGenerator class.
This will allow benchmarking arbitrary code (see PR38437).
Reviewers: gchatelet
Subscribers: mgorny, tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D51979
llvm-svn: 342117
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/Uops.h')
| -rw-r--r-- | llvm/tools/llvm-exegesis/lib/Uops.h | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/Uops.h b/llvm/tools/llvm-exegesis/lib/Uops.h index 0236cd99182..160397affed 100644 --- a/llvm/tools/llvm-exegesis/lib/Uops.h +++ b/llvm/tools/llvm-exegesis/lib/Uops.h @@ -16,14 +16,14 @@ #define LLVM_TOOLS_LLVM_EXEGESIS_UOPS_H #include "BenchmarkRunner.h" +#include "SnippetGenerator.h" namespace exegesis { -class UopsBenchmarkRunner : public BenchmarkRunner { +class UopsSnippetGenerator : public SnippetGenerator { public: - UopsBenchmarkRunner(const LLVMState &State) - : BenchmarkRunner(State, InstructionBenchmark::Uops) {} - ~UopsBenchmarkRunner() override; + UopsSnippetGenerator(const LLVMState &State) : SnippetGenerator(State) {} + ~UopsSnippetGenerator() override; llvm::Expected<CodeTemplate> generateCodeTemplate(unsigned Opcode) const override; @@ -33,10 +33,6 @@ public: private: llvm::Error isInfeasible(const llvm::MCInstrDesc &MCInstrDesc) const; - std::vector<BenchmarkMeasure> - runMeasurements(const ExecutableFunction &EF, ScratchSpace &Scratch, - const unsigned NumRepetitions) const override; - // Instantiates memory operands within a snippet. // To make computations as parallel as possible, we generate independant // memory locations for instructions that load and store. If there are less @@ -65,6 +61,20 @@ private: std::vector<InstructionBuilder> &Snippet) const; }; +class UopsBenchmarkRunner : public BenchmarkRunner { +public: + UopsBenchmarkRunner(const LLVMState &State) + : BenchmarkRunner(State, InstructionBenchmark::Uops) {} + ~UopsBenchmarkRunner() override; + + static constexpr const size_t kMinNumDifferentAddresses = 6; + +private: + std::vector<BenchmarkMeasure> + runMeasurements(const ExecutableFunction &EF, ScratchSpace &Scratch, + const unsigned NumRepetitions) const override; +}; + } // namespace exegesis #endif // LLVM_TOOLS_LLVM_EXEGESIS_UOPS_H |

