Adding dllimport, dllexport and external weak linkage types.
[oota-llvm.git] / docs / BytecodeFormat.html
index 0e36db2eb4b63ff479a8e021c9c9ee870f74ff8b..2b856a71631134dce97a331b5f2011723c088d58 100644 (file)
@@ -39,8 +39,8 @@
       <li><a href="#constantpool">Global Constant Pool</a></li>
       <li><a href="#functiondefs">Function Definition</a></li>
       <li><a href="#compactiontable">Compaction Table</a></li>
-      <li><a href="#instructionlist">Instruction List</a></li>
-      <li><a href="#opcodes">Instruction Opcodes</a></li>
+      <li><a href="#instructionlist">Instructions List</a></li>
+      <li><a href="#instructions">Instructions</a></li>
       <li><a href="#symtab">Symbol Table</a></li>
     </ol>
   </li>
@@ -732,7 +732,7 @@ as shown in the following table.</p>
 </table>
 <p>
 Of particular note, the bytecode format number is simply a 28-bit
-monotonically increase integer that identifies the version of the bytecode
+monotonically increasing integer that identifies the version of the bytecode
 format (which is not directly related to the LLVM release number). The
 bytecode versions defined so far are (note that this document only
 describes the latest version, 1.3):</p>
@@ -740,12 +740,14 @@ describes the latest version, 1.3):</p>
   <li>#0: LLVM 1.0 &amp; 1.1</li>
   <li>#1: LLVM 1.2</li>
   <li>#2: LLVM 1.2.5 (not released)</li>
-  <li>#3: LLVM 1.3<br>
+  <li>#3: LLVM 1.3</li>
+  <li>#4: LLVM 1.3.x (not released)</li>
+  <li>#5: LLVM 1.4 and newer</li>
   </li>
 </ul>
 <p>Note that we plan to eventually expand the target description
 capabilities
-of bytecode files to <a href="http://llvm.cs.uiuc.edu/PR263">target
+of bytecode files to <a href="http://llvm.org/PR263">target
 triples</a>.
 </p>
 </div>
@@ -953,8 +955,7 @@ all functions. The format is shown in the table below:</p>
     </tr>
     <tr>
       <td><a href="#block">block</a></td>
-      <td class="td_left">Module global info identifier (0x05) + size<br>
-      </td>
+      <td class="td_left">Module global info identifier (0x05) + size</td>
     </tr>
     <tr>
       <td><a href="#zlist">zlist</a>(<a href="#globalvar">globalvar</a>)</td>
@@ -967,21 +968,26 @@ definitions occurring in the module.</td>
 occurring in the module.</td>
     </tr>
     <tr>
-      <td style="vertical-align: top;"><a href="#llist">llist</a>(<a
- href="#string">string</a>)<br>
-      </td>
-      <td style="vertical-align: top; text-align: left;">A length list
+      <td><a href="#llist">llist</a>(<a href="#string">string</a>)</td>
+      <td class="td_left">A length list
 of strings that specify the names of the libraries that this module
-depends upon.<br>
-      </td>
+depends upon.</td>
     </tr>
     <tr>
-      <td style="vertical-align: top;"><a href="#string">string</a><br>
-      </td>
-      <td style="vertical-align: top; text-align: left;">The target
+      <td><a href="#string">string</a></td>
+      <td class="td_left">The target
 triple for the module (blank means no target triple specified, i.e. a
-platform independent module).<br>
-      </td>
+platform independent module).</td>
+    </tr>
+    <tr>
+      <td><a href="#llist">llist</a>(<a href="#string">string</a>)</td>
+      <td class="td_left">A length list
+of strings that defines a table of section strings for globals.  A global's
+SectionID is an index into this table.</td>
+    </tr>
+    <tr>
+      <td><a href="#string">string</a></td>
+      <td class="td_left">The inline asm block for this module.</td>
     </tr>
   </tbody>
 </table>
@@ -990,12 +996,16 @@ platform independent module).<br>
 <!-- _______________________________________________________________________ -->
 <div class="doc_subsubsection"><a name="globalvar">Global Variable Field</a>
 </div>
+
 <div class="doc_text">
+
 <p>Global variables are written using an <a href="#uint32_vbr">uint32_vbr</a>
-that encodes information about the global variable and a list of the
-constant initializers for the global var, if any.</p>
+that encodes information about the global variable, an optional extension vbr,
+and a an optional initializers for the global var.</p>
+
 <p>The table below provides the bit layout of the first <a
  href="#uint32_vbr">uint32_vbr</a> that describes the global variable.</p>
 <table>
   <tbody>
     <tr>
@@ -1015,7 +1025,8 @@ follows. </td>
     <tr>
       <td><a href="#bit">bit(2-4)</a></td>
       <td class="td_left">Linkage type: 0=External, 1=Weak,
-2=Appending, 3=Internal, 4=LinkOnce</td>
+        2=Appending, 3=Internal, 4=LinkOnce, 5=DllImport, 
+        6=DllExport, 7=ExternWeak</td>
     </tr>
     <tr>
       <td><a href="#bit">bit(5-31)</a></td>
@@ -1023,8 +1034,65 @@ follows. </td>
     </tr>
   </tbody>
 </table>
-<p>The table below provides the format of the constant initializers for
-the global variable field, if it has one.</p>
+
+<p>When the Linkage type is set to 3 (internal) and the initializer field is set
+to 0 (an invalid combination), an extension word follows the first <a
+href="#uint32_vbr">uint32_vbr</a> which encodes the real linkage and init flag,
+and can includes more information:</p>
+
+<table>
+  <tbody>
+    <tr>
+      <th><b>Type</b></th>
+      <th class="td_left"><b>Description</b></th>
+    </tr>
+    <tr>
+      <td><a href="#bit">bit(0)</a></td>
+      <td class="td_left">Has initializer?  Indicates the real value of the "Has
+        initializer" field for the global. </td>
+    </tr>
+    <tr>
+      <td><a href="#bit">bit(2-4)</a></td>
+      <td class="td_left">Linkage type: Indicates the real value of the "linkage
+        type" field for the global.</td>
+    </tr>
+    <tr>
+      <td><a href="#bit">bit(4-8)</a></td>
+      <td class="td_left">The log-base-2 of the alignment for the global.</td>
+    </tr>
+    <tr>
+      <td><a href="#bit">bit(9)</a></td>
+      <td class="td_left">If this bit is set, a SectionID follows this vbr.</td>
+    </tr>
+    <tr>
+      <td><a href="#bit">bit(10-31)</a></td>
+      <td class="td_left">Currently unassigned.</td>
+    </tr>
+  </tbody>
+</table>
+
+<p>If the SectionID bit is set above, the following field is included:</p>
+
+<table>
+  <tbody>
+    <tr>
+      <th><b>Type</b></th>
+      <th class="td_left"><b>Description</b></th>
+    </tr>
+    <tr>
+      <td><a href="#uint32_vbr">uint32_vbr</a>
+      </td>
+      <td class="td_left">An optional section ID number, specifying the string
+        to use for the section of the global.  This an index (+1) of an entry
+        into the SectionID llist in the <a href="#globalinfo">Module Global
+        Info</a> block.  If this value is 0 or not present, the global has an
+        empty section string.</td>
+    </tr>
+  </tbody>
+</table>
+
+<p>If the "Has initializer" field is set, the following field is included:</p>
+
 <table>
   <tbody>
     <tr>
@@ -1032,10 +1100,10 @@ the global variable field, if it has one.</p>
       <th class="td_left"><b>Description</b></th>
     </tr>
     <tr>
-      <td>(<a href="#zlist">zlist</a>(<a href="#uint32_vbr">uint32_vbr</a>))?
+      <td><a href="#uint32_vbr">uint32_vbr</a>
       </td>
