summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit1639c3905e934654195318aba00f7eae3d5d677f (patch)
tree480fc9d2338e97b45b6fd2b06657dd8f23620dfe /llvm/docs
parent52d03b252eb4abae3ad24c5757ffe683bf3620d6 (diff)
downloadbcm5719-llvm-1639c3905e934654195318aba00f7eae3d5d677f.tar.gz
bcm5719-llvm-1639c3905e934654195318aba00f7eae3d5d677f.zip
Add a new keyword 'inbounds' for use with getelementptr. See the
LangRef.html changes for details. llvm-svn: 77259
Diffstat (limited to 'llvm/docs')
-rw-r--r--llvm/docs/LangRef.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/docs/LangRef.html b/llvm/docs/LangRef.html
index 1f9f80d6d43..adc5d9a143f 100644
--- a/llvm/docs/LangRef.html
+++ b/llvm/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>
OpenPOWER on IntegriCloud