Grep any LLVM code for Function::Create<br><br>For example:<br><br><a href="https://hpcforge.org/scm/viewvc.php/*checkout*/trunk/src/runtime/Wrappers.cpp?root=kernelgen">https://hpcforge.org/scm/viewvc.php/*checkout*/trunk/src/runtime/Wrappers.cpp?root=kernelgen</a><br>
<br>        // The host call launcher prototype to be added<br>        // to entire module.<br>        Module* m = call->getParent()->getParent()->getParent();<br>        Function* hostcall = m->getFunction("kernelgen_hostcall");<br>
        if (!hostcall)<br>                hostcall = Function::Create(<br>                        TypeBuilder<void(types::i<8>*, types::i<64>,<br>                                types::i<64>, types::i<32>*), true>::get(context),<br>
                        GlobalValue::ExternalLinkage, "kernelgen_hostcall", m);<br><br><div class="gmail_quote">2013/4/19 reed kotler <span dir="ltr"><<a href="mailto:rkotler@mips.com" target="_blank">rkotler@mips.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm looking for an example of how to insert a new function into a module.<br>
<br>
I have a module pass that needs to create some new functions.<br>
<br>
Tia.<br>
<br>
Reed<br>
<br>
<br>
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">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/<u></u>mailman/listinfo/llvmdev</a><br>
</blockquote></div><br>