callinst vs. invokeinst

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

callinst vs. invokeinst

Ryan M. Lefever
What is the difference between a CallInst and an InvokeInst in LLVM?  Is
an InvokeInst a CallInst that can throw an exception?

Thanks,
Ryan
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: callinst vs. invokeinst

Reid Spencer-2
On Mon, 2006-10-30 at 19:24 -0600, Ryan M. Lefever wrote:
> What is the difference between a CallInst and an InvokeInst in LLVM?  Is
> an InvokeInst a CallInst that can throw an exception?

Sort off. The return destination of a CallInst is implied .. the next
instruction. The return destination of an InvokeInst is explicit and
there are two of them: normal case and exceptional case. If the unwind
instruction is executed (during the call) it causes a stack unwind and
branch to the exceptional case. Normal returns (without unwind
instruction) return to the normal case.

The intention is for exception handling.

Reid.

>
> Thanks,
> Ryan
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: callinst vs. invokeinst

Chris Lattner
In reply to this post by Ryan M. Lefever
On Mon, 30 Oct 2006, Ryan M. Lefever wrote:
> What is the difference between a CallInst and an InvokeInst in LLVM?  Is
> an InvokeInst a CallInst that can throw an exception?

They both allow the callee to throw an exception.  Invoke is used when a
callee is calling a function and wants to stop unwinding if it throws.

Some references:

http://llvm.org/docs/LangRef.html#i_invoke
http://llvm.org/pubs/2004-01-30-CGO-LLVM.html

-Chris

--
http://nondot.org/sabre/
http://llvm.org/
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev