Add notes about LLVM and CygWin from Brian Gaeke
[oota-llvm.git] / docs / LangRef.html
index 926d8dca34679173a39dcfce9155a5a010a08fcc..8ed470c6def3dbdb43265feb09c10c4ebb324256 100644 (file)
@@ -22,7 +22,7 @@
           <li><a href="#t_function">Function Type</a>
           <li><a href="#t_pointer">Pointer Type</a>
           <li><a href="#t_struct" >Structure Type</a>
-          <li><a href="#t_packed" >Packed Type</a>
+          <!-- <li><a href="#t_packed" >Packed Type</a> -->
         </ol>
     </ol>
   <li><a href="#highlevel">High Level Structure</a>
           <li><a href="#i_switch">'<tt>switch</tt>' Instruction</a>
           <li><a href="#i_invoke">'<tt>invoke</tt>' Instruction</a>
         </ol>
-      <li><a href="#unaryops">Unary Operations</a>
-        <ol>
-          <li><a href="#i_not" >'<tt>not</tt>' Instruction</a>
-        </ol>
       <li><a href="#binaryops">Binary Operations</a>
         <ol>
           <li><a href="#i_add"  >'<tt>add</tt>' Instruction</a>
 <!--
   <li><a href="#related">Related Work</a>
 -->
+
+  <p><b>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a> and <A href="mailto:vadve@cs.uiuc.edu">Vikram Adve</a></b><p>
+
+
 </ol>
 
 
 <!-- *********************************************************************** -->
 
 <blockquote>
-  This document describes the LLVM assembly language.  LLVM is an SSA based
-  representation that is a useful midlevel IR, providing type safety, low level
-  operations, flexibility, and the capability of representing 'all' high level
-  languages cleanly.
+  This document is a reference manual for the LLVM assembly language.  LLVM is
+  an SSA based representation that provides type safety, low level operations,
+  flexibility, and the capability of representing 'all' high level languages
+  cleanly.  It is the common code representation used throughout all phases of
+  the LLVM compilation strategy.
 </blockquote>
 
 
@@ -117,14 +118,14 @@ different forms of LLVM are all equivalent.  This document describes the human
 readable representation and notation.<p>
 
 The LLVM representation aims to be a light weight and low level while being
