[llvm-commits] CVS: llvm/docs/WritingAnLLVMPass.html

Chris Lattner lattner at cs.uiuc.edu
Sun Aug 27 16:19:06 PDT 2006



Changes in directory llvm/docs:

WritingAnLLVMPass.html updated: 1.47 -> 1.48
---
Log message:

update doc: analyze is gone and passes should just use RegisterPass


---
Diffs of the changes:  (+20 -43)

 WritingAnLLVMPass.html |   63 +++++++++++++++----------------------------------
 1 files changed, 20 insertions(+), 43 deletions(-)


Index: llvm/docs/WritingAnLLVMPass.html
diff -u llvm/docs/WritingAnLLVMPass.html:1.47 llvm/docs/WritingAnLLVMPass.html:1.48
--- llvm/docs/WritingAnLLVMPass.html:1.47	Fri Aug 11 11:37:02 2006
+++ llvm/docs/WritingAnLLVMPass.html	Sun Aug 27 18:18:52 2006
@@ -18,8 +18,7 @@
     <ul>
     <li><a href="#makefile">Setting up the build environment</a></li>
     <li><a href="#basiccode">Basic code required</a></li>
-    <li><a href="#running">Running a pass with <tt>opt</tt>
-                 or <tt>analyze</tt></a></li>
+    <li><a href="#running">Running a pass with <tt>opt</tt></a></li>
     </ul></li>
   <li><a href="#passtype">Pass classes and requirements</a>
      <ul>
@@ -194,7 +193,7 @@
 <p>This makefile specifies that all of the <tt>.cpp</tt> files in the current
 directory are to be compiled and linked together into a
 <tt>Debug/lib/Hello.so</tt> shared object that can be dynamically loaded by
-the <tt>opt</tt> or <tt>analyze</tt> tools via their <tt>-load</tt> options.  
+the <tt>opt</tt> or <tt>bugpoint</tt> tools via their <tt>-load</tt> options.  
 If your operating system uses a suffix other than .so (such as windows or 
 Mac OS/X), the appropriate extension will be used.</p>
 
@@ -271,15 +270,13 @@
 function.</p>
 
 <div class="doc_code"><pre>
-  RegisterOpt<Hello> X("<i>hello</i>", "<i>Hello World Pass</i>");
+  RegisterPass<Hello> X("<i>hello</i>", "<i>Hello World Pass</i>");
 }  <i>// end of anonymous namespace</i>
 </pre></div>
 
-<p>Lastly, we register our class <tt>Hello</tt>, giving it a command line
-argument "<tt>hello</tt>", and a name "<tt>Hello World Pass</tt>".  There are
-several different ways of <a href="#registration">registering your pass</a>,
-depending on what it is to be used for.  For "optimizations" we use the
-<tt>RegisterOpt</tt> template.</p>
+<p>Lastly, we <a href="#registration">register our class</a> <tt>Hello</tt>, 
+giving it a command line
+argument "<tt>hello</tt>", and a name "<tt>Hello World Pass</tt>".</p>
 
 <p>As a whole, the <tt>.cpp</tt> file looks like:</p>
 
@@ -297,7 +294,7 @@
     }
   };
   
-  RegisterOpt<Hello> X("<i>hello</i>", "<i>Hello World Pass</i>");
+  RegisterPass<Hello> X("<i>hello</i>", "<i>Hello World Pass</i>");
 }
 </pre></div>
 
@@ -312,14 +309,14 @@
 
 <!-- ======================================================================= -->
 <div class="doc_subsection">
-  <a name="running">Running a pass with <tt>opt</tt> or <tt>analyze</tt></a>
+  <a name="running">Running a pass with <tt>opt</tt></a>
 </div>
 
 <div class="doc_text">
 
 <p>Now that you have a brand new shiny shared object file, we can use the
 <tt>opt</tt> command to run an LLVM program through your pass.  Because you
-registered your pass with the <tt>RegisterOpt</tt> template, you will be able to
+registered your pass with the <tt>RegisterPass</tt> template, you will be able to
 use the <tt>opt</tt> tool to access it, once loaded.</p>
 
 <p>To test it, follow the example at the end of the <a
