Update doc to reflect changes I am about to install to fix PR 888.

llvm-svn: 36631
This commit is contained in:
Devang Patel 2007-05-01 20:55:38 +00:00
parent fa34bc9623
commit a612049dd8
1 changed files with 19 additions and 0 deletions

View File

@ -262,6 +262,14 @@ href="#passtype">later</a>, but for now, know that <a
href="#FunctionPass"><tt>FunctionPass</tt></a>'s operate a function at a
time.</p>
<div class="doc_code"><pre>
static const int ID;
Hello() : FunctionPass((intptr_t)&ID) {}
</pre></div><p>
<p> This declares pass identifier used by LLVM to identify pass. This allows LLVM to
avoid using expensive C++ runtime information.</p>
<div class="doc_code"><pre>
<b>virtual bool</b> <a href="#runOnFunction">runOnFunction</a>(Function &amp;F) {
llvm::cerr &lt;&lt; "<i>Hello: </i>" &lt;&lt; F.getName() &lt;&lt; "\n";
@ -276,6 +284,13 @@ href="#FunctionPass"><tt>FunctionPass</tt></a>. This is where we are supposed
to do our thing, so we just print out our message with the name of each
function.</p>
<div class="doc_code"><pre>
const int Hello::ID = 0;
</pre></div>
<p> We initialize pass ID here. LLVM uses ID's address to identify pass so
initialization value is not important.</p>
<div class="doc_code"><pre>
RegisterPass&lt;Hello&gt; X("<i>hello</i>", "<i>Hello World Pass</i>");
} <i>// end of anonymous namespace</i>
@ -295,6 +310,10 @@ argument "<tt>hello</tt>", and a name "<tt>Hello World Pass</tt>".</p>
<b>namespace</b> {
<b>struct Hello</b> : <b>public</b> <a href="#FunctionPass">FunctionPass</a> {
static const int ID;
Hello() : FunctionPass((intptr_t)&ID) {}
<b>virtual bool</b> <a href="#runOnFunction">runOnFunction</a>(Function &amp;F) {
llvm::cerr &lt;&lt; "<i>Hello: </i>" &lt;&lt; F.getName() &lt;&lt; "\n";
<b>return false</b>;