Fixed problem with invoking intrinsics, which llvm doesn't allow.

This commit is contained in:
Tomas Lindquist Olsen
2008-08-01 19:54:31 +02:00
parent fd2fac6aa7
commit 65406bba25

View File

@@ -215,6 +215,13 @@ CallOrInvoke* IRState::CreateCallOrInvoke(LLValue* Callee, InputIterator ArgBegi
llvm::BasicBlock* pad;
if(pad = func()->landingPad.get())
{
// intrinsics don't support invoking
LLFunction* funcval = llvm::dyn_cast<LLFunction>(Callee);
if (funcval && funcval->isIntrinsic())
{
return new CallOrInvoke_Call(ir->CreateCall(Callee, ArgBegin, ArgEnd, Name));
}
llvm::BasicBlock* postinvoke = llvm::BasicBlock::Create("postinvoke", topfunc(), scopeend());
llvm::InvokeInst* invoke = ir->CreateInvoke(Callee, postinvoke, pad, ArgBegin, ArgEnd, Name);
scope() = IRScope(postinvoke, scopeend());