[LLVMdev] inserting a function into a module
Dmitry Mikushin
dmitry at kernelgen.org
Thu Apr 18 16:49:21 PDT 2013
Grep any LLVM code for Function::Create
For example:
https://hpcforge.org/scm/viewvc.php/*checkout*/trunk/src/runtime/Wrappers.cpp?root=kernelgen
// The host call launcher prototype to be added
// to entire module.
Module* m = call->getParent()->getParent()->getParent();
Function* hostcall = m->getFunction("kernelgen_hostcall");
if (!hostcall)
hostcall = Function::Create(
TypeBuilder<void(types::i<8>*, types::i<64>,
types::i<64>, types::i<32>*),
true>::get(context),
GlobalValue::ExternalLinkage, "kernelgen_hostcall",
m);
2013/4/19 reed kotler <rkotler at mips.com>
> I'm looking for an example of how to insert a new function into a module.
>
> I have a module pass that needs to create some new functions.
>
> Tia.
>
> Reed
>
>
> ______________________________**_________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130419/1b6dedd9/attachment.html>
More information about the llvm-dev
mailing list