[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
This commit is contained in:
Guillaume Chatelet 2018-06-13 14:07:36 +00:00
parent df2b898db8
commit ae44b4328d
3 changed files with 11 additions and 4 deletions

View File

@ -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;

View File

@ -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; }

View File

@ -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();