X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.html;h=5dfc9539c9116ceddb37ac38fc94f2950acd4011;hb=31b24322edc0bcfb8c77277fc5eeebfe98267118;hp=cf514490a8a2de2ed084e4d2eee2bb2c1f352605;hpb=7faa88366572f1515cc4e5e818c8ea9e6d0f2f8b;p=oota-llvm.git diff --git a/docs/LangRef.html b/docs/LangRef.html index cf514490a8a..5dfc9539c91 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -1,1596 +1,2597 @@ - -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. Function Structure +
      3. Module Structure
      4. +
      5. Global Variables
      6. +
      7. 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. 'getelementptr' Instruction -
        5. 'load' Instruction -
        6. 'store' 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
        -
      7. Builtin Functions +
      -
    4. TODO List +
    5. +
    6. Intrinsic Functions
        -
      1. Exception Handling Instructions -
      2. Synchronization Instructions -
      -
    7. Possible Extensions -
        -
      1. 'tailcall' Instruction -
      2. Global Variables -
      3. Explicit Parrellelism +
      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
      -
    8. Related Work +
    +
    +

    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.

+ -
-Type System -
   -Primitive Types -


Type Classifications

   -Derived Types -


Array Type


Function Type


Structure Type


Pointer Type

-High Level Structure -
   -Module Structure -
   -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


'getelementptr' Instruction


'load' Instruction


'store' Instruction

   -Other Operations -


'cast .. to' Instruction


'call' Instruction


'icall' Instruction


'phi' Instruction

   -Builtin Functions -
-TODO List -


Synchronization Instructions

-Possible Extensions -


'tailcall' Instruction


Global Variables


Explicit Parrellelism

-Related Work -


Vectorized Architectures

- + + +
+ 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: Sun Apr 14 01:12:55 CDT 2002 - -
- +
+ Valid CSS! + Valid HTML 4.01! + + Chris Lattner
+ The LLVM Compiler Infrastructure
+ Last modified: $Date$ +
+ +