X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.html;h=f8ca2879c44743480160fe5e97cf9469706d9096;hb=b9a31a15f9ee8d4eff5bb0fec3dbfde54121af56;hp=94ef37b97a7e79ef39daef4c30182d96225c32b3;hpb=0c46a7d66688c6e38d59d17e302b8bcd354b04c5;p=oota-llvm.git diff --git a/docs/LangRef.html b/docs/LangRef.html index 94ef37b97a7..f8ca2879c44 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -24,7 +24,7 @@
  • Calling Conventions
  • Global Variables
  • Functions
  • -
  • Aliases +
  • Aliases
  • Parameter Attributes
  • Function Attributes
  • Garbage Collector Names
  • @@ -58,16 +58,16 @@
  • Constants
      -
    1. Simple Constants -
    2. Aggregate Constants -
    3. Global Variable and Function Addresses -
    4. Undefined Values -
    5. Constant Expressions +
    6. Simple Constants
    7. +
    8. Aggregate Constants
    9. +
    10. Global Variable and Function Addresses
    11. +
    12. Undefined Values
    13. +
    14. Constant Expressions
  • Other Values
      -
    1. Inline Assembler Expressions +
    2. Inline Assembler Expressions
  • Instruction Reference @@ -143,6 +143,7 @@
  • 'inttoptr .. to' Instruction
  • 'bitcast .. to' Instruction
  • +
  • Other Operations
    1. 'icmp' Instruction
    2. @@ -153,7 +154,6 @@
    3. 'select' Instruction
    4. 'call' Instruction
    5. 'va_arg' Instruction
    6. -
    7. 'getresult' Instruction
  • @@ -328,15 +328,16 @@ the parser.

    LLVM identifiers come in two basic types: global and local. Global identifiers (functions, global variables) begin with the @ character. Local identifiers (register names, types) begin with the % character. Additionally, - there are three different formats for identifiers, for different purposes: + there are three different formats for identifiers, for different purposes:

    1. Named values are represented as a string of characters with their prefix. For example, %foo, @DivisionByZero, %a.really.long.identifier. The actual regular expression used is '[%@][a-zA-Z$._][a-zA-Z$._0-9]*'. Identifiers which require other characters in their names can be surrounded - with quotes. In this way, anything except a " character can - be used in a named value.
    2. + with quotes. Special characters may be escaped using "\xx" where xx is the + ASCII code for the character in hexadecimal. In this way, any character can + be used in a name value, even quotes themselves.
    3. Unnamed values are represented as an unsigned numeric value with their prefix. For example, %12, @2, %44.
    4. @@ -572,7 +573,7 @@ outside of the current module.

      to have any linkage type other than "externally visible", dllimport, or extern_weak.

      Aliases can have only external, internal and weak -linkages. +linkages.

      @@ -750,8 +751,9 @@ an optional linkage type, an optional calling convention, a return type, an optional parameter attribute for the return type, a function name, a (possibly empty) argument list (each with optional -parameter attributes), an optional section, an -optional alignment, an optional garbage collector name, +parameter attributes), optional +function attributes, an optional section, +an optional alignment, an optional garbage collector name, an opening curly brace, a list of basic blocks, and a closing curly brace. LLVM function declarations consist of the "declare" keyword, an @@ -784,6 +786,18 @@ to whatever it feels convenient. If an explicit alignment is specified, the function is forced to have at least that much alignment. All alignments must be a power of 2.

      +
      Syntax:
      + +
      + +define [linkage] [visibility] + [cconv] [ret attrs] + <ResultType> @<FunctionName> ([argument list]) + [fn Attrs] [section "name"] [align N] + [gc] { ... } + +
      + @@ -826,7 +840,8 @@ a power of 2.

       declare i32 @printf(i8* noalias , ...)
      -declare i32 @atoi(i8 zeroext*)
      +declare i32 @atoi(i8 zeroext)
      +declare signext i8 @returns_signed_char()
       
      @@ -836,42 +851,52 @@ declare i32 @atoi(i8 zeroext*)

      Currently, only the following parameter attributes are defined:

      zeroext
      -
      This indicates that the parameter should be zero extended just before - a call to this function.
      +
      This indicates to the code generator that the parameter or return value + should be zero-extended to a 32-bit value by the caller (for a parameter) + or the callee (for a return value).
      signext
      -
      This indicates that the parameter should be sign extended just before - a call to this function.
      +
      This indicates to the code generator that the parameter or return value + should be sign-extended to a 32-bit value by the caller (for a parameter) + or the callee (for a return value).
      inreg
      This indicates that this parameter or return value should be treated in a special target-dependent fashion during while emitting code for a function call or return (usually, by putting it in a register as opposed - to memory; in some places it is used to distinguish between two different - kinds of registers). Use of this attribute is target-specific
      + to memory, though some targets use it to distinguish between two different + kinds of registers). Use of this attribute is target-specific. -
      byval
      +
      byval
      This indicates that the pointer parameter should really be passed by value to the function. The attribute implies that a hidden copy of the pointee is made between the caller and the callee, so the callee is unable to modify the value in the callee. This attribute is only valid on LLVM pointer arguments. It is generally used to pass structs and arrays by - value, but is also valid on scalars (even though this is silly).
      + value, but is also valid on pointers to scalars. The copy is considered to + belong to the caller not the callee (for example, + readonly functions should not write to + byval parameters). This is not a valid attribute for return + values.
      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.
      + This pointer must be guaranteed by the caller to be valid: loads and stores + to the structure may be assumed by the callee to not to trap. This may only + be applied to the first parameter. This is not a valid attribute for + return values.
      noalias
      This indicates that the parameter does not alias any global or any other parameter. The caller is responsible for ensuring that this is the case, - usually by placing the value in a stack allocation.
      + usually by placing the value in a stack allocation. This is not a valid + attribute for return values.
      nest
      This indicates that the pointer parameter can be excised using the - trampoline intrinsics.
      + trampoline intrinsics. This is not a valid + attribute for return values.
      @@ -920,38 +945,46 @@ define void @f() optsize
      alwaysinline
      -
      This attribute requests inliner to inline this function irrespective of -inlining size threshold for this function.
      +
      This attribute indicates that the inliner should attempt to inline this +function into callers whenever possible, ignoring any active inlining size +threshold for this caller.
      noinline
      -
      This attributes requests inliner to never inline this function in any -situation. This attribute may not be used together with alwaysinline - attribute.
      +
      This attribute indicates that the inliner should never inline this function +in any situation. This attribute may not be used together with the +alwaysinline attribute.
      optsize
      This attribute suggests that optimization passes and code generator passes -make choices that help reduce code size.
      +make choices that keep the code size of this function low, and otherwise do +optimizations specifically to reduce code size.
      noreturn
      -
      This function attribute indicates that the function never returns. This - tells LLVM that every call to this function should be treated as if - an unreachable instruction immediately followed the call.
      +
      This function attribute indicates that the function never returns normally. +This produces undefined behavior at runtime if the function ever does +dynamically return.
      nounwind
      -
      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.
      - -
      readonly
      -
      This function attribute indicates that the function has no side-effects - except for producing a return value or throwing an exception. The value - returned must only depend on the function arguments and/or global variables. - It may use values obtained by dereferencing pointers.
      +
      This function attribute indicates that the function never returns with an +unwind or exceptional control flow. If the function does unwind, its runtime +behavior is undefined.
      +
      readnone
      -
      A readnone function has the same restrictions as a readonly - function, but in addition it is not allowed to dereference any pointer arguments - or global variables. +
      This attribute indicates that the function computes its result (or the +exception it throws) based strictly on its arguments, without dereferencing any +pointer arguments or otherwise accessing any mutable state (e.g. memory, control +registers, etc) visible to caller functions. It does not write through any +pointer arguments (including byval arguments) and +never changes any state visible to callers.
      + +
      readonly
      +
      This attribute indicates that the function does not write through any +pointer arguments (including byval arguments) +or otherwise modify any state (e.g. memory, control registers, etc) visible to +caller functions. It may dereference pointer arguments and read state that may +be set in the caller. A readonly function always returns the same value (or +throws the same exception) when called with the same set of arguments and global +state.
      @@ -1046,7 +1079,7 @@ are given in this list:

    5. a0:0:1 - aggregates are 8-bit aligned
    6. When LLVM is determining the alignment for a given type, it uses the -following rules: +following rules:

      1. If the type sought is an exact match for one of the specifications, that specification is used.
      2. @@ -1058,8 +1091,8 @@ following rules: i65 and i256 will use the alignment of i64 (largest specified).
      3. If no match is found, and the type sought is a vector type, then the largest vector type that is smaller than the sought vector type will be used - as a fall back. This happens because <128 x double> can be implemented in - terms of 64 <2 x double>, for example.
      4. + as a fall back. This happens because <128 x double> can be implemented + in terms of 64 <2 x double>, for example.
      @@ -1125,6 +1158,7 @@ classifications:

      packed structure, vector, opaque. + @@ -1768,7 +1802,7 @@ following is the syntax for constant expressions:

      extractelement ( VAL, IDX )
      Perform the extractelement - operation on constants. + operation on constants.
      insertelement ( VAL, ELT, IDX )
      @@ -1842,7 +1876,8 @@ call void asm sideeffect "eieio", ""()

      TODO: The format of the asm and constraints string still need to be documented here. Constraints on what can be done (e.g. duplication, moving, etc -need to be documented). +need to be documented). This is probably best done by reference to another +document that covers inline asm from a holistic perspective.

      @@ -1888,27 +1923,30 @@ the 'invoke' instruction, the '
      Syntax:
      -
        ret <type> <value>       ; Return a value from a non-void function
      +
      +  ret <type> <value>       ; Return a value from a non-void function
         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.

      +

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

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

      Arguments:
      -

      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.

      +

      The 'ret' instruction optionally accepts a single argument, +the return value. The type of the return value must be a +'first class' type.

      + +

      A function is not well formed if +it it has a non-void return type and contains a 'ret' +instruction with no return value or a return value with a type that +does not match its type, or if it has a void return type and contains +a 'ret' instruction with a return value.

      Semantics:
      @@ -1919,16 +1957,14 @@ the instruction after the call. If the caller was an "invoke" instruction, execution continues at the beginning of the "normal" destination block. If the instruction returns a value, that value shall set the call or invoke instruction's -return value. If the instruction returns multiple values then these -values can only be accessed through a 'getresult -' instruction.

      +return value.

      Example:
         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  
      +  ret { i32, i8 } { i32 4, i8 2 } ; Return an aggregate of values 4 and 2
       
      @@ -2025,7 +2061,7 @@ branches or with a lookup table.

      Syntax:
      -  <result> = invoke [cconv] <ptr to function ty> <function ptr val>(<function args>) 
      +  <result> = invoke [cconv] [ret attrs] <ptr to function ty> <function ptr val>(<function args>) [fn attrs]
                       to label <normal label> unwind label <exception label>
       
      @@ -2038,9 +2074,7 @@ function, with the possibility of control flow transfer to either the "ret" instruction, control flow will return to 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 only accessible through -a 'getresult' instruction.

      +continued at the dynamically nearest "exception" label.

      Arguments:
      @@ -2052,6 +2086,11 @@ a 'getresult' instruction.

      convention the call should use. If none is specified, the call defaults to using C calling conventions. + +
    7. The optional Parameter Attributes list for + return values. Only 'zeroext', 'signext', + and 'inreg' attributes are valid here.
    8. +
    9. 'ptr to function ty': shall be the signature of the pointer to function value being invoked. In most cases, this is a direct function invocation, but indirect invokes are just as possible, branching off @@ -2072,6 +2111,9 @@ a 'getresult' instruction.

    10. 'exception label': the label reached when a callee returns with the unwind instruction.
    11. +
    12. The optional function attributes list. Only + 'noreturn', 'nounwind', 'readonly' and + 'readnone' attributes are valid here.
    Semantics:
    @@ -3026,6 +3068,7 @@ indices in a 'getelementptr' instruction. The value to insert must have the same type as the value identified by the indices. +

    Semantics:
    @@ -3281,25 +3324,34 @@ at the location specified by the '<pointer>' operand.

    Syntax:
    -  <result> = getelementptr <ty>* <ptrval>{, <ty> <idx>}*
    +  <result> = getelementptr <pty>* <ptrval>{, <ty> <idx>}*
     
    Overview:

    The 'getelementptr' instruction is used to get the address of a -subelement of an aggregate data structure.

    +subelement of an aggregate data structure. It performs address calculation only +and does not access memory.

    Arguments:
    -

    This instruction takes a list of integer operands that indicate what -elements of the aggregate object to index to. The actual types of the arguments -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; 32-bit -values will be sign extended to 64-bits if required.

    +

    The first argument is always a pointer, and forms the basis of the +calculation. The remaining arguments are indices, that indicate which of the +elements of the aggregate object are indexed. The interpretation of each index +is dependent on the type being indexed into. The first index always indexes the +pointer value given as the first argument, the second index indexes a value of +the type pointed to (not necessarily the value directly pointed to, since the +first index can be non-zero), etc. The first type indexed into must be a pointer +value, subsequent types can be arrays, vectors and structs. Note that subsequent +types being indexed into can never be pointers, since that would require loading +the pointer before continuing calculation.

    + +

    The type of each index argument depends on the type it is indexing into. +When indexing into a (packed) structure, only i32 integer +constants are allowed. When indexing into an array, pointer or vector, +only integers of 32 or 64 bits are allowed (also non-constants). 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:

    @@ -3340,13 +3392,6 @@ entry:
    Semantics:
    -

    The index types specified for the 'getelementptr' instruction depend -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 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 }' type, a structure. The second index indexes into the third element of @@ -3386,7 +3431,11 @@ FAQ.

         ; yields [12 x i8]*:aptr
    -    %aptr = getelementptr {i32, [12 x i8]}* %sptr, i64 0, i32 1
    +    %aptr = getelementptr {i32, [12 x i8]}* %saptr, i64 0, i32 1
    +    ; yields i8*:vptr
    +    %vptr = getelementptr {i32, <2 x i8>}* %svptr, i64 0, i32 1, i32 1
    +    ; yields i8*:eptr
    +    %eptr = getelementptr [12 x i8]* %aptr, i64 0, i32 1
     
    @@ -3688,7 +3737,7 @@ the value cannot fit in the floating point value, the results are undefined.

    Example:
       %X = uitofp i32 257 to float         ; yields float:257.0
    -  %Y = uitofp i8  -1 to double         ; yields double:255.0
    +  %Y = uitofp i8 -1 to double          ; yields double:255.0
     
    @@ -3722,7 +3771,7 @@ the value cannot fit in the floating point value, the results are undefined.

    Example:
       %X = sitofp i32 257 to float         ; yields float:257.0
    -  %Y = sitofp i8  -1 to double         ; yields double:-1.0
    +  %Y = sitofp i8 -1 to double          ; yields double:-1.0
     
    @@ -3744,7 +3793,7 @@ the integer type ty2.

    Arguments:

    The 'ptrtoint' instruction takes a value to cast, which must be a pointer value, and a type to cast it to -ty2, which must be an integer type. +ty2, which must be an integer type.

    Semantics:

    The 'ptrtoint' instruction converts value to integer type @@ -3780,7 +3829,7 @@ a pointer type, ty2.

    Arguments:

    The 'inttoptr' instruction takes an integer value to cast, and a type to cast it to, which must be a -pointer type. +pointer type.

    Semantics:

    The 'inttoptr' instruction converts value to type @@ -3838,7 +3887,7 @@ other types, use the inttoptr or

       %X = bitcast i8 255 to i8              ; yields i8 :-1
       %Y = bitcast i32* %x to sint*          ; yields sint*:%x
    -  %Z = bitcast <2xint> %V to i64;        ; yields i64: %V   
    +  %Z = bitcast <2 x int> %V to i64;      ; yields i64: %V   
     
    @@ -3854,7 +3903,7 @@ instructions, which defy better classification.

    Syntax:
    -
      <result> = icmp <cond> <ty> <op1>, <op2>   ; yields {i1} or {<N x i1>}:result
    +
      <result> = icmp <cond> <ty> <op1>, <op2>   ; yields {i1} or {<N x i1>}:result
     
    Overview:

    The 'icmp' instruction returns a boolean value or @@ -3864,6 +3913,7 @@ of its two integer, integer vector, or pointer operands.

    The 'icmp' 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. ne: not equal
    3. @@ -3884,12 +3934,13 @@ They must also be identical types.

      The 'icmp' compares op1 and op2 according to the condition code given as cond. The comparison performed always yields either an i1 or vector of i1 result, as follows: +

      1. eq: yields true if the operands are equal, false otherwise. No sign interpretation is necessary or performed.
      2. ne: yields true if the operands are unequal, - false otherwise. No sign interpretation is necessary or performed. + false otherwise. No sign interpretation is necessary or performed.
      3. ugt: interprets the operands as unsigned values and yields true if op1 is greater than op2.
      4. uge: interprets the operands as unsigned values and yields @@ -3930,12 +3981,12 @@ Otherwise, the result is an i1.
    Syntax:
    -
      <result> = fcmp <cond> <ty> <op1>, <op2>     ; yields {i1} or {<N x i1>}:result
    +
      <result> = fcmp <cond> <ty> <op1>, <op2>     ; yields {i1} or {<N x i1>}:result
     
    Overview:

    The 'fcmp' instruction returns a boolean value or vector of boolean values based on comparison -of its operands. +of its operands.

    If the operands are floating point scalars, then the result type is a boolean (i1). @@ -3946,7 +3997,7 @@ operands being compared.

    Arguments:

    The 'fcmp' 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: +a value, just a keyword. The possible condition code are:

    1. false: no comparison, always returns false
    2. oeq: ordered and equal
    3. @@ -3977,7 +4028,7 @@ according to the condition code given as cond. If the operands are vectors, then the vectors are compared element by element. Each comparison performed -always yields an i1 result, as follows: +always yields an i1 result, as follows:

      1. false: always yields false, regardless of operands.
      2. oeq: yields true if both operands are not a QNAN and @@ -4031,7 +4082,7 @@ 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: +a value, just a keyword. The possible condition code are:

        1. eq: equal
        2. ne: not equal
        3. @@ -4054,7 +4105,7 @@ 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. +instruction.

          Example:
          @@ -4077,7 +4128,7 @@ 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: +a value, just a keyword. The possible condition code are:

          1. false: no comparison, always returns false
          2. oeq: ordered and equal
          3. @@ -4108,12 +4159,15 @@ 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. +'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 >
            +  ; yields: result=<2 x i32> < i32 0, i32 -1 >
            +  <result> = vfcmp oeq <2 x float> < float 4, float 0 >, < float 5, float 0 >
            +  
            +  ; yields: result=<2 x i64> < i64 -1, i64 0 >
            +  <result> = vfcmp ult <2 x double> < double 1, double 2 >, < double 2, double 2>
             
    @@ -4170,7 +4224,7 @@ Loop: ; Infinite loop that counts from 0 on up...
       <result> = select selty <cond>, <ty> <val1>, <ty> <val2>             ; yields ty
     
    -  selty is either i1 or {<N x i1>}
    +  selty is either i1 or {<N x i1>}
     
    Overview:
    @@ -4221,7 +4275,7 @@ by element.
    Syntax:
    -  <result> = [tail] call [cconv] <ty> [<fnty>*] <fnptrval>(<param list>)
    +  <result> = [tail] call [cconv] [ret attrs] <ty> [<fnty>*] <fnptrval>(<function args>) [fn attrs]
     
    Overview:
    @@ -4238,13 +4292,20 @@ by element. any allocas or varargs in the caller. If the "tail" marker is present, the function call is eligible for tail call optimization. Note that calls may be marked "tail" even if they do not occur before a ret instruction. + href="#i_ret">ret instruction.

  • The optional "cconv" marker indicates which calling convention the call should use. If none is specified, the call defaults - to using C calling conventions. + to using C calling conventions.

  • + +
  • +

    The optional Parameter Attributes list for + return values. Only 'zeroext', 'signext', + and 'inreg' attributes are valid here.

    +
  • +
  • 'ty': the type of the call instruction itself which is also the type of the return value. Functions that return no value are marked @@ -4269,6 +4330,11 @@ by element. indicates the function accepts a variable number of arguments, the extra arguments can be specified.

  • +
  • +

    The optional function attributes list. Only + 'noreturn', 'nounwind', 'readonly' and + 'readnone' attributes are valid here.

    +
  • Semantics:
    @@ -4278,9 +4344,7 @@ 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 callee returns multiple -values then the return values of the function are only accessible through -the 'getresult' instruction.

    +function is bound to the result argument.

    Example:
    @@ -4292,9 +4356,11 @@ the 'getresult' instruction.

    call void %foo(i8 97 signext) %struct.A = type { i32, i8 } - %r = call %struct.A @foo() ; yields { 32, i8 } - %gr = getresult %struct.A %r, 0 ; yields i32 - %gr1 = getresult %struct.A %r, 1 ; yields i8 + %r = call %struct.A @foo() ; yields { 32, i8 } + %gr = extractvalue %struct.A %r, 0 ; yields i32 + %gr1 = extractvalue %struct.A %r, 1 ; yields i8 + %Z = call void @foo() noreturn ; indicates that %foo never returns normally + %ZZ = call zeroext i32 @bar() ; Return value is %zero extended @@ -4347,52 +4413,6 @@ argument.

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

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

    - -
    Arguments:
    - -

    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 the element identified by -'index' from the aggregate value.

    - -
    Example:
    - -
    -  %struct.A = type { i32, i8 }
    -
    -  %r = call %struct.A @foo()
    -  %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
    -
    - -
    -
    Intrinsic Functions
    @@ -4504,17 +4524,17 @@ declare void @llvm.va_end(i8*)
    Syntax:
      declare void %llvm.va_start(i8* <arglist>)
    Overview:
    -

    The 'llvm.va_start' intrinsic initializes +

    The 'llvm.va_start' intrinsic initializes *<arglist> for subsequent use by va_arg.

    Arguments:
    -

    The argument is a pointer to a va_list element to initialize.

    +

    The argument is a pointer to a va_list element to initialize.

    Semantics:
    -

    The 'llvm.va_start' intrinsic works just like the va_start +

    The 'llvm.va_start' intrinsic works just like the va_start macro available in C. In a target-dependent way, it initializes the va_list element to which the argument points, so that the next call to va_arg will produce the first variable argument passed to the function. @@ -5194,7 +5214,7 @@ this can be specified as the fourth argument, otherwise it should be set to 0 or

    Syntax:

    This is an overloaded intrinsic. You can use llvm.sqrt on any floating point or vector of floating point type. Not all targets support all -types however. +types however.

       declare float     @llvm.sqrt.f32(float %Val)
       declare double    @llvm.sqrt.f64(double %Val)
    @@ -5238,7 +5258,7 @@ floating point number.
     
    Syntax:

    This is an overloaded intrinsic. You can use llvm.powi on any floating point or vector of floating point type. Not all targets support all -types however. +types however.

       declare float     @llvm.powi.f32(float  %Val, i32 %power)
       declare double    @llvm.powi.f64(double %Val, i32 %power)
    @@ -5280,7 +5300,7 @@ unspecified sequence of rounding operations.

    Syntax:

    This is an overloaded intrinsic. You can use llvm.sin on any floating point or vector of floating point type. Not all targets support all -types however. +types however.

       declare float     @llvm.sin.f32(float  %Val)
       declare double    @llvm.sin.f64(double %Val)
    @@ -5319,7 +5339,7 @@ conditions in the same way.

    Syntax:

    This is an overloaded intrinsic. You can use llvm.cos on any floating point or vector of floating point type. Not all targets support all -types however. +types however.

       declare float     @llvm.cos.f32(float  %Val)
       declare double    @llvm.cos.f64(double %Val)
    @@ -5358,7 +5378,7 @@ conditions in the same way.

    Syntax:

    This is an overloaded intrinsic. You can use llvm.pow on any floating point or vector of floating point type. Not all targets support all -types however. +types however.

       declare float     @llvm.pow.f32(float  %Val, float %Power)
       declare double    @llvm.pow.f64(double %Val, double %Power)
    @@ -5413,7 +5433,7 @@ These allow efficient code generation for some algorithms.
     
     
    Syntax:

    This is an overloaded intrinsic function. You can use bswap on any integer -type that is an even number of bytes (i.e. BitWidth % 16 == 0). +type that is an even number of bytes (i.e. BitWidth % 16 == 0).

       declare i16 @llvm.bswap.i16(i16 <id>)
       declare i32 @llvm.bswap.i32(i32 <id>)
    @@ -5452,7 +5472,7 @@ additional even-byte lengths (6 bytes, 8 bytes and more, respectively).
     
     
    Syntax:

    This is an overloaded intrinsic. You can use llvm.ctpop on any integer bit -width. Not all targets support all bit widths however. +width. Not all targets support all bit widths however.

       declare i8 @llvm.ctpop.i8 (i8  <src>)
       declare i16 @llvm.ctpop.i16(i16 <src>)
    @@ -5491,7 +5511,7 @@ The 'llvm.ctpop' intrinsic counts the 1's in a variable.
     
     
    Syntax:

    This is an overloaded intrinsic. You can use llvm.ctlz on any -integer bit width. Not all targets support all bit widths however. +integer bit width. Not all targets support all bit widths however.

       declare i8 @llvm.ctlz.i8 (i8  <src>)
       declare i16 @llvm.ctlz.i16(i16 <src>)
    @@ -5534,7 +5554,7 @@ of src. For example, llvm.ctlz(i32 2) = 30.
     
     
    Syntax:

    This is an overloaded intrinsic. You can use llvm.cttz on any -integer bit width. Not all targets support all bit widths however. +integer bit width. Not all targets support all bit widths however.

       declare i8 @llvm.cttz.i8 (i8  <src>)
       declare i16 @llvm.cttz.i16(i16 <src>)
    @@ -5575,7 +5595,7 @@ of src.  For example, llvm.cttz(2) = 1.
     
     
    Syntax:

    This is an overloaded intrinsic. You can use llvm.part.select -on any integer bit width. +on any integer bit width.

       declare i17 @llvm.part.select.i17 (i17 %val, i32 %loBit, i32 %hiBit)
       declare i29 @llvm.part.select.i29 (i29 %val, i32 %loBit, i32 %hiBit)
    @@ -5605,7 +5625,7 @@ only the %hiBit - %loBit bits set, as follows:

  • The %loBits value is subtracted from the %hiBits value to determine the number of bits to retain.
  • A mask of the retained bits is created by shifting a -1 value.
  • -
  • The mask is ANDed with %val to produce the result. +
  • The mask is ANDed with %val to produce the result.
  • In reverse mode, a similar computation is made except that the bits are returned in the reverse order. So, for example, if X has the value @@ -5622,7 +5642,7 @@ returned in the reverse order. So, for example, if X has the value

    Syntax:

    This is an overloaded intrinsic. You can use llvm.part.set -on any integer bit width. +on any integer bit width.

       declare i17 @llvm.part.set.i17.i9 (i17 %val, i9 %repl, i32 %lo, i32 %hi)
       declare i29 @llvm.part.set.i29.i9 (i29 %val, i9 %repl, i32 %lo, i32 %hi)
    @@ -5651,10 +5671,10 @@ up to that size.

    In forward mode, the bits between %lo and %hi (inclusive) are replaced with corresponding bits from %repl. That is the 0th bit in %repl replaces the %loth bit in %val and etc. up -to the %hith bit. +to the %hith bit.

    In reverse mode, a similar computation is made except that the bits are reversed. That is, the 0th bit in %repl replaces the -%hi bit in %val and etc. down to the %loth bit. +%hi bit in %val and etc. down to the %loth bit.

    Examples:
       llvm.part.set(0xFFFF, 0, 4, 7) -> 0xFF0F
    @@ -5821,7 +5841,7 @@ i1 <device> )
         
  • ls: load-store barrier
  • sl: store-load barrier
  • ss: store-store barrier
  • -
  • device: barrier applies to device and uncached memory also. +
  • device: barrier applies to device and uncached memory also.
  • Semantics:

    @@ -6345,6 +6365,7 @@ This intrinsic allows annotations to be put on arbitrary expressions with arbitrary strings. This can be useful for special purpose optimizations that want to look for these annotations. These have no other defined use, they are ignored by code generation and optimization. +