X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.html;h=01b971bf2f0a9402a06394a4ec68ffff9503b983;hb=a6fb5b54f3a35fdefbb03b9c7be4c6d6d53cdd35;hp=7796126b62d55fcb8e829029a0c2a6251816697c;hpb=c3fc6dfa59199234e90e56536c8339b6485c7930;p=oota-llvm.git diff --git a/docs/LangRef.html b/docs/LangRef.html index 7796126b62d..01b971bf2f0 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -111,6 +111,12 @@
  • 'shufflevector' Instruction
  • +
  • Aggregate Operations +
      +
    1. 'extractvalue' Instruction
    2. +
    3. 'insertvalue' Instruction
    4. +
    +
  • Memory Access and Addressing Operations
    1. 'malloc' Instruction
    2. @@ -140,6 +146,8 @@
      1. 'icmp' Instruction
      2. 'fcmp' Instruction
      3. +
      4. 'vicmp' Instruction
      5. +
      6. 'vfcmp' Instruction
      7. 'phi' Instruction
      8. 'select' Instruction
      9. 'call' Instruction
      10. @@ -458,7 +466,7 @@ All Global Variables and Functions have one of the following types of linkage:
        -
        internal
        +
        internal:
        Global values with internal linkage are only directly accessible by objects in the current module. In particular, linking code into a module with @@ -477,14 +485,22 @@ All Global Variables and Functions have one of the following types of linkage: allowed to be discarded.
        +
        common:
        + +
        "common" linkage is exactly the same as linkonce + linkage, except that unreferenced common globals may not be + discarded. This is used for globals that may be emitted in multiple + translation units, but that are not guaranteed to be emitted into every + translation unit that uses them. One example of this is tentative + definitions in C, such as "int X;" at global scope. +
        +
        weak:
        -
        "weak" linkage is exactly the same as linkonce linkage, - except that unreferenced weak globals may not be discarded. This is - used for globals that may be emitted in multiple translation units, but that - are not guaranteed to be emitted into every translation unit that uses them. - One example of this are common globals in C, such as "int X;" at - global scope. +
        "weak" linkage is the same as common linkage, except + that some targets may choose to emit different assembly sequences for them + for target-dependent reasons. This is used for globals that are declared + "weak" in C source code.
        appending:
        @@ -578,9 +594,11 @@ the future:

        (e.g. by passing things in registers). This calling convention allows the target to use whatever tricks it wants to produce fast code for the target, without having to conform to an externally specified ABI. Implementations of - this convention should allow arbitrary tail call optimization to be supported. - This calling convention does not support varargs and requires the prototype of - all callees to exactly match the prototype of the function definition. + this convention should allow arbitrary + tail call optimization to be + supported. This calling convention does not support varargs and requires the + prototype of all callees to exactly match the prototype of the function + definition.
        "coldcc" - The cold calling convention:
        @@ -763,8 +781,8 @@ a power of 2.

        Aliases act as "second name" for the aliasee value (which can be either - function or global variable or bitcast of global value). Aliases may have an - optional linkage type, and an + function, global variable, another alias or bitcast of global value). Aliases + may have an optional linkage type, and an optional visibility style.

        Syntax:
        @@ -829,6 +847,7 @@ declare i32 @atoi(i8*) nounwind readonly
        sret
        This indicates that the pointer parameter specifies the address of a structure that is the return value of the function in the source program. + Loads and stores to the structure are assumed not to trap. May only be applied to the first parameter.
        noalias
        @@ -842,10 +861,11 @@ declare i32 @atoi(i8*) nounwind readonly an unreachable instruction immediately followed the call.
        nounwind
        -
        This function attribute indicates that the function type does not use - the unwind instruction and does not allow stack unwinding to propagate - through it.
        - +
        This function attribute indicates that no exceptions unwind out of the + function. Usually this is because the function makes no use of exceptions, + but it may also be that the function catches any exceptions thrown when + executing it.
        +
        nest
        This indicates that the parameter can be excised using the trampoline intrinsics.
        @@ -1025,14 +1045,16 @@ classifications:

        integer, floating point, pointer, - vector + vector, + structure, + array, + label. primitive label, void, - integer, floating point. @@ -1052,8 +1074,7 @@ classifications:

        The first class types are perhaps the most important. Values of these types are the only ones which can be produced by instructions, passed as arguments, or used as operands to -instructions. This means that all structures and arrays must be -manipulated either by pointer or by component.

        +instructions.

        @@ -1221,15 +1242,21 @@ type "{ i32, [0 x float]}", for example.

        +
        Overview:
        +

        The function type can be thought of as a function signature. It -consists of a return type and a list of formal parameter types. -Function types are usually used to build virtual function tables -(which are structures of pointers to functions), for indirect function -calls, and when defining a function.

        +consists of a return type and a list of formal parameter types. The +return type of a function type is a scalar type, a void type, or a struct type. +If the return type is a struct type then all struct elements must be of first +class types, and the struct must have at least one element.

        Syntax:
        -
          <returntype list> (<parameter list>)
        + +
        +  <returntype list> (<parameter list>)
        +
        +

        ...where '<parameter list>' is a comma-separated list of type specifiers. Optionally, the parameter list may include a type ..., which indicates that the function takes a variable number of arguments. @@ -1237,6 +1264,7 @@ Variable argument functions can access their arguments with the variable argument handling intrinsic functions. '<returntype list>' is a comma-separated list of first class type specifiers.

        +
        Examples:
        @@ -1258,6 +1286,11 @@ Variable argument functions can access their arguments with the printf in LLVM. + + +
        {i32, i32} (i32)A function taking an i32>, returning two + i32 values as an aggregate of type { i32, i32 } +
        @@ -1456,8 +1489,10 @@ them all and their syntax.

        Floating point constants use standard decimal notation (e.g. 123.421), exponential notation (e.g. 1.23421e+2), or a more precise hexadecimal - notation (see below). Floating point constants must have a floating point type.
        + notation (see below). The assembler requires the exact decimal value of + a floating-point constant. For example, the assembler accepts 1.25 but + rejects 1.3 because 1.3 is a repeating decimal in binary. Floating point + constants must have a floating point type.
        Null pointer constants
        @@ -1664,6 +1699,12 @@ following is the syntax for constant expressions:

        fcmp COND ( VAL1, VAL2 )
        Performs the fcmp operation on constants.
        +
        vicmp COND ( VAL1, VAL2 )
        +
        Performs the vicmp operation on constants.
        + +
        vfcmp COND ( VAL1, VAL2 )
        +
        Performs the vfcmp operation on constants.
        +
        extractelement ( VAL, IDX )
        Perform the extractelement @@ -1791,19 +1832,26 @@ Instruction
        ret void ; Return from void function ret <type> <value>, <type> <value> ; Return two values from a non-void function +
        Overview:
        +

        The 'ret' instruction is used to return control flow (and a value) from a function back to the caller.

        There are two forms of the 'ret' instruction: one that -returns a value and then causes control flow, and one that just causes +returns value(s) and then causes control flow, and one that just causes control flow to occur.

        +
        Arguments:
        -

        The 'ret' instruction may return one or multiple values. The -type of each return value must be 'first class' - type. Notice that a function is not well formed -if there exists a 'ret' instruction inside of the function that -returns values that does not match the return type of the function.

        + +

        The 'ret' instruction may return zero, one or multiple values. +The type of each return value must be a 'first +class' type. Note that a function is not well +formed if there exists a 'ret' instruction inside of the +function that returns values that do not match the return type of the +function.

        +
        Semantics:
        +

        When the 'ret' instruction is executed, control flow returns back to the calling function's context. If the caller is a "call" instruction, execution continues at @@ -1812,10 +1860,13 @@ the instruction after the call. If the caller was an "getresult -' insctruction.

        +values can only be accessed through a 'getresult +' instruction.

        +
        Example:
        -
          ret i32 5                       ; Return an integer value of 5
        +
        +
        +  ret i32 5                       ; Return an integer value of 5
           ret void                        ; Return from a void function
           ret i32 4, i8 2                 ; Return two values 4 and 2  
         
        @@ -1914,7 +1965,7 @@ branches or with a lookup table.

        Syntax:
        -  <result> = invoke [cconv] <ptr to function ty> %<function ptr val>(<function args>) 
        +  <result> = invoke [cconv] <ptr to function ty> <function ptr val>(<function args>) 
                         to label <normal label> unwind label <exception label>
         
        @@ -1928,8 +1979,8 @@ function, with the possibility of control flow transfer to either the "normal" label. If the callee (or any indirect callees) returns with the "unwind" instruction, control is interrupted and continued at the dynamically nearest "exception" label. If the callee function -returns multiple values then individual return values are accessed only through -'getresult' instruction.

        +returns multiple values then individual return values are only accessible through +a 'getresult' instruction.

        Arguments:
        @@ -1977,9 +2028,9 @@ exception. Additionally, this is important for implementation of
        Example:
        -  %retval = invoke i32 %Test(i32 15) to label %Continue
        +  %retval = invoke i32 @Test(i32 15) to label %Continue
                       unwind label %TestCleanup              ; {i32}:retval set
        -  %retval = invoke coldcc i32 %Test(i32 15) to label %Continue
        +  %retval = invoke coldcc i32 %Testfnptr(i32 15) to label %Continue
                       unwind label %TestCleanup              ; {i32}:retval set
         
        @@ -2006,7 +2057,7 @@ primarily used to implement exception handling.

        Semantics:
        -

        The 'unwind' intrinsic causes execution of the current function to +

        The 'unwind' instruction causes execution of the current function to immediately halt. The dynamic call stack is then searched for the first invoke instruction on the call stack. Once found, execution continues at the "exceptional" destination block specified by the @@ -2044,90 +2095,128 @@ no-return function cannot be reached, and other facts.

        Binary operators are used to do most of the computation in a -program. They require two operands, execute an operation on them, and +program. They require two operands of the same type, execute an operation on them, and produce a single value. The operands might represent multiple data, as is the case with the vector data type. -The result value of a binary operator is not -necessarily the same type as its operands.

        +The result value has the same type as its operands.

        There are several different binary operators:

        - + +
        +
        Syntax:
        -
          <result> = add <ty> <var1>, <var2>   ; yields {ty}:result
        +
        +
        +  <result> = add <ty> <var1>, <var2>   ; yields {ty}:result
         
        +
        Overview:
        +

        The 'add' instruction returns the sum of its two operands.

        +
        Arguments:
        -

        The two arguments to the 'add' instruction must be either integer or floating point values. - This instruction can also take vector versions of the values. -Both arguments must have identical types.

        + +

        The two arguments to the 'add' instruction must be integer, floating point, or + vector values. Both arguments must have identical + types.

        +
        Semantics:
        +

        The value produced is the integer or floating point sum of the two operands.

        +

        If an integer sum has unsigned overflow, the result returned is the mathematical result modulo 2n, where n is the bit width of the result.

        +

        Because LLVM integers use a two's complement representation, this instruction is appropriate for both signed and unsigned integers.

        +
        Example:
        -
          <result> = add i32 4, %var          ; yields {i32}:result = 4 + %var
        +
        +
        +  <result> = add i32 4, %var          ; yields {i32}:result = 4 + %var
         
        - + +
        +
        Syntax:
        -
          <result> = sub <ty> <var1>, <var2>   ; yields {ty}:result
        +
        +
        +  <result> = sub <ty> <var1>, <var2>   ; yields {ty}:result
         
        +
        Overview:
        +

        The 'sub' instruction returns the difference of its two operands.

        -

        Note that the 'sub' instruction is used to represent the 'neg' -instruction present in most other intermediate representations.

        + +

        Note that the 'sub' instruction is used to represent the +'neg' instruction present in most other intermediate +representations.

        +
        Arguments:
        -

        The two arguments to the 'sub' instruction must be either integer or floating point -values. -This instruction can also take vector versions of the values. -Both arguments must have identical types.

        + +

        The two arguments to the 'sub' instruction must be integer, floating point, + or vector values. Both arguments must have identical + types.

        +
        Semantics:
        +

        The value produced is the integer or floating point difference of the two operands.

        +

        If an integer difference has unsigned overflow, the result returned is the mathematical result modulo 2n, where n is the bit width of the result.

        +

        Because LLVM integers use a two's complement representation, this instruction is appropriate for both signed and unsigned integers.

        +
        Example:
           <result> = sub i32 4, %var          ; yields {i32}:result = 4 - %var
           <result> = sub i32 0, %val          ; yields {i32}:result = -%var
         
        + - + +
        +
        Syntax:
          <result> = mul <ty> <var1>, <var2>   ; yields {ty}:result
         
        Overview:

        The 'mul' instruction returns the product of its two operands.

        +
        Arguments:
        -

        The two arguments to the 'mul' instruction must be either integer or floating point -values. -This instruction can also take vector versions of the values. -Both arguments must have identical types.

        + +

        The two arguments to the 'mul' instruction must be integer, floating point, +or vector values. Both arguments must have identical +types.

        +
        Semantics:
        +

        The value produced is the integer or floating point product of the two operands.

        +

        If the result of an integer multiplication has unsigned overflow, the result returned is the mathematical result modulo 2n, where n is the bit width of the result.

        @@ -2141,6 +2230,7 @@ width of the full product.

          <result> = mul i32 4, %var          ; yields {i32}:result = 4 * %var
         
        + @@ -2151,12 +2241,15 @@ width of the full product.

        Overview:

        The 'udiv' instruction returns the quotient of its two operands.

        +
        Arguments:
        +

        The two arguments to the 'udiv' instruction must be -integer values. Both arguments must have identical -types. This instruction can also take vector versions -of the values in which case the elements must be integers.

        +integer or vector of integer +values. Both arguments must have identical types.

        +
        Semantics:
        +

        The value produced is the unsigned integer quotient of the two operands.

        Note that unsigned integer division and signed integer division are distinct operations; for signed integer division, use 'sdiv'.

        @@ -2170,18 +2263,23 @@ operations; for signed integer division, use 'sdiv'.

        Syntax:
        -
          <result> = sdiv <ty> <var1>, <var2>   ; yields {ty}:result
        +
        +  <result> = sdiv <ty> <var1>, <var2>   ; yields {ty}:result
         
        +
        Overview:
        +

        The 'sdiv' instruction returns the quotient of its two operands.

        +
        Arguments:
        -

        The two arguments to the 'sdiv' instruction must be -integer values. Both arguments must have identical -types. This instruction can also take vector versions -of the values in which case the elements must be integers.

        + +

        The two arguments to the 'sdiv' instruction must be +integer or vector of integer +values. Both arguments must have identical types.

        +
        Semantics:
        -

        The value produced is the signed integer quotient of the two operands.

        +

        The value produced is the signed integer quotient of the two operands rounded towards zero.

        Note that signed integer division and unsigned integer division are distinct operations; for unsigned integer division, use 'udiv'.

        Division by zero leads to undefined behavior. Overflow also leads to @@ -2196,22 +2294,31 @@ by doing a 32-bit division of -2147483648 by -1.

        Instruction
        Syntax:
        -
          <result> = fdiv <ty> <var1>, <var2>   ; yields {ty}:result
        +
        +  <result> = fdiv <ty> <var1>, <var2>   ; yields {ty}:result
         
        Overview:
        +

        The 'fdiv' instruction returns the quotient of its two operands.

        +
        Arguments:
        +

        The two arguments to the 'fdiv' instruction must be -floating point values. Both arguments must have -identical types. This instruction can also take vector -versions of floating point values.

        +floating point or vector +of floating point values. Both arguments must have identical types.

        +
        Semantics:
        +

        The value produced is the floating point quotient of the two operands.

        +
        Example:
        -
          <result> = fdiv float 4.0, %var          ; yields {float}:result = 4.0 / %var
        +
        +
        +  <result> = fdiv float 4.0, %var          ; yields {float}:result = 4.0 / %var
         
        + @@ -2223,14 +2330,12 @@ versions of floating point values.

        The 'urem' instruction returns the remainder from the unsigned division of its two arguments.

        Arguments:
        -

        The two arguments to the 'urem' instruction must be -integer values. Both arguments must have identical -types. This instruction can also take vector versions -of the values in which case the elements must be integers.

        +

        The two arguments to the 'urem' instruction must be +integer or vector of integer +values. Both arguments must have identical types.

        Semantics:

        This instruction returns the unsigned integer remainder of a division. -This instruction always performs an unsigned division to get the remainder, -regardless of whether the arguments are unsigned or not.

        +This instruction always performs an unsigned division to get the remainder.

        Note that unsigned integer remainder and signed integer remainder are distinct operations; for signed integer remainder, use 'srem'.

        Taking the remainder of a division by zero leads to undefined behavior.

        @@ -2240,23 +2345,33 @@ distinct operations; for signed integer remainder, use 'srem'.

        - + +
        +
        Syntax:
        -
          <result> = srem <ty> <var1>, <var2>   ; yields {ty}:result
        +
        +
        +  <result> = srem <ty> <var1>, <var2>   ; yields {ty}:result
         
        +
        Overview:
        +

        The 'srem' instruction returns the remainder from the signed division of its two operands. This instruction can also take vector versions of the values in which case the elements must be integers.

        Arguments:
        +

        The two arguments to the 'srem' instruction must be -integer values. Both arguments must have identical -types.

        +integer or vector of integer +values. Both arguments must have identical types.

        +
        Semantics:
        +

        This instruction returns the remainder of a division (where the result has the same sign as the dividend, var1), not the modulo operator (where the result has the same sign as the divisor, var2) of @@ -2279,9 +2394,11 @@ and the remainder.)

        - + +
        +
        Syntax:
          <result> = frem <ty> <var1>, <var2>   ; yields {ty}:result
         
        @@ -2290,13 +2407,18 @@ Instruction
        division of its two operands.

        Arguments:

        The two arguments to the 'frem' instruction must be -floating point values. Both arguments must have -identical types. This instruction can also take vector -versions of floating point values.

        +floating point or vector +of floating point values. Both arguments must have identical types.

        +
        Semantics:
        -

        This instruction returns the remainder of a division.

        + +

        This instruction returns the remainder of a division. +The remainder has the same sign as the dividend.

        +
        Example:
        -
          <result> = frem float 4.0, %var          ; yields {float}:result = 4.0 % %var
        +
        +
        +  <result> = frem float 4.0, %var          ; yields {float}:result = 4.0 % %var
         
        @@ -2307,9 +2429,8 @@ Operations

        Bitwise binary operators are used to do various forms of bit-twiddling in a program. They are generally very efficient instructions and can commonly be strength reduced from other -instructions. They require two operands, execute an operation on them, -and produce a single value. The resulting value of the bitwise binary -operators is always the same type as its first operand.

        +instructions. They require two operands of the same type, execute an operation on them, +and produce a single value. The resulting value is the same type as its operands.

        @@ -2328,13 +2449,15 @@ the left a specified number of bits.

        Arguments:

        Both arguments to the 'shl' instruction must be the same integer type.

        + href="#t_integer">integer type. 'var2' is treated as an +unsigned value. This instruction does not support +vector operands.

        Semantics:
        -

        The value produced is var1 * 2var2. If -var2 is (statically or dynamically) equal to or larger than the number -of bits in var1, the result is undefined.

        +

        The value produced is var1 * 2var2 mod 2n, +where n is the width of the result. If var2 is (statically or dynamically) negative or +equal to or larger than the number of bits in var1, the result is undefined.

        Example:
           <result> = shl i32 4, %var   ; yields {i32}: 4 << %var
        @@ -2357,7 +2480,9 @@ operand shifted to the right a specified number of bits with zero fill.

        Arguments:

        Both arguments to the 'lshr' instruction must be the same -integer type.

        +integer type. 'var2' is treated as an +unsigned value. This instruction does not support +vector operands.

        Semantics:
        @@ -2391,7 +2516,9 @@ operand shifted to the right a specified number of bits with sign extension.

        Arguments:

        Both arguments to the 'ashr' instruction must be the same -integer type.

        +integer type. 'var2' is treated as an +unsigned value. This instruction does not support +vector operands.

        Semantics:

        This instruction always performs an arithmetic shift right operation, @@ -2413,17 +2540,26 @@ larger than the number of bits in var1, the result is undefined.

        +
        +
        Syntax:
        -
          <result> = and <ty> <var1>, <var2>   ; yields {ty}:result
        +
        +
        +  <result> = and <ty> <var1>, <var2>   ; yields {ty}:result
         
        +
        Overview:
        +

        The 'and' instruction returns the bitwise logical and of its two operands.

        +
        Arguments:
        -

        The two arguments to the 'and' instruction must be integer values. Both arguments must have -identical types.

        + +

        The two arguments to the 'and' instruction must be +integer or vector of integer +values. Both arguments must have identical types.

        +
        Semantics:

        The truth table used for the 'and' instruction is:

        @@ -2459,7 +2595,8 @@ identical types.

        Example:
        -
          <result> = and i32 4, %var         ; yields {i32}:result = 4 & %var
        +
        +  <result> = and i32 4, %var         ; yields {i32}:result = 4 & %var
           <result> = and i32 15, 40          ; yields {i32}:result = 8
           <result> = and i32 4, 8            ; yields {i32}:result = 0
         
        @@ -2474,9 +2611,10 @@ identical types.

        The 'or' instruction returns the bitwise logical inclusive or of its two operands.

        Arguments:
        -

        The two arguments to the 'or' instruction must be integer values. Both arguments must have -identical types.

        + +

        The two arguments to the 'or' instruction must be +integer or vector of integer +values. Both arguments must have identical types.

        Semantics:

        The truth table used for the 'or' instruction is:

        @@ -2529,10 +2667,12 @@ Instruction or of its two operands. The xor is used to implement the "one's complement" operation, which is the "~" operator in C.

        Arguments:
        -

        The two arguments to the 'xor' instruction must be integer values. Both arguments must have -identical types.

        +

        The two arguments to the 'xor' instruction must be +integer or vector of integer +values. Both arguments must have identical types.

        +
        Semantics:
        +

        The truth table used for the 'xor' instruction is:

        @@ -2647,7 +2787,7 @@ results are undefined.
        Syntax:
        -  <result> = insertelement <n x <ty>> <val>, <ty> <elt>, i32 <idx>    ; yields <n x <ty>>
        +  <result> = insertelement <n x <ty>> <val>, <ty> <elt>, i32 <idx>    ; yields <n x <ty>>
         
        Overview:
        @@ -2738,6 +2878,114 @@ operand may be undef if performing a shuffle from only one vector.
        + + + +
        + +

        LLVM supports several instructions for working with aggregate values. +

        + +
        + + + + +
        + +
        Syntax:
        + +
        +  <result> = extractvalue <aggregate type> <val>, <idx>{, <idx>}*
        +
        + +
        Overview:
        + +

        +The 'extractvalue' instruction extracts the value of a struct field +or array element from an aggregate value. +

        + + +
        Arguments:
        + +

        +The first operand of an 'extractvalue' instruction is a +value of struct or array +type. The operands are constant indices to specify which value to extract +in a similar manner as indices in a +'getelementptr' instruction. +

        + +
        Semantics:
        + +

        +The result is the value at the position in the aggregate specified by +the index operands. +

        + +
        Example:
        + +
        +  %result = extractvalue {i32, float} %agg, 0    ; yields i32
        +
        +
        + + + + + +
        + +
        Syntax:
        + +
        +  <result> = insertvalue <aggregate type> <val>, <ty> <val>, <idx>    ; yields <n x <ty>>
        +
        + +
        Overview:
        + +

        +The 'insertvalue' instruction inserts a value +into a struct field or array element in an aggregate. +

        + + +
        Arguments:
        + +

        +The first operand of an 'insertvalue' instruction is a +value of struct or array type. +The second operand is a first-class value to insert. +The following operands are constant indices +indicating the position at which to insert the value in a similar manner as +indices in a +'getelementptr' instruction. +The value to insert must have the same type as the value identified +by the indices. + +

        Semantics:
        + +

        +The result is an aggregate of the same type as val. Its +value is that of val except that the value at the position +specified by the indices is that of elt. +

        + +
        Example:
        + +
        +  %result = insertvalue {i32, float} %agg, i32 1, 0    ; yields {i32, float}
        +
        +
        + +
        Memory Access and Addressing Operations @@ -2778,7 +3026,7 @@ address space (address space zero).

        bytes of memory from the operating system and returns a pointer of the appropriate type to the program. If "NumElements" is specified, it is the number of elements allocated, otherwise "NumElements" is defaulted to be one. -If an alignment is specified, the value result of the allocation is guaranteed to +If a constant alignment is specified, the value result of the allocation is guaranteed to be aligned to at least that boundary. If not specified, or if zero, the target can choose to align the allocation on any convenient boundary.

        @@ -2787,7 +3035,8 @@ choose to align the allocation on any convenient boundary.

        Semantics:

        Memory is allocated using the system "malloc" function, and -a pointer is returned.

        +a pointer is returned. The result of a zero byte allocattion is undefined. The +result is null if there is insufficient memory available.

        Example:
        @@ -2829,7 +3078,8 @@ instruction.

        Semantics:

        Access to the memory pointed to by the pointer is no longer defined -after this instruction executes.

        +after this instruction executes. If the pointer is null, the operation +is a noop.

        Example:
        @@ -2865,7 +3115,7 @@ space (address space zero).

        bytes of memory on the runtime stack, returning a pointer of the appropriate type to the program. If "NumElements" is specified, it is the number of elements allocated, otherwise "NumElements" is defaulted to be one. -If an alignment is specified, the value result of the allocation is guaranteed +If a constant alignment is specified, the value result of the allocation is guaranteed to be aligned to at least that boundary. If not specified, or if zero, the target can choose to align the allocation on any convenient boundary.

        @@ -2873,12 +3123,14 @@ can choose to align the allocation on any convenient boundary.

        Semantics:
        -

        Memory is allocated; a pointer is returned. 'alloca'd +

        Memory is allocated; a pointer is returned. The operation is undefiend if +there is insufficient stack space for the allocation. 'alloca'd memory is automatically released when the function returns. The 'alloca' instruction is commonly used to represent automatic variables that must have an address available. When the function returns (either with the ret or unwind -instructions), the memory is reclaimed.

        +instructions), the memory is reclaimed. Allocating zero bytes +is legal, but the result is undefined.

        Example:
        @@ -2907,7 +3159,7 @@ the number or order of execution of this load with other volatile load and store instructions.

        -The optional "align" argument specifies the alignment of the operation +The optional constant "align" argument specifies the alignment of the operation (that is, the alignment of the memory address). A value of 0 or an omitted "align" argument means that the operation has the preferential alignment for the target. It is the responsibility of the code emitter @@ -2938,13 +3190,14 @@ Instruction

        Arguments:

        There are two arguments to the 'store' instruction: a value to store and an address at which to store it. The type of the '<pointer>' -operand must be a pointer to the type of the '<value>' +operand must be a pointer to the first class type +of the '<value>' operand. If the store is marked as volatile, then the optimizer is not allowed to modify the number or order of execution of this store with other volatile load and store instructions.

        -The optional "align" argument specifies the alignment of the operation +The optional constant "align" argument specifies the alignment of the operation (that is, the alignment of the memory address). A value of 0 or an omitted "align" argument means that the operation has the preferential alignment for the target. It is the responsibility of the code emitter @@ -2988,8 +3241,8 @@ provided depend on the type of the first pointer argument. The 'getelementptr' instruction is used to index down through the type levels of a structure or to a specific index in an array. When indexing into a structure, only i32 integer constants are allowed. When indexing -into an array or pointer, only integers of 32 or 64 bits are allowed, and will -be sign extended to 64-bit values.

        +into an array or pointer, only integers of 32 or 64 bits are allowed; 32-bit +values will be sign extended to 64-bits if required.

        For example, let's consider a C code fragment and how it gets compiled to LLVM:

        @@ -3034,8 +3287,8 @@ entry: on the pointer type that is being indexed into. Pointer and array types can use a 32-bit or 64-bit integer type but the value will always be sign extended -to 64-bits. Structure types require i32 -constants.

        +to 64-bits. Structure and packed +structure types require i32 constants.

        In the example above, the first index is indexing into the '%ST*' type, which is a pointer, yielding a '%ST' = '{ i32, double, %RT @@ -3064,7 +3317,7 @@ the LLVM code for the given testcase is equivalent to:

        Note that it is undefined to access an array out of bounds: array and pointer indexes must always be within the defined bounds of the array type. -The one exception for this rules is zero length arrays. These arrays are +The one exception for this rule is zero length arrays. These arrays are defined to be accessible as variable length arrays, which requires access beyond the zero'th element.

        @@ -3500,15 +3753,19 @@ nothing is done (no-op cast).

        Overview:
        +

        The 'bitcast' instruction converts value to type ty2 without changing any bits.

        Arguments:
        +

        The 'bitcast' instruction takes a value to cast, which must be a first class value, and a type to cast it to, which must also be a first class type. The bit sizes of value and the destination type, ty2, must be identical. If the source -type is a pointer, the destination type must also be a pointer.

        +type is a pointer, the destination type must also be a pointer. This +instruction supports bitwise conversion of vectors to integers and to vectors +of other types (as long as they have the same size).

        Semantics:

        The 'bitcast' instruction converts value to type @@ -3543,7 +3800,7 @@ instructions, which defy better classification.

        Overview:

        The 'icmp' instruction returns a boolean value based on comparison -of its two integer operands.

        +of its two integer or pointer operands.

        Arguments:

        The 'icmp' instruction takes three operands. The first operand is the condition code indicating the kind of comparison to perform. It is not @@ -3640,9 +3897,9 @@ a value, just a keyword. The possible condition code are: floating point typed. They must have identical types.

        Semantics:
        -

        The 'fcmp' compares var1 and var2 according to -the condition code given as cond. The comparison performed always -yields a i1 result, as follows: +

        The 'fcmp' instruction compares var1 and var2 +according to the condition code given as cond. The comparison performed +always yields a i1 result, as follows:

        1. false: always yields false, regardless of operands.
        2. oeq: yields true if both operands are not a QNAN and @@ -3683,30 +3940,144 @@ yields a i1 result, as follows: - +
          Syntax:
          +
            <result> = vicmp <cond> <ty> <var1>, <var2>   ; yields {ty}:result
          +
          +
          Overview:
          +

          The 'vicmp' instruction returns an integer vector value based on +element-wise comparison of its two integer vector operands.

          +
          Arguments:
          +

          The 'vicmp' instruction takes three operands. The first operand is +the condition code indicating the kind of comparison to perform. It is not +a value, just a keyword. The possible condition code are: +

            +
          1. eq: equal
          2. +
          3. ne: not equal
          4. +
          5. ugt: unsigned greater than
          6. +
          7. uge: unsigned greater or equal
          8. +
          9. ult: unsigned less than
          10. +
          11. ule: unsigned less or equal
          12. +
          13. sgt: signed greater than
          14. +
          15. sge: signed greater or equal
          16. +
          17. slt: signed less than
          18. +
          19. sle: signed less or equal
          20. +
          +

          The remaining two arguments must be vector of +integer typed. They must also be identical types.

          +
          Semantics:
          +

          The 'vicmp' instruction compares var1 and var2 +according to the condition code given as cond. The comparison yields a +vector of integer result, of +identical type as the values being compared. The most significant bit in each +element is 1 if the element-wise comparison evaluates to true, and is 0 +otherwise. All other bits of the result are undefined. The condition codes +are evaluated identically to the 'icmp' +instruction. + +

          Example:
          +
          +  <result> = vicmp eq <2 x i32> < i32 4, i32 0>, < i32 5, i32 0>   ; yields: result=<2 x i32> < i32 0, i32 -1 >
          +  <result> = vicmp ult <2 x i8 > < i8 1, i8 2>, < i8 2, i8 2 >        ; yields: result=<2 x i8> < i8 -1, i8 0 >
          +
          +
          + + + +
          +
          Syntax:
          +
            <result> = vfcmp <cond> <ty> <var1>, <var2>
          +
          Overview:
          +

          The 'vfcmp' instruction returns an integer vector value based on +element-wise comparison of its two floating point vector operands. The output +elements have the same width as the input elements.

          +
          Arguments:
          +

          The 'vfcmp' instruction takes three operands. The first operand is +the condition code indicating the kind of comparison to perform. It is not +a value, just a keyword. The possible condition code are: +

            +
          1. false: no comparison, always returns false
          2. +
          3. oeq: ordered and equal
          4. +
          5. ogt: ordered and greater than
          6. +
          7. oge: ordered and greater than or equal
          8. +
          9. olt: ordered and less than
          10. +
          11. ole: ordered and less than or equal
          12. +
          13. one: ordered and not equal
          14. +
          15. ord: ordered (no nans)
          16. +
          17. ueq: unordered or equal
          18. +
          19. ugt: unordered or greater than
          20. +
          21. uge: unordered or greater than or equal
          22. +
          23. ult: unordered or less than
          24. +
          25. ule: unordered or less than or equal
          26. +
          27. une: unordered or not equal
          28. +
          29. uno: unordered (either nans)
          30. +
          31. true: no comparison, always returns true
          32. +
          +

          The remaining two arguments must be vector of +floating point typed. They must also be identical +types.

          +
          Semantics:
          +

          The 'vfcmp' instruction compares var1 and var2 +according to the condition code given as cond. The comparison yields a +vector of integer result, with +an identical number of elements as the values being compared, and each element +having identical with to the width of the floating point elements. The most +significant bit in each element is 1 if the element-wise comparison evaluates to +true, and is 0 otherwise. All other bits of the result are undefined. The +condition codes are evaluated identically to the +'fcmp' instruction. + +

          Example:
          +
          +  <result> = vfcmp oeq <2 x float> < float 4, float 0 >, < float 5, float 0 >       ; yields: result=<2 x i32> < i32 0, i32 -1 >
          +  <result> = vfcmp ult <2 x double> < double 1, double 2 >, < double 2, double 2>   ; yields: result=<2 x i64> < i64 -1, i64 0 >
          +
          +
          + + + + +
          + +
          Syntax:
          +
            <result> = phi <ty> [ <val0>, <label0>], ...
          Overview:

          The 'phi' instruction is used to implement the φ node in the SSA graph representing the function.

          Arguments:
          +

          The type of the incoming values is specified with the first type field. After this, the 'phi' instruction takes a list of pairs as arguments, with one pair for each predecessor basic block of the current block. Only values of first class type may be used as the value arguments to the PHI node. Only labels may be used as the label arguments.

          +

          There must be no non-phi instructions between the start of a basic block and the PHI instructions: i.e. PHI instructions must be first in a basic block.

          +
          Semantics:
          +

          At runtime, the 'phi' instruction logically takes on the value specified by the pair corresponding to the predecessor basic block that executed just prior to the current block.

          +
          Example:
          -
          Loop:       ; Infinite loop that counts from 0 on up...
          %indvar = phi i32 [ 0, %LoopHeader ], [ %nextindvar, %Loop ]
          %nextindvar = add i32 %indvar, 1
          br label %Loop
          +
          +Loop:       ; Infinite loop that counts from 0 on up...
          +  %indvar = phi i32 [ 0, %LoopHeader ], [ %nextindvar, %Loop ]
          +  %nextindvar = add i32 %indvar, 1
          +  br label %Loop
          +
          @@ -3733,13 +4104,16 @@ condition, without branching.
          Arguments:

          -The 'select' instruction requires a boolean value indicating the condition, and two values of the same first class type. +The 'select' instruction requires an 'i1' value indicating the +condition, and two values of the same first class +type. If the val1/val2 are vectors, the entire vectors are selected, not +individual elements.

          Semantics:

          -If the boolean condition evaluates to true, the instruction returns the first +If the i1 condition evaluates is 1, the instruction returns the first value argument; otherwise, it returns the second value argument.

          @@ -3817,25 +4191,23 @@ transfer to a specified function, with its incoming arguments bound to the specified values. Upon a 'ret' instruction in the called function, control flow continues with the instruction after the function call, and the return value of the -function is bound to the result argument. If the 'ret -' instruction returns multiple values then the return value of the -function is only accessed through 'getresult -' instruction. This is a simpler case of -the invoke instruction.

          +function is bound to the result argument. If the callee returns multiple +values then the return values of the function are only accessible through +the 'getresult' instruction.

          Example:
             %retval = call i32 @test(i32 %argc)
          -  call i32 (i8 *, ...)* @printf(i8 * %msg, i32 12, i8 42);
          -  %X = tail call i32 @foo()
          -  %Y = tail call fastcc i32 @foo()
          -  %Z = call void %foo(i8 97 signext)
          +  call i32 (i8 *, ...)* @printf(i8 * %msg, i32 12, i8 42)      ; yields i32
          +  %X = tail call i32 @foo()                                    ; yields i32
          +  %Y = tail call fastcc i32 @foo()  ; yields i32
          +  call void %foo(i8 97 signext)
           
             %struct.A = type { i32, i8 }
          -  %r = call %struct.A @foo()
          -  %gr = getresult %struct.A %r, 0
          -  %gr1 = getresult %struct.A %r, 1
          +  %r = call %struct.A @foo()                     ; yields { 32, i8 }
          +  %gr = getresult %struct.A %r, 0                ; yields i32
          +  %gr1 = getresult %struct.A %r, 1               ; yields i8
           
          @@ -3897,24 +4269,28 @@ argument.

          Syntax:
          -  <resultval> = getresult <type> <retval>,  <index>
          +  <resultval> = getresult <type> <retval>, <index>
           
          +
          Overview:

          The 'getresult' instruction is used to extract individual values -from multiple values returned by 'call' -or 'invoke' instruction. +from a 'call' +or 'invoke' instruction that returns multiple +results.

          Arguments:
          -The 'getresult' instruction takes return value as first argument. The -value must have structure type. The second argument -is unsigned index value. +

          The 'getresult' instruction takes a call or invoke value as its +first argument, or an undef value. The value must have structure type. The second argument is a constant +unsigned index value which must be in range for the number of values returned +by the call.

          Semantics:
          -The 'getresult' instruction extracts element identified by -'index' from the aggregate value. +

          The 'getresult' instruction extracts the element identified by +'index' from the aggregate value.

          Example:
          @@ -3922,8 +4298,8 @@ The 'getresult' instruction extracts element identified by %struct.A = type { i32, i8 } %r = call %struct.A @foo() - %gr = getresult %struct.A %r, 0 - %gr1 = getresult %struct.A %r, 1 + %gr = getresult %struct.A %r, 0 ; yields i32:%gr + %gr1 = getresult %struct.A %r, 1 ; yields i8:%gr1 add i32 %gr, 42 add i8 %gr1, 41
        @@ -4173,7 +4549,7 @@ value address) contains the meta-data to be associated with the root.

        Semantics:
        -

        At runtime, a call to this intrinsics stores a null pointer into the "ptrloc" +

        At runtime, a call to this intrinsic stores a null pointer into the "ptrloc" location. At compile-time, the code generator generates information to allow the runtime to find the pointer at GC safe points. The 'llvm.gcroot' intrinsic may only be used in a function which specifies a GC