From 4860b9844375c608a465f2c25c77d013d5ce570e Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Tue, 26 Jun 2018 08:49:30 +0000 Subject: [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 --- llvm/tools/llvm-exegesis/lib/LlvmState.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/tools/llvm-exegesis/lib/LlvmState.cpp') diff --git a/llvm/tools/llvm-exegesis/lib/LlvmState.cpp b/llvm/tools/llvm-exegesis/lib/LlvmState.cpp index 9b30d78b0c9..9ff42ca71fd 100644 --- a/llvm/tools/llvm-exegesis/lib/LlvmState.cpp +++ b/llvm/tools/llvm-exegesis/lib/LlvmState.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "LlvmState.h" +#include "Target.h" #include "llvm/ADT/SmallVector.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCContext.h" @@ -30,6 +31,10 @@ LLVMState::LLVMState(const std::string &Triple, const std::string &CpuName) { TheTarget->createTargetMachine(Triple, CpuName, /*Features*/ "", Options, llvm::Reloc::Model::Static))); TheExegesisTarget = ExegesisTarget::lookup(TargetMachine->getTargetTriple()); + if (!TheExegesisTarget) { + llvm::errs() << "no exegesis target for " << Triple << ", using default\n"; + TheExegesisTarget = &ExegesisTarget::getDefault(); + } } LLVMState::LLVMState() -- cgit v1.2.3