diff options
| author | Clement Courbet <courbet@google.com> | 2018-06-26 08:49:30 +0000 |
|---|---|---|
| committer | Clement Courbet <courbet@google.com> | 2018-06-26 08:49:30 +0000 |
| commit | 4860b9844375c608a465f2c25c77d013d5ce570e (patch) | |
| tree | f98c861964d14b083a1bb1379732527238329e64 /llvm/unittests/tools | |
| parent | 36cbbff48e5e69e93c1691360d5f35ac80c760f8 (diff) | |
| download | bcm5719-llvm-4860b9844375c608a465f2c25c77d013d5ce570e.tar.gz bcm5719-llvm-4860b9844375c608a465f2c25c77d013d5ce570e.zip | |
[llvm-exegesis] Get the BenchmarkRunner from the ExegesisTarget.
Summary:
This allows targets to override code generation for some instructions.
As an example of override, this also moves ad-hoc instruction filtering
for X86 into the X86 ExegesisTarget.
Reviewers: gchatelet
Subscribers: mgorny, tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D48587
llvm-svn: 335582
Diffstat (limited to 'llvm/unittests/tools')
| -rw-r--r-- | llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h | 7 | ||||
| -rw-r--r-- | llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h b/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h index 52133b4aee8..a0cfb1d86c7 100644 --- a/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h +++ b/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "Assembler.h" +#include "Target.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/TargetInstrInfo.h" @@ -36,11 +37,11 @@ protected: } template <class... Bs> inline void Check(llvm::MCInst MCInst, Bs... Bytes) { - CheckWithSetup(nullptr, {}, MCInst, Bytes...); + CheckWithSetup(ExegesisTarget::getDefault(), {}, MCInst, Bytes...); } template <class... Bs> - inline void CheckWithSetup(const ExegesisTarget *ET, + inline void CheckWithSetup(const ExegesisTarget &ET, llvm::ArrayRef<unsigned> RegsToDef, llvm::MCInst MCInst, Bs... Bytes) { ExecutableFunction Function = @@ -67,7 +68,7 @@ private: } ExecutableFunction - assembleToFunction(const ExegesisTarget *ET, + assembleToFunction(const ExegesisTarget &ET, llvm::ArrayRef<unsigned> RegsToDef, llvm::ArrayRef<llvm::MCInst> Instructions) { llvm::SmallString<256> Buffer; diff --git a/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp index 77de5e78926..edacd7fe629 100644 --- a/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp @@ -217,17 +217,14 @@ TEST_F(UopsSnippetGeneratorTest, NoTiedVariables) { class FakeBenchmarkRunner : public BenchmarkRunner { public: - using BenchmarkRunner::BenchmarkRunner; + FakeBenchmarkRunner(const LLVMState &State) + : BenchmarkRunner(State, InstructionBenchmark::Unknown) {} Instruction createInstruction(unsigned Opcode) { return Instruction(State.getInstrInfo().get(Opcode), RATC); } private: - InstructionBenchmark::ModeE getMode() const override { - return InstructionBenchmark::Unknown; - } - llvm::Expected<SnippetPrototype> generatePrototype(unsigned Opcode) const override { return llvm::make_error<llvm::StringError>("not implemented", |