-      <td class="td_left">An optional zero-terminated list of value slot
-numbers of the global variable's constant initializer.</td>
+      <td class="td_left">An optional value slot number for the global 
+          variable's constant initializer.</td>
     </tr>
   </tbody>
 </table>
@@ -1046,7 +1114,8 @@ numbers of the global variable's constant initializer.</td>
 </div>
 <div class="doc_text">
 <p>Functions are written using an <a href="#uint32_vbr">uint32_vbr</a>
-that encodes information about the function and a set of flags.</p>
+that encodes information about the function and a set of flags.  If needed,
+an extension word may follow this first field.</p>
 
 <p>The table below provides the bit layout of the <a
 href="#uint32_vbr">uint32_vbr</a> that describes the function.</p>
@@ -1060,8 +1129,7 @@ href="#uint32_vbr">uint32_vbr</a> that describes the function.</p>
     <tr>
       <td><a href="#bit">bit(0-3)</a></td>
       <td class="td_left">
-      Encodes the calling convention number of the function.  If this number is
-      zero, this field is followed by a vbr indicating the CC#.  Otherwise, the
+      Encodes the calling convention number of the function. The
       CC number of the function is the value of this field minus one.
       </td>
     </tr>
@@ -1069,11 +1137,71 @@ href="#uint32_vbr">uint32_vbr</a> that describes the function.</p>
       <td><a href="#bit">bit(4)</a></td>
       <td class="td_left">If this bit is set to 1, the indicated function is
       external, and there is no <a href="#functiondefs">Function Definiton
-      Block</a> in the bytecode file for the function.</td>
+      Block</a> in the bytecode file for the function. If the function is
+      external and has <tt>dllimport or extern_weak</tt> linkage additional
+      field in the extension word is used to indicate the actual linkage
+      type.</td>
     </tr>
     <tr>
-      <td><a href="#bit">bit(5-)</a></td>
+      <td><a href="#bit">bit(5-30)</a></td>
       <td class="td_left">Type slot number of type for the function.</td>
+    </tr>
+                                      <tr>
+      <td><a href="#bit">bit(31)</a></td>
+      <td class="td_left">Indicates whether an extension word follows.</td>
+    </tr>
+  </tbody>
+</table>
+
+<p>If bit(31) is set, an additional <a href="#uint32_vbr">uint32_vbr</a> word
+follows with the following fields:</p>
+
+<table>
+  <tbody>
+    <tr>
+      <th><b>Type</b></th>
+      <th class="td_left"><b>Description</b></th>
+    </tr>
+    <tr>
+      <td><a href="#bit">bit(0-4)</a></td>
+      <td class="td_left">The log-base-2 of the alignment for the function.</td>
+    </tr>
+    <tr>
+      <td><a href="#bit">bit(5-9)</a></td>
+      <td class="td_left">The top nibble of the calling convention.</td>
+    </tr>
+    <tr>
+      <td><a href="#bit">bit(10)</a></td>
+      <td class="td_left">If this bit is set, a SectionID follows this vbr.</td>
+    </tr>
+    <tr>
+      <td><a href="#bit">bit(11-12)</a></td>
+      <td class="td_left">Linkage type for external functions. 0 - External
+        linkage, 1 - DLLImport linkage, 2 - External weak linkage.</td>
+    </tr>
+    <tr>
+      <td><a href="#bit">bit(13-31)</a></td>
+      <td class="td_left">Currently unassigned.</td>
+    </tr>
+  </tbody>
+</table>
+
+<p>If the SectionID bit is set above, the following field is included:</p>
+
+<table>
+  <tbody>
+    <tr>
+      <th><b>Type</b></th>
+      <th class="td_left"><b>Description</b></th>
+    </tr>
+    <tr>
+      <td><a href="#uint32_vbr">uint32_vbr</a>
+      </td>
+      <td class="td_left">An optional section ID number, specifying the string
+        to use for the section of the function.  This an index (+1) of an entry
+        into the SectionID llist in the <a href="#globalinfo">Module Global
+        Info</a> block.  If this value is 0 or not present, the function has an
+        empty section string.</td>
     </tr>
   </tbody>
 </table>
