mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-20 14:29:27 +00:00
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
This commit is contained in:
parent
d20a00d011
commit
edb05dfe48
@ -852,13 +852,16 @@ declare signext i8 @returns_signed_char()
|
|||||||
to memory, though some targets use it to distinguish between two different
|
to memory, though some targets use it to distinguish between two different
|
||||||
kinds of registers). Use of this attribute is target-specific.</dd>
|
kinds of registers). Use of this attribute is target-specific.</dd>
|
||||||
|
|
||||||
<dt><tt>byval</tt></dt>
|
<dt><tt><a name="byval">byval</a></tt></dt>
|
||||||
<dd>This indicates that the pointer parameter should really be passed by
|
<dd>This indicates that the pointer parameter should really be passed by
|
||||||
value to the function. The attribute implies that a hidden copy of the
|
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
|
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
|
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
|
pointer arguments. It is generally used to pass structs and arrays by
|
||||||
value, but is also valid on pointers to scalars.</dd>
|
value, but is also valid on pointers to scalars. The copy is considered to
|
||||||
|
belong to the caller not the callee (for example,
|
||||||
|
<tt><a href="#readonly">readonly</a></tt> functions should not write to
|
||||||
|
<tt>byval</tt> parameters).</dd>
|
||||||
|
|
||||||
<dt><tt>sret</tt></dt>
|
<dt><tt>sret</tt></dt>
|
||||||
<dd>This indicates that the pointer parameter specifies the address of a
|
<dd>This indicates that the pointer parameter specifies the address of a
|
||||||
@ -948,19 +951,21 @@ unwind or exceptional control flow. If the function does unwind, its runtime
|
|||||||
behavior is undefined.</dd>
|
behavior is undefined.</dd>
|
||||||
|
|
||||||
<dt><tt>readnone</tt></dt>
|
<dt><tt>readnone</tt></dt>
|
||||||
<dd>This attribute indicates that the function computes its result (or its
|
<dd>This attribute indicates that the function computes its result (or the
|
||||||
thrown exception) based strictly on its arguments. It does not read any global
|
exception it throws) based strictly on its arguments, without dereferencing any
|
||||||
mutable state (e.g. memory, control registers, etc) visible to caller functions.
|
pointer arguments or otherwise accessing any mutable state (e.g. memory, control
|
||||||
Furthermore, <tt>readnone</tt> functions never change any state visible to their
|
registers, etc) visible to caller functions. It does not write through any
|
||||||
caller.
|
pointer arguments (including <tt><a href="#byval">byval</a></tt> arguments) and
|
||||||
|
never changes any state visible to callers.</dd>
|
||||||
<dt><tt>readonly</tt></dt>
|
|
||||||
<dd>This function attribute indicates that the function has no side-effects on
|
|
||||||
the calling function, but that it depends on state (memory state, control
|
|
||||||
register state, etc) that may be set in the caller. A readonly function always
|
|
||||||
returns the same value (or throws the same exception) whenever it is called with
|
|
||||||
a particular set of arguments and global state.</dd>
|
|
||||||
|
|
||||||
|
<dt><tt><a name="readonly">readonly</a></tt></dt>
|
||||||
|
<dd>This attribute indicates that the function does not write through any
|
||||||
|
pointer arguments (including <tt><a href="#byval">byval</a></tt> 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.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user