[llvm-commits] CVS: llvm/docs/LangRef.html

Reid Spencer reid at x10sys.com
Sat Nov 11 13:01:02 PST 2006



Changes in directory llvm/docs:

LangRef.html updated: 1.168 -> 1.169
---
Log message:

Add a preview of two new conversion operators: ptrtoint and inttoptr. Update
the defintion of bitconvert correspondingly.


---
Diffs of the changes:  (+80 -5)

 LangRef.html |   85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 80 insertions(+), 5 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.168 llvm/docs/LangRef.html:1.169
--- llvm/docs/LangRef.html:1.168	Thu Nov  9 17:03:26 2006
+++ llvm/docs/LangRef.html	Sat Nov 11 15:00:47 2006
@@ -124,6 +124,8 @@
           <li><a href="#i_fptosi">'<tt>fptosi .. to</tt>' Instruction</a></li>
           <li><a href="#i_uitofp">'<tt>uitofp .. to</tt>' Instruction</a></li>
           <li><a href="#i_sitofp">'<tt>sitofp .. to</tt>' Instruction</a></li>
+          <li><a href="#i_ptrtoint">'<tt>ptrtoint .. to</tt>' Instruction</a></li>
+          <li><a href="#i_inttoptr">'<tt>inttoptr .. to</tt>' Instruction</a></li>
           <li><a href="#i_bitconvert">'<tt>bitconvert .. to</tt>' Instruction</a></li>
         </ol>
       <li><a href="#otherops">Other Operations</a>
@@ -2955,6 +2957,77 @@
 
 <!-- _______________________________________________________________________ -->
 <div class="doc_subsubsection">
+   <a name="i_ptrtoint">'<tt>ptrtoint .. to</tt>' Instruction</a>
+</div>
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+<pre>
+  <result> = ptrtoint <ty> <value> to <ty2>             <i>; yields ty2</i>
+</pre>
+
+<h5>Overview:</h5>
+<p>The '<tt>ptrtoint</tt>' instruction converts the pointer <tt>value</tt> to 
+the integer type <tt>ty2</tt>.</p>
+
+<h5>Arguments:</h5>
+<p>The '<tt>ptrtoint</tt>' instruction takes a <tt>value</tt> to cast, which 
+must be a <a href="t_pointer">pointer</a> value, and a type to cast it to
+<tt>ty2</tt>, which must be an <a href="#t_integer">integer</a> type. 
+
+<h5>Semantics:</h5>
+<p>The '<tt>ptrtoint</tt>' instruction converts <tt>value</tt> to integer type
+<tt>ty2</tt> by interpreting the pointer value as an integer and either 
+truncating or zero extending that value to the size of the integer type. If
+<tt>value</tt> is smaller than <tt>ty2</tt> then a zero extension is done. If
+<tt>value</tt> is larger than <tt>ty2</tt> then a truncation is done. If they
+are the same size, then nothing is done (<i>no-op cast</i>).</p>
+
+<h5>Example:</h5>
+<pre>
+  %X = ptrtoint int* %X to sbyte          <i>; yields truncation on 32-bit</i>
+  %Y = ptrtoint int* %x to ulong          <i>; yields zero extend on 32-bit</i>
+</pre>
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+   <a name="i_inttoptr">'<tt>inttoptr .. to</tt>' Instruction</a>
+</div>
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+<pre>
+  <result> = inttoptr <ty> <value> to <ty2>             <i>; yields ty2</i>
+</pre>
+
+<h5>Overview:</h5>
+<p>The '<tt>inttoptr</tt>' instruction converts an integer <tt>value</tt> to 
+a pointer type, <tt>ty2</tt>.</p>
+
+<h5>Arguments:</h5>
+<p>The '<tt>inttoptr</tt>' instruction takes an <a href="i_integer">integer</a>
+value to cast, and a type to cast it to, which must be a 
+<a href="#t_pointer">pointer</a> type. </tt>
+
+<h5>Semantics:</h5>
+<p>The '<tt>inttoptr</tt>' instruction converts <tt>value</tt> to type
+<tt>ty2</tt> by applying either a zero extension or a truncation depending on
+the size of the integer <tt>value</tt>. If <tt>value</tt> is larger than the
+size of a pointer then a truncation is done. If <tt>value</tt> is smaller than
+the size of a pointer then a zero extension is done. If they are the same size,
+nothing is done (<i>no-op cast</i>).</p>
+
+<h5>Example:</h5>
+<pre>
+  %X = inttoptr int 255 to int*            <i>; yields zero extend on 64-bit</i>
+  %X = inttoptr int 255 to int*            <i>; yields no-op on 32-bit </i>
+  %Y = inttoptr short 0 to int*            <i>; yields zero extend on 32-bit</i>
+</pre>
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
    <a name="i_bitconvert">'<tt>bitconvert .. to</tt>' Instruction</a>
 </div>
 <div class="doc_text">
@@ -2976,10 +3049,12 @@
 
 <h5>Semantics:</h5>
 <p>The '<tt>bitconvert</tt>' instruction converts <tt>value</tt> to type
-<tt>ty2</tt> as if the value had been stored to memory and read back as type
-<tt>ty2</tt>. That is, no bits are changed during the conversion. The
-<tt>bitconvert</tt> instruction is the only conversion instruction that permits
-<i>no-op casts</i> to be constructed.</p>
+<tt>ty2</tt>. It is always a <i>no-op cast</i> because no bits change with 
+this conversion.  The conversion is done as if the <tt>value</tt> had been 
+stored to memory and read back as type <tt>ty2</tt>. Pointer types may only be
+converted to other pointer types with this instruction. To convert pointers to 
+other types, use the <a href="#i_inttoptr">inttoptr</a> or 
+<a href="#i_ptrtoint">ptrtoint</a> instructions first.</p>
 
 <h5>Example:</h5>
 <pre>
@@ -4224,7 +4299,7 @@
 
   <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
   <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date: 2006/11/09 23:03:26 $
+  Last modified: $Date: 2006/11/11 21:00:47 $
 </address>
 </body>
 </html>






More information about the llvm-commits mailing list