summaryrefslogtreecommitdiff
path: root/docs
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
commit242d61d1c974e1c79f063a29fe8448d543f24cb1 (patch)
treeade0394437dbaaabce4bdd893c38aa8d34622428 /docs
parent91dad87ddc1e69ac5fa8953a583de4185e1dd0d7 (diff)
downloadllvm-242d61d1c974e1c79f063a29fe8448d543f24cb1.tar.gz
llvm-242d61d1c974e1c79f063a29fe8448d543f24cb1.tar.bz2
llvm-242d61d1c974e1c79f063a29fe8448d543f24cb1.tar.xz
Document type upreferences (PR3380), patch by Stein Roger Skafløtten
with enhancements and corrections by me. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63502 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r--docs/LangRef.html54
1 files changed, 53 insertions, 1 deletions
diff --git a/docs/LangRef.html b/docs/LangRef.html
index 35f83b48d4..8d9b60da2a 100644
--- a/docs/LangRef.html
+++ b/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>