<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><BLOCKQUOTE type="cite">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.<BR></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>In the past, I have done this by making the requiring pass a FunctionPass instead of a ModulePass.  If you look in include/llvm/Pass.h, you'll see that a FunctionPass is just a ModulePass in which (1) a "doInitialization" method is called; (2) a "runOnFunction" method is called for each function in the module; and (3) a "doFinalization" method is called.  The doInitialization and doFinalization methods both take a Module as an argument, so any interprocedural code can go there.  If you create a data structure to store the results of the runOnFunction methods as they are called and put your interprocedural code in the "doFinalization" method, you can write a FunctionPass that requires another FunctionPass and does interprocedural analysis.  This is a little ugly, but it works.  If there's a better way, I'd certainly like to know about it.  :^)</DIV><BR><BLOCKQUOTE type="cite">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 ?<BR></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I have an example that I can give you offline.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Rob</DIV></DIV><BR><DIV> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">Robert L. Bocchino Jr.</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">Ph.D. Student</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">University of Illinois, Urbana-Champaign</FONT></P>  </DIV><BR></BODY></HTML>