1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

* Use the doc_code class for code listings to make it stand out from text

* Wrap text in soft, comfortable <div>s and <p>s
* Wrap lines at 80 cols

llvm-svn: 15311
This commit is contained in:
Misha Brukman 2004-07-28 22:18:33 +00:00
parent d5160e3865
commit b0de0106f6

View File

@ -134,16 +134,18 @@ symbolic LLVM <tt>Value*</tt>) and a static size.</p>
important for correct Alias Analyses. For example, consider this (silly, but important for correct Alias Analyses. For example, consider this (silly, but
possible) C code:</p> possible) C code:</p>
<div class="doc_code">
<pre> <pre>
int i; int i;
char C[2]; char C[2];
char A[10]; char A[10];
/* ... */ /* ... */
for (i = 0; i != 10; ++i) { for (i = 0; i != 10; ++i) {
C[0] = A[i]; /* One byte store */ C[0] = A[i]; /* One byte store */
C[1] = A[9-i]; /* One byte store */ C[1] = A[9-i]; /* One byte store */
} }
</pre> </pre>
</div>
<p>In this case, the <tt>basicaa</tt> pass will disambiguate the stores to <p>In this case, the <tt>basicaa</tt> pass will disambiguate the stores to
<tt>C[0]</tt> and <tt>C[1]</tt> because they are accesses to two distinct <tt>C[0]</tt> and <tt>C[1]</tt> because they are accesses to two distinct
@ -151,16 +153,18 @@ locations one byte apart, and the accesses are each one byte. In this case, the
LICM pass can use store motion to remove the stores from the loop. In LICM pass can use store motion to remove the stores from the loop. In
constrast, the following code:</p> constrast, the following code:</p>
<div class="doc_code">
<pre> <pre>
int i; int i;
char C[2]; char C[2];
char A[10]; char A[10];
/* ... */ /* ... */
for (i = 0; i != 10; ++i) { for (i = 0; i != 10; ++i) {
((short*)C)[0] = A[i]; /* Two byte store! */ ((short*)C)[0] = A[i]; /* Two byte store! */
C[1] = A[9-i]; /* One byte store */ C[1] = A[9-i]; /* One byte store */
} }
</pre> </pre>
</div>
<p>In this case, the two stores to C do alias each other, because the access to <p>In this case, the two stores to C do alias each other, because the access to
the <tt>&amp;C[0]</tt> element is a two byte access. If size information wasn't the <tt>&amp;C[0]</tt> element is a two byte access. If size information wasn't
@ -361,25 +365,29 @@ the <tt>AliasAnalysis</tt> base class: <tt>getAnalysisUsage</tt> and
declaring any pass dependencies your pass has. Thus you should have something declaring any pass dependencies your pass has. Thus you should have something
like this:</p> like this:</p>
<div class="doc_code">
<pre> <pre>
void getAnalysisUsage(AnalysisUsage &amp;AU) const { void getAnalysisUsage(AnalysisUsage &amp;AU) const {
AliasAnalysis::getAnalysisUsage(AU); AliasAnalysis::getAnalysisUsage(AU);
<i>// declare your dependencies here.</i> <i>// declare your dependencies here.</i>
} }
</pre> </pre>
</div>
<p>Additionally, your must invoke the <tt>InitializeAliasAnalysis</tt> method <p>Additionally, your must invoke the <tt>InitializeAliasAnalysis</tt> method
from your analysis run method (<tt>run</tt> for a <tt>Pass</tt>, from your analysis run method (<tt>run</tt> for a <tt>Pass</tt>,
<tt>runOnFunction</tt> for a <tt>FunctionPass</tt>, or <tt>InitializePass</tt> <tt>runOnFunction</tt> for a <tt>FunctionPass</tt>, or <tt>InitializePass</tt>
for an <tt>ImmutablePass</tt>). For example (as part of a <tt>Pass</tt>):</p> for an <tt>ImmutablePass</tt>). For example (as part of a <tt>Pass</tt>):</p>
<div class="doc_code">
<pre> <pre>
bool run(Module &amp;M) { bool run(Module &amp;M) {
InitializeAliasAnalysis(this); InitializeAliasAnalysis(this);
<i>// Perform analysis here...</i> <i>// Perform analysis here...</i>
return false; return false;
} }
</pre> </pre>
</div>
</div> </div>
@ -419,17 +427,19 @@ for methods that you don't override. For methods that you do override, in code
paths that return a conservative MayAlias or Mod/Ref result, simply return paths that return a conservative MayAlias or Mod/Ref result, simply return
whatever the superclass computes. For example:</p> whatever the superclass computes. For example:</p>
<div class="doc_code">
<pre> <pre>
AliasAnalysis::AliasResult alias(const Value *V1, unsigned V1Size, AliasAnalysis::AliasResult alias(const Value *V1, unsigned V1Size,
const Value *V2, unsigned V2Size) { const Value *V2, unsigned V2Size) {
if (...) if (...)
return NoAlias; return NoAlias;
... ...
<i>// Couldn't determine a must or no-alias result.</i> <i>// Couldn't determine a must or no-alias result.</i>
return AliasAnalysis::alias(V1, V1Size, V2, V2Size); return AliasAnalysis::alias(V1, V1Size, V2, V2Size);
} }
</pre> </pre>
</div>
<p>In addition to analysis queries, you must make sure to unconditionally pass <p>In addition to analysis queries, you must make sure to unconditionally pass
LLVM <a href="#updating">update notification</a> methods to the superclass as LLVM <a href="#updating">update notification</a> methods to the superclass as
@ -473,7 +483,6 @@ for each value in the program. When this method is called, they should remove
any entries for the specified value, if they exist. any entries for the specified value, if they exist.
</div> </div>
<!-- _______________________________________________________________________ --> <!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">The <tt>copyValue</tt> method</div> <div class="doc_subsubsection">The <tt>copyValue</tt> method</div>
@ -485,7 +494,6 @@ this is the only way to introduce a new value. This method indicates that the
new value has exactly the same properties as the value being copied. new value has exactly the same properties as the value being copied.
</div> </div>
<!-- _______________________________________________________________________ --> <!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">The <tt>replaceWithNewValue</tt> method</div> <div class="doc_subsubsection">The <tt>replaceWithNewValue</tt> method</div>
@ -549,8 +557,8 @@ just use the <tt>load-vn</tt> pass, which uses alias analysis.</p>
<p>Many transformations need information about alias <b>sets</b> that are active <p>Many transformations need information about alias <b>sets</b> that are active
in some scope, rather than information about pairwise aliasing. The <tt><a in some scope, rather than information about pairwise aliasing. The <tt><a
href="/doxygen/classllvm_1_1AliasSetTracker.html">AliasSetTracker</a></tt> class is used href="/doxygen/classllvm_1_1AliasSetTracker.html">AliasSetTracker</a></tt> class
to efficiently build these Alias Sets from the pairwise alias analysis is used to efficiently build these Alias Sets from the pairwise alias analysis
information provided by the <tt>AliasAnalysis</tt> interface.</p> information provided by the <tt>AliasAnalysis</tt> interface.</p>
<p>First you initialize the AliasSetTracker by using the "<tt>add</tt>" methods <p>First you initialize the AliasSetTracker by using the "<tt>add</tt>" methods
@ -602,7 +610,6 @@ are.</p>
</div> </div>
<!-- ======================================================================= --> <!-- ======================================================================= -->
<div class="doc_subsection"> <div class="doc_subsection">
<a name="direct">Using the <tt>AliasAnalysis</tt> interface directly</a> <a name="direct">Using the <tt>AliasAnalysis</tt> interface directly</a>
@ -662,7 +669,6 @@ problem.</p>
</div> </div>
<!-- _______________________________________________________________________ --> <!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <div class="doc_subsubsection">
<a name="basic-aa">The <tt>-basicaa</tt> pass</a> <a name="basic-aa">The <tt>-basicaa</tt> pass</a>
@ -845,8 +851,8 @@ pointer.</p>
</div> </div>
<div class="doc_text"> <div class="doc_text">
<p>
The <tt>-load-vn</tt> pass uses alias analysis to "<a href="#loadvn">value <p>The <tt>-load-vn</tt> pass uses alias analysis to "<a href="#loadvn">value
number</a>" loads and pointers values, which is used by the GCSE pass to number</a>" loads and pointers values, which is used by the GCSE pass to
eliminate instructions. The <tt>-load-vn</tt> pass relies on alias information eliminate instructions. The <tt>-load-vn</tt> pass relies on alias information
and must-alias information. This combination of passes can make the following and must-alias information. This combination of passes can make the following
@ -864,18 +870,19 @@ calls into direct calls.</li>
</div> </div>
<!-- ======================================================================= --> <!-- ======================================================================= -->
<div class="doc_subsection"> <div class="doc_subsection">
<a name="aliasanalysis-debug">Clients for debugging and evaluation of implementations</a> <a name="aliasanalysis-debug">Clients for debugging and evaluation of
implementations</a>
</div> </div>
These passes are useful for evaluating the various alias analysis <div class="doc_text">
implementations. You can use them with commands like '<tt>opt -anders-aa -ds-aa
-aa-eval foo.bc -disable-output -stats</tt>'.
<p>These passes are useful for evaluating the various alias analysis
implementations. You can use them with commands like '<tt>opt -anders-aa -ds-aa
-aa-eval foo.bc -disable-output -stats</tt>'.</p>
</div>
<!-- _______________________________________________________________________ --> <!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <div class="doc_subsubsection">
@ -900,17 +907,19 @@ the <tt>AliasSetTracker</tt> class.</p>
<div class="doc_text"> <div class="doc_text">
<p>The <tt>-count-aa</tt> pass is useful to see how many queries a particular <p>The <tt>-count-aa</tt> pass is useful to see how many queries a particular
pass is making and what responses are returned by the alias analysis. An pass is making and what responses are returned by the alias analysis. As an
example usage is:</p> example,</p>
<div class="doc_code">
<pre> <pre>
$ opt -basicaa -count-aa -ds-aa -count-aa -licm % opt -basicaa -count-aa -ds-aa -count-aa -licm
</pre> </pre>
</div>
<p>Which will print out how many queries (and what responses are returned) by <p>will print out how many queries (and what responses are returned) by the
the <tt>-licm</tt> pass (of the <tt>-ds-aa</tt> pass) and how many queries are <tt>-licm</tt> pass (of the <tt>-ds-aa</tt> pass) and how many queries are made
made of the <tt>-basicaa</tt> pass by the <tt>-ds-aa</tt> pass. This can be of the <tt>-basicaa</tt> pass by the <tt>-ds-aa</tt> pass. This can be useful
useful when debugging a transformation or an alias analysis implementation.</p> when debugging a transformation or an alias analysis implementation.</p>
</div> </div>