From 6c7e8a02d81be9b66a8cfc6f8b6f20d48088d915 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Sat, 5 Dec 2009 02:46:03 +0000 Subject: [PATCH] More updates to objectsize intrinsic docs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90644 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 186 +++++++++++++++++++++++++--------------------- 1 file changed, 103 insertions(+), 83 deletions(-) diff --git a/docs/LangRef.html b/docs/LangRef.html index 691e34171fc..45f6f38f598 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -5,7 +5,7 @@ LLVM Assembly Language Reference Manual - @@ -54,7 +54,7 @@
  • Type System
    1. Type Classifications
    2. -
    3. Primitive Types +
    4. Primitive Types
      1. Integer Type
      2. Floating Point Types
      3. @@ -576,7 +576,7 @@ define i32 @main() { ; i32()* Symbols with "common" linkage are merged in the same way as weak symbols, and they may not be deleted if unreferenced. common symbols may not have an explicit section, - must have a zero initializer, and may not be marked 'constant'. Functions and aliases may not have common linkage. @@ -843,7 +843,7 @@ define i32 @main() { ; i32()*

        LLVM function declarations consist of the "declare" keyword, an optional linkage type, an optional - visibility style, an optional + visibility style, an optional calling convention, a return type, an optional parameter attribute for the return type, a function name, a possibly empty list of arguments, an optional alignment, and an @@ -1192,7 +1192,7 @@ target datalayout = "layout specification" location.

        p:size:abi:pref
        -
        This specifies the size of a pointer and its abi and +
        This specifies the size of a pointer and its abi and preferred alignments. All sizes are in bits. Specifying the pref alignment is optional. If omitted, the preceding : should be omitted too.
        @@ -1202,11 +1202,11 @@ target datalayout = "layout specification" size. The value of size must be in the range [1,2^23).
        vsize:abi:pref
        -
        This specifies the alignment for a vector type of a given bit +
        This specifies the alignment for a vector type of a given bit size.
        fsize:abi:pref
        -
        This specifies the alignment for a floating point type of a given bit +
        This specifies the alignment for a floating point type of a given bit size. The value of size must be either 32 (float) or 64 (double).
        @@ -1222,7 +1222,7 @@ target datalayout = "layout specification"
        This specifies a set of native integer widths for the target CPU in bits. For example, it might contain "n32" for 32-bit PowerPC, "n32:64" for PowerPC 64, or "n8:16:32:64" for X86-64. Elements of - this set are considered to support most general arithmetic + this set are considered to support most general arithmetic operations efficiently.
        @@ -1616,16 +1616,16 @@ Classifications float (i16 signext, i32 *) * - Pointer to a function that takes - an i16 that should be sign extended and a - pointer to i32, returning + Pointer to a function that takes + an i16 that should be sign extended and a + pointer to i32, returning float. i32 (i8*, ...) - A vararg function that takes at least one - pointer to i8 (char in C), - which returns an integer. This is the signature for printf in + A vararg function that takes at least one + pointer to i8 (char in C), + which returns an integer. This is the signature for printf in LLVM. @@ -2054,9 +2054,9 @@ Unsafe: For example, if "%X" has a zero bit, then the output of the 'and' operation will always be a zero, no matter what the corresponding bit from the undef is. As such, it is unsafe to optimize or assume that the result of the and is undef. -However, it is safe to assume that all bits of the undef could be 0, and -optimize the and to 0. Likewise, it is safe to assume that all the bits of -the undef operand to the or could be set, allowing the or to be folded to +However, it is safe to assume that all bits of the undef could be 0, and +optimize the and to 0. Likewise, it is safe to assume that all the bits of +the undef operand to the or could be set, allowing the or to be folded to -1.

        @@ -2086,7 +2086,7 @@ the optimizer is allowed to assume that the undef operand could be the same as
           %A = xor undef, undef
        -  
        +
           %B = undef
           %C = xor %B, %B
         
        @@ -2137,7 +2137,7 @@ does not execute at all.  This allows us to delete the divide and all code after
         it: since the undefined operation "can't happen", the optimizer can assume that
         it occurs in dead code.
         

        - +
         a:  store undef -> %X
        @@ -2149,7 +2149,7 @@ b: unreachable
         

        These examples reiterate the fdiv example: a store "of" an undefined value -can be assumed to not have any effect: we can assume that the value is +can be assumed to not have any effect: we can assume that the value is overwritten with bits that happen to match what was already there. However, a store "to" an undefined location could clobber arbitrary memory, therefore, it has undefined behavior.

        @@ -2166,7 +2166,7 @@ has undefined behavior.

        The 'blockaddress' constant computes the address of the specified basic block in the specified function, and always has an i8* type. Taking the address of the entry block is illegal.

        - +

        This value only has defined behavior when used as an operand to the 'indirectbr' instruction or for comparisons against null. Pointer equality tests between labels addresses is undefined @@ -2175,7 +2175,7 @@ has undefined behavior.

        pointer sized value as long as the bits are not inspected. This allows ptrtoint and arithmetic to be performed on these values so long as the original value is reconstituted before the indirectbr.

        - +

        Finally, some targets may provide defined semantics when using the value as the operand to an inline assembly, but that is target specific. @@ -2703,7 +2703,7 @@ IfUnequal: rest of the arguments indicate the full set of possible destinations that the address may point to. Blocks are allowed to occur multiple times in the destination list, though this isn't particularly useful.

        - +

        This destination list is required so that dataflow analysis has an accurate understanding of the CFG.

        @@ -3060,7 +3060,7 @@ Instruction

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

        - +
        Semantics:

        The value produced is the integer product of the two operands.

        @@ -3132,7 +3132,7 @@ Instruction

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

        Arguments:
        -

        The two arguments to the 'udiv' instruction must be +

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

        @@ -3167,7 +3167,7 @@ Instruction

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

        Arguments:
        -

        The two arguments to the 'sdiv' instruction must be +

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

        @@ -3238,7 +3238,7 @@ Instruction division of its two arguments.

        Arguments:
        -

        The two arguments to the 'urem' instruction must be +

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

        @@ -3278,7 +3278,7 @@ Instruction elements must be integers.

        Arguments:
        -

        The two arguments to the 'srem' instruction must be +

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

        @@ -3373,7 +3373,7 @@ Instruction

        Both arguments to the 'shl' instruction must be the same integer or vector of integer type. 'op2' is treated as an unsigned value.

        - +
        Semantics:

        The value produced is op1 * 2op2 mod 2n, where n is the width of the result. If op2 @@ -3409,7 +3409,7 @@ Instruction operand shifted to the right a specified number of bits with zero fill.

        Arguments:
        -

        Both arguments to the 'lshr' instruction must be the same +

        Both arguments to the 'lshr' instruction must be the same integer or vector of integer type. 'op2' is treated as an unsigned value.

        @@ -3449,7 +3449,7 @@ Instruction extension.

        Arguments:
        -

        Both arguments to the 'ashr' instruction must be the same +

        Both arguments to the 'ashr' instruction must be the same integer or vector of integer type. 'op2' is treated as an unsigned value.

        @@ -3489,7 +3489,7 @@ Instruction operands.

        Arguments:
        -

        The two arguments to the 'and' instruction must be +

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

        @@ -3548,7 +3548,7 @@ Instruction two operands.

        Arguments:
        -

        The two arguments to the 'or' instruction must be +

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

        @@ -3611,7 +3611,7 @@ Instruction complement" operation, which is the "~" operator in C.

        Arguments:
        -

        The two arguments to the 'xor' instruction must be +

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

        @@ -3659,7 +3659,7 @@ Instruction -
        + @@ -3782,20 +3782,20 @@ Instruction
        Example:
        -  <result> = shufflevector <4 x i32> %v1, <4 x i32> %v2, 
        +  <result> = shufflevector <4 x i32> %v1, <4 x i32> %v2,
                                   <4 x i32> <i32 0, i32 4, i32 1, i32 5>  ; yields <4 x i32>
        -  <result> = shufflevector <4 x i32> %v1, <4 x i32> undef, 
        +  <result> = shufflevector <4 x i32> %v1, <4 x i32> undef,
                                   <4 x i32> <i32 0, i32 1, i32 2, i32 3>  ; yields <4 x i32> - Identity shuffle.
        -  <result> = shufflevector <8 x i32> %v1, <8 x i32> undef, 
        +  <result> = shufflevector <8 x i32> %v1, <8 x i32> undef,
                                   <4 x i32> <i32 0, i32 1, i32 2, i32 3>  ; yields <4 x i32>
        -  <result> = shufflevector <4 x i32> %v1, <4 x i32> %v2, 
        +  <result> = shufflevector <4 x i32> %v1, <4 x i32> %v2,
                                   <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7 >  ; yields <8 x i32>
         
        -
        + @@ -3880,7 +3880,7 @@ Instruction
        -
        + @@ -4243,15 +4243,15 @@ entry:
        Overview:
        -

        The 'zext' instruction zero extends its operand to type +

        The 'zext' instruction zero extends its operand to type ty2.

        Arguments:
        -

        The 'zext' instruction takes a value to cast, which must be of +

        The 'zext' instruction takes a value to cast, which must be of integer type, and a type to cast it to, which must also be of integer type. The bit size of the - value must be smaller than the bit size of the destination type, + value must be smaller than the bit size of the destination type, ty2.

        Semantics:
        @@ -4283,10 +4283,10 @@ entry:

        The 'sext' sign extends value to the type ty2.

        Arguments:
        -

        The 'sext' instruction takes a value to cast, which must be of +

        The 'sext' instruction takes a value to cast, which must be of integer type, and a type to cast it to, which must also be of integer type. The bit size of the - value must be smaller than the bit size of the destination type, + value must be smaller than the bit size of the destination type, ty2.

        Semantics:
        @@ -4324,12 +4324,12 @@ entry:

        The 'fptrunc' instruction takes a floating point value to cast and a floating point type to cast it to. The size of value must be larger than the size of - ty2. This implies that fptrunc cannot be used to make a + ty2. This implies that fptrunc cannot be used to make a no-op cast.

        Semantics:

        The 'fptrunc' instruction truncates a value from a larger - floating point type to a smaller + floating point type to a smaller floating point type. If the value cannot fit within the destination type, ty2, then the results are undefined.

        @@ -4358,7 +4358,7 @@ entry: floating point value.

        Arguments:
        -

        The 'fpext' instruction takes a +

        The 'fpext' instruction takes a floating point value to cast, and a floating point type to cast it to. The source type must be smaller than the destination type.

        @@ -4401,7 +4401,7 @@ entry: vector integer type with the same number of elements as ty

        Semantics:
        -

        The 'fptoui' instruction converts its +

        The 'fptoui' instruction converts its floating point operand into the nearest (rounding towards zero) unsigned integer value. If the value cannot fit in ty2, the results are undefined.

        @@ -4427,7 +4427,7 @@ entry:
        Overview:
        -

        The 'fptosi' instruction converts +

        The 'fptosi' instruction converts floating point value to type ty2.

        @@ -4439,7 +4439,7 @@ entry: vector integer type with the same number of elements as ty

        Semantics:
        -

        The 'fptosi' instruction converts its +

        The 'fptosi' instruction converts its floating point operand into the nearest (rounding towards zero) signed integer value. If the value cannot fit in ty2, the results are undefined.

        @@ -4636,7 +4636,7 @@ entry:
           %X = bitcast i8 255 to i8              ; yields i8 :-1
           %Y = bitcast i32* %x to sint*          ; yields sint*:%x
        -  %Z = bitcast <2 x int> %V to i64;      ; yields i64: %V   
        +  %Z = bitcast <2 x int> %V to i64;      ; yields i64: %V
         
        @@ -4696,11 +4696,11 @@ entry: result, as follows:

          -
        1. eq: yields true if the operands are equal, +
        2. eq: yields true if the operands are equal, false otherwise. No sign interpretation is necessary or performed.
        3. -
        4. ne: yields true if the operands are unequal, +
        5. ne: yields true if the operands are unequal, false otherwise. No sign interpretation is necessary or performed.
        6. @@ -4817,42 +4817,42 @@ entry:
          1. false: always yields false, regardless of operands.
          2. -
          3. oeq: yields true if both operands are not a QNAN and +
          4. oeq: yields true if both operands are not a QNAN and op1 is equal to op2.
          5. ogt: yields true if both operands are not a QNAN and op1 is greather than op2.
          6. -
          7. oge: yields true if both operands are not a QNAN and +
          8. oge: yields true if both operands are not a QNAN and op1 is greater than or equal to op2.
          9. -
          10. olt: yields true if both operands are not a QNAN and +
          11. olt: yields true if both operands are not a QNAN and op1 is less than op2.
          12. -
          13. ole: yields true if both operands are not a QNAN and +
          14. ole: yields true if both operands are not a QNAN and op1 is less than or equal to op2.
          15. -
          16. one: yields true if both operands are not a QNAN and +
          17. one: yields true if both operands are not a QNAN and op1 is not equal to op2.
          18. ord: yields true if both operands are not a QNAN.
          19. -
          20. ueq: yields true if either operand is a QNAN or +
          21. ueq: yields true if either operand is a QNAN or op1 is equal to op2.
          22. -
          23. ugt: yields true if either operand is a QNAN or +
          24. ugt: yields true if either operand is a QNAN or op1 is greater than op2.
          25. -
          26. uge: yields true if either operand is a QNAN or +
          27. uge: yields true if either operand is a QNAN or op1 is greater than or equal to op2.
          28. -
          29. ult: yields true if either operand is a QNAN or +
          30. ult: yields true if either operand is a QNAN or op1 is less than op2.
          31. -
          32. ule: yields true if either operand is a QNAN or +
          33. ule: yields true if either operand is a QNAN or op1 is less than or equal to op2.
          34. -
          35. une: yields true if either operand is a QNAN or +
          36. une: yields true if either operand is a QNAN or op1 is not equal to op2.
          37. uno: yields true if either operand is a QNAN.
          38. @@ -5144,7 +5144,7 @@ freestanding environments and non-C-based langauges.

            suffix is required. Because the argument's type is matched against the return type, it does not require its own name suffix.

            -

            To learn how to add an intrinsic function, please see the +

            To learn how to add an intrinsic function, please see the Extending LLVM Guide.

            @@ -6579,11 +6579,11 @@ LLVM.

            • ll: All loads before the barrier must complete before any load after the barrier begins.
            • -
            • ls: All loads before the barrier must complete before any +
            • ls: All loads before the barrier must complete before any store after the barrier begins.
            • -
            • ss: All stores before the barrier must complete before any +
            • ss: All stores before the barrier must complete before any store after the barrier begins.
            • -
            • sl: All stores before the barrier must complete before any +
            • sl: All stores before the barrier must complete before any load after the barrier begins.
            @@ -6796,7 +6796,7 @@ LLVM.

            Overview:
            -

            This intrinsic subtracts delta to the value stored in memory at +

            This intrinsic subtracts delta to the value stored in memory at ptr. It yields the original value at ptr.

            Arguments:
            @@ -6952,7 +6952,7 @@ LLVM.

            Overview:
            -

            These intrinsics takes the signed or unsigned minimum or maximum of +

            These intrinsics takes the signed or unsigned minimum or maximum of delta and the value stored in memory at ptr. It yields the original value at ptr.

            @@ -7262,24 +7262,44 @@ LLVM.

            Overview:
            -

            The llvm.objectsize intrinsic returns the constant number of bytes - from ptr to the end of the object ptr points to, if it - can deduce this at compile time. If there are any side-effects in evaluating - the argument or it cannot deduce which objects ptr points to at compile - time, the intrinsic returns i32/i64 -1 for type 0 - or 1 and i32/i64 0 for type 2 or 3.

            +

            The llvm.objectsize intrinsic is designed to provide information + to the optimizers to either discover at compile time either a) when an + operation like memcpy will either overflow a buffer that corresponds to + an object, or b) to determine that a runtime check for overflow isn't + necessary. An object in this context means an allocation of a + specific type.

            Arguments:

            The llvm.objectsize intrinsic takes two arguments. The first argument is a pointer to the object ptr. The second argument - is an integer type which ranges from 0 to 3. The first bit - corresponds to a return value based on whole objects, and the second bit - whether or not we return the maximum or minimum remaining bytes computed.

            + is an integer type which ranges from 0 to 3. The first bit in + the type corresponds to a return value based on whole objects, + and the second bit whether or not we return the maximum or minimum + remaining bytes computed.

            + + + + + + + + + + + + + + + + + +
            00whole object, maximum number of bytes
            01partial object, maximum number of bytes
            10whole object, minimum number of bytes
            11partial object, minimum number of bytes
            Semantics:

            The llvm.objectsize intrinsic is lowered to either a constant - representing the size of the object concerned or i32/i64 -1 if - it cannot be determined at compile time.

            + representing the size of the object concerned or i32/i64 -1 or 0 + (depending on the type argument if the size cannot be determined + at compile time.

            -- 2.34.1