hamed hamzehi
2010-Oct-16 12:15 UTC
[LLVMdev] How to insert a CallInst which calls to a function from a library
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? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101016/8003795f/attachment.html>
Kenneth Uildriks
2010-Oct-16 12:43 UTC
[LLVMdev] How to insert a CallInst which calls to a function from a library
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. UseModule::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>