[LLVMdev] ModulePasses requiring FunctionPasses

Balpreet Pankaj balpreet.pankaj at gmail.com
Mon May 1 11:00:16 PDT 2006


I am trying to write a ModulePass which requires PostDominator sets for
every function in the module. Now finding post dominators is  a function
pass. The link on the llvm.org website says that :

"Currently it is illegal for a
ModulePass<http://llvm.org/docs/WritingAnLLVMPass.html#ModulePass>to
require a
FunctionPass <http://llvm.org/docs/WritingAnLLVMPass.html#FunctionPass>.
This is because there is only one instance of the
FunctionPass<http://llvm.org/docs/WritingAnLLVMPass.html#FunctionPass>object
ever created, thus nowhere to store information for all of the
functions in the program at the same time. Although this has come up a
couple of times before, this has always been worked around by factoring one
big complicated pass into a global and an interprocedural part, both of
which are distinct. In the future, it would be nice to have this though."

This says that we can work around by factoring the code into a global and
interprocedural part. If so, is our global pass a Module pass ? And then,
how do the global and inter-procedural passes interact ? Is there a specific
example where this has been done before ?

Thanks,
-Balpreet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060501/ca8cb622/attachment.html>


More information about the llvm-dev mailing list