summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-07-27 21:53:46 +0000
committerDan Gohman <gohman@apple.com>2009-07-27 21:53:46 +0000
commitdd8004dc73d091ccb3927dbbc3b41639a3738ae3 (patch)
tree635ee4ff5a89aefb2eb5ba8394207f65c8771bcf /docs
parent9a7e2ccf574368b60455f8c8975030475a1f3ce0 (diff)
downloadllvm-dd8004dc73d091ccb3927dbbc3b41639a3738ae3.tar.gz
llvm-dd8004dc73d091ccb3927dbbc3b41639a3738ae3.tar.bz2
llvm-dd8004dc73d091ccb3927dbbc3b41639a3738ae3.tar.xz
Add a new keyword 'inbounds' for use with getelementptr. See the
LangRef.html changes for details. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77259 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r--docs/LangRef.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/LangRef.html b/docs/LangRef.html
index 1f9f80d6d4..adc5d9a143 100644
--- a/docs/LangRef.html
+++ b/docs/LangRef.html
@@ -2091,6 +2091,7 @@ Classifications</a> </div>
instruction</a>.</dd>
<dt><b><tt>getelementptr ( CSTPTR, IDX0, IDX1, ... )</tt></b></dt>
+ <dt><b><tt>getelementptr inbounds ( CSTPTR, IDX0, IDX1, ... )</tt></b></dt>
<dd>Perform the <a href="#i_getelementptr">getelementptr operation</a> on
constants. As with the <a href="#i_getelementptr">getelementptr</a>
instruction, the index list may have zero or more indexes, which are
@@ -3902,6 +3903,7 @@ Instruction</a> </div>
<h5>Syntax:</h5>
<pre>
&lt;result&gt; = getelementptr &lt;pty&gt;* &lt;ptrval&gt;{, &lt;ty&gt; &lt;idx&gt;}*
+ &lt;result&gt; = getelementptr inbounds &lt;pty&gt;* &lt;ptrval&gt;{, &lt;ty&gt; &lt;idx&gt;}*
</pre>
<h5>Overview:</h5>
@@ -3990,6 +3992,20 @@ entry:
}
</pre>
+<p>If the <tt>inbounds</tt> keyword is present, the result value of the
+ <tt>getelementptr</tt> is undefined if the base pointer is not pointing
+ into an allocated object, or if any of the addresses formed by successive
+ addition of the offsets implied by the indices to the base address is
+ outside of the allocated object into which the base pointer points.</p>
+
+<p>If the <tt>inbounds</tt> keyword is not present, the offsets are added to
+ the base address with silently-wrapping two's complement arithmetic, and
+ the result value of the <tt>getelementptr</tt> may be outside the object
+ pointed to by the base pointer. The result value may not necessarily be
+ used to access memory though, even if it happens to point into allocated
+ storage. See the <a href="#pointeraliasing">Pointer Aliasing Rules</a>
+ section for more information.</p>
+
<p>The getelementptr instruction is often confusing. For some more insight into
how it works, see <a href="GetElementPtr.html">the getelementptr FAQ</a>.</p>