summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86FrameLowering.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-11-17 21:10:25 +0000
committerReid Kleckner <rnk@google.com>2015-11-17 21:10:25 +0000
commitc20276d0b2da8bff1e3da2fd80fc4d17f861eddd (patch)
treeb9a45ab78fbb27616e40726209077d3acac213cc /llvm/lib/Target/X86/X86FrameLowering.cpp
parentc4e2bed73885b35ba82dd872cc20c9aa46ec774a (diff)
downloadbcm5719-llvm-c20276d0b2da8bff1e3da2fd80fc4d17f861eddd.tar.gz
bcm5719-llvm-c20276d0b2da8bff1e3da2fd80fc4d17f861eddd.zip
[WinEH] Move WinEHFuncInfo from MachineModuleInfo to MachineFunction
Summary: Now that there is a one-to-one mapping from MachineFunction to WinEHFuncInfo, we don't need to use a DenseMap to select the right WinEHFuncInfo for the current funclet. The main challenge here is that X86WinEHStatePass is an IR pass that doesn't have access to the MachineFunction. I gave it its own WinEHFuncInfo object that it uses to calculate state numbers, which it then throws away. As long as nobody creates or removes EH pads between this pass and SDAG construction, we will get the same state numbers. The other thing X86WinEHStatePass does is to mark the EH registration node. Instead of communicating which alloca was the registration through WinEHFuncInfo, I added the llvm.x86.seh.ehregnode intrinsic. This intrinsic generates no code and simply marks the alloca in use. Reviewers: JCTremoulet Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14668 llvm-svn: 253378
Diffstat (limited to 'llvm/lib/Target/X86/X86FrameLowering.cpp')
-rw-r--r--llvm/lib/Target/X86/X86FrameLowering.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp
index 72baa078661..4fbe3613d1e 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -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.
OpenPOWER on IntegriCloud