[LLVMdev] How to insert a CallInst which calls to a function from a library

Kenneth Uildriks kennethuil at gmail.com
Sat Oct 16 05:43:02 PDT 2010


On Sat, Oct 16, 2010 at 7:15 AM, hamed hamzehi <mohammadhamzehi at yahoo.com>wrote:

> *Hello
> I want to write a pass which insert a new call to a library function
> but I don't know how to create a** CallInst that calls a
> function like "pthread_create",
> can anyone help** me with this problem?
> *
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
> First you have to create a declaration for the library function.  Use
Module::getOrInsertFunction for that; you'll get back a Value representing
the library function.  Once you've got that, pass that Value in as the
callee of the call instruction.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101016/0c7795eb/attachment.html>


More information about the llvm-dev mailing list