aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-05-27 23:54:20 +0000
committerJim Grosbach <grosbach@apple.com>2010-05-27 23:54:20 +0000
commit6d172e2985346e55095c75f456901ea5d40fddaa (patch)
tree9807a1e035aa20763369fee26e1b3f7e9a07a17f /lib
parent8ee411e40fa202a73e11630a01c12005d75e832e (diff)
Update __builtin_setjmp codegen to match llvmCore changes in r104900.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104902 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/CGBuiltin.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
index 8c3478c3b0..2b27bebe66 100644
--- a/lib/CodeGen/CGBuiltin.cpp
+++ b/lib/CodeGen/CGBuiltin.cpp
@@ -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));