aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2018-06-13 14:07:36 +0000
committerGuillaume Chatelet <gchatelet@google.com>2018-06-13 14:07:36 +0000
commitb391f2430378cd4d1bba41d04e6f60d890748f20 (patch)
treeab87487d53ac38f33a4fc8d50404124285328bdd
parente368de364e1fa1dcd0f67a5fbb5ae5cbb0adae65 (diff)
downloadllvm-b391f2430378cd4d1bba41d04e6f60d890748f20.zip
llvm-b391f2430378cd4d1bba41d04e6f60d890748f20.tar.gz
llvm-b391f2430378cd4d1bba41d04e6f60d890748f20.tar.bz2
[llvm-exegesis] Fix buildbot - power was using native target for X86.
Reviewers: courbet Reviewed By: courbet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48125 llvm-svn: 334601
-rw-r--r--llvm/tools/llvm-exegesis/lib/LlvmState.cpp9
-rw-r--r--llvm/tools/llvm-exegesis/lib/LlvmState.h3
-rw-r--r--llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp3
3 files changed, 11 insertions, 4 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/LlvmState.cpp b/llvm/tools/llvm-exegesis/lib/LlvmState.cpp
index cb534f5..e286853 100644
--- a/llvm/tools/llvm-exegesis/lib/LlvmState.cpp
+++ b/llvm/tools/llvm-exegesis/lib/LlvmState.cpp
@@ -20,9 +20,8 @@
namespace exegesis {
-LLVMState::LLVMState()
- : TheTriple(llvm::sys::getProcessTriple()),
- CpuName(llvm::sys::getHostCPUName().str()) {
+LLVMState::LLVMState(const std::string &Triple, const std::string &CpuName)
+ : TheTriple(Triple), CpuName(CpuName) {
std::string Error;
TheTarget = llvm::TargetRegistry::lookupTarget(TheTriple, Error);
assert(TheTarget && "unknown target for host");
@@ -33,6 +32,10 @@ LLVMState::LLVMState()
AsmInfo.reset(TheTarget->createMCAsmInfo(*RegInfo, TheTriple));
}
+LLVMState::LLVMState()
+ : LLVMState(llvm::sys::getProcessTriple(),
+ llvm::sys::getHostCPUName().str()) {}
+
std::unique_ptr<llvm::LLVMTargetMachine>
LLVMState::createTargetMachine() const {
const llvm::TargetOptions Options;
diff --git a/llvm/tools/llvm-exegesis/lib/LlvmState.h b/llvm/tools/llvm-exegesis/lib/LlvmState.h
index 6bde4f6..3c8a4a0 100644
--- a/llvm/tools/llvm-exegesis/lib/LlvmState.h
+++ b/llvm/tools/llvm-exegesis/lib/LlvmState.h
@@ -32,6 +32,9 @@ class LLVMState {
public:
LLVMState();
+ LLVMState(const std::string &Triple,
+ const std::string &CpuName); // For tests.
+
llvm::StringRef getTriple() const { return TheTriple; }
llvm::StringRef getCpuName() const { return CpuName; }
llvm::StringRef getFeatures() const { return Features; }
diff --git a/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
index d020d4c..fda7d06 100644
--- a/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
+++ b/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
@@ -23,7 +23,8 @@ namespace {
class X86SnippetGeneratorTest : public ::testing::Test {
protected:
X86SnippetGeneratorTest()
- : MCInstrInfo(State.getInstrInfo()), MCRegisterInfo(State.getRegInfo()) {}
+ : State("x86_64-unknown-linux", "haswell"),
+ MCInstrInfo(State.getInstrInfo()), MCRegisterInfo(State.getRegInfo()) {}
static void SetUpTestCase() {
LLVMInitializeX86TargetInfo();