Changes in directory llvm/docs:
WritingAnLLVMPass.html updated: 1.54 -> 1.55 --- Log message: Document how, module pass can require function pass. --- Diffs of the changes: (+19 -3) WritingAnLLVMPass.html | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-) Index: llvm/docs/WritingAnLLVMPass.html diff -u llvm/docs/WritingAnLLVMPass.html:1.54 llvm/docs/WritingAnLLVMPass.html:1.55 --- llvm/docs/WritingAnLLVMPass.html:1.54 Mon Mar 19 17:21:25 2007 +++ llvm/docs/WritingAnLLVMPass.html Mon Apr 16 16:28:14 2007 @@ -466,7 +466,9 @@ <tt>ModulePass</tt> indicates that your pass uses the entire program as a unit, refering to function bodies in no predictable order, or adding and removing functions. Because nothing is known about the behavior of <tt>ModulePass</tt> -subclasses, no optimization can be done for their execution.</p> +subclasses, no optimization can be done for their execution. A module pass +can use function level passes (e.g. dominators) using getAnalysis interface +<tt> getAnalysis<DominatorTree>(Function)</tt>. </p> <p>To write a correct <tt>ModulePass</tt> subclass, derive from <tt>ModulePass</tt> and overload the <tt>runOnModule</tt> method with the @@ -1127,7 +1129,21 @@ declare as required in your <a href="#getAnalysisUsage"><tt>getAnalysisUsage</tt></a> implementation. This method can be called by your <tt>run*</tt> method implementation, or by any -other local method invoked by your <tt>run*</tt> method.</p> +other local method invoked by your <tt>run*</tt> method. + +A module level pass can use function level analysis info using this interface. +For example:</p> + +<div class="doc_code"><pre> + bool ModuleLevelPass::runOnModule(Module &M) { + ... + DominatorTree &DT = getAnalysis<DominatorTree>(Function &F); + ... + } +</pre></div> + +In above example, runOnFunction for DominatorTree is called by pass manager +before returning a reference to the desired pass.</p> <p> If your pass is capable of updating analyses if they exist (e.g., @@ -1799,7 +1815,7 @@ <a href="mailto:[EMAIL PROTECTED]">Chris Lattner</a><br> <a href="http://llvm.org";>The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2007/03/19 22:21:25 $ + Last modified: $Date: 2007/04/16 21:28:14 $ </address> </body> _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits