summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/tools
diff options
context:
space:
mode:
authorClement Courbet <courbet@google.com>2018-05-17 11:31:24 +0000
committerClement Courbet <courbet@google.com>2018-05-17 11:31:24 +0000
commit0994ec2f211710b55ea4b8b32514f869e830f2ad (patch)
tree3482d9f9f61a73b630fa7b10b1a7a81166701af2 /llvm/unittests/tools
parenta2a9cfab83a9252b3fbdb0b487fd5acb6e32b323 (diff)
downloadbcm5719-llvm-0994ec2f211710b55ea4b8b32514f869e830f2ad.tar.gz
bcm5719-llvm-0994ec2f211710b55ea4b8b32514f869e830f2ad.zip
Fix r332592 : X86 tests should use the X86 target, not the native targets.
llvm-svn: 332594
Diffstat (limited to 'llvm/unittests/tools')
-rw-r--r--llvm/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/llvm/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp
index eb6f294dc13..e756e803eca 100644
--- a/llvm/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp
+++ b/llvm/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp
@@ -4,7 +4,6 @@
#include <memory>
#include "X86InstrInfo.h"
-#include "llvm/Support/Host.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "gmock/gmock.h"
@@ -16,17 +15,27 @@ namespace {
class RegisterAliasingTest : public ::testing::Test {
protected:
RegisterAliasingTest() {
- const std::string TT = llvm::sys::getProcessTriple();
+ const std::string TT = "x86_64-unknown-linux";
std::string error;
const llvm::Target *const TheTarget =
llvm::TargetRegistry::lookupTarget(TT, error);
- assert(TheTarget);
+ if (!TheTarget) {
+ llvm::errs() << error << "\n";
+ return;
+ }
MCRegInfo.reset(TheTarget->createMCRegInfo(TT));
}
- static void SetUpTestCase() { llvm::InitializeNativeTarget(); }
+ static void SetUpTestCase() {
+ LLVMInitializeX86TargetInfo();
+ LLVMInitializeX86Target();
+ LLVMInitializeX86TargetMC();
+ }
- const llvm::MCRegisterInfo &getMCRegInfo() { return *MCRegInfo; }
+ const llvm::MCRegisterInfo &getMCRegInfo() {
+ assert(MCRegInfo);
+ return *MCRegInfo;
+ }
private:
std::unique_ptr<const llvm::MCRegisterInfo> MCRegInfo;
OpenPOWER on IntegriCloud