X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.html;h=47fc33ebbb7f59e08c2af983c7c4a044158143db;hb=812402019264506bea49749b23d0ead1be9fde7c;hp=86041a4d49f50ae1be99cc30c31d98c23f193fbb;hpb=2b7d320d90c8d7989d9c33bd6a6280fb3fd9d2c9;p=oota-llvm.git diff --git a/docs/LangRef.html b/docs/LangRef.html index 86041a4d49f..47fc33ebbb7 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -1,1579 +1,2599 @@ - -llvm Assembly Language Reference Manual - + + + + LLVM Assembly 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. 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. Packed Type +
        6. Array Type
        7. +
        8. Function Type
        9. +
        10. Pointer Type
        11. +
        12. Structure Type
        13. +
        +
      +
    2. High Level Structure
        -
      1. Module Structure -
      2. Global Variables -
      3. Function Structure +
      4. Module Structure
      5. +
      6. Global Variables
      7. +
      8. Function Structure
      +
    3. Instruction Reference
      1. Terminator Instructions
          -
        1. 'ret' Instruction -
        2. 'br' Instruction -
        3. 'switch' Instruction -
        4. 'invoke' Instruction -
        -
      2. Unary Operations -
          -
        1. 'not' Instruction +
        2. 'ret' Instruction
        3. +
        4. 'br' Instruction
        5. +
        6. 'switch' Instruction
        7. +
        8. 'invoke' Instruction
        9. +
        10. 'unwind' Instruction
        +
      3. 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
        +
      4. 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
        +
      5. 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
        +
      6. Other Operations
          -
        1. 'cast .. to' Instruction -
        2. 'call' Instruction -
        3. 'icall' Instruction -
        4. 'phi' Instruction +
        5. 'phi' Instruction
        6. +
        7. 'cast .. to' Instruction
        8. +
        9. 'select' Instruction
        10. +
        11. 'call' Instruction
        12. +
        13. 'vanext' Instruction
        14. +
        15. 'vaarg' Instruction
        +
      -
    4. Related Work +
    5. +
    6. Intrinsic Functions +
        +
      1. Variable Argument Handling Intrinsics +
          +
        1. 'llvm.va_start' Intrinsic
        2. +
        3. 'llvm.va_end' Intrinsic
        4. +
        5. 'llvm.va_copy' Intrinsic
        6. +
        +
      2. +
      3. Accurate Garbage Collection Intrinsics +
          +
        1. 'llvm.gcroot' Intrinsic
        2. +
        3. 'llvm.gcread' Intrinsic
        4. +
        5. 'llvm.gcwrite' Intrinsic
        6. +
        +
      4. +
      5. Code Generator Intrinsics +
          +
        1. 'llvm.returnaddress' Intrinsic
        2. +
        3. 'llvm.frameaddress' Intrinsic
        4. +
        +
      6. +
      7. Operating System Intrinsics +
          +
        1. 'llvm.readport' Intrinsic
        2. +
        3. 'llvm.writeport' Intrinsic
        4. +
        5. 'llvm.readio' Intrinsic
        6. +
        7. 'llvm.writeio' Intrinsic
        8. +
        +
      8. Standard C Library Intrinsics +
          +
        1. 'llvm.memcpy' Intrinsic
        2. +
        3. 'llvm.memmove' Intrinsic
        4. +
        5. 'llvm.memset' Intrinsic
        6. +
        7. 'llvm.isunordered' Intrinsic
        8. +
        +
      9. +
      10. Debugger intrinsics
      11. +
      +
    +
    +

    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:

+
  %result = shl uint %X, ubyte 3
+

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:

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

...and it also show 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.

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

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


Type Classifications

   -Derived Types -


Array Type


Function Type


Structure Type


Pointer Type

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


'ret' Instruction


'br' Instruction


'switch' Instruction


'invoke' Instruction

-
   -Unary Operations -


'not' 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 -


'cast .. to' Instruction


'call' Instruction


'icall' Instruction


'phi' Instruction

-
-Related Work -


Vectorized Architectures

- - -
- -
Chris Lattner
- - -Last modified: Fri May 3 14:39:52 CDT 2002 - -
- +
+ Valid CSS! + Valid HTML 4.01! + + Chris Lattner
+ The LLVM Compiler Infrastructure
+ Last modified: $Date$ +
+ +