diff --git a/include/llvm/CodeGen/FastISel.h b/include/llvm/CodeGen/FastISel.h index 487031c1990..b3b4c75cab5 100644 --- a/include/llvm/CodeGen/FastISel.h +++ b/include/llvm/CodeGen/FastISel.h @@ -49,7 +49,6 @@ protected: SmallSet &CatchInfoLost; #endif MachineFunction &MF; - MachineModuleInfo *MMI; MachineRegisterInfo &MRI; MachineFrameInfo &MFI; MachineConstantPool &MCP; @@ -114,7 +113,6 @@ public: protected: FastISel(MachineFunction &mf, - MachineModuleInfo *mmi, DenseMap &vm, DenseMap &bm, DenseMap &am diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index 862a8bad3da..1a94b4448ae 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -47,7 +47,6 @@ namespace llvm { class MachineFrameInfo; class MachineInstr; class MachineJumpTableInfo; - class MachineModuleInfo; class MCContext; class MCExpr; class SDNode; @@ -1272,7 +1271,7 @@ public: /// createFastISel - This method returns a target specific FastISel object, /// or null if the target does not support "fast" ISel. virtual FastISel * - createFastISel(MachineFunction &, MachineModuleInfo *, + createFastISel(MachineFunction &, DenseMap &, DenseMap &, DenseMap & diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index fdb3b5c3ad8..4bf41f28c25 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -326,7 +326,7 @@ bool FastISel::SelectCall(User *I) { case Intrinsic::dbg_declare: { DbgDeclareInst *DI = cast(I); if (!DIDescriptor::ValidDebugInfo(DI->getVariable(), CodeGenOpt::None) || - !MMI->hasDebugInfo()) + !MF.getMMI().hasDebugInfo()) return true; Value *Address = DI->getAddress(); @@ -340,7 +340,7 @@ bool FastISel::SelectCall(User *I) { if (SI == StaticAllocaMap.end()) break; // VLAs. int FI = SI->second; if (!DI->getDebugLoc().isUnknown()) - MMI->setVariableDbgInfo(DI->getVariable(), FI, DI->getDebugLoc()); + MF.getMMI().setVariableDbgInfo(DI->getVariable(), FI, DI->getDebugLoc()); // Building the map above is target independent. Generating DBG_VALUE // inline is target dependent; do this now. @@ -399,44 +399,39 @@ bool FastISel::SelectCall(User *I) { switch (TLI.getOperationAction(ISD::EHSELECTION, VT)) { default: break; case TargetLowering::Expand: { - if (MMI) { - if (MBB->isLandingPad()) - AddCatchInfo(*cast(I), MMI, MBB); - else { + if (MBB->isLandingPad()) + AddCatchInfo(*cast(I), &MF.getMMI(), MBB); + else { #ifndef NDEBUG - CatchInfoLost.insert(cast(I)); + CatchInfoLost.insert(cast(I)); #endif - // FIXME: Mark exception selector register as live in. Hack for PR1508. - unsigned Reg = TLI.getExceptionSelectorRegister(); - if (Reg) MBB->addLiveIn(Reg); - } - + // FIXME: Mark exception selector register as live in. Hack for PR1508. unsigned Reg = TLI.getExceptionSelectorRegister(); - EVT SrcVT = TLI.getPointerTy(); - const TargetRegisterClass *RC = TLI.getRegClassFor(SrcVT); - unsigned ResultReg = createResultReg(RC); - bool InsertedCopy = TII.copyRegToReg(*MBB, MBB->end(), ResultReg, Reg, - RC, RC); - assert(InsertedCopy && "Can't copy address registers!"); - InsertedCopy = InsertedCopy; - - // Cast the register to the type of the selector. - if (SrcVT.bitsGT(MVT::i32)) - ResultReg = FastEmit_r(SrcVT.getSimpleVT(), MVT::i32, ISD::TRUNCATE, - ResultReg); - else if (SrcVT.bitsLT(MVT::i32)) - ResultReg = FastEmit_r(SrcVT.getSimpleVT(), MVT::i32, - ISD::SIGN_EXTEND, ResultReg); - if (ResultReg == 0) - // Unhandled operand. Halt "fast" selection and bail. - return false; - - UpdateValueMap(I, ResultReg); - } else { - unsigned ResultReg = - getRegForValue(Constant::getNullValue(I->getType())); - UpdateValueMap(I, ResultReg); + if (Reg) MBB->addLiveIn(Reg); } + + unsigned Reg = TLI.getExceptionSelectorRegister(); + EVT SrcVT = TLI.getPointerTy(); + const TargetRegisterClass *RC = TLI.getRegClassFor(SrcVT); + unsigned ResultReg = createResultReg(RC); + bool InsertedCopy = TII.copyRegToReg(*MBB, MBB->end(), ResultReg, Reg, + RC, RC); + assert(InsertedCopy && "Can't copy address registers!"); + InsertedCopy = InsertedCopy; + + // Cast the register to the type of the selector. + if (SrcVT.bitsGT(MVT::i32)) + ResultReg = FastEmit_r(SrcVT.getSimpleVT(), MVT::i32, ISD::TRUNCATE, + ResultReg); + else if (SrcVT.bitsLT(MVT::i32)) + ResultReg = FastEmit_r(SrcVT.getSimpleVT(), MVT::i32, + ISD::SIGN_EXTEND, ResultReg); + if (ResultReg == 0) + // Unhandled operand. Halt "fast" selection and bail. + return false; + + UpdateValueMap(I, ResultReg); + return true; } } @@ -733,7 +728,6 @@ FastISel::SelectOperator(User *I, unsigned Opcode) { } FastISel::FastISel(MachineFunction &mf, - MachineModuleInfo *mmi, DenseMap &vm, DenseMap &bm, DenseMap &am @@ -749,7 +743,6 @@ FastISel::FastISel(MachineFunction &mf, CatchInfoLost(cil), #endif MF(mf), - MMI(mmi), MRI(MF.getRegInfo()), MFI(*MF.getFrameInfo()), MCP(*MF.getConstantPool()), diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index a6de8e737ea..ff832aa86fc 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -845,9 +845,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn, // Initialize the Fast-ISel state, if needed. FastISel *FastIS = 0; if (EnableFastISel) - FastIS = TLI.createFastISel(MF, MMI, - FuncInfo->ValueMap, - FuncInfo->MBBMap, + FastIS = TLI.createFastISel(MF, FuncInfo->ValueMap, FuncInfo->MBBMap, FuncInfo->StaticAllocaMap #ifndef NDEBUG , FuncInfo->CatchInfoLost diff --git a/lib/Target/X86/X86FastISel.cpp b/lib/Target/X86/X86FastISel.cpp index 536c64f8070..7849b51accc 100644 --- a/lib/Target/X86/X86FastISel.cpp +++ b/lib/Target/X86/X86FastISel.cpp @@ -54,7 +54,6 @@ class X86FastISel : public FastISel { public: explicit X86FastISel(MachineFunction &mf, - MachineModuleInfo *mmi, DenseMap &vm, DenseMap &bm, DenseMap &am @@ -62,7 +61,7 @@ public: , SmallSet &cil #endif ) - : FastISel(mf, mmi, vm, bm, am + : FastISel(mf, vm, bm, am #ifndef NDEBUG , cil #endif @@ -1752,7 +1751,6 @@ unsigned X86FastISel::TargetMaterializeAlloca(AllocaInst *C) { namespace llvm { llvm::FastISel *X86::createFastISel(MachineFunction &mf, - MachineModuleInfo *mmi, DenseMap &vm, DenseMap &bm, DenseMap &am @@ -1760,7 +1758,7 @@ namespace llvm { , SmallSet &cil #endif ) { - return new X86FastISel(mf, mmi, vm, bm, am + return new X86FastISel(mf, vm, bm, am #ifndef NDEBUG , cil #endif diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 7ac6628236f..64702f1d5c9 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -2398,7 +2398,7 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee, } FastISel * -X86TargetLowering::createFastISel(MachineFunction &mf, MachineModuleInfo *mmo, +X86TargetLowering::createFastISel(MachineFunction &mf, DenseMap &vm, DenseMap &bm, DenseMap &am @@ -2406,7 +2406,7 @@ X86TargetLowering::createFastISel(MachineFunction &mf, MachineModuleInfo *mmo, , SmallSet &cil #endif ) { - return X86::createFastISel(mf, mmo, vm, bm, am + return X86::createFastISel(mf, vm, bm, am #ifndef NDEBUG , cil #endif diff --git a/lib/Target/X86/X86ISelLowering.h b/lib/Target/X86/X86ISelLowering.h index 85099015b9c..1026480ef0a 100644 --- a/lib/Target/X86/X86ISelLowering.h +++ b/lib/Target/X86/X86ISelLowering.h @@ -574,7 +574,7 @@ namespace llvm { /// createFastISel - This method returns a target specific FastISel object, /// or null if the target does not support "fast" ISel. virtual FastISel * - createFastISel(MachineFunction &mf, MachineModuleInfo *mmi, + createFastISel(MachineFunction &mf, DenseMap &, DenseMap &, DenseMap & @@ -815,7 +815,6 @@ namespace llvm { namespace X86 { FastISel *createFastISel(MachineFunction &mf, - MachineModuleInfo *mmi, DenseMap &, DenseMap &, DenseMap &