llvm.org GIT mirror llvm / edb05df
Clarify the relationship between byval and readonly/ readnone. Make clearer that readnone functions do not dereference pointer arguments. Do not use the highly ambiguous "side-effects" in the readonly description (since such functions can have control flow side-effects, such as throwing an exception, or looping for ever). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57166 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan Sands 12 years ago
1 changed file(s) with 20 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
851851 to memory, though some targets use it to distinguish between two different
852852 kinds of registers). Use of this attribute is target-specific.
853853
854
byval
854
byval
855855
This indicates that the pointer parameter should really be passed by
856856 value to the function. The attribute implies that a hidden copy of the
857857 pointee is made between the caller and the callee, so the callee is unable
858858 to modify the value in the callee. This attribute is only valid on LLVM
859859 pointer arguments. It is generally used to pass structs and arrays by
860 value, but is also valid on pointers to scalars.
860 value, but is also valid on pointers to scalars. The copy is considered to
861 belong to the caller not the callee (for example,
862 readonly functions should not write to
863 byval parameters).
861864
862865
sret
863866
This indicates that the pointer parameter specifies the address of a
947950 behavior is undefined.
948951
949952
readnone
950
This attribute indicates that the function computes its result (or its
951 thrown exception) based strictly on its arguments. It does not read any global
952 mutable state (e.g. memory, control registers, etc) visible to caller functions.
953 Furthermore, readnone functions never change any state visible to their
954 caller.
955
956
readonly
957
This function attribute indicates that the function has no side-effects on
958 the calling function, but that it depends on state (memory state, control
959 register state, etc) that may be set in the caller. A readonly function always
960 returns the same value (or throws the same exception) whenever it is called with
961 a particular set of arguments and global state.
962
953
This attribute indicates that the function computes its result (or the
954 exception it throws) based strictly on its arguments, without dereferencing any
955 pointer arguments or otherwise accessing any mutable state (e.g. memory, control
956 registers, etc) visible to caller functions. It does not write through any
957 pointer arguments (including byval arguments) and
958 never changes any state visible to callers.
959
960
readonly
961
This attribute indicates that the function does not write through any
962 pointer arguments (including byval arguments)
963 or otherwise modify any state (e.g. memory, control registers, etc) visible to
964 caller functions. It may dereference pointer arguments and read state that may
965 be set in the caller. A readonly function always returns the same value (or
966 throws the same exception) when called with the same set of arguments and global
967 state.
963968
964969
965970