@@ -1156,16 +1284,21 @@ for the details. </p>
   </tbody>
 </table>
 </div>
+
 <!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="constant">Constant Field</a></div>
+<div class="doc_subsubsection"><a name="constant">Simple Constant Pool
+Entries</a></div>
+
 <div class="doc_text">
-<p>Constants come in many shapes and flavors. The sections that follow
-define the format for each of them. All constants start with a <a
+
+<p>Constant pool entries come in many shapes and flavors. The sections that
+follow define the format for each of them. All constants start with a <a
  href="#uint32_vbr">uint32_vbr</a> encoded integer that provides the
 number of operands for the constant. For primitive, structure, and
-array constants, this will always be zero since those types of
-constants have no operands. In this case, we have the following field
-definitions:</p>
+array constants, this will always be zero to indicate that the form of the 
+constant is solely determined by its type. In this case, we have the following
+field definitions, based on type:</p>
+
 <ul>
   <li><b>Bool</b>. This is written as an <a href="#uint32_vbr">uint32_vbr</a>
 of value 1U or 0U.</li>
@@ -1184,12 +1317,59 @@ element values.</li>
 field values of the structure.</li>
 </ul>
 
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">Undef Entries</a></div>
+
+<div class="doc_text">
 <p>When the number of operands to the constant is one, we have an 'undef' value
 of the specified type.</p>
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">Inline Assembler Entries</a></div>
+
+<div class="doc_text">
+<p>Inline Assembler entries are stored in the constant pool, though they are not
+   officially LLVM constants.  These entries are marked with a value of
+   "4294967295" (all ones) for the number of operands.  They are encoded as
+   follows:</p>
+   
+<table>
+  <tbody>
+    <tr>
+      <th><b>Type</b></th>
+      <th class="td_left"><b>Field Description</b></th>
+    </tr>
+    <tr>
+      <td><a href="#string">string</a></td>
+      <td class="td_left">The asm string.</td>
+    </tr>
+    <tr>
+      <td><a href="#string">string</a></td>
+      <td class="td_left">The constraints string.</td>
+    </tr>
+    <tr>
+      <td><a href="#uint32_vbr">uint32_vbr</a></td>
+      <td class="td_left">Flags</sup></td>
+    </tr>
+  </tbody>
+</table>
+
+<p>Currently, the only defined flag, the low bit, indicates whether or not the
+   inline assembler has side effects.</p>
+
+</div>
 
-<p>When the number of operands to the constant is greater than one, we have a
-constant expression and its field format is provided in the table below, and the
-number is equal to the number of operands+1.</p>
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">Constant Expression Entries</a></div>
+
+<div class="doc_text">
+
+<p>Otherwise, we have a constant expression.  The format of the constant
+expression is specified in the table below, and the number is equal to the
+number of operands+1.</p>
 <table>
   <tbody>
     <tr>
@@ -1239,8 +1419,8 @@ size<br>
     </tr>
     <tr>
       <td><a href="#uint32_vbr">uint32_vbr</a></td>
-      <td class="td_left">The linkage type of the function: 0=External,
-1=Weak, 2=Appending, 3=Internal, 4=LinkOnce<sup>1</sup></td>
+      <td class="td_left">The linkage type of the function: 0=External, 1=Weak,
+2=Appending, 3=Internal, 4=LinkOnce, 5=DllImport, 6=DllExport<sup>1</sup></td>
     </tr>
     <tr>
       <td><a href="#block">block</a></td>
@@ -1361,8 +1541,155 @@ of formats. See <a href="#instruction">Instructions</a> for details.</td>
   </tbody>
 </table>
 </div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsection"><a name="instructions">Instructions</a></div>
