]> granicus.if.org Git - clang/commitdiff
Update __builtin_setjmp codegen to match llvmCore changes in r104900.
authorJim Grosbach <grosbach@apple.com>
Thu, 27 May 2010 23:54:20 +0000 (23:54 +0000)
committerJim Grosbach <grosbach@apple.com>
Thu, 27 May 2010 23:54:20 +0000 (23:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104902 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBuiltin.cpp

index 8c3478c3b0c746e6e80222be12106393723d9e86..2b27bebe66ea299facbd852b73145827d3e03254 100644 (file)
@@ -567,6 +567,14 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
                          ConstantInt::get(llvm::Type::getInt32Ty(VMContext), 0));
     Builder.CreateStore(FrameAddr, Buf);
 
+    // Store the stack pointer to the setjmp buffer.
+    Value *StackAddr =
+      Builder.CreateCall(CGM.getIntrinsic(Intrinsic::stacksave));
+    Value *StackSaveSlot =
+      Builder.CreateGEP(Buf, ConstantInt::get(llvm::Type::getInt32Ty(VMContext),
+                                              2));
+    Builder.CreateStore(StackAddr, StackSaveSlot);
+
     // Call LLVM's EH setjmp, which is lightweight.
     Value *F = CGM.getIntrinsic(Intrinsic::eh_sjlj_setjmp);
     Buf = Builder.CreateBitCast(Buf, llvm::Type::getInt8PtrTy(VMContext));