[LLVMdev] module and function pass issue

John Criswell criswell at illinois.edu
Thu Sep 19 13:57:18 PDT 2013


On 9/19/13 3:40 PM, reed kotler wrote:
> There some cases where I will need to emit some stubs and I only find 
> out about this while I'm compiling a function.
>
> Typically a function pass cannot create new functions; only a module 
> pass can do that.
>
> What would be the correct way to do this?

There may be several ways to do it, but I think the most typical 
approach is to run a ModulePass before all of your FunctionPass's that 
adds any functions that may be required.  If the set of all possible 
functions is known apriori, this should work.  Dead Code Elimination can 
delete any functions that are unused at the end.

Another approach is to make all of your code ModulePass's.  This may be 
less ideal, but you can probably get it to work.

-- John T.


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