+
+<div class="doc_text">
+<p>Instructions are written out one at a time as distinct units.  Each
+instruction
+record contains at least an <a href="#opcodes">opcode</a> and a type field, 
+and may contain a <a href="#instoperands">list of operands</a> (whose
+interpretation depends on the opcode). Based on the number of operands, the
+<a href="#instencode">instruction is encoded</a> in a
+dense format that tries to encoded each instruction into 32-bits if 
+possible. </p>
+</div>
+
 <!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="instruction">Instructions</a></div>
+<div class="doc_subsubsection"><a name="opcodes">Instruction Opcodes</a></div>
+<div class="doc_text">
+  <p>Instructions encode an opcode that identifies the kind of instruction.
+  Opcodes are an enumerated integer value. The specific values used depend on
+  the version of LLVM you're using. The opcode values are defined in the
+  <a href="http://llvm.org/cvsweb/cvsweb.cgi/llvm/include/llvm/Instruction.def">
+  <tt>include/llvm/Instruction.def</tt></a> file. You should check there for the
+  most recent definitions. The table below provides the opcodes defined as of
+  the writing of this document. The table associates each opcode mnemonic with
+  its enumeration value and the bytecode and LLVM version numbers in which the
+  opcode was introduced.</p>
+  <table>
+    <tbody>
+      <tr>
+        <th>Opcode</th>
+        <th>Number</th>
+        <th>Bytecode Version</th>
+        <th>LLVM Version</th>
+      </tr>
+      <tr><td colspan="4"><b>Terminator Instructions</b></td></tr>
+      <tr><td>Ret</td><td>1</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Br</td><td>2</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Switch</td><td>3</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Invoke</td><td>4</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Unwind</td><td>5</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Unreachable</td><td>6</td><td>1</td><td>1.4</td></tr>
+      <tr><td colspan="4"><b>Binary Operators</b></td></tr>
+      <tr><td>Add</td><td>7</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Sub</td><td>8</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Mul</td><td>9</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Div</td><td>10</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Rem</td><td>11</td><td>1</td><td>1.0</td></tr>
+      <tr><td colspan="4"><b>Logical Operators</b></td></tr>
+      <tr><td>And</td><td>12</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Or</td><td>13</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Xor</td><td>14</td><td>1</td><td>1.0</td></tr>
+      <tr><td colspan="4"><b>Binary Comparison Operators</b></td></tr>
+      <tr><td>SetEQ</td><td>15</td><td>1</td><td>1.0</td></tr>
+      <tr><td>SetNE</td><td>16</td><td>1</td><td>1.0</td></tr>
+      <tr><td>SetLE</td><td>17</td><td>1</td><td>1.0</td></tr>
+      <tr><td>SetGE</td><td>18</td><td>1</td><td>1.0</td></tr>
+      <tr><td>SetLT</td><td>19</td><td>1</td><td>1.0</td></tr>
+      <tr><td>SetGT</td><td>20</td><td>1</td><td>1.0</td></tr>
+      <tr><td colspan="4"><b>Memory Operators</b></td></tr>
+      <tr><td>Malloc</td><td>21</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Free</td><td>22</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Alloca</td><td>23</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Load</td><td>24</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Store</td><td>25</td><td>1</td><td>1.0</td></tr>
+      <tr><td>GetElementPtr</td><td>26</td><td>1</td><td>1.0</td></tr>
+      <tr><td colspan="4"><b>Other Operators</b></td></tr>
+      <tr><td>PHI</td><td>27</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Cast</td><td>28</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Call</td><td>29</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Shl</td><td>30</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Shr</td><td>31</td><td>1</td><td>1.0</td></tr>
+      <tr><td>VANext</td><td>32</td><td>1</td><td>1.0</td></tr>
+      <tr><td>VAArg</td><td>33</td><td>1</td><td>1.0</td></tr>
+      <tr><td>Select</td><td>34</td><td>2</td><td>1.2</td></tr>
+      <tr><td colspan="4">
+          <b>Pseudo Instructions<a href="#pi_note">*</a></b>
+      </td></tr>
+      <tr><td>Invoke+CC </td><td>56</td><td>5</td><td>1.5</td></tr>
+      <tr><td>Invoke+FastCC</td><td>57</td><td>5</td><td>1.5</td></tr>
+      <tr><td>Call+CC</td><td>58</td><td>5</td><td>1.5</td></tr>
+      <tr><td>Call+FastCC+TailCall</td><td>59</td><td>5</td><td>1.5</td></tr>
+      <tr><td>Call+FastCC</td><td>60</td><td>5</td><td>1.5</td></tr>
+      <tr><td>Call+CCC+TailCall</td><td>61</td><td>5</td><td>1.5</td></tr>
+      <tr><td>Load+Volatile</td><td>62</td><td>3</td><td>1.3</td></tr>
+      <tr><td>Store+Volatile</td><td>63</td><td>3</td><td>1.3</td></tr>
+    </tbody>
+  </table>
+
+<p><b><a name="pi_note">* Note: </a></b>
+These aren't really opcodes from an LLVM language perspective. They encode
+information into other opcodes without reserving space for that information. 
+For example, opcode=63 is a Volatile Store. The opcode for this
+instruction is 25 (Store) but we encode it as 63 to indicate that is a Volatile
+Store. The same is done for the calling conventions and tail calls.
+In each of these entries in range 56-63, the opcode is documented as the base
+opcode (Invoke, Call, Store) plus some set of modifiers, as follows:</p>
+<dl>
+  <dt>CC</dt>
+  <dd>This means an arbitrary calling convention is specified
+  in a VBR that follows the opcode. This is used when the instruction cannot
+  be encoded with one of the more compact forms.
+  </dd>
+  <dt>FastCC</dt>
+  <dd>This indicates that the Call or Invoke is using the FastCC calling 
+  convention.</dd>
+  <dt>CCC</dt>
+  <dd>This indicates that the Call or Invoke is using the native "C" calling 
+  convention.</dd>
+  <dt>TailCall</dt>
+  <dd>This indicates that the Call has the 'tail' modifier.</dd>
+</dl>
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"><a name="instoperands">Instruction
+Operands</a></div>
+
+<div class="doc_text">
+<p>
+Based on the instruction opcode and type, the bytecode format implicitly (to 
+save space) specifies the interpretation of the operand list.  For most
+instructions, the type of each operand is implicit from the type of the 
+instruction itself (e.g. the type of operands of a binary operator must match
+the type of the instruction).  As such, the bytecode format generally only 
+encodes the value number of the operand, not the type.</p>
+
+<p>In some cases, however, this is not sufficient.  This section enumerates
+those cases:</p>
+
+<ul>
+<li>getelementptr: the slot numbers for sequential type indexes are shifted up
+two bits.  This allows the low order bits will encode the type of index used,
+as follows: 0=uint, 1=int, 2=ulong, 3=long.</li>
+<li>cast: the result type number is encoded as the second operand.</li>
+<li>alloca/malloc: If the allocation has an explicit alignment, the log2 of the
+    alignment is encoded as the second operand.</li>
+<li>call: If the tail marker and calling convention cannot be <a 
+    href="#pi_note">encoded into the opcode</a> of the call, it is passed as an
+    additional operand.  The low bit of the operand is a flag indicating whether
+    the call is a tail call.  The rest of the bits contain the calling 
+    convention number (shifted left by one bit).</li>
+</ul>
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"><a name="instencode">Instruction 
+Encoding</a></div>
+
 <div class="doc_text">
 <p>For brevity, instructions are written in one of four formats,
 depending on the number of operands to the instruction. Each
