summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-03-25 20:10:36 +0000
committerReid Kleckner <reid@kleckner.net>2015-03-25 20:10:36 +0000
commit7e9546b378969743fd4e0e3a78c3ed2f75b0a197 (patch)
treed6500a85b682f9a45e5079845e7cbc42b2540b4d /llvm/lib/CodeGen
parent4f7b9eb217f0a065acffe81189599b7db49a0792 (diff)
downloadbcm5719-llvm-7e9546b378969743fd4e0e3a78c3ed2f75b0a197.tar.gz
bcm5719-llvm-7e9546b378969743fd4e0e3a78c3ed2f75b0a197.zip
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. llvm-svn: 233209
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp10
-rw-r--r--llvm/lib/CodeGen/WinEHPrepare.cpp13
2 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 6f5ea7c7469..6c14e7969c5 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -5446,6 +5446,16 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
case Intrinsic::eh_begincatch:
case Intrinsic::eh_endcatch:
llvm_unreachable("begin/end catch intrinsics not lowered in codegen");
+ case Intrinsic::eh_unwindhelp: {
+ AllocaInst *Slot =
+ cast<AllocaInst>(I.getArgOperand(0)->stripPointerCasts());
+ assert(FuncInfo.StaticAllocaMap.count(Slot) &&
+ "can only use static allocas with llvm.eh.unwindhelp");
+ int FI = FuncInfo.StaticAllocaMap[Slot];
+ // TODO: Save this in the not-yet-existant WinEHFuncInfo struct.
+ (void)FI;
+ return nullptr;
+ }
}
}
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp
index d1b385579b9..ab0f96ef05f 100644
--- a/llvm/lib/CodeGen/WinEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WinEHPrepare.cpp
@@ -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();
OpenPOWER on IntegriCloud