<div class="gmail_quote">On Sat, Oct 16, 2010 at 7:15 AM, hamed hamzehi <span dir="ltr"><<a href="mailto:mohammadhamzehi@yahoo.com">mohammadhamzehi@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit"><pre><i>Hello <br>I want to write a pass which insert a new call to a library function <br>but I don't know how to create a</i><i> CallInst that calls a <br>
function like "pthread_create",<br>can anyone help</i><i> me with this problem?<br></i></pre></td></tr></tbody></table><br>

      <br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div>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.