From 242d61d1c974e1c79f063a29fe8448d543f24cb1 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 2 Feb 2009 07:32:36 +0000 Subject: [PATCH] =?UTF-8?q?Document=20type=20upreferences=20(PR3380),=20pa?= =?UTF-8?q?tch=20by=20Stein=20Roger=20Skafl=C3=B8tten=20with=20enhancement?= =?UTF-8?q?s=20and=20corrections=20by=20me.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63502 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 54 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/docs/LangRef.html b/docs/LangRef.html index 35f83b48d4f..8d9b60da2a6 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -55,6 +55,7 @@
  • Opaque Type
  • +
  • Type Up-references
  • Constants @@ -722,7 +723,6 @@ change.

    -
    Global Variables @@ -1646,6 +1646,58 @@ structure type).

    + + + +
    +
    Overview:
    +

    +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:

    + +
    +   { \2 * }                %x = type { %t* }
    +   { \2 }*                 %y = type { %y }*
    +   \1*                     %z = type %z*
    +
    + +

    +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). +

    + +
    Syntax:
    +
    +   \<level>
    +
    + +

    +The level is the count of the lexical type that is being referred to. +

    + +
    Examples:
    + + + + + + + + + + +
    \1*Self-referential pointer.
    { { \3*, i8 }, i32 }Recursive structure where the upref refers to the out-most + structure.
    +
    + + +