summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-04-22 21:18:02 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-04-22 21:18:02 +0000
commit74eabdd998cb907f33bf6362af7dd5dbb10b24b8 (patch)
tree20ba36ac8e310f69806479a939d2ce46e633da7a /docs
parent6217a62bc009d55e160dbb694f2e94a22c80809f (diff)
Introduce llvm.load.relative intrinsic.
This intrinsic takes two arguments, ``%ptr`` and ``%offset``. It loads a 32-bit value from the address ``%ptr + %offset``, adds ``%ptr`` to that value and returns it. The constant folder specifically recognizes the form of this intrinsic and the constant initializers it may load from; if a loaded constant initializer is known to have the form ``i32 trunc(x - %ptr)``, the intrinsic call is folded to ``x``. LLVM provides that the calculation of such a constant initializer will not overflow at link time under the medium code model if ``x`` is an ``unnamed_addr`` function. However, it does not provide this guarantee for a constant initializer folded into a function body. This intrinsic can be used to avoid the possibility of overflows when loading from such a constant. Differential Revision: http://reviews.llvm.org/D18367 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267223 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r--docs/LangRef.rst25
1 files changed, 25 insertions, 0 deletions
diff --git a/docs/LangRef.rst b/docs/LangRef.rst
index 2cb71bb78ce..d588b0514b0 100644
--- a/docs/LangRef.rst
+++ b/docs/LangRef.rst
@@ -12361,6 +12361,31 @@ if"); and this allows for "check widening" type optimizations.
``@llvm.experimental.guard`` cannot be invoked.
+'``llvm.load.relative``' Intrinsic
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+
+::
+
+ declare i8* @llvm.load.relative.iN(i8* %ptr, iN %offset) argmemonly nounwind readonly
+
+Overview:
+"""""""""
+
+This intrinsic loads a 32-bit value from the address ``%ptr + %offset``,
+adds ``%ptr`` to that value and returns it. The constant folder specifically
+recognizes the form of this intrinsic and the constant initializers it may
+load from; if a loaded constant initializer is known to have the form
+``i32 trunc(x - %ptr)``, the intrinsic call is folded to ``x``.
+
+LLVM provides that the calculation of such a constant initializer will
+not overflow at link time under the medium code model if ``x`` is an
+``unnamed_addr`` function. However, it does not provide this guarantee for
+a constant initializer folded into a function body. This intrinsic can be
+used to avoid the possibility of overflows when loading from such a constant.
+
Stack Map Intrinsics
--------------------