X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.html;h=5dfc9539c9116ceddb37ac38fc94f2950acd4011;hb=31b24322edc0bcfb8c77277fc5eeebfe98267118;hp=56d5153a67165580636aa1bbcc527445cdb5077a;hpb=2c1bbd8bea465657e04007d60612f81836d24f5c;p=oota-llvm.git diff --git a/docs/LangRef.html b/docs/LangRef.html index 56d5153a671..5dfc9539c91 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -1,505 +1,589 @@ - -LLVM Assembly Language Reference Manual - + + + + LLVM Assembly Language Reference Manual + + - - -
  LLVM 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. Array Type
        6. +
        7. Function Type
        8. +
        9. Pointer Type
        10. +
        11. Structure Type
        12. +
        +
      +
    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 -
        5. 'unwind' Instruction +
        6. 'ret' Instruction
        7. +
        8. 'br' Instruction
        9. +
        10. 'switch' Instruction
        11. +
        12. 'invoke' Instruction
        13. +
        14. 'unwind' 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
        +
      +
    4. 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. +
          +
        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. 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:

+
  %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 -
-
   -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
- - -Last modified: Tue Oct 21 10:43:36 CDT 2003 - -
- +
+ Valid CSS! + Valid HTML 4.01! + + Chris Lattner
+ The LLVM Compiler Infrastructure
+ Last modified: $Date$ +
+ +