-expressive, type safe, and extensible at the same time.  It aims to be a
-"universal IR" of sorts, by being at a low enough level that high level ideas
-may be cleanly mapped to it (similar to how microprocessors are "universal
-IR's", allowing many source languages to be mapped to them).  By providing type
-safety, LLVM can be used as the target of optimizations: for example, through
-pointer analysis, it can be proven that a C automatic variable is never accessed
-outside of the current function... allowing it to be promoted to a simple SSA
-value instead of a memory location.<p>
+expressive, typed, and extensible at the same time.  It aims to be a "universal
+IR" of sorts, by being at a low enough level that high level ideas may be
+cleanly mapped to it (similar to how microprocessors are "universal IR's",
+allowing many source languages to be mapped to them).  By providing type
+information, LLVM can be used as the target of optimizations: for example,
+through pointer analysis, it can be proven that a C automatic variable is never
+accessed outside of the current function... allowing it to be promoted to a
+simple SSA value instead of a memory location.<p>
 
 <!-- _______________________________________________________________________ -->
 </ul><a name="wellformed"><h4><hr size=0>Well Formedness</h4><ul>
@@ -138,15 +139,14 @@ syntactically okay, but not well formed:<p>
   %x = <a href="#i_add">add</a> int 1, %x
 </pre>
 
-...because only a <tt><a href="#i_phi">phi</a></tt> node may refer to itself.
-The LLVM api provides a verification pass (created by the
-<tt>createVerifierPass</tt> function) that may be used to verify that an LLVM
-module is well formed.  This pass is automatically run by the parser after
+...because the definition of %x does not dominate all of its uses.  The LLVM
+infrastructure provides a verification pass that may be used to verify that an
+LLVM module is well formed.  This pass is automatically run by the parser after
 parsing input assembly, and by the optimizer before it outputs bytecode.  The
 violations pointed out by the verifier pass indicate bugs in transformation
 passes or input to the parser.<p>
 
-Describe the typesetting conventions here. 
+<!-- Describe the typesetting conventions here. -->
 
 
 <!-- *********************************************************************** -->
@@ -193,8 +193,8 @@ After strength reduction:
 
 And the hard way:
 <pre>
-  <a href="#i_add">add</a> uint %X, %X           <i>; yields {int}:%0</i>
-  <a href="#i_add">add</a> uint %0, %0           <i>; yields {int}:%1</i>
+  <a href="#i_add">add</a> uint %X, %X           <i>; yields {uint}:%0</i>
+  <a href="#i_add">add</a> uint %0, %0           <i>; yields {uint}:%1</i>
   %result = <a href="#i_add">add</a> uint %1, %1
 </pre>
 
@@ -232,15 +232,15 @@ constants.<p>
 <!-- *********************************************************************** -->
 
 The LLVM type system is one of the most important features of the intermediate
-representation.  Being strongly typed enables a number of optimizations to be
-performed on the IR directly, without having to do extra analyses on the side
-before the transformation.  A strong type system makes it easier to read the
-generated code and enables novel analyses and transformations that are not
-feasible to perform on normal three address code representations.<p>
+representation.  Being typed enables a number of optimizations to be performed
+on the IR directly, without having to do extra analyses on the side before the
+transformation.  A strong type system makes it easier to read the generated code
+and enables novel analyses and transformations that are not feasible to perform
+on normal three address code representations.<p>
 
-The written form for the type system was heavily influenced by the syntactic
-problems with types in the C language<sup><a
-href="#rw_stroustrup">1</a></sup>.<p>
+<!-- The written form for the type system was heavily influenced by the
+syntactic problems with types in the C language<sup><a
+href="#rw_stroustrup">1</a></sup>.<p> -->
 
 
 
@@ -288,7 +288,8 @@ These different primitive types fall into a few useful classifications:<p>
 <table border=1 cellspacing=0 cellpadding=4 align=center>
 <tr><td><a name="t_signed">signed</td>    <td><tt>sbyte, short, int, long, float, double</tt></td></tr>
 <tr><td><a name="t_unsigned">unsigned</td><td><tt>ubyte, ushort, uint, ulong</tt></td></tr>
-<tr><td><a name="t_integral">integral</td><td><tt>ubyte, sbyte, ushort, short, uint, int, ulong, long</tt></td></tr>
+<tr><td><a name="t_integral">integer</td><td><tt>ubyte, sbyte, ushort, short, uint, int, ulong, long</tt></td></tr>
+<tr><td><a name="t_integral">integral</td><td><tt>bool, ubyte, sbyte, ushort, short, uint, int, ulong, long</tt></td></tr>
 <tr><td><a name="t_floating">floating point</td><td><tt>float, double</tt></td></tr>
 <tr><td><a name="t_firstclass">first class</td><td><tt>bool, ubyte, sbyte, ushort, short,<br> uint, int, ulong, long, float, double, <a href="#t_pointer">pointer</a></tt></td></tr>
 </table><p>
@@ -392,8 +393,9 @@ LLVM.</td></tr>
 <h5>Overview:</h5>
 
 The structure type is used to represent a collection of data members together in
-memory.  Although the runtime is allowed to lay out the data members any way
-that it would like, they are guaranteed to be "close" to each other.<p>
+memory.  The packing of the field types is defined to match the ABI of the
+underlying processor.  The elements of a structure may be any type that has a
+size.<p>
 
 Structures are accessed using '<tt><a href="#i_load">load</a></tt> and '<tt><a
 href="#i_store">store</a></tt>' by getting a pointer to a field with the '<tt><a
@@ -411,7 +413,7 @@ href="#i_getelementptr">getelementptr</a></tt>' instruction.<p>
 <tr><td><tt>{ int, int, int }</tt></td><td>: a triple of three <tt>int</tt>
 values</td></tr>
 
-<tr><td><tt>{ float, int (int *) * }</tt></td><td>: A pair, where the first
+<tr><td><tt>{ float, int (int) * }</tt></td><td>: A pair, where the first
 element is a <tt>float</tt> and the second element is a <a
 href="#t_pointer">pointer</a> to a <a href="t_function">function</a> that takes
 an <tt>int</tt>, returning an <tt>int</tt>.</td></tr>
@@ -488,7 +490,7 @@ declarations, and merges symbol table entries. Here is an example of the "hello
 <i>; Definition of main function</i>
 int "main"() {                                                       <i>; int()* </i>
         <i>; Convert [13x sbyte]* to sbyte *...</i>
-        %cast210 = <a href="#i_getelementptr">getelementptr</a> [13 x sbyte]* %.LC0, uint 0, uint 0 <i>; sbyte*</i>
+        %cast210 = <a href="#i_getelementptr">getelementptr</a> [13 x sbyte]* %.LC0, long 0, long 0 <i>; sbyte*</i>
 
         <i>; Call puts function to write out the string to stdout...</i>
         <a href="#i_call">call</a> int %puts(sbyte* %cast210)                              <i>; int</i>
@@ -505,14 +507,14 @@ In general, a module is made up of a list of global values, where both functions
 and global variables are global values.  Global values are represented by a
 pointer to a memory location (in this case, a pointer to an array of char, and a
 pointer to a function), and can be either "internal" or externally accessible
-(which corresponds to the static keyword in C, when used at function scope).<p>
+(which corresponds to the static keyword in C, when used at global scope).<p>
 
 For example, since the "<tt>.LC0</tt>" variable is defined to be internal, if
 another module defined a "<tt>.LC0</tt>" variable and was linked with this one,
 one of the two would be renamed, preventing a collision.  Since "<tt>main</tt>"
-and "<tt>puts</tt>" are external (lacking "<tt>internal</tt>" declarations),
-they are accessible outside of the current module.  It is illegal for a function
-declaration to be "<tt>internal</tt>".<p>
+and "<tt>puts</tt>" are external (i.e., lacking "<tt>internal</tt>"
+declarations), they are accessible outside of the current module.  It is illegal
+for a function declaration to be "<tt>internal</tt>".<p>
 
 
 <!-- ======================================================================= -->
@@ -522,15 +524,15 @@ declaration to be "<tt>internal</tt>".<p>
 </b></font></td></tr></table><ul>
 
 Global variables define regions of memory allocated at compilation time instead
-of runtime.  Global variables, may optionally be initialized.  A variable may be
-defined as a global "constant", which indicates that the contents of the
+of run-time.  Global variables may optionally be initialized.  A variable may
+be defined as a global "constant", which indicates that the contents of the
 variable will never be modified (opening options for optimization).  Constants
 must always have an initial value.<p>
 
-As SSA values, global variables define pointer values that are in scope in
-(i.e. they dominate) all basic blocks in the program.  Global variables always
-define a pointer to their "content" type because they describe a region of
-memory, and all memory objects in LLVM are accessed through pointers.<p>
+As SSA values, global variables define pointer values that are in scope
+(i.e. they dominate) for all basic blocks in the program.  Global variables
+always define a pointer to their "content" type because they describe a region
+of memory, and all memory objects in LLVM are accessed through pointers.<p>
 
 
 
@@ -565,10 +567,9 @@ function).<p>
 <!-- *********************************************************************** -->
 
 The LLVM instruction set consists of several different classifications of
-instructions: <a href="#terminators">terminator instructions</a>, a <a
-href="#unaryops">unary instruction</a>, <a href="#binaryops">binary
-instructions</a>, <a href="#memoryops">memory instructions</a>, and <a
-href="#otherops">other instructions</a>.<p>
+instructions: <a href="#terminators">terminator instructions</a>, <a
+href="#binaryops">binary instructions</a>, <a href="#memoryops">memory
+instructions</a>, and <a href="#otherops">other instructions</a>.<p>
 
 
 <!-- ======================================================================= -->
@@ -578,11 +579,11 @@ href="#otherops">other instructions</a>.<p>
 </b></font></td></tr></table><ul>
 
 As mentioned <a href="#functionstructure">previously</a>, every basic block in a
-program ends with a "Terminator" instruction, which indicates where control flow
-should go now that this basic block has been completely executed.  These
-terminator instructions typically yield a '<tt>void</tt>' value: they produce
-control flow, not values (the one exception being the '<a
-href="#i_invoke"><tt>invoke</tt></a>' instruction).<p>
+program ends with a "Terminator" instruction, which indicates which block should
+be executed after the current block is finished. These terminator instructions
+typically yield a '<tt>void</tt>' value: they produce control flow, not values
+(the one exception being the '<a href="#i_invoke"><tt>invoke</tt></a>'
+instruction).<p>
 
 There are four different terminator instructions: the '<a
 href="#i_ret"><tt>ret</tt></a>' instruction, the '<a
@@ -620,7 +621,7 @@ that returns a value that does not match the return type of the function.<p>
 
 When the '<tt>ret</tt>' instruction is executed, control flow returns back to
 the calling function's context.  If the instruction returns a value, that value
-shall be propogated into the calling function's data space.<p>
+shall be propagated into the calling function's data space.<p>
 
 <h5>Example:</h5>
 <pre>
@@ -681,13 +682,19 @@ IfUnequal:
 
   <i>; Lookup indirect branch</i>
   switch uint &lt;value&gt;, label &lt;defaultdest&gt;, %switchtype &lt;switchtable&gt;
-
+<!--
   <i>; Indexed indirect branch</i>
   switch uint &lt;idxvalue&gt;, label &lt;defaultdest&gt;, [&lt;anysize&gt; x label] &lt;desttable&gt;
+-->
 </pre>
 
 <h5>Overview:</h5>
 
+<b>NOTE:</b> The switch instruction may go away in the future.  It is not very
+well supported in LLVM anyway, so don't go to great lengths to support it.  Talk
+to <a href="mailto:sabre@nondot.org">Chris</a> for more info if this concerns
+you.<p>
+
 The '<tt>switch</tt>' instruction is used to transfer control flow to one of
 several different places.  It is a generalization of the '<tt>br</tt>'
 instruction, allowing a branch to occur to one of many possible destinations.<p>
@@ -760,7 +767,7 @@ specified function, with the possibility of control flow transfer to either the
 '<tt>normal label</tt>' label or the '<tt>exception label</tt>'.  The '<tt><a
 href="#i_call">call</a></tt>' instruction is closely related, but guarantees
 that control flow either never returns from the called function, or that it
-returns to the instruction succeeding the '<tt><a href="#i_call">call</a></tt>'
+returns to the instruction following the '<tt><a href="#i_call">call</a></tt>'
 instruction.<p>
 
 <h5>Arguments:</h5>
@@ -770,7 +777,7 @@ This instruction requires several arguments:<p>
 
 <li>'<tt>ptr to function ty</tt>': shall be the signature of the pointer to
 function value being invoked.  In most cases, this is a direct function
-invocation, but indirect <tt>invoke</tt>'s are just as possible, branching off
+invocation, but indirect <tt>invoke</tt>s are just as possible, branching off
 an arbitrary pointer to function value.<p>
 
 <li>'<tt>function ptr val</tt>': An LLVM value containing a pointer to a
@@ -797,7 +804,7 @@ is performed in the case of either a <tt>longjmp</tt> or a thrown exception.
 Additionally, this is important for implementation of '<tt>catch</tt>' clauses
 in high-level languages that support them.<p>
 
-For a more comprehensive explanation of this instruction look in the llvm/docs/2001-05-18-ExceptionHandling.txt document.<p>
+<!-- For a more comprehensive explanation of how this instruction is used, look in the llvm/docs/2001-05-18-ExceptionHandling.txt document.<p> -->
 
 <h5>Example:</h5>
 <pre>
@@ -807,48 +814,6 @@ For a more comprehensive explanation of this instruction look in the llvm/docs/2
 
 
 
-<!-- ======================================================================= -->
-</ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
-<tr><td>&nbsp;</td><td width="100%">&nbsp; <font color="#EEEEFF" face="Georgia,Palatino"><b>
-<a name="unaryops">Unary Operations
-</b></font></td></tr></table><ul>
-
-Unary operators are used to do a simple operation to a single value.<p>
-
-There is only one unary operator: the '<a href="#i_not"><tt>not</tt></a>' instruction.<p>
-
-
-<!-- _______________________________________________________________________ -->
-</ul><a name="i_not"><h4><hr size=0>'<tt>not</tt>' Instruction</h4><ul>
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = not &lt;ty&gt; &lt;var&gt;       <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-The  '<tt>not</tt>' instruction returns the bitwise complement of its operand.<p>
-
-<h5>Arguments:</h5>
-The single argument to '<tt>not</tt>' must be of of <a href="#t_integral">integral</a> or bool type.<p>
-
-
-<h5>Semantics:</h5> The '<tt>not</tt>' instruction returns the bitwise
-complement (AKA ones complement) of an <a href="#t_integral">integral</a>
-type.<p>
-
-<pre>
-  &lt;result&gt; = xor bool true, &lt;var&gt; <i>; yields {bool}:result</i>
-</pre>
-
-<h5>Example:</h5>
-<pre>
-  %x = not int 1                  <i>; {int}:x is now equal to -2</i>
-  %x = not bool true              <i>; {bool}:x is now equal to false</i>
-</pre>
-
-
-
 <!-- ======================================================================= -->
 </ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0><tr><td>&nbsp;</td><td width="100%">&nbsp; <font color="#EEEEFF" face="Georgia,Palatino"><b>
 <a name="binaryops">Binary Operations
@@ -874,10 +839,11 @@ There are several different binary operators:<p>
 The '<tt>add</tt>' instruction returns the sum of its two operands.<p>
 
 <h5>Arguments:</h5>
-The two arguments to the '<tt>add</tt>' instruction must be either <a href="#t_integral">integral</a> or <a href="#t_floating">floating point</a> values.  Both arguments must have identical types.<p>
+The two arguments to the '<tt>add</tt>' instruction must be either <a href="#t_integer">integer</a> or <a href="#t_floating">floating point</a> values.  Both arguments must have identical types.<p>
 
 <h5>Semantics:</h5>
-...<p>
+
+The value produced is the integer or floating point sum of the two operands.<p>
 
 <h5>Example:</h5>
 <pre>
@@ -903,11 +869,13 @@ instruction present in most other intermediate representations.<p>
 <h5>Arguments:</h5>
 
 The two arguments to the '<tt>sub</tt>' instruction must be either <a
-href="#t_integral">integral</a> or <a href="#t_floating">floating point</a>
+href="#t_integer">integer</a> or <a href="#t_floating">floating point</a>
 values.  Both arguments must have identical types.<p>
 
 <h5>Semantics:</h5>
-...<p>
+
+The value produced is the integer or floating point difference of the two
+operands.<p>
 
 <h5>Example:</h5>
 <pre>
@@ -927,10 +895,12 @@ values.  Both arguments must have identical types.<p>
 The  '<tt>mul</tt>' instruction returns the product of its two operands.<p>
 
 <h5>Arguments:</h5>
-The two arguments to the '<tt>mul</tt>' instruction must be either <a href="#t_integral">integral</a> or <a href="#t_floating">floating point</a> values.  Both arguments must have identical types.<p>
+The two arguments to the '<tt>mul</tt>' instruction must be either <a href="#t_integer">integer</a> or <a href="#t_floating">floating point</a> values.  Both arguments must have identical types.<p>
 
 <h5>Semantics:</h5>
-...<p>
+
+The value produced is the integer or floating point product of the two
+operands.<p>
 
 There is no signed vs unsigned multiplication.  The appropriate action is taken
 based on the type of the operand. <p>
@@ -957,11 +927,13 @@ The  '<tt>div</tt>' instruction returns the quotient of its two operands.<p>
 <h5>Arguments:</h5>
 
 The two arguments to the '<tt>div</tt>' instruction must be either <a
-href="#t_integral">integral</a> or <a href="#t_floating">floating point</a>
+href="#t_integer">integer</a> or <a href="#t_floating">floating point</a>
 values.  Both arguments must have identical types.<p>
 
 <h5>Semantics:</h5>
-...<p>
+
+The value produced is the integer or floating point quotient of the two
+operands.<p>
 
 <h5>Example:</h5>
 <pre>
@@ -981,7 +953,7 @@ values.  Both arguments must have identical types.<p>
 The  '<tt>rem</tt>' instruction returns the remainder from the division of its two operands.<p>
 
 <h5>Arguments:</h5>
-The two arguments to the '<tt>rem</tt>' instruction must be either <a href="#t_integral">integral</a> or <a href="#t_floating">floating point</a> values.  Both arguments must have identical types.<p>
+The two arguments to the '<tt>rem</tt>' instruction must be either <a href="#t_integer">integer</a> or <a href="#t_floating">floating point</a> values.  Both arguments must have identical types.<p>
 
 <h5>Semantics:</h5>
 
@@ -991,8 +963,6 @@ as the dividend) of a value.  For more information about the difference, see: <a
 href="http://mathforum.org/dr.math/problems/anne.4.28.99.html">The Math
 Forum</a>.<p>
 
-...<p>
-
 <h5>Example:</h5>
 <pre>
   &lt;result&gt; = rem int 4, %var          <i>; yields {int}:result = 4 % %var</i>
@@ -1081,13 +1051,22 @@ The '<tt>and</tt>' instruction returns the bitwise logical and of its two operan
 
 <h5>Arguments:</h5>
 
-The two arguments to the '<tt>and</tt>' instruction must be either <a
-href="#t_integral">integral</a> or <tt>bool</tt> values.  Both arguments must
-have identical types.<p>
+The two arguments to the '<tt>and</tt>' instruction must be <a
+href="#t_integral">integral</a> values.  Both arguments must have identical
+types.<p>
 
 
 <h5>Semantics:</h5>
-...<p>
+
+The truth table used for the '<tt>and</tt>' instruction is:<p>
+
+<center><table border=1 cellspacing=0 cellpadding=4>
+<tr><td>In0</td>  <td>In1</td>  <td>Out</td></tr>
+<tr><td>0</td>  <td>0</td>  <td>0</td></tr>
+<tr><td>0</td>  <td>1</td>  <td>0</td></tr>
+<tr><td>1</td>  <td>0</td>  <td>0</td></tr>
+<tr><td>1</td>  <td>1</td>  <td>1</td></tr>
+</table></center><p>
 
 
 <h5>Example:</h5>
@@ -1112,13 +1091,22 @@ inclusive or of its two operands.<p>
 
 <h5>Arguments:</h5>
 
-The two arguments to the '<tt>or</tt>' instruction must be either <a
-href="#t_integral">integral</a> or <tt>bool</tt> values.  Both arguments must
-have identical types.<p>
+The two arguments to the '<tt>or</tt>' instruction must be <a
+href="#t_integral">integral</a> values.  Both arguments must have identical
+types.<p>
 
 
 <h5>Semantics:</h5>
-...<p>
+
+The truth table used for the '<tt>or</tt>' instruction is:<p>
+
+<center><table border=1 cellspacing=0 cellpadding=4>
+<tr><td>In0</td>  <td>In1</td>  <td>Out</td></tr>
+<tr><td>0</td>  <td>0</td>  <td>0</td></tr>
+<tr><td>0</td>  <td>1</td>  <td>1</td></tr>
+<tr><td>1</td>  <td>0</td>  <td>1</td></tr>
+<tr><td>1</td>  <td>1</td>  <td>1</td></tr>
+</table></center><p>
 
 
 <h5>Example:</h5>
@@ -1144,13 +1132,22 @@ two operands.<p>
 
 <h5>Arguments:</h5>
 
-The two arguments to the '<tt>xor</tt>' instruction must be either <a
-href="#t_integral">integral</a> or <tt>bool</tt> values.  Both arguments must
-have identical types.<p>
+The two arguments to the '<tt>xor</tt>' instruction must be <a
+href="#t_integral">integral</a> values.  Both arguments must have identical
+types.<p>
 
 
 <h5>Semantics:</h5>
-...<p>
+
+The truth table used for the '<tt>xor</tt>' instruction is:<p>
+
+<center><table border=1 cellspacing=0 cellpadding=4>
+<tr><td>In0</td>  <td>In1</td>  <td>Out</td></tr>
+<tr><td>0</td>  <td>0</td>  <td>0</td></tr>
+<tr><td>0</td>  <td>1</td>  <td>1</td></tr>
+<tr><td>1</td>  <td>0</td>  <td>1</td></tr>
+<tr><td>1</td>  <td>1</td>  <td>0</td></tr>
+</table></center><p>
 
 
 <h5>Example:</h5>
@@ -1177,11 +1174,12 @@ specified number of bits.
 <h5>Arguments:</h5>
 
 The first argument to the '<tt>shl</tt>' instruction must be an <a
-href="#t_integral">integral</a> type.  The second argument must be an
+href="#t_integer">integer</a> type.  The second argument must be an
 '<tt>ubyte</tt>' type.<p>
 
 <h5>Semantics:</h5>
-... 0 bits are shifted into the emptied bit positions...<p>
+
+The value produced is <tt>var1</tt> * 2<sup><tt>var2</tt></sup>.<p>
 
 
 <h5>Example:</h5>
@@ -1205,10 +1203,13 @@ href="#t_integral">integral</a> type.  The second argument must be an
 The '<tt>shr</tt>' instruction returns the first operand shifted to the right a specified number of bits.
 
 <h5>Arguments:</h5>
-The first argument to the '<tt>shr</tt>' instruction must be an  <a href="#t_integral">integral</a> type.  The second argument must be an '<tt>ubyte</tt>' type.<p>
+The first argument to the '<tt>shr</tt>' instruction must be an  <a href="#t_integer">integer</a> type.  The second argument must be an '<tt>ubyte</tt>' type.<p>
 
 <h5>Semantics:</h5>
-... if the first argument is a <a href="#t_signed">signed</a> type, the most significant bit is duplicated in the newly free'd bit positions.  If the first argument is unsigned, zeros shall fill the empty positions...<p>
+
+If the first argument is a <a href="#t_signed">signed</a> type, the most
+significant bit is duplicated in the newly free'd bit positions.  If the first
+argument is unsigned, zero bits shall fill the empty positions.<p>
 
 <h5>Example:</h5>
 <pre>
@@ -1400,7 +1401,7 @@ operand.<p>
 
 <h5>Syntax:</h5>
 <pre>
-  &lt;result&gt; = getelementptr &lt;ty&gt;* &lt;ptrval&gt;{, uint &lt;aidx&gt;|, ubyte &lt;sidx&gt;}*
+  &lt;result&gt; = getelementptr &lt;ty&gt;* &lt;ptrval&gt;{, long &lt;aidx&gt;|, ubyte &lt;sidx&gt;}*
 </pre>
 
 <h5>Overview:</h5>
@@ -1410,7 +1411,7 @@ subelement of an aggregate data structure.<p>
 
 <h5>Arguments:</h5>
 
-This instruction takes a list of <tt>uint</tt> values and <tt>ubyte</tt>
+This instruction takes a list of <tt>long</tt> values and <tt>ubyte</tt>
 constants that indicate what form of addressing to perform.  The actual types of
 the arguments provided depend on the type of the first pointer argument.  The
 '<tt>getelementptr</tt>' instruction is used to index down through the type
@@ -1443,7 +1444,7 @@ The LLVM code generated by the GCC frontend is:
 %ST = type { int, double, %RT }
 
 int* "foo"(%ST* %s) {
-  %reg = getelementptr %ST* %s, uint 1, ubyte 2, ubyte 1, uint 5, uint 13
+  %reg = getelementptr %ST* %s, long 1, ubyte 2, ubyte 1, long 5, long 13
   ret int* %reg
 }
 </pre>
@@ -1452,7 +1453,7 @@ int* "foo"(%ST* %s) {
 
 The index types specified for the '<tt>getelementptr</tt>' instruction depend on
 the pointer type that is being index into.  <a href="t_pointer">Pointer</a> and
-<a href="t_array">array</a> types require '<tt>uint</tt>' values, and <a
+<a href="t_array">array</a> types require '<tt>long</tt>' values, and <a
 href="t_struct">structure</a> types require '<tt>ubyte</tt>'
 <b>constants</b>.<p>
 
@@ -1472,11 +1473,11 @@ given testcase is equivalent to:<p>
 
 <pre>
 int* "foo"(%ST* %s) {
-  %t1 = getelementptr %ST* %s , uint 1                        <i>; yields %ST*:%t1</i>
-  %t2 = getelementptr %ST* %t1, uint 0, ubyte 2               <i>; yields %RT*:%t2</i>
-  %t3 = getelementptr %RT* %t2, uint 0, ubyte 1               <i>; yields [10 x [20 x int]]*:%t3</i>
-  %t4 = getelementptr [10 x [20 x int]]* %t3, uint 0, uint 5  <i>; yields [20 x int]*:%t4</i>
-  %t5 = getelementptr [20 x int]* %t4, uint 0, uint 13        <i>; yields int*:%t5</i>
+  %t1 = getelementptr %ST* %s , long 1                        <i>; yields %ST*:%t1</i>
+  %t2 = getelementptr %ST* %t1, long 0, ubyte 2               <i>; yields %RT*:%t2</i>
+  %t3 = getelementptr %RT* %t2, long 0, ubyte 1               <i>; yields [10 x [20 x int]]*:%t3</i>
+  %t4 = getelementptr [10 x [20 x int]]* %t3, long 0, long 5  <i>; yields [20 x int]*:%t4</i>
+  %t5 = getelementptr [20 x int]* %t4, long 0, long 13        <i>; yields int*:%t5</i>
   ret int* %t5
 }
 </pre>
@@ -1485,8 +1486,8 @@ int* "foo"(%ST* %s) {
 
 <h5>Example:</h5>
 <pre>
-  <i>; yields {[12 x ubyte]*}:aptr</i>
-  %aptr = getelementptr {int, [12 x ubyte]}* %sptr, uint 0, ubyte 1
+  <i>; yields [12 x ubyte]*:aptr</i>
+  %aptr = getelementptr {int, [12 x ubyte]}* %sptr, long 0, ubyte 1
 </pre>
 
 
@@ -1554,7 +1555,7 @@ casting pointers).<p>
 
 <h5>Arguments:</h5>
 
-The '<tt>cast</tt>' instruction takes a value to case, which must be a first
+The '<tt>cast</tt>' instruction takes a value to cast, which must be a first
 class value, and a type to cast it to, which must also be a first class type.<p>
 
 <h5>Semantics:</h5>
@@ -1562,12 +1563,20 @@ class value, and a type to cast it to, which must also be a first class type.<p>
 This instruction follows the C rules for explicit casts when determining how the
 data being cast must change to fit in its new container.<p>
 
-When casting to bool, any value that would be considered true in the context of a C '<tt>if</tt>' condition is converted to the boolean '<tt>true</tt>' values, all else are '<tt>false</tt>'.<p>
+When casting to bool, any value that would be considered true in the context of
+a C '<tt>if</tt>' condition is converted to the boolean '<tt>true</tt>' values,
+all else are '<tt>false</tt>'.<p>
+
+When extending an integral value from a type of one signness to another (for
+example '<tt>sbyte</tt>' to '<tt>ulong</tt>'), the value is sign-extended if the
+<b>source</b> value is signed, and zero-extended if the source value is
+unsigned.  <tt>bool</tt> values are always zero extended into either zero or
+one.<p>
 
 <h5>Example:</h5>
 <pre>
   %X = cast int 257 to ubyte              <i>; yields ubyte:1</i>
-  %Y = cast int 123 to bool               <i>; yields bool::true</i>
+  %Y = cast int 123 to bool               <i>; yields bool:true</i>
 </pre>
 
 
@@ -1594,7 +1603,7 @@ invoked.  The argument types must match the types implied by this signature.<p>
 
 <li>'<tt>fnptrval</tt>': An LLVM value containing a pointer to a function to be
 invoked. In most cases, this is a direct function invocation, but indirect
-<tt>call</tt>'s are just as possible, calling an arbitrary pointer to function
+<tt>call</tt>s are just as possible, calling an arbitrary pointer to function
 values.<p>
 
 <li>'<tt>function args</tt>': argument list whose types match the function
@@ -1697,7 +1706,7 @@ more...
 <address><a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
 <!-- Created: Tue Jan 23 15:19:28 CST 2001 -->
 <!-- hhmts start -->
-Last modified: Mon May  6 17:07:42 CDT 2002
+Last modified: Fri Dec 13 00:00:57 CST 2002
 <!-- hhmts end -->
 </font>
 </body></html>