summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-exegesis/lib/LlvmState.cpp
diff options
context:
space:
mode:
authorClement Courbet <courbet@google.com>2018-06-26 08:49:30 +0000
committerClement Courbet <courbet@google.com>2018-06-26 08:49:30 +0000
commit4860b9844375c608a465f2c25c77d013d5ce570e (patch)
treef98c861964d14b083a1bb1379732527238329e64 /llvm/tools/llvm-exegesis/lib/LlvmState.cpp
parent36cbbff48e5e69e93c1691360d5f35ac80c760f8 (diff)
downloadbcm5719-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/tools/llvm-exegesis/lib/LlvmState.cpp')
-rw-r--r--llvm/tools/llvm-exegesis/lib/LlvmState.cpp5
1 files changed, 5 insertions, 0 deletions
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()
OpenPOWER on IntegriCloud