X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.html;h=23911e2540f43504fd172e0c536f61e35f9d8141;hb=120bc6da2fe9b6706de2f5ee890a844cb91ae2d5;hp=a664f328d5d54596850162c028d22f03c2038306;hpb=478921b11a9e9f6ffac0c4eb96c4275e2b2ce3cd;p=oota-llvm.git diff --git a/docs/LangRef.html b/docs/LangRef.html index a664f328d5d..23911e2540f 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -1,865 +1,1307 @@ - -LLVM Assembly Language Reference Manual - - - - -
  LLVM Language Reference Manual
- + + + + LLVM Assembly Language Reference Manual + + + + + + + + +
LLVM Language Reference Manual
    -
  1. Abstract -
  2. Introduction -
  3. Identifiers +
  4. Abstract
  5. +
  6. Introduction
  7. +
  8. Identifiers
  9. +
  10. High Level Structure +
      +
    1. Module Structure
    2. +
    3. Linkage Types
    4. +
    5. Calling Conventions
    6. +
    7. Global Variables
    8. +
    9. Function Structure
    10. +
    +
  11. Type System
      -
    1. Primitive Types -
        -
      1. Type Classifications +
      2. Primitive Types +
          +
        1. Type Classifications
        +
      3. Derived Types
          -
        1. Array Type -
        2. Function Type -
        3. Pointer Type -
        4. Structure Type - +
        5. Array Type
        6. +
        7. Function Type
        8. +
        9. Pointer Type
        10. +
        11. Structure Type
        12. +
        13. Packed Type
        14. +
        15. Opaque Type
        +
      -
    2. High Level Structure +
    3. +
    4. Constants
        -
      1. Module Structure -
      2. Global Variables -
      3. Function Structure +
      4. Simple Constants +
      5. Aggregate Constants +
      6. Global Variable and Function Addresses +
      7. Undefined Values +
      8. Constant Expressions
      +
    5. Instruction Reference
      1. Terminator Instructions
          -
        1. 'ret' Instruction -
        2. 'br' Instruction -
        3. 'switch' Instruction -
        4. 'invoke' Instruction -
        5. 'unwind' Instruction +
        6. 'ret' Instruction
        7. +
        8. 'br' Instruction
        9. +
        10. 'switch' Instruction
        11. +
        12. 'invoke' Instruction
        13. +
        14. 'unwind' Instruction
        15. +
        16. 'unreachable' Instruction
        +
      2. Binary Operations
          -
        1. 'add' Instruction -
        2. 'sub' Instruction -
        3. 'mul' Instruction -
        4. 'div' Instruction -
        5. 'rem' Instruction -
        6. 'setcc' Instructions +
        7. 'add' Instruction
        8. +
        9. 'sub' Instruction
        10. +
        11. 'mul' Instruction
        12. +
        13. 'div' Instruction
        14. +
        15. 'rem' Instruction
        16. +
        17. 'setcc' Instructions
        +
      3. Bitwise Binary Operations
          -
        1. 'and' Instruction -
        2. 'or' Instruction -
        3. 'xor' Instruction -
        4. 'shl' Instruction -
        5. 'shr' Instruction +
        6. 'and' Instruction
        7. +
        8. 'or' Instruction
        9. +
        10. 'xor' Instruction
        11. +
        12. 'shl' Instruction
        13. +
        14. 'shr' Instruction
        +
      4. Memory Access Operations
          -
        1. 'malloc' Instruction -
        2. 'free' Instruction -
        3. 'alloca' Instruction -
        4. 'load' Instruction -
        5. 'store' Instruction -
        6. 'getelementptr' Instruction +
        7. 'malloc' Instruction
        8. +
        9. 'free' Instruction
        10. +
        11. 'alloca' Instruction
        12. +
        13. 'load' Instruction
        14. +
        15. 'store' Instruction
        16. +
        17. 'getelementptr' Instruction
        +
      5. Other Operations
          -
        1. 'phi' Instruction -
        2. 'cast .. to' Instruction -
        3. 'call' Instruction -
        4. 'vanext' Instruction -
        5. 'vaarg' Instruction +
        6. 'phi' Instruction
        7. +
        8. 'cast .. to' Instruction
        9. +
        10. 'select' Instruction
        11. +
        12. 'call' Instruction
        13. +
        14. 'vanext' Instruction
        15. +
        16. 'vaarg' Instruction
        +
      +
    6. Intrinsic Functions -
        -
      1. Variable Argument Handling Intrinsics
          -
        1. 'llvm.va_start' Intrinsic -
        2. 'llvm.va_end' Intrinsic -
        3. 'llvm.va_copy' Intrinsic +
        4. Variable Argument Handling Intrinsics +
            +
          1. 'llvm.va_start' Intrinsic
          2. +
          3. 'llvm.va_end' Intrinsic
          4. +
          5. 'llvm.va_copy' Intrinsic
          6. +
          +
        5. +
        6. Accurate Garbage Collection Intrinsics +
            +
          1. 'llvm.gcroot' Intrinsic
          2. +
          3. 'llvm.gcread' Intrinsic
          4. +
          5. 'llvm.gcwrite' Intrinsic
          6. +
          +
        7. +
        8. Code Generator Intrinsics +
            +
          1. 'llvm.returnaddress' Intrinsic
          2. +
          3. 'llvm.frameaddress' Intrinsic
          4. +
          5. 'llvm.prefetch' Intrinsic
          6. +
          7. 'llvm.pcmarker' Intrinsic
          8. +
          +
        9. +
        10. Operating System Intrinsics +
            +
          1. 'llvm.readport' Intrinsic
          2. +
          3. 'llvm.writeport' Intrinsic
          4. +
          5. 'llvm.readio' Intrinsic
          6. +
          7. 'llvm.writeio' Intrinsic
          8. +
          +
        11. Standard C Library Intrinsics +
            +
          1. 'llvm.memcpy' Intrinsic
          2. +
          3. 'llvm.memmove' Intrinsic
          4. +
          5. 'llvm.memset' Intrinsic
          6. +
          7. 'llvm.isunordered' Intrinsic
          8. +
          +
        12. +
        13. Bit counting Intrinsics +
            +
          1. 'llvm.ctpop' Intrinsic
          2. +
          3. 'llvm.cttz' Intrinsic
          4. +
          5. 'llvm.ctlz' Intrinsic
          6. +
          +
        14. +
        15. Debugger intrinsics
        -
      - -

      Written by Chris Lattner and Vikram Adve

      - - +

    +
    +

    Written by Chris Lattner + and Vikram Adve

    +
    -

    -
    -Abstract -

    -
    -Introduction -


    Well Formedness

    -
    -Identifiers -