@@ -1399,17 +1726,11 @@ format.</td>
     <tr>
       <td><a href="#uint32_vbr">uint32_vbr</a>+</td>
       <td class="td_left">The slot number of the value(s) for the operand(s).
-        <sup>1</sup></td>
+      </td>
     </tr>
   </tbody>
 </table>
-Notes:
-<ol>
-  <li>Note that if the instruction is a getelementptr and the type of
-the operand is a sequential type (array or pointer) then the slot
-number is shifted up two bits and the low order bits will encode the
-type of index used, as follows: 0=uint, 1=int, 2=ulong, 3=long.</li>
-</ol>
+
 <p><b>Instruction Format 1</b></p>
 <p>This format encodes the opcode, type and a single operand into a
 single <a href="#uint32_vbr">uint32_vbr</a> as follows:</p>
@@ -1428,7 +1749,7 @@ single <a href="#uint32_vbr">uint32_vbr</a> as follows:</p>
     </tr>
     <tr>
       <td>2-7</td>
-      <td><a href="#opcode">opcode</a></td>
+      <td><a href="#instructions">opcode</a></td>
       <td class="td_left">Specifies the opcode of the instruction. Note that 
         the maximum opcode value is 63.</td>
     </tr>
@@ -1465,7 +1786,7 @@ single <a href="#uint32_vbr">uint32_vbr</a> as follows:</p>
     </tr>
     <tr>
       <td>2-7</td>
