[SEH] Emit 32-bit SEH tables for the new EH IR
[oota-llvm.git] / lib / Target / X86 / X86ISelLowering.cpp
index b793213d955679fe87b7a7408a754be56007e006..0225b081edf2dae6903ee09129aad265752d26bd 100644 (file)
@@ -16880,6 +16880,16 @@ SDValue X86TargetLowering::LowerCATCHRET(SDValue Op, SelectionDAG &DAG) const {
   SDLoc DL(Op);
 
   MVT PtrVT = getPointerTy(DAG.getDataLayout());
+
+  MachineFunction &MF = DAG.getMachineFunction();
+  if (isAsynchronousEHPersonality(
+          classifyEHPersonality(MF.getFunction()->getPersonalityFn()))) {
+    // For SEH, codegen catchret as a branch for now.
+    // FIXME: Insert something to restore the frame.
+    return DAG.getNode(ISD::BR, DL, MVT::Other, Chain, Dest);
+  }
+
+
   unsigned ReturnReg = (PtrVT == MVT::i64 ? X86::RAX : X86::EAX);
 
   // Load the address of the destination block.