diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-02 07:32:36 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-02 07:32:36 +0000 |
commit | 515195a43b99392b97ddd8fd6443c657531b1f02 (patch) | |
tree | ade0394437dbaaabce4bdd893c38aa8d34622428 /docs/LangRef.html | |
parent | db6a6a1c32ccc7345190d83d5668d4fa77cc5413 (diff) | |
download | external_llvm-515195a43b99392b97ddd8fd6443c657531b1f02.zip external_llvm-515195a43b99392b97ddd8fd6443c657531b1f02.tar.gz external_llvm-515195a43b99392b97ddd8fd6443c657531b1f02.tar.bz2 |
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/LangRef.html')
-rw-r--r-- | docs/LangRef.html | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/docs/LangRef.html b/docs/LangRef.html index 35f83b4..8d9b60d 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> + \<level> +</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> |