From bc088218e6b2922da6c2e280ec321152699e9c30 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 11 Jan 2009 20:53:49 +0000 Subject: [PATCH] Implement PR3313, and while I'm at it address a very FAQ. llvm-svn: 62048 --- llvm/docs/LangRef.html | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/llvm/docs/LangRef.html b/llvm/docs/LangRef.html index 9afc2259afed..7b8d4f8c8545 100644 --- a/llvm/docs/LangRef.html +++ b/llvm/docs/LangRef.html @@ -22,6 +22,7 @@
  • Module Structure
  • Linkage Types
  • Calling Conventions
  • +
  • Named Types
  • Global Variables
  • Functions
  • Aliases
  • @@ -680,6 +681,41 @@ All Global Variables and Functions have one of the following visibility styles: + +
    + Named Types +
    + +
    + +

    LLVM IR allows you to specify name aliases for certain types. This can make +it easier to read the IR and make the IR more condensed (particularly when +recursive types are involved). An example of a name specification is: +

    + +
    +
    +%mytype = type { %mytype*, i32 }
    +
    +
    + +

    You may give a name to any type except "void". Type name aliases may be used anywhere a type is +expected with the syntax "%mytype".

    + +

    Note that type names are aliases for the structural type that they indicate, +and that you can therefore specify multiple names for the same type. This often +leads to confusing behavior when dumping out a .ll file. Since LLVM IR uses +structural typing, the name is not part of the type. When printing out LLVM IR, +the printer will pick one name to render all types of a particular +shape. This means that if you have code where two different source types end up +having the same LLVM type, that the dumper will sometimes print the "wrong" or +unexpected type. This is an important design point and isn't going to +change.

    + +
    + +
    Global Variables @@ -3425,8 +3461,8 @@ int *foo(struct ST *s) {
    -%RT = type { i8 , [10 x [20 x i32]], i8  }
    -%ST = type { i32, double, %RT }
    +%RT = type { i8 , [10 x [20 x i32]], i8  }
    +%ST = type { i32, double, %RT }
     
     define i32* %foo(%ST* %s) {
     entry: