WinEH: Create an unwind help alloca for __CxxFrameHandler3 xdata tables

We don't have any logic to emit those tables yet, so the sdag lowering
of this intrinsic is just a stub. We can see the intrinsic in the
prepared IR, though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233209 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Kleckner
2015-03-25 20:10:36 +00:00
parent 151bc36220
commit a8b46e7055
6 changed files with 49 additions and 0 deletions

View File

@ -601,6 +601,19 @@ bool WinEHPrepare::prepareExceptionHandlers(
Builder.SetInsertPoint(&F.getEntryBlock().back());
Builder.CreateCall(FrameEscapeFn, AllocasToEscape);
// Insert an alloca for the EH state in the entry block. On x86, we will also
// insert stores to update the EH state, but on other ISAs, the runtime does
// it for us.
// FIXME: This record is different on x86.
Type *UnwindHelpTy = Type::getInt64Ty(Context);
AllocaInst *UnwindHelp =
new AllocaInst(UnwindHelpTy, "unwindhelp", &F.getEntryBlock().front());
Builder.CreateStore(llvm::ConstantInt::get(UnwindHelpTy, -2), UnwindHelp);
Function *UnwindHelpFn =
Intrinsic::getDeclaration(M, Intrinsic::eh_unwindhelp);
Builder.CreateCall(UnwindHelpFn,
Builder.CreateBitCast(UnwindHelp, Int8PtrType));
// Clean up the handler action maps we created for this function
DeleteContainerSeconds(CatchHandlerMap);
CatchHandlerMap.clear();