summaryrefslogtreecommitdiffstats
path: root/llvm/docs/LangRef.html
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-02 07:32:36 +0000
committerChris Lattner <sabre@nondot.org>2009-02-02 07:32:36 +0000
commitcf7a58434129bac25d3a9c856613ec948a804887 (patch)
treea3cd686ef638ba26393e80b56ab15989e45f50bb /llvm/docs/LangRef.html
parent1f386b8ec8de5d24f2eaaa676db0737fe298bccf (diff)
downloadbcm5719-llvm-cf7a58434129bac25d3a9c856613ec948a804887.tar.gz
bcm5719-llvm-cf7a58434129bac25d3a9c856613ec948a804887.zip
Document type upreferences (PR3380), patch by Stein Roger Skafløtten
with enhancements and corrections by me. llvm-svn: 63502
Diffstat (limited to 'llvm/docs/LangRef.html')
-rw-r--r--llvm/docs/LangRef.html54
1 files changed, 53 insertions, 1 deletions
diff --git a/llvm/docs/LangRef.html b/llvm/docs/LangRef.html
index 35f83b48d4f..8d9b60da2a6 100644
--- a/llvm/docs/LangRef.html
+++ b/llvm/docs/LangRef.html
@@ -55,6 +55,7 @@
<li><a href="#t_opaque">Opaque Type</a></li>
</ol>
</li>
+ <li><a href="#t_uprefs">Type Up-references</a></li>
</ol>
</li>
<li><a href="#constants">Constants</a>
@@ -722,7 +723,6 @@ change.</p>
</div>
-
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="globalvars">Global Variables</a>
@@ -1646,6 +1646,58 @@ structure type).</p>
</table>
</div>
+<!-- ======================================================================= -->
+<div class="doc_subsection">
+ <a name="t_uprefs">Type Up-references</a>
+</div>
+
+<div class="doc_text">
+<h5>Overview:</h5>
+<p>
+An "up reference" allows you to refer to a lexically enclosing type without
+requiring it to have a name. For instance, a structure declaration may contain a
+pointer to any of the types it is lexically a member of. Example of up
+references (with their equivalent as named type declarations) include:</p>
+
+<pre>
+ { \2 * } %x = type { %t* }
+ { \2 }* %y = type { %y }*
+ \1* %z = type %z*
+</pre>
+
+<p>
+An up reference is needed by the asmprinter for printing out cyclic types when
+there is no declared name for a type in the cycle. Because the asmprinter does
+not want to print out an infinite type string, it needs a syntax to handle
+recursive types that have no names (all names are optional in llvm IR).
+</p>
+
+<h5>Syntax:</h5>
+<pre>
+ \&lt;level&gt;
+</pre>
+
+<p>
+The level is the count of the lexical type that is being referred to.
+</p>
+
+<h5>Examples:</h5>
+
+<table class="layout">
+ <tr class="layout">
+ <td class="left"><tt>\1*</tt></td>
+ <td class="left">Self-referential pointer.</td>
+ </tr>
+ <tr class="layout">
+ <td class="left"><tt>{ { \3*, i8 }, i32 }</tt></td>
+ <td class="left">Recursive structure where the upref refers to the out-most
+ structure.</td>
+ </tr>
+</table>
+</div>
+
+</div>
+
<!-- *********************************************************************** -->
<div class="doc_section"> <a name="constants">Constants</a> </div>
OpenPOWER on IntegriCloud