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.cpp | |
| 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.cpp')
| -rw-r--r-- | llvm/tools/llvm-exegesis/lib/Uops.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/Uops.cpp b/llvm/tools/llvm-exegesis/lib/Uops.cpp index d7346de85a0..beb9fa8acf5 100644 --- a/llvm/tools/llvm-exegesis/lib/Uops.cpp +++ b/llvm/tools/llvm-exegesis/lib/Uops.cpp @@ -86,7 +86,7 @@ static bool hasUnknownOperand(const llvm::MCOperandInfo &OpInfo) { } llvm::Error -UopsBenchmarkRunner::isInfeasible(const llvm::MCInstrDesc &MCInstrDesc) const { +UopsSnippetGenerator::isInfeasible(const llvm::MCInstrDesc &MCInstrDesc) const { if (llvm::any_of(MCInstrDesc.operands(), hasUnknownOperand)) return llvm::make_error<BenchmarkFailure>( "Infeasible : has unknown operands"); @@ -123,8 +123,9 @@ static void remove(llvm::BitVector &a, const llvm::BitVector &b) { } UopsBenchmarkRunner::~UopsBenchmarkRunner() = default; +UopsSnippetGenerator::~UopsSnippetGenerator() = default; -void UopsBenchmarkRunner::instantiateMemoryOperands( +void UopsSnippetGenerator::instantiateMemoryOperands( const unsigned ScratchSpacePointerInReg, std::vector<InstructionBuilder> &Instructions) const { if (ScratchSpacePointerInReg == 0) @@ -144,11 +145,12 @@ void UopsBenchmarkRunner::instantiateMemoryOperands( ++I; Instructions.push_back(std::move(IB)); } - assert(I * MemStep < ScratchSpace::kSize && "not enough scratch space"); + assert(I * MemStep < BenchmarkRunner::ScratchSpace::kSize && + "not enough scratch space"); } llvm::Expected<CodeTemplate> -UopsBenchmarkRunner::generateCodeTemplate(unsigned Opcode) const { +UopsSnippetGenerator::generateCodeTemplate(unsigned Opcode) const { const auto &InstrDesc = State.getInstrInfo().get(Opcode); if (auto E = isInfeasible(InstrDesc)) return std::move(E); @@ -285,6 +287,6 @@ UopsBenchmarkRunner::runMeasurements(const ExecutableFunction &Function, return Result; } -constexpr const size_t UopsBenchmarkRunner::kMinNumDifferentAddresses; +constexpr const size_t UopsSnippetGenerator::kMinNumDifferentAddresses; } // namespace exegesis |

