[WinEH] Move WinEHFuncInfo from MachineModuleInfo to MachineFunction
[oota-llvm.git] / lib / Target / X86 / X86FrameLowering.cpp
index 72baa078661ad2051d6cc0eda53b4f256b89810e..4fbe3613d1e5f0599c7d7cb4909001277af0905f 100644 (file)
@@ -1252,7 +1252,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF,
       assert(classifyEHPersonality(Fn->getPersonalityFn()) ==
              EHPersonality::MSVC_CXX);
       unsigned FrameReg;
-      int FI = MMI.getWinEHFuncInfo(Fn).EHRegNodeFrameIndex;
+      int FI = MF.getWinEHFuncInfo()->EHRegNodeFrameIndex;
       int64_t EHRegOffset = getFrameIndexReference(MF, FI, FrameReg);
       // ESP is the first field, so no extra displacement is needed.
       addRegOffset(BuildMI(MBB, MBBI, DL, TII.get(X86::MOV32mr)), FrameReg,
@@ -1292,7 +1292,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF,
     // and the GC can recover it.
     unsigned PSPSlotOffset = getPSPSlotOffsetFromSP(MF);
     auto PSPInfo = MachinePointerInfo::getFixedStack(
-        MF, MF.getMMI().getWinEHFuncInfo(Fn).PSPSymFrameIdx);
+        MF, MF.getWinEHFuncInfo()->PSPSymFrameIdx);
     addRegOffset(BuildMI(MBB, MBBI, DL, TII.get(X86::MOV64mr)), StackPtr, false,
                  PSPSlotOffset)
         .addReg(StackPtr)
@@ -1401,8 +1401,7 @@ static bool isFuncletReturnInstr(MachineInstr *MI) {
 // frame with only a single offset reported for the entire method.
 unsigned
 X86FrameLowering::getPSPSlotOffsetFromSP(const MachineFunction &MF) const {
-  MachineModuleInfo &MMI = MF.getMMI();
-  WinEHFuncInfo &Info = MMI.getWinEHFuncInfo(MF.getFunction());
+  const WinEHFuncInfo &Info = *MF.getWinEHFuncInfo();
   // getFrameIndexReferenceFromSP has an out ref parameter for the stack
   // pointer register; pass a dummy that we ignore
   unsigned SPReg;
@@ -2592,9 +2591,7 @@ MachineBasicBlock::iterator X86FrameLowering::restoreWin32EHStackPointers(
   MachineFunction &MF = *MBB.getParent();
   unsigned FramePtr = TRI->getFrameRegister(MF);
   unsigned BasePtr = TRI->getBaseRegister();
-  MachineModuleInfo &MMI = MF.getMMI();
-  const Function *Fn = MF.getFunction();
-  WinEHFuncInfo &FuncInfo = MMI.getWinEHFuncInfo(Fn);
+  WinEHFuncInfo &FuncInfo = *MF.getWinEHFuncInfo();
   X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>();
   MachineFrameInfo *MFI = MF.getFrameInfo();
 
@@ -2679,7 +2676,7 @@ void X86FrameLowering::processFunctionBeforeFrameFinalized(
   int64_t UnwindHelpOffset = MinFixedObjOffset - SlotSize;
   int UnwindHelpFI =
       MFI->CreateFixedObject(SlotSize, UnwindHelpOffset, /*Immutable=*/false);
-  MF.getMMI().getWinEHFuncInfo(Fn).UnwindHelpFrameIdx = UnwindHelpFI;
+  MF.getWinEHFuncInfo()->UnwindHelpFrameIdx = UnwindHelpFI;
 
   // Store -2 into UnwindHelp on function entry. We have to scan forwards past
   // other frame setup instructions.