-      <td><a href="#opcodes">opcode</a></td>
+      <td><a href="#instructions">opcode</a></td>
       <td class="td_left">Specifies the opcode of the instruction. Note that 
         the maximum opcode value is 63.</td>
     </tr>
@@ -1507,7 +1828,7 @@ single <a href="#uint32_vbr">uint32_vbr</a> as follows:</p>
     </tr>
     <tr>
       <td>2-7</td>
-      <td><a href="#opcodes">opcode</a></td>
+      <td><a href="#instructions">opcode</a></td>
       <td class="td_left">Specifies the opcode of the instruction. Note that 
         the maximum opcode value is 63.</td>
     </tr>
@@ -1539,106 +1860,6 @@ single <a href="#uint32_vbr">uint32_vbr</a> as follows:</p>
 </table>
 </div>
 
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="opcodes">Instruction Opcodes</a></div>
-<div class="doc_text">
-  <p>Instructions encode an opcode that identifies the kind of instruction.
-  Opcodes are an enumerated integer value. The specific values used depend on
-  the version of LLVM you're using. The opcode values are defined in the
-  <a href="http://llvm.cs.uiuc.edu/cvsweb/cvsweb.cgi/llvm/include/llvm/Instruction.def">
-  <tt>include/llvm/Instruction.def</tt></a> file. You should check there for the
-  most recent definitions. The table below provides the opcodes defined as of
-  the writing of this document. The table associates each opcode mnemonic with
-  its enumeration value and the bytecode and LLVM version numbers in which the
-  opcode was introduced.</p>
-  <table>
-    <tbody>
-      <tr>
-        <th>Opcode</th>
-        <th>Number</th>
-        <th>Bytecode Version</th>
-        <th>LLVM Version</th>
-      </tr>
-      <tr><td colspan="4"><b>Terminator Instructions</b></td></tr>
-      <tr><td>Ret</td><td>1</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Br</td><td>2</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Switch</td><td>3</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Invoke</td><td>4</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Unwind</td><td>5</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Unreachable</td><td>6</td><td>1</td><td>1.4</td></tr>
-      <tr><td colspan="4"><b>Binary Operators</b></td></tr>
-      <tr><td>Add</td><td>7</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Sub</td><td>8</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Mul</td><td>9</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Div</td><td>10</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Rem</td><td>11</td><td>1</td><td>1.0</td></tr>
-      <tr><td colspan="4"><b>Logical Operators</b></td></tr>
-      <tr><td>And</td><td>12</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Or</td><td>13</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Xor</td><td>14</td><td>1</td><td>1.0</td></tr>
-      <tr><td colspan="4"><b>Binary Comparison Operators</b></td></tr>
-      <tr><td>SetEQ</td><td>15</td><td>1</td><td>1.0</td></tr>
-      <tr><td>SetNE</td><td>16</td><td>1</td><td>1.0</td></tr>
-      <tr><td>SetLE</td><td>17</td><td>1</td><td>1.0</td></tr>
-      <tr><td>SetGE</td><td>18</td><td>1</td><td>1.0</td></tr>
-      <tr><td>SetLT</td><td>19</td><td>1</td><td>1.0</td></tr>
-      <tr><td>SetGT</td><td>20</td><td>1</td><td>1.0</td></tr>
-      <tr><td colspan="4"><b>Memory Operators</b></td></tr>
-      <tr><td>Malloc</td><td>21</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Free</td><td>22</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Alloca</td><td>23</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Load</td><td>24</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Store</td><td>25</td><td>1</td><td>1.0</td></tr>
-      <tr><td>GetElementPtr</td><td>26</td><td>1</td><td>1.0</td></tr>
-      <tr><td colspan="4"><b>Other Operators</b></td></tr>
-      <tr><td>PHI</td><td>27</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Cast</td><td>28</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Call</td><td>29</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Shl</td><td>30</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Shr</td><td>31</td><td>1</td><td>1.0</td></tr>
-      <tr><td>VANext</td><td>32</td><td>1</td><td>1.0</td></tr>
-      <tr><td>VAArg</td><td>33</td><td>1</td><td>1.0</td></tr>
-      <tr><td>Select</td><td>34</td><td>2</td><td>1.2</td></tr>
-      <tr><td colspan="4">
-          <b>Pseudo Instructions<a href="#pi_note">*</a></b>
-      </td></tr>
-      <tr><td>Invoke+CC </td><td>56</td><td>5</td><td>1.5</td></tr>
-      <tr><td>Invoke+FastCC</td><td>57</td><td>5</td><td>1.5</td></tr>
-      <tr><td>Call+CC</td><td>58</td><td>5</td><td>1.5</td></tr>
-      <tr><td>Call+FastCC+TailCall</td><td>59</td><td>5</td><td>1.5</td></tr>
-      <tr><td>Call+FastCC</td><td>60</td><td>5</td><td>1.5</td></tr>
-      <tr><td>Call+CCC+TailCall</td><td>61</td><td>5</td><td>1.5</td></tr>
-      <tr><td>Load+Volatile</td><td>62</td><td>3</td><td>1.3</td></tr>
-      <tr><td>Store+Volatile</td><td>63</td><td>3</td><td>1.3</td></tr>
-    </tbody>
-  </table>
-</div>
-
-<p><b><a name="pi_note">* Note: </a></b>
-These aren't really opcodes from an LLVM language prespeective. They encode
-information into other opcodes without reserving space for that information. 
-For example, opcode=63 is a Volatile Store. The opcode for this
-instruction is 25 (Store) but we encode it as 63 to indicate that is a Volatile
-Store. The same is done for the calling conventions and tail calls.
-In each of these entries in range 56-63, the opcode is documented as the base
-opcode (Invoke, Call, Store) plus some set of modifiers, as follows:</p>
-<dl>
-  <dt>CC</dt>
-  <dd>This means a generic (user defined) calling convention number is specified
-  in a VBR that follows the opcode immediately. This is used when the calling 
-  convention for the Invoke or the Call instruction is not one of the LLVM 
-  standard ones (like FastCC or CCC)
-  </dd>
-  <dt>FastCC</dt>
-  <dd>This indicates that the Call or Invoke is using the FastCC calling 
-  convention which puts arguments in registers to avoid stack loading.</dd>
-  <dt>CCC</dt>
-  <dd>This indicates that the Call or Invoke is using the "C" calling convention
-  which is specified by the C99 language.</dd>
-  <dt>TailCall</dt>
-  <dd>This indicates that the Call or Invoke is a tail call.</dd>
-</dl>
-
 <!-- _______________________________________________________________________ -->
 <div class="doc_subsection"><a name="symtab">Symbol Table</a> </div>
 <div class="doc_text">
@@ -1935,7 +2156,7 @@ From 1.1</a></div>
  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
 <a href="mailto:rspencer@x10sys.com">Reid Spencer</a> and <a
  href="mailto:sabre@nondot.org">Chris Lattner</a><br>
-<a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a><br>
+<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
 Last modified: $Date$
 </address>
 </body>