[LLVMdev] inserting a function into a module

John Criswell criswell at illinois.edu
Thu Apr 18 16:52:38 PDT 2013


On 4/18/13 6:41 PM, reed kotler wrote:
> I'm looking for an example of how to insert a new function into a module.

You'll create a function declaration (i.e., an empty function) and then 
add basic blocks to it.

I believe this code from SAFECode 
(http://llvm.org/viewvc/llvm-project/safecode/branches/release_32/lib/OptimizeChecks/InlineFastChecks.cpp?revision=168085&view=markup) 
may provide an example (caveat: it works with LLVM 3.2).

-- John T.

>
> 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




More information about the llvm-dev mailing list