aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorEli Bendersky <eliben@chromium.org>2013-07-30 10:29:48 -0700
committerEli Bendersky <eliben@chromium.org>2013-07-30 10:29:48 -0700
commit1bd549d7142a69735d1f054f61d5b551f8884eee (patch)
tree1db3a9e7d2310af300e726926dc8f10bfaacade2 /docs
parent8347d6d0703d610e7ce229ff5c0e06501b0922a3 (diff)
Describe NaCl-specific intrinsics.
BUG=None R=jfb@chromium.org Review URL: https://codereview.chromium.org/21162002
Diffstat (limited to 'docs')
-rw-r--r--docs/PNaClLangRef.rst43
1 files changed, 38 insertions, 5 deletions
diff --git a/docs/PNaClLangRef.rst b/docs/PNaClLangRef.rst
index 8ddfae0739..4ba5c5ff21 100644
--- a/docs/PNaClLangRef.rst
+++ b/docs/PNaClLangRef.rst
@@ -372,18 +372,26 @@ The only intrinsics supported by PNaCl bitcode are the following.
* ``llvm.stacksave``
* ``llvm.stackrestore``
+
+ These intrinsics are used to implement language features like scoped automatic
+ variable sized arrays in C99. ``llvm.stacksave`` returns a value that
+ represents the current state of the stack. This value may only be used as the
+ argument to ``llvm.stackrestore``, which restores the stack to the given
+ state.
+
* ``llvm.trap``
-* ``llvm.nacl.read.tp``
- TODO: describe
+ This intrinsic is lowered to a target dependent trap instruction, which aborts
+ execution.
-* ``llvm.nacl.longjmp``
+* ``llvm.nacl.read.tp``
- TODO: describe
+ See :ref:`thread pointer related intrinsics <threadpointerintrinsics>`.
+* ``llvm.nacl.longjmp``
* ``llvm.nacl.setjmp``
- TODO: describe
+ See :ref:`Setjmp and Longjmp <setjmplongjmp>`.
.. _atomic intrinsics:
@@ -395,6 +403,31 @@ The only intrinsics supported by PNaCl bitcode are the following.
See :ref:`atomic intrinsics <atomicintrinsics>`.
+.. _threadpointerintrinsics:
+
+Thread pointer related intrinsics
+---------------------------------
+
+.. code-block:: llvm
+
+ declare i8* @llvm.nacl.read.tp()
+
+Returns the thread pointer, which can be set by the embedding sandbox's runtime.
+
+.. _setjmplongjmp:
+
+Setjmp and Longjmp
+------------------
+
+.. code-block:: llvm
+
+ declare void @llvm.nacl.longjmp(i8* %jmpbuf, i32)
+ declare i32 @llvm.nacl.setjmp(i8* %jmpbuf)
+
+These intrinsics implement the semantics of C11 ``setjmp`` and ``longjmp``. The
+``jmpbuf`` pointer must be 64-bit aligned and point to at least 1024 bytes of
+allocated memory.
+
.. _atomicintrinsics:
Atomic intrinsics