<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On May 1, 2006, at 1:00 PM, Balpreet Pankaj wrote:</DIV><BR class="Apple-interchange-newline"><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. The link on the <A href="http://llvm.org">llvm.org</A> website says that :<BR> <BR> "Currently it is illegal for a <A href="http://llvm.org/docs/WritingAnLLVMPass.html#ModulePass"><TT>ModulePass</TT></A> to require a <A href="http://llvm.org/docs/WritingAnLLVMPass.html#FunctionPass"><TT>FunctionPass</TT></A>.  This is because there is only one instance of the <A href="http://llvm.org/docs/WritingAnLLVMPass.html#FunctionPass"><TT>FunctionPass</TT></A> 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."<BR> <BR> 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> <BR></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Ahhh, you must remember the terribly confusing terminology.  Global means function level.  This is sort of like doing an iterative data flow where</DIV><DIV>you have a part that computes local basic block analyses, and then the global part merges those analyses at exits and entries to blocks.   Now</DIV><DIV>you are going to do something on a function level, store it to data structures of some sort and use a ModulePass to merge at calls.  The only</DIV><DIV>problem I see is this is still an issue of a Module Pass Requiring a FunctionPass, so you are going to have to declare some sort of structure</DIV><DIV>like a std::vector of whatever analysis structure you need, and "push a new one on" in the beginning of run on Function.  A hash_map</DIV><DIV>from Function* to analysis information might be better however.  Actually, if you want to get this working really fast it might be better</DIV><DIV>to just edit PostDominator set to have a map of PostDominatorSets, and make it a ModulePass.</DIV><BR><BLOCKQUOTE type="cite"> Thanks,<BR> -Balpreet<BR><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">LLVM Developers mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</A> <SPAN class="Apple-converted-space">        </SPAN><A href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</A></DIV> </BLOCKQUOTE></DIV><BR></BODY></HTML>