[PATCH] [SEH] Add 32-bit lowering for SEH __try

David Majnemer david.majnemer at gmail.com
Tue Jun 30 16:05:55 PDT 2015


================
Comment at: lib/CodeGen/CGException.cpp:1309-1313
@@ -1318,5 +1308,7 @@
 
+    // In 64-bit, we call the child function with arguments. In 32-bit, we store
+    // zero in the parent frame and use framerecover to check the value.
+    const CGFunctionInfo *FnInfo;
     CallArgList Args;
-    llvm::Value *IsForEH =
-        llvm::ConstantInt::get(CGF.ConvertType(ArgTys[0]), F.isForEHCleanup());
-    Args.add(RValue::get(IsForEH), ArgTys[0]);
+    if (CGF.getTarget().getTriple().getArch() == llvm::Triple::x86_64) {
+      // Compute the two argument values.
----------------
I bet ARM is more like x86_64 than x86_32.  Perhaps we should have `!= llvm::Triple::x86`

================
Comment at: lib/CodeGen/CGException.cpp:1459-1466
@@ -1378,10 +1458,10 @@
 
-  // Typically there are no captures and we can exit early.
-  if (Finder.Captures.empty())
+  // We can exit early on x86_64 when there are no captures.
+  if (!Finder.foundCaptures() &&
+      CGM.getTarget().getTriple().getArch() == llvm::Triple::x86_64)
     return;
 
-  // Prepare the first two arguments to llvm.framerecover.
-  llvm::Function *FrameRecoverFn = llvm::Intrinsic::getDeclaration(
-      &CGM.getModule(), llvm::Intrinsic::framerecover);
-  llvm::Constant *ParentI8Fn =
-      llvm::ConstantExpr::getBitCast(ParentCGF.CurFn, Int8PtrTy);
+  llvm::Value *EntryEBP = nullptr;
+  llvm::Value *ParentFP;
+  if (CGM.getTarget().getTriple().getArch() == llvm::Triple::x86_64) {
+    // On x64, the parent FP is passed as the second argument.
----------------
Ditto here for ARM.

http://reviews.llvm.org/D10852

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list