summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86FrameLowering.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-10-01 21:38:24 +0000
committerReid Kleckner <rnk@google.com>2015-10-01 21:38:24 +0000
commitfc64fae6e35cf024bd07a364c6268cef5c54c56c (patch)
tree842da66ccbf3863c5d1f968df402f99af273a500 /llvm/lib/Target/X86/X86FrameLowering.cpp
parent5d41326751920e089029af784901a72f5f69cc80 (diff)
downloadbcm5719-llvm-fc64fae6e35cf024bd07a364c6268cef5c54c56c.tar.gz
bcm5719-llvm-fc64fae6e35cf024bd07a364c6268cef5c54c56c.zip
[WinEH] Emit __C_specific_handler tables for the new IR
We emit denormalized tables, where every range of invokes in the same state gets a complete list of EH action entries. This is significantly simpler than trying to infer the correct nested scoping structure from the MI. Fortunately, for SEH, the nesting structure is really just a size optimization. With this, some basic __try / __except examples work. llvm-svn: 249078
Diffstat (limited to 'llvm/lib/Target/X86/X86FrameLowering.cpp')
-rw-r--r--llvm/lib/Target/X86/X86FrameLowering.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp
index fc192cd6bfd..c2c9f07ee10 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -1489,10 +1489,21 @@ bool X86FrameLowering::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
if (CSI.empty())
return false;
- // Don't restore CSRs in 32-bit EH funclets. Matches
- // spillCalleeSavedRegisters.
- if (isFuncletReturnInstr(MI) && STI.is32Bit() && STI.isOSWindows())
- return true;
+ if (isFuncletReturnInstr(MI) && STI.isOSWindows()) {
+ // Don't restore CSRs in 32-bit EH funclets. Matches
+ // spillCalleeSavedRegisters.
+ if (STI.is32Bit())
+ return true;
+ // Don't restore CSRs before an SEH catchret. SEH except blocks do not form
+ // funclets. emitEpilogue transforms these to normal jumps.
+ if (MI->getOpcode() == X86::CATCHRET) {
+ const Function *Func = MBB.getParent()->getFunction();
+ bool IsSEH = isAsynchronousEHPersonality(
+ classifyEHPersonality(Func->getPersonalityFn()));
+ if (IsSEH)
+ return true;
+ }
+ }
DebugLoc DL = MBB.findDebugLoc(MI);
OpenPOWER on IntegriCloud