From aa3c1410b427909da350f2b5e8d4ec3db62a3618 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Tue, 30 May 2006 21:45:53 +0000 Subject: [PATCH] Fix a build breaker. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28574 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrInfo.cpp | 22 ++++++++++++---------- lib/Target/X86/X86InstrInfo.h | 4 +++- lib/Target/X86/X86TargetMachine.cpp | 4 ++-- lib/Target/X86/X86TargetMachine.h | 4 ++-- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index e414e19656e..71504f94d02 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -13,13 +13,16 @@ #include "X86InstrInfo.h" #include "X86.h" +#include "X86GenInstrInfo.inc" #include "X86InstrBuilder.h" +#include "X86Subtarget.h" +#include "X86TargetMachine.h" #include "llvm/CodeGen/MachineInstrBuilder.h" -#include "X86GenInstrInfo.inc" using namespace llvm; -X86InstrInfo::X86InstrInfo() - : TargetInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0])) { +X86InstrInfo::X86InstrInfo(X86TargetMachine &tm) + : TargetInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0])), + TM(tm) { } @@ -122,13 +125,12 @@ MachineInstr *X86InstrInfo::convertToThreeAddress(MachineInstr *MI) const { case X86::SHUFPSrri: { assert(MI->getNumOperands() == 4 && "Unknown shufps instruction!"); const X86Subtarget *Subtarget = &TM.getSubtarget(); - if (Subtarget->hasSSE2()) { - unsigned A = MI->getOperand(0).getReg(); - unsigned B = MI->getOperand(1).getReg(); - unsigned C = MI->getOperand(2).getReg(); - unsigned M = MI->getOperand(3).getImmedValue(); - return BuildMI(X86::PSHUFDri, 2, A).addReg(B).addImm(M); - } + if (!Subtarget->hasSSE2()) return 0; + unsigned A = MI->getOperand(0).getReg(); + unsigned B = MI->getOperand(1).getReg(); + unsigned C = MI->getOperand(2).getReg(); + unsigned M = MI->getOperand(3).getImmedValue(); + return BuildMI(X86::PSHUFDri, 2, A).addReg(B).addImm(M); } } diff --git a/lib/Target/X86/X86InstrInfo.h b/lib/Target/X86/X86InstrInfo.h index b49c351d68f..7691798646f 100644 --- a/lib/Target/X86/X86InstrInfo.h +++ b/lib/Target/X86/X86InstrInfo.h @@ -18,6 +18,7 @@ #include "X86RegisterInfo.h" namespace llvm { + class X86TargetMachine; /// X86II - This namespace holds all of the target specific flags that /// instruction info tracks. @@ -168,9 +169,10 @@ namespace X86II { } class X86InstrInfo : public TargetInstrInfo { + X86TargetMachine &TM; const X86RegisterInfo RI; public: - X86InstrInfo(); + X86InstrInfo(X86TargetMachine &tm); /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As /// such, whenever a client has an instance of instruction info, it should diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index 846da901695..8ab0073633d 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -69,11 +69,11 @@ unsigned X86TargetMachine::getModuleMatchQuality(const Module &M) { /// X86TargetMachine::X86TargetMachine(const Module &M, const std::string &FS) : TargetMachine("X86"), - DataLayout(std::string("X86"), std::string("e-p:32:32-d:32-l:32")), Subtarget(M, FS), + DataLayout(std::string("X86"), std::string("e-p:32:32-d:32-l:32")), FrameInfo(TargetFrameInfo::StackGrowsDown, Subtarget.getStackAlignment(), -4), - JITInfo(*this), TLInfo(*this) { + InstrInfo(*this), JITInfo(*this), TLInfo(*this) { if (getRelocationModel() == Reloc::Default) if (Subtarget.isTargetDarwin()) setRelocationModel(Reloc::DynamicNoPIC); diff --git a/lib/Target/X86/X86TargetMachine.h b/lib/Target/X86/X86TargetMachine.h index f85794bd4b7..8a76b0e89cd 100644 --- a/lib/Target/X86/X86TargetMachine.h +++ b/lib/Target/X86/X86TargetMachine.h @@ -27,10 +27,10 @@ namespace llvm { class X86TargetMachine : public TargetMachine { - const TargetData DataLayout; // Calculates type size & alignment - X86InstrInfo InstrInfo; X86Subtarget Subtarget; + const TargetData DataLayout; // Calculates type size & alignment TargetFrameInfo FrameInfo; + X86InstrInfo InstrInfo; X86JITInfo JITInfo; X86TargetLowering TLInfo; public: -- 2.34.1