summaryrefslogtreecommitdiff
path: root/docs/LangRef.rst
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2013-07-06 00:29:58 +0000
committerNick Lewycky <nicholas@mxc.ca>2013-07-06 00:29:58 +0000
commitdc89737bcdbb8f69d8ae7578bdfa904cabcfc5ed (patch)
tree1838b5d8368383a083fad1cdca2fe777528e5a69 /docs/LangRef.rst
parent202eb7b18e220205ec86a03ddf18f2066c70ab15 (diff)
downloadllvm-dc89737bcdbb8f69d8ae7578bdfa904cabcfc5ed.tar.gz
llvm-dc89737bcdbb8f69d8ae7578bdfa904cabcfc5ed.tar.bz2
llvm-dc89737bcdbb8f69d8ae7578bdfa904cabcfc5ed.tar.xz
Extend 'readonly' and 'readnone' to work on function arguments as well as
functions. Make the function attributes pass add it to known library functions and when it can deduce it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185735 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/LangRef.rst')
-rw-r--r--docs/LangRef.rst17
1 files changed, 13 insertions, 4 deletions
diff --git a/docs/LangRef.rst b/docs/LangRef.rst
index 13706e167f..1e65f0b823 100644
--- a/docs/LangRef.rst
+++ b/docs/LangRef.rst
@@ -879,17 +879,22 @@ example:
passes make choices that keep the code size of this function low,
and otherwise do optimizations specifically to reduce code size.
``readnone``
- This attribute indicates that the function computes its result (or
- decides to unwind an exception) based strictly on its arguments,
+ On a function, this attribute indicates that the function computes its
+ result (or decides to unwind an exception) 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. This means that it cannot unwind exceptions by calling
the ``C++`` exception throwing methods.
+
+ On an argument, this attribute indicates that the function does not
+ dereference that pointer argument, even though it may read or write the
+ memory that the pointer points to through if accessed through other
+ pointers.
``readonly``
- This attribute indicates that the function does not write through
- any pointer arguments (including ``byval`` arguments) or otherwise
+ On a function, 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
@@ -897,6 +902,10 @@ example:
called with the same set of arguments and global state. It cannot
unwind an exception by calling the ``C++`` exception throwing
methods.
+
+ On an argument, this attribute indicates that the function does not write
+ through this pointer argument, even though it may write to the memory that
+ the pointer points to.
``returns_twice``
This attribute indicates that this function can return twice. The C
``setjmp`` is an example of such a function. The compiler disables