+ +

LLVM requires that values start with a '%' sign for two reasons: Compilers +don't need to worry about name clashes with reserved words, and the set of +reserved words may be expanded in the future without penalty. Additionally, +unnamed identifiers allow a compiler to quickly come up with a temporary +variable without having to avoid symbol table conflicts.

+ +

Reserved words in LLVM are very similar to reserved words in other +languages. There are keywords for different opcodes ('add', 'cast', 'ret', etc...), for primitive type names ('void', 'uint', etc...), +and others. These reserved words cannot conflict with variable names, because +none of them start with a '%' character.

+ +

Here is an example of LLVM code to multiply the integer variable +'%X' by 8:

+ +

The easy way:

+
   %result = mul uint %X, 8
 
-After strength reduction: +

After strength reduction:

+
   %result = shl uint %X, ubyte 3
 
-And the hard way: +

And the hard way:

+
   add uint %X, %X           ; yields {uint}:%0
   add uint %0, %0           ; yields {uint}:%1
   %result = add uint %1, %1
 
-This last way of multiplying %X by 8 illustrates several important lexical features of LLVM:

+

This last way of multiplying %X by 8 illustrates several +important lexical features of LLVM:

    -
  1. Comments are delimited with a ';' and go until the end of line. -
  2. Unnamed temporaries are created when the result of a computation is not - assigned to a named value. -
  3. Unnamed temporaries are numbered sequentially -

-...and it also show a convention that we follow in this document. When +

  • Comments are delimited with a ';' and go until the end of + line.
  • + +
  • Unnamed temporaries are created when the result of a computation is not + assigned to a named value.
  • + +
  • Unnamed temporaries are numbered sequentially
  • + + + +

    ...and it also shows a convention that we follow in this document. When demonstrating instructions, we will follow an instruction with a comment that defines the type and name of value produced. Comments are shown in italic -text.

    - -The one non-intuitive notation for constants is the optional hexidecimal form of -floating point constants. For example, the form 'double -0x432ff973cafa8000' is equivalent to (but harder to read than) 'double -4.5e+15' which is also supported by the parser. The only time hexadecimal -floating point constants are useful (and the only time that they are generated -by the disassembler) is when an FP constant has to be emitted that is not -representable as a decimal floating point number exactly. For example, NaN's, -infinities, and other special cases are represented in their IEEE hexadecimal -format so that assembly and disassembly do not cause any bits to change in the -constants.

    +text.

    + - -
    -Type System -
    -
       -Primitive Types -


    Type Classifications

       -Derived Types -


    Array Type


    Function Type


    Structure Type


    Pointer Type

    -
    -High Level Structure -
    -
       -Module Structure -
    -
       -Global Variables -
    -
       -Functions -
    -
    -Instruction Reference -
    -
       -Terminator Instructions -


    'ret' Instruction


    'br' Instruction


    'switch' Instruction


    'invoke' Instruction


    'unwind' Instruction

       -Binary Operations -


    'add' Instruction


    'sub' Instruction


    'mul' Instruction


    'div' Instruction


    'rem' Instruction


    'setcc' Instructions

    -
       -Bitwise Binary Operations -


    'and' Instruction


    'or' Instruction


    'xor' Instruction


    'shl' Instruction


    'shr' Instruction

    -
       -Memory Access Operations -


    'malloc' Instruction


    'free' Instruction


    'alloca' Instruction


    'load' Instruction


    'store' Instruction


    'getelementptr' Instruction

    -
       -Other Operations -


    'phi' Instruction


    'cast .. to' Instruction


    'call' Instruction


    'vanext' Instruction


    'vaarg' Instruction

    -
    -Intrinsic Functions -
    -
       -Variable Argument Handling Intrinsics -


    'llvm.va_start' Intrinsic


    'llvm.va_end' Intrinsic


    'llvm.va_copy' Intrinsic

    - + +
    + Debugger Intrinsics +
    + +
    +

    +The LLVM debugger intrinsics (which all start with llvm.dbg. prefix), +are described in the LLVM Source Level +Debugging document. +

    +
    +
    - -
    Chris Lattner
    -The LLVM Compiler Infrastructure -
    - - -Last modified: Wed Oct 29 19:30:46 CST 2003 - -
    - +
    + Valid CSS! + Valid HTML 4.01! + + Chris Lattner
    + The LLVM Compiler Infrastructure
    + Last modified: $Date$ +
    + +