diff options
Diffstat (limited to 'llvm/lib/CodeGen/SjLjEHPrepare.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SjLjEHPrepare.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/llvm/lib/CodeGen/SjLjEHPrepare.cpp index d09953e76a80..f98c096ccf08 100644 --- a/llvm/lib/CodeGen/SjLjEHPrepare.cpp +++ b/llvm/lib/CodeGen/SjLjEHPrepare.cpp @@ -90,7 +90,7 @@ FunctionPass *llvm::createSjLjEHPreparePass(const TargetMachine *TM) { bool SjLjEHPrepare::doInitialization(Module &M) { // Build the function context structure. // builtin_setjmp uses a five word jbuf - Type *VoidPtrTy = Type::getInt8PtrTy(M.getContext()); + Type *VoidPtrTy = PointerType::getUnqual(M.getContext()); unsigned DataBits = TM ? TM->getSjLjDataSize() : TargetMachine::DefaultSjLjDataSize; DataTy = Type::getIntNTy(M.getContext(), DataBits); @@ -200,7 +200,7 @@ Value *SjLjEHPrepare::setupFunctionContext(Function &F, Value *ExceptionAddr = Builder.CreateConstGEP2_32(doubleUnderDataTy, FCData, 0, 0, "exception_gep"); Value *ExnVal = Builder.CreateLoad(DataTy, ExceptionAddr, true, "exn_val"); - ExnVal = Builder.CreateIntToPtr(ExnVal, Builder.getInt8PtrTy()); + ExnVal = Builder.CreateIntToPtr(ExnVal, Builder.getPtrTy()); Value *SelectorAddr = Builder.CreateConstGEP2_32(doubleUnderDataTy, FCData, 0, 1, "exn_selector_gep"); @@ -218,9 +218,7 @@ Value *SjLjEHPrepare::setupFunctionContext(Function &F, Value *PersonalityFn = F.getPersonalityFn(); Value *PersonalityFieldPtr = Builder.CreateConstGEP2_32( FunctionContextTy, FuncCtx, 0, 3, "pers_fn_gep"); - Builder.CreateStore( - Builder.CreateBitCast(PersonalityFn, Builder.getInt8PtrTy()), - PersonalityFieldPtr, /*isVolatile=*/true); + Builder.CreateStore(PersonalityFn, PersonalityFieldPtr, /*isVolatile=*/true); // LSDA address Value *LSDA = Builder.CreateCall(LSDAAddrFn, {}, "lsda_addr"); @@ -418,8 +416,7 @@ bool SjLjEHPrepare::setupEntryBlockAndCallSites(Function &F) { // Store a pointer to the function context so that the back-end will know // where to look for it. - Value *FuncCtxArg = Builder.CreateBitCast(FuncCtx, Builder.getInt8PtrTy()); - Builder.CreateCall(FuncCtxFn, FuncCtxArg); + Builder.CreateCall(FuncCtxFn, FuncCtx); // At this point, we are all set up, update the invoke instructions to mark // their call_site values. @@ -490,12 +487,15 @@ bool SjLjEHPrepare::runOnFunction(Function &F) { UnregisterFn = M.getOrInsertFunction( "_Unwind_SjLj_Unregister", Type::getVoidTy(M.getContext()), PointerType::getUnqual(FunctionContextTy)); - FrameAddrFn = Intrinsic::getDeclaration( - &M, Intrinsic::frameaddress, - {Type::getInt8PtrTy(M.getContext(), - M.getDataLayout().getAllocaAddrSpace())}); - StackAddrFn = Intrinsic::getDeclaration(&M, Intrinsic::stacksave); - StackRestoreFn = Intrinsic::getDeclaration(&M, Intrinsic::stackrestore); + + PointerType *AllocaPtrTy = M.getDataLayout().getAllocaPtrType(M.getContext()); + + FrameAddrFn = + Intrinsic::getDeclaration(&M, Intrinsic::frameaddress, {AllocaPtrTy}); + StackAddrFn = + Intrinsic::getDeclaration(&M, Intrinsic::stacksave, {AllocaPtrTy}); + StackRestoreFn = + Intrinsic::getDeclaration(&M, Intrinsic::stackrestore, {AllocaPtrTy}); BuiltinSetupDispatchFn = Intrinsic::getDeclaration(&M, Intrinsic::eh_sjlj_setup_dispatch); LSDAAddrFn = Intrinsic::getDeclaration(&M, Intrinsic::eh_sjlj_lsda); |