@@ -844,37 +841,17 @@
 pass registration works, and discussed some of the reasons that it is used and
 what it does.  Here we discuss how and why passes are registered.</p>
 
-<p>Passes can be registered in several different ways.  Depending on the general
-classification of the pass, you should use one of the following templates to
-register the pass:</p>
-
-<ul>
-<li><b><tt>RegisterOpt</tt></b> - This template should be used when you are
-registering a pass that logically should be available for use in the
-'<tt>opt</tt>' utility.</li>
-
-<li><b><tt>RegisterAnalysis</tt></b> - This template should be used when you are
-registering a pass that logically should be available for use in the
-'<tt>analyze</tt>' utility.</li>
-
-<li><b><tt>RegisterPass</tt></b> - This is the generic form of the
-<tt>Register*</tt> templates that should be used if you want your pass listed by
-multiple or no utilities.  This template takes an extra third argument that
-specifies which tools it should be listed in.  See the <a
-href="http://llvm.org/doxygen/PassSupport_8h-source.html">PassSupport.h</a>
-file for more information.</li>
-
-</ul>
-
-<p>Regardless of how you register your pass, you must specify at least two
+<p>As we saw above, passes are registered with the <b><tt>RegisterPass</tt></b>
+template, which requires you to pass at least two
 parameters.  The first parameter is the name of the pass that is to be used on
 the command line to specify that the pass should be added to a program (for
-example <tt>opt</tt> or <tt>analyze</tt>).  The second argument is the name of
-the pass, which is to be used for the <tt>--help</tt> output of programs, as
+example, with <tt>opt</tt> or <tt>bugpoint</tt>).  The second argument is the
+name of the pass, which is to be used for the <tt>--help</tt> output of
+programs, as
 well as for debug output generated by the <tt>--debug-pass</tt> option.</p>
 
-<p>If a pass is registered to be used by the <tt>analyze</tt> utility, you
-should implement the virtual <tt>print</tt> method:</p>
+<p>If you want your pass to be easily dumpable, you should 
+implement the virtual <tt>print</tt> method:</p>
 
 </div>
 
@@ -892,7 +869,7 @@
 <p>The <tt>print</tt> method must be implemented by "analyses" in order to print
 a human readable version of the analysis results.  This is useful for debugging
 an analysis itself, as well as for other people to figure out how an analysis
-works.  The <tt>analyze</tt> tool uses this method to generate its output.</p>
+works.  Use the <tt>opt -analyze</tt> argument to invoke this method.</p>
 
 <p>The <tt>ostream</tt> parameter specifies the stream to write the results on,
 and the <tt>Module</tt> parameter gives a pointer to the top level module of the
@@ -1181,7 +1158,7 @@
 <div class="doc_code"><pre>
 <b>namespace</b> {
   //<i> Analysis Group implementations <b>must</b> be registered normally...</i>
-  RegisterOpt<FancyAA>
+  RegisterPass<FancyAA>
   B("<i>somefancyaa</i>", "<i>A more complex alias analysis implementation</i>");
 
   //<i> Declare that we implement the AliasAnalysis interface</i>
@@ -1199,7 +1176,7 @@
 <div class="doc_code"><pre>
 <b>namespace</b> {
   //<i> Analysis Group implementations <b>must</b> be registered normally...</i>
-  RegisterOpt<<a href="http://llvm.org/doxygen/structBasicAliasAnalysis.html">BasicAliasAnalysis</a>>
+  RegisterPass<<a href="http://llvm.org/doxygen/structBasicAliasAnalysis.html">BasicAliasAnalysis</a>>
   D("<i>basicaa</i>", "<i>Basic Alias Analysis (default AA impl)</i>");
 
   //<i> Declare that we implement the AliasAnalysis interface</i>
@@ -1734,7 +1711,7 @@
 
   <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
   <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date: 2006/08/11 16:37:02 $
+  Last modified: $Date: 2006/08/27 23:18:52 $
 </address>
 
 </body>






More information about the llvm-commits mailing list