diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-09-28 03:36:43 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-09-28 03:36:43 +0000 |
commit | 66b110f57123b3deee657ad368b95460d5a414a7 (patch) | |
tree | bf5e02c4591ac97028e2ea0b1b728856fd2f2616 /llvm/lib/CodeGen | |
parent | 2e76ca9d9a6ae096fb93d576d10ae8c527cd4743 (diff) | |
download | bcm5719-llvm-66b110f57123b3deee657ad368b95460d5a414a7.tar.gz bcm5719-llvm-66b110f57123b3deee657ad368b95460d5a414a7.zip |
Create and use an llvm.eh.sjlj.functioncontext intrinsic.
This intrinsic is used to pass the index of the function context to the back-end
for further processing. The back-end is in charge of filling in the rest of the
entries.
llvm-svn: 140676
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SjLjEHPrepare.cpp | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 9d86c759b82..b2b93c9ff57 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -4754,6 +4754,14 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) { MMI.setCurrentCallSite(CI->getZExtValue()); return 0; } + case Intrinsic::eh_sjlj_functioncontext: { + // Get and store the index of the function context. + MachineFrameInfo *MFI = DAG.getMachineFunction().getFrameInfo(); + AllocaInst *FnCtx = cast<AllocaInst>(I.getArgOperand(0)); + int FI = FuncInfo.StaticAllocaMap[FnCtx]; + MFI->setFunctionContextIndex(FI); + return 0; + } case Intrinsic::eh_sjlj_setjmp: { setValue(&I, DAG.getNode(ISD::EH_SJLJ_SETJMP, dl, MVT::i32, getRoot(), getValue(I.getArgOperand(0)))); diff --git a/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/llvm/lib/CodeGen/SjLjEHPrepare.cpp index baa70b961b9..9749a7e1191 100644 --- a/llvm/lib/CodeGen/SjLjEHPrepare.cpp +++ b/llvm/lib/CodeGen/SjLjEHPrepare.cpp @@ -721,6 +721,12 @@ void SjLjEHPass::setupFunctionContext(Function &F, AllocaInst *FuncCtx = new AllocaInst(FunctionContextTy, 0, Align, "fn_context", EntryBB->begin()); + // Store a pointer to the function context so that the back-end will know + // where to look for it. + CallInst::Create(Intrinsic::getDeclaration(F.getParent(), + Intrinsic::eh_sjlj_functioncontext), + FuncCtx, "", EntryBB->getTerminator()); + // Fill in the function context structure. Value *Idxs[2]; Type *Int32Ty = Type::getInt32Ty(F.getContext()); |