Clarify that ptrtoint+inttoptr are an alternative to GEP which are
authorDan Gohman <gohman@apple.com>
Thu, 18 Feb 2010 18:40:29 +0000 (18:40 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 18 Feb 2010 18:40:29 +0000 (18:40 +0000)
not restricted by the GEP rules.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96598 91177308-0d34-0410-b5e6-96231b3b80d8

docs/AdvancedGetElementPtr.html

index 65ccbc4829153ea31bec33a53c4f91f4ccd5c074..a6baa1321923cac50e414effa829c4a20a396529 100644 (file)
                      to null?</b></a>
 </div>
 <div class="doc_text">
-  <p>You can compute an address that way, but you can't use that pointer to
-     actually access the object if you do, unless the object is managed
-     outside of LLVM.</p>
+  <p>You can compute an address that way, but if you use GEP to do the add,
+     you can't use that pointer to actually access the object, unless the
+     object is managed outside of LLVM.</p>
 
   <p>The underlying integer computation is sufficiently defined; null has a
      defined value -- zero -- and you can add whatever value you want to it.</p>
      object with such a pointer. This includes GlobalVariables, Allocas, and
      objects pointed to by noalias pointers.</p>
 
+  <p>If you really need this functionality, you can do the arithmetic with
+     explicit integer instructions, and use inttoptr to convert the result to
+     an address. Most of GEP's special aliasing rules do not apply to pointers
+     computed from ptrtoint, arithmetic, and inttoptr sequences.</p>
+
 </div>
 
 <!-- *********************************************************************** -->
                      that value to one address to compute the other address?</b></a>
 </div>
 <div class="doc_text">
-  <p>As with arithmetic on null, You can compute an address that way, but
-     you can't use that pointer to actually access the object if you do,
-     unless the object is managed outside of LLVM.</p>
+  <p>As with arithmetic on null, You can use GEP to compute an address that
+     way, but you can't use that pointer to actually access the object if you
+     do, unless the object is managed outside of LLVM.</p>
+
+  <p>Also as above, ptrtoint and inttoptr provide an alternative way to do this
+     which do not have this restriction.</p>
 
 </div>