Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 2 | <html> |
| 3 | <head> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 5 | <title>LLVM Bytecode File Format</title> |
| 6 | <link rel="stylesheet" href="llvm.css" type="text/css"> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 7 | <style type="text/css"> |
Reid Spencer | 2de2999 | 2004-08-03 20:21:05 +0000 | [diff] [blame] | 8 | TR, TD { border: 2px solid gray; padding-left: 4pt; padding-right: 4pt; |
| 9 | padding-top: 2pt; padding-bottom: 2pt; } |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 10 | TH { border: 2px solid gray; font-weight: bold; font-size: 105%; } |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 11 | TABLE { text-align: center; border: 2px solid black; |
Reid Spencer | 2de2999 | 2004-08-03 20:21:05 +0000 | [diff] [blame] | 12 | border-collapse: collapse; margin-top: 1em; margin-left: 1em; |
| 13 | margin-right: 1em; margin-bottom: 1em; } |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 14 | .td_left { border: 2px solid gray; text-align: left; } |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 15 | </style> |
| 16 | </head> |
| 17 | <body> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 18 | <div class="doc_title"> LLVM Bytecode File Format </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 19 | <ol> |
| 20 | <li><a href="#abstract">Abstract</a></li> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 21 | <li><a href="#concepts">Concepts</a> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 22 | <ol> |
| 23 | <li><a href="#blocks">Blocks</a></li> |
| 24 | <li><a href="#lists">Lists</a></li> |
| 25 | <li><a href="#fields">Fields</a></li> |
| 26 | <li><a href="#align">Alignment</a></li> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 27 | <li><a href="#vbr">Variable Bit-Rate Encoding</a></li> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 28 | <li><a href="#encoding">Encoding Primitives</a></li> |
| 29 | <li><a href="#slots">Slots</a></li> |
| 30 | </ol> |
| 31 | </li> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 32 | <li><a href="#general">General Structure</a> </li> |
| 33 | <li><a href="#blockdefs">Block Definitions</a> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 34 | <ol> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame] | 35 | <li><a href="#signature">Signature Block</a></li> |
| 36 | <li><a href="#module">Module Block</a></li> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 37 | <li><a href="#globaltypes">Global Type Pool</a></li> |
| 38 | <li><a href="#globalinfo">Module Info Block</a></li> |
| 39 | <li><a href="#constantpool">Global Constant Pool</a></li> |
| 40 | <li><a href="#functiondefs">Function Definition</a></li> |
| 41 | <li><a href="#compactiontable">Compaction Table</a></li> |
| 42 | <li><a href="#instructionlist">Instruction List</a></li> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 43 | <li><a href="#opcodes">Instruction Opcodes</a></li> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 44 | <li><a href="#symtab">Symbol Table</a></li> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 45 | </ol> |
| 46 | </li> |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 47 | <li><a href="#versiondiffs">Version Differences</a> |
| 48 | <ol> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 49 | <li><a href="#vers13">Version 1.3 Differences From 1.4</a></li> |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 50 | <li><a href="#vers12">Version 1.2 Differences From 1.3</a></li> |
| 51 | <li><a href="#vers11">Version 1.1 Differences From 1.2</a></li> |
| 52 | <li><a href="#vers10">Version 1.0 Differences From 1.1</a></li> |
| 53 | </ol> |
| 54 | </li> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 55 | </ol> |
Chris Lattner | 8dabb50 | 2004-05-25 17:44:58 +0000 | [diff] [blame] | 56 | <div class="doc_author"> |
| 57 | <p>Written by <a href="mailto:rspencer@x10sys.com">Reid Spencer</a> |
| 58 | </p> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 59 | </div> |
| 60 | <!-- *********************************************************************** --> |
| 61 | <div class="doc_section"> <a name="abstract">Abstract </a></div> |
| 62 | <!-- *********************************************************************** --> |
| 63 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 64 | <p>This document describes the LLVM bytecode file format. It specifies |
| 65 | the binary encoding rules of the bytecode file format so that |
| 66 | equivalent systems can encode bytecode files correctly. The LLVM |
| 67 | bytecode representation is used to store the intermediate |
| 68 | representation on disk in compacted form.</p> |
| 69 | <p>The LLVM bytecode format may change in the future, but LLVM will |
| 70 | always be backwards compatible with older formats. This document will |
| 71 | only describe the most current version of the bytecode format. See <a |
| 72 | href="#versiondiffs">Version Differences</a> for the details on how |
| 73 | the current version is different from previous versions.</p> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 74 | </div> |
| 75 | <!-- *********************************************************************** --> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 76 | <div class="doc_section"> <a name="concepts">Concepts</a> </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 77 | <!-- *********************************************************************** --> |
| 78 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 79 | <p>This section describes the general concepts of the bytecode file |
| 80 | format without getting into specific layout details. It is recommended |
| 81 | that you read this section thoroughly before interpreting the detailed |
| 82 | descriptions.</p> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 83 | </div> |
| 84 | <!-- _______________________________________________________________________ --> |
| 85 | <div class="doc_subsection"><a name="blocks">Blocks</a> </div> |
| 86 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 87 | <p>LLVM bytecode files consist simply of a sequence of blocks of bytes |
| 88 | using a binary encoding Each block begins with an header of two |
| 89 | unsigned integers. The first value identifies the type of block and the |
| 90 | second value provides the size of the block in bytes. The block |
| 91 | identifier is used because it is possible for entire blocks to be |
| 92 | omitted from the file if they are empty. The block identifier helps the |
| 93 | reader determine which kind of block is next in the file. Note that |
| 94 | blocks can be nested within other blocks.</p> |
| 95 | <p> All blocks are variable length, and the block header specifies the |
| 96 | size of the block. All blocks begin on a byte index that is aligned to |
| 97 | an even 32-bit boundary. That is, the first block is 32-bit aligned |
| 98 | because it starts at offset 0. Each block is padded with zero fill |
| 99 | bytes to ensure that the next block also starts on a 32-bit boundary.</p> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 100 | </div> |
| 101 | <!-- _______________________________________________________________________ --> |
| 102 | <div class="doc_subsection"><a name="lists">Lists</a> </div> |
| 103 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 104 | <p>LLVM Bytecode blocks often contain lists of things of a similar |
| 105 | type. For example, a function contains a list of instructions and a |
| 106 | function type contains a list of argument types. There are two basic |
| 107 | types of lists: length lists (<a href="#llist">llist</a>), and null |
| 108 | terminated lists (<a href="#zlist">zlist</a>), as described below in |
| 109 | the <a href="#encoding">Encoding Primitives</a>.</p> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 110 | </div> |
| 111 | <!-- _______________________________________________________________________ --> |
| 112 | <div class="doc_subsection"><a name="fields">Fields</a> </div> |
| 113 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 114 | <p>Fields are units of information that LLVM knows how to write atomically. Most |
| 115 | fields have a uniform length or some kind of length indication built into their |
| 116 | encoding. For example, a constant string (array of bytes) is written simply as |
| 117 | the length followed by the characters. Although this is similar to a list, |
| 118 | constant strings are treated atomically and are thus fields.</p> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 119 | <p>Fields use a condensed bit format specific to the type of information |
| 120 | they must contain. As few bits as possible are written for each field. The |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 121 | sections that follow will provide the details on how these fields are |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 122 | written and how the bits are to be interpreted.</p> |
| 123 | </div> |
| 124 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 125 | <div class="doc_subsection"><a name="align">Alignment</a> </div> |
Reid Spencer | 7aa940d | 2004-05-25 15:47:57 +0000 | [diff] [blame] | 126 | <div class="doc_text"> |
Reid Spencer | 267660f | 2004-08-03 20:33:56 +0000 | [diff] [blame] | 127 | <p>To support cross-platform differences, the bytecode file is aligned on |
| 128 | certain boundaries. This means that a small amount of padding (at most 3 |
| 129 | bytes) will be added to ensure that the next entry is aligned to a 32-bit |
| 130 | boundary.</p> |
Chris Lattner | 8dabb50 | 2004-05-25 17:44:58 +0000 | [diff] [blame] | 131 | </div> |
Reid Spencer | 7aa940d | 2004-05-25 15:47:57 +0000 | [diff] [blame] | 132 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 133 | <div class="doc_subsection"><a name="vbr">Variable Bit-Rate Encoding</a> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 134 | </div> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 135 | <div class="doc_text"> |
| 136 | <p>Most of the values written to LLVM bytecode files are small integers. To |
| 137 | minimize the number of bytes written for these quantities, an encoding scheme |
| 138 | similar to UTF-8 is used to write integer data. The scheme is known as |
| 139 | variable bit rate (vbr) encoding. In this encoding, the high bit of |
| 140 | each byte is used to indicate if more bytes follow. If (byte & |
| 141 | 0x80) is non-zero in any given byte, it means there is another byte |
| 142 | immediately following that also contributes to the value. For the final |
| 143 | byte (byte & 0x80) is false (the high bit is not set). In each byte |
| 144 | only the low seven bits contribute to the value. Consequently 32-bit |
| 145 | quantities can take from one to <em>five</em> bytes to encode. In |
| 146 | general, smaller quantities will encode in fewer bytes, as follows:</p> |
| 147 | <table> |
| 148 | <tbody> |
| 149 | <tr> |
| 150 | <th>Byte #</th> |
| 151 | <th>Significant Bits</th> |
| 152 | <th>Maximum Value</th> |
| 153 | </tr> |
| 154 | <tr> |
| 155 | <td>1</td> |
| 156 | <td>0-6</td> |
| 157 | <td>127</td> |
| 158 | </tr> |
| 159 | <tr> |
| 160 | <td>2</td> |
| 161 | <td>7-13</td> |
| 162 | <td>16,383</td> |
| 163 | </tr> |
| 164 | <tr> |
| 165 | <td>3</td> |
| 166 | <td>14-20</td> |
| 167 | <td>2,097,151</td> |
| 168 | </tr> |
| 169 | <tr> |
| 170 | <td>4</td> |
| 171 | <td>21-27</td> |
| 172 | <td>268,435,455</td> |
| 173 | </tr> |
| 174 | <tr> |
| 175 | <td>5</td> |
| 176 | <td>28-34</td> |
| 177 | <td>34,359,738,367</td> |
| 178 | </tr> |
| 179 | <tr> |
| 180 | <td>6</td> |
| 181 | <td>35-41</td> |
| 182 | <td>4,398,046,511,103</td> |
| 183 | </tr> |
| 184 | <tr> |
| 185 | <td>7</td> |
| 186 | <td>42-48</td> |
| 187 | <td>562,949,953,421,311</td> |
| 188 | </tr> |
| 189 | <tr> |
| 190 | <td>8</td> |
| 191 | <td>49-55</td> |
| 192 | <td>72,057,594,037,927,935</td> |
| 193 | </tr> |
| 194 | <tr> |
| 195 | <td>9</td> |
| 196 | <td>56-62</td> |
| 197 | <td>9,223,372,036,854,775,807</td> |
| 198 | </tr> |
| 199 | <tr> |
| 200 | <td>10</td> |
| 201 | <td>63-69</td> |
| 202 | <td>1,180,591,620,717,411,303,423</td> |
| 203 | </tr> |
| 204 | </tbody> |
| 205 | </table> |
| 206 | <p>Note that in practice, the tenth byte could only encode bit 63 since |
| 207 | the maximum quantity to use this encoding is a 64-bit integer.</p> |
| 208 | <p><em>Signed</em> VBR values are encoded with the standard vbr |
| 209 | encoding, but with the sign bit as the low order bit instead of the |
| 210 | high order bit. This allows small negative quantities to be encoded |
| 211 | efficiently. For example, -3 |
| 212 | is encoded as "((3 << 1) | 1)" and 3 is encoded as "(3 << |
| 213 | 1) | 0)", emitted with the standard vbr encoding above.</p> |
| 214 | </div> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 215 | <!-- _______________________________________________________________________ --> |
| 216 | <div class="doc_subsection"><a name="encoding">Encoding Primitives</a> </div> |
| 217 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 218 | <p>Each field in the bytecode format is encoded into the file using a |
| 219 | small set of primitive formats. The table below defines the encoding |
| 220 | rules for the various primitives used and gives them each a type name. |
| 221 | The type names used in the descriptions of blocks and fields in the <a |
| 222 | href="#details">Detailed Layout</a>next section. Any type name with |
| 223 | the suffix <em>_vbr</em> indicates a quantity that is encoded using |
| 224 | variable bit rate encoding as described above.</p> |
| 225 | <table class="doc_table"> |
| 226 | <tbody> |
| 227 | <tr> |
| 228 | <th><b>Type</b></th> |
| 229 | <th class="td_left"><b>Rule</b></th> |
| 230 | </tr> |
| 231 | <tr> |
| 232 | <td><a name="unsigned"><b>unsigned</b></a></td> |
| 233 | <td class="td_left">A 32-bit unsigned integer that always occupies four |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame] | 234 | consecutive bytes. The unsigned integer is encoded using LSB first |
| 235 | ordering. That is bits 2<sup>0</sup> through 2<sup>7</sup> are in the |
| 236 | byte with the lowest file offset (little endian).</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 237 | </tr> |
| 238 | <tr> |
Reid Spencer | 301fe48 | 2004-08-03 20:57:56 +0000 | [diff] [blame] | 239 | <td style="vertical-align: top;"><a name="uint24_vbr"> |
| 240 | <b>uint24_vbr</b></a></td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 241 | <td style="vertical-align: top; text-align: left;">A 24-bit unsigned |
| 242 | integer that occupies from one to four bytes using variable bit rate |
| 243 | encoding.</td> |
| 244 | </tr> |
| 245 | <tr> |
| 246 | <td><a name="uint32_vbr"><b>uint32_vbr</b></a></td> |
Reid Spencer | f08561f | 2004-08-03 19:20:18 +0000 | [diff] [blame] | 247 | <td class="td_left">A 32-bit unsigned integer that occupies from one to |
| 248 | five bytes using variable bit rate encoding.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 249 | </tr> |
| 250 | <tr> |
| 251 | <td><a name="uint64_vbr"><b>uint64_vbr</b></a></td> |
Reid Spencer | f08561f | 2004-08-03 19:20:18 +0000 | [diff] [blame] | 252 | <td class="td_left">A 64-bit unsigned integer that occupies from one to ten |
| 253 | bytes using variable bit rate encoding.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 254 | </tr> |
| 255 | <tr> |
| 256 | <td><a name="int64_vbr"><b>int64_vbr</b></a></td> |
Reid Spencer | f08561f | 2004-08-03 19:20:18 +0000 | [diff] [blame] | 257 | <td class="td_left">A 64-bit signed integer that occupies from one to ten |
| 258 | bytes using the signed variable bit rate encoding.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 259 | </tr> |
| 260 | <tr> |
| 261 | <td><a name="char"><b>char</b></a></td> |
Reid Spencer | f08561f | 2004-08-03 19:20:18 +0000 | [diff] [blame] | 262 | <td class="td_left">A single unsigned character encoded into one byte</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 263 | </tr> |
| 264 | <tr> |
| 265 | <td><a name="bit"><b>bit(n-m)</b></a></td> |
Reid Spencer | f08561f | 2004-08-03 19:20:18 +0000 | [diff] [blame] | 266 | <td class="td_left">A set of bit within some larger integer field. The values |
| 267 | of <code>n</code> and <code>m</code> specify the inclusive range of bits |
| 268 | that define the subfield. The value for <code>m</code> may be omitted if |
| 269 | its the same as <code>n</code>.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 270 | </tr> |
| 271 | <tr> |
| 272 | <td style="vertical-align: top;"><b><a name="float"><b>float</b></a></b></td> |
Reid Spencer | f08561f | 2004-08-03 19:20:18 +0000 | [diff] [blame] | 273 | <td style="vertical-align: top; text-align: left;">A floating point value encoded |
| 274 | as a 32-bit IEEE value written in little-endian form.<br> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 275 | </td> |
| 276 | </tr> |
| 277 | <tr> |
| 278 | <td style="vertical-align: top;"><b><b><a name="double"><b>double</b></a></b></b></td> |
Reid Spencer | f08561f | 2004-08-03 19:20:18 +0000 | [diff] [blame] | 279 | <td style="vertical-align: top; text-align: left;">A floating point value encoded |
| 280 | as a64-bit IEEE value written in little-endian form</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 281 | </tr> |
| 282 | <tr> |
| 283 | <td><a name="string"><b>string</b></a></td> |
| 284 | <td class="td_left">A uint32_vbr indicating the type of the |
| 285 | constant string which also includes its length, immediately followed by |
| 286 | the characters of the string. There is no terminating null byte in the |
| 287 | string.</td> |
| 288 | </tr> |
| 289 | <tr> |
| 290 | <td><a name="data"><b>data</b></a></td> |
| 291 | <td class="td_left">An arbitrarily long segment of data to which |
| 292 | no interpretation is implied. This is used for constant initializers.<br> |
| 293 | </td> |
| 294 | </tr> |
| 295 | <tr> |
| 296 | <td><a name="llist"><b>llist(x)</b></a></td> |
| 297 | <td class="td_left">A length list of x. This means the list is |
| 298 | encoded as an <a href="#uint32_vbr">uint32_vbr</a> providing the |
| 299 | length of the list, followed by a sequence of that many "x" items. This |
| 300 | implies that the reader should iterate the number of times provided by |
| 301 | the length.</td> |
| 302 | </tr> |
| 303 | <tr> |
| 304 | <td><a name="zlist"><b>zlist(x)</b></a></td> |
| 305 | <td class="td_left">A zero-terminated list of x. This means the |
| 306 | list is encoded as a sequence of an indeterminate number of "x" items, |
| 307 | followed by an <a href="#uint32_vbr">uint32_vbr</a> terminating value. |
| 308 | This implies that none of the "x" items can have a zero value (or else |
| 309 | the list terminates).</td> |
| 310 | </tr> |
| 311 | <tr> |
| 312 | <td><a name="block"><b>block</b></a></td> |
| 313 | <td class="td_left">A block of data that is logically related. A |
| 314 | block is an unsigned 32-bit integer that encodes the type of the block |
| 315 | in the low 5 bits and the size of the block in the high 27 bits. The |
| 316 | length does not include the block header or any alignment bytes at the |
| 317 | end of the block. Blocks may compose other blocks. </td> |
| 318 | </tr> |
| 319 | </tbody> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame] | 320 | </table> |
| 321 | </div> |
| 322 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 323 | <div class="doc_subsection"><a name="notation">Field Notation</a> </div> |
| 324 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 325 | <p>In the detailed block and field descriptions that follow, a regex |
| 326 | like notation is used to describe optional and repeated fields. A very |
| 327 | limited subset of regex is used to describe these, as given in the |
| 328 | following table: </p> |
| 329 | <table class="doc_table"> |
| 330 | <tbody> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 331 | <tr> |
| 332 | <th><b>Character</b></th> |
| 333 | <th class="td_left"><b>Meaning</b></th> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 334 | </tr> |
| 335 | <tr> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 336 | <td><b><code>?</code></b></td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 337 | <td class="td_left">The question mark indicates 0 or 1 |
| 338 | occurrences of the thing preceding it.</td> |
| 339 | </tr> |
| 340 | <tr> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 341 | <td><b><code>*</code></b></td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 342 | <td class="td_left">The asterisk indicates 0 or more occurrences |
| 343 | of the thing preceding it.</td> |
| 344 | </tr> |
| 345 | <tr> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 346 | <td><b><code>+</code></b></td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 347 | <td class="td_left">The plus sign indicates 1 or more occurrences |
| 348 | of the thing preceding it.</td> |
| 349 | </tr> |
| 350 | <tr> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 351 | <td><b><code>()</code></b></td> |
| 352 | <td class="td_left">Parentheses are used for grouping.</td> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 353 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 354 | <tr> |
| 355 | <td><b><code>,</code></b></td> |
| 356 | <td class="td_left">The comma separates sequential fields.</td> |
| 357 | </tr> |
| 358 | </tbody> |
| 359 | </table> |
| 360 | <p>So, for example, consider the following specifications:</p> |
| 361 | <div class="doc_code"> |
| 362 | <ol> |
| 363 | <li><code>string?</code></li> |
| 364 | <li><code>(uint32_vbr,uin32_vbr)+</code></li> |
| 365 | <li><code>(unsigned?,uint32_vbr)*</code></li> |
| 366 | <li><code>(llist(unsigned))?</code></li> |
| 367 | </ol> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 368 | </div> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 369 | <p>with the following interpretations:</p> |
| 370 | <ol> |
| 371 | <li>An optional string. Matches either nothing or a single string</li> |
| 372 | <li>One or more pairs of uint32_vbr.</li> |
| 373 | <li>Zero or more occurrences of either an unsigned followed by a |
| 374 | uint32_vbr or just a uint32_vbr.</li> |
| 375 | <li>An optional length list of unsigned values.</li> |
| 376 | </ol> |
| 377 | </div> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 378 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 379 | <div class="doc_subsection"><a name="slots">Slots</a> </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 380 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 381 | <p>The bytecode format uses the notion of a "slot" to reference Types |
| 382 | and Values. Since the bytecode file is a <em>direct</em> representation of |
| 383 | LLVM's intermediate representation, there is a need to represent pointers in |
| 384 | the file. Slots are used for this purpose. For example, if one has the following |
| 385 | assembly: |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 386 | </p> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 387 | <div class="doc_code"><code> %MyType = type { int, sbyte }<br> |
| 388 | %MyVar = external global %MyType |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 389 | </code></div> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 390 | <p>there are two definitions. The definition of <tt>%MyVar</tt> uses <tt>%MyType</tt>. |
| 391 | In the C++ IR this linkage between <tt>%MyVar</tt> and <tt>%MyType</tt> |
| 392 | is explicit through the use of C++ pointers. In bytecode, however, there's no |
| 393 | ability to store memory addresses. Instead, we compute and write out |
| 394 | slot numbers for every Type and Value written to the file.</p> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 395 | <p>A slot number is simply an unsigned 32-bit integer encoded in the variable |
| 396 | bit rate scheme (see <a href="#encoding">encoding</a>). This ensures that |
| 397 | low slot numbers are encoded in one byte. Through various bits of magic LLVM |
| 398 | attempts to always keep the slot numbers low. The first attempt is to associate |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 399 | slot numbers with their "type plane". That is, Values of the same type |
| 400 | are written to the bytecode file in a list (sequentially). Their order in |
| 401 | that list determines their slot number. This means that slot #1 doesn't mean |
| 402 | anything unless you also specify for which type you want slot #1. Types are |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 403 | always written to the file first (in the <a href="#globaltypes">Global Type |
| 404 | Pool</a>) and in such a way that both forward and backward references of the |
| 405 | types can often be resolved with a single pass through the type pool. </p> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 406 | <p>Slot numbers are also kept small by rearranging their order. Because |
| 407 | of the structure of LLVM, certain values are much more likely to be used |
| 408 | frequently in the body of a function. For this reason, a compaction table is |
| 409 | provided in the body of a function if its use would make the function body |
| 410 | smaller. Suppose you have a function body that uses just the types "int*" and |
| 411 | "{double}" but uses them thousands of time. Its worthwhile to ensure that the |
| 412 | slot number for these types are low so they can be encoded in a single byte |
| 413 | (via vbr). This is exactly what the compaction table does.</p> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 414 | <p>In summary then, a slot number can be though of as just a vbr encoded index |
| 415 | into a list of Type* or Value*. To keep slot numbers low, Value* are indexed by |
| 416 | two slot numbers: the "type plane index" (type slot) and the "value index" |
| 417 | (value slot).</p> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 418 | </div> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 419 | <!-- *********************************************************************** --> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 420 | <div class="doc_section"> <a name="general">General Structure</a> </div> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 421 | <!-- *********************************************************************** --> |
| 422 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 423 | <p>This section provides the general structure of the LLVM bytecode |
| 424 | file format. The bytecode file format requires blocks to be in a |
| 425 | certain order and nested in a particular way so that an LLVM module can |
| 426 | be constructed efficiently from the contents of the file. This ordering |
| 427 | defines a general structure for bytecode files as shown below. The |
| 428 | table below shows the order in which all block types may appear. Please |
| 429 | note that some of the blocks are optional and some may be repeated. The |
| 430 | structure is fairly loose because optional blocks, if empty, are |
| 431 | completely omitted from the file.</p> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 432 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 433 | <tbody> |
| 434 | <tr> |
| 435 | <th>ID</th> |
| 436 | <th>Parent</th> |
| 437 | <th>Optional?</th> |
| 438 | <th>Repeated?</th> |
| 439 | <th>Level</th> |
| 440 | <th>Block Type</th> |
| 441 | <th>Description</th> |
| 442 | </tr> |
| 443 | <tr> |
| 444 | <td>N/A</td> |
| 445 | <td>File</td> |
| 446 | <td>No</td> |
| 447 | <td>No</td> |
| 448 | <td>0</td> |
| 449 | <td class="td_left"><a href="#signature">Signature</a></td> |
| 450 | <td class="td_left">This contains the file signature (magic |
| 451 | number) that identifies the file as LLVM bytecode.</td> |
| 452 | </tr> |
| 453 | <tr> |
| 454 | <td>0x01</td> |
| 455 | <td>File</td> |
| 456 | <td>No</td> |
| 457 | <td>No</td> |
| 458 | <td>0</td> |
| 459 | <td class="td_left"><a href="#module">Module</a></td> |
| 460 | <td class="td_left">This is the top level block in a bytecode |
| 461 | file. It contains all the other blocks. </td> |
| 462 | </tr> |
| 463 | <tr> |
| 464 | <td>0x06</td> |
| 465 | <td>Module</td> |
| 466 | <td>No</td> |
| 467 | <td>No</td> |
| 468 | <td>1</td> |
| 469 | <td class="td_left"> <a href="#globaltypes">Global Type Pool</a></td> |
| 470 | <td class="td_left">This block contains all the global (module) |
| 471 | level types.</td> |
| 472 | </tr> |
| 473 | <tr> |
| 474 | <td>0x05</td> |
| 475 | <td>Module</td> |
| 476 | <td>No</td> |
| 477 | <td>No</td> |
| 478 | <td>1</td> |
| 479 | <td class="td_left"> <a href="#globalinfo">Module Globals Info</a></td> |
| 480 | <td class="td_left">This block contains the type, constness, and |
| 481 | linkage for each of the global variables in the module. It also |
| 482 | contains the type of the functions and the constant initializers.</td> |
| 483 | </tr> |
| 484 | <tr> |
| 485 | <td>0x03</td> |
| 486 | <td>Module</td> |
| 487 | <td>Yes</td> |
| 488 | <td>No</td> |
| 489 | <td>1</td> |
| 490 | <td class="td_left"> <a href="#constantpool">Module Constant Pool</a></td> |
| 491 | <td class="td_left">This block contains all the global constants |
| 492 | except function arguments, global values and constant strings.</td> |
| 493 | </tr> |
| 494 | <tr> |
| 495 | <td>0x02</td> |
| 496 | <td>Module</td> |
| 497 | <td>Yes</td> |
| 498 | <td>Yes</td> |
| 499 | <td>1</td> |
| 500 | <td class="td_left"> <a href="#functiondefs">Function Definitions</a>*</td> |
| 501 | <td class="td_left">One function block is written for each |
| 502 | function in the module. The function block contains the instructions, |
| 503 | compaction table, type constant pool, and symbol table for the function.</td> |
| 504 | </tr> |
| 505 | <tr> |
| 506 | <td>0x03</td> |
| 507 | <td>Function</td> |
| 508 | <td>Yes</td> |
| 509 | <td>No</td> |
| 510 | <td>2</td> |
| 511 | <td class="td_left"> <a |
| 512 | href="#constantpool">Function Constant Pool</a></td> |
| 513 | <td class="td_left">Any constants (including types) used solely |
| 514 | within the function are emitted here in the function constant pool. </td> |
| 515 | </tr> |
| 516 | <tr> |
| 517 | <td>0x08</td> |
| 518 | <td>Function</td> |
| 519 | <td>Yes</td> |
| 520 | <td>No</td> |
| 521 | <td>2</td> |
| 522 | <td class="td_left"> <a |
| 523 | href="#compactiontable">Compaction Table</a></td> |
| 524 | <td class="td_left">This table reduces bytecode size by providing |
| 525 | a funtion-local mapping of type and value slot numbers to their global |
| 526 | slot numbers</td> |
| 527 | </tr> |
| 528 | <tr> |
| 529 | <td>0x07</td> |
| 530 | <td>Function</td> |
| 531 | <td>No</td> |
| 532 | <td>No</td> |
| 533 | <td>2</td> |
| 534 | <td class="td_left"> <a |
| 535 | href="#instructionlist">Instruction List</a></td> |
| 536 | <td class="td_left">This block contains all the instructions of |
| 537 | the function. The basic blocks are inferred by terminating |
| 538 | instructions. </td> |
| 539 | </tr> |
| 540 | <tr> |
| 541 | <td>0x04</td> |
| 542 | <td>Function</td> |
| 543 | <td>Yes</td> |
| 544 | <td>No</td> |
| 545 | <td>2</td> |
| 546 | <td class="td_left"> <a |
| 547 | href="#symtab">Function Symbol Table</a></td> |
| 548 | <td class="td_left">This symbol table provides the names for the |
| 549 | function specific values used (basic block labels mostly).</td> |
| 550 | </tr> |
| 551 | <tr> |
| 552 | <td>0x04</td> |
| 553 | <td>Module</td> |
| 554 | <td>Yes</td> |
| 555 | <td>No</td> |
| 556 | <td>1</td> |
| 557 | <td class="td_left"> <a href="#symtab">Module Symbol Table</a></td> |
| 558 | <td class="td_left">This symbol table provides the names for the |
| 559 | various entries in the file that are not function specific (global |
| 560 | vars, and functions mostly).</td> |
| 561 | </tr> |
| 562 | </tbody> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 563 | </table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 564 | <p>Use the links in the table for details about the contents of each of |
| 565 | the block types.</p> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 566 | </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 567 | <!-- *********************************************************************** --> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 568 | <div class="doc_section"> <a name="blockdefs">Block Definitions</a> </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 569 | <!-- *********************************************************************** --> |
| 570 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 571 | <p>This section provides the detailed layout of the individual block |
| 572 | types in the LLVM bytecode file format. </p> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 573 | </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 574 | <!-- _______________________________________________________________________ --> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame] | 575 | <div class="doc_subsection"><a name="signature">Signature Block</a> </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 576 | <div class="doc_text"> |
Chris Lattner | 2b90565 | 2004-05-24 05:35:17 +0000 | [diff] [blame] | 577 | <p>The signature occurs in every LLVM bytecode file and is always first. |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame] | 578 | It simply provides a few bytes of data to identify the file as being an LLVM |
| 579 | bytecode file. This block is always four bytes in length and differs from the |
| 580 | other blocks because there is no identifier and no block length at the start |
| 581 | of the block. Essentially, this block is just the "magic number" for the file. |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 582 | </p> |
Reid Spencer | da794e7 | 2004-11-08 08:55:21 +0000 | [diff] [blame] | 583 | <p>There are two types of signatures for LLVM bytecode: uncompressed and |
| 584 | compressed as shown in the table below. </p> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 585 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 586 | <tbody> |
| 587 | <tr> |
| 588 | <th><b>Type</b></th> |
Reid Spencer | da794e7 | 2004-11-08 08:55:21 +0000 | [diff] [blame] | 589 | <th class="td_left"><b>Uncompressed</b></th> |
| 590 | <th class="td_left"><b>Compressed</b></th> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 591 | </tr> |
| 592 | <tr> |
| 593 | <td><a href="#char">char</a></td> |
| 594 | <td class="td_left">Constant "l" (0x6C)</td> |
Reid Spencer | da794e7 | 2004-11-08 08:55:21 +0000 | [diff] [blame] | 595 | <td class="td_left">Constant "l" (0x6C)</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 596 | </tr> |
| 597 | <tr> |
| 598 | <td><a href="#char">char</a></td> |
| 599 | <td class="td_left">Constant "l" (0x6C)</td> |
Reid Spencer | da794e7 | 2004-11-08 08:55:21 +0000 | [diff] [blame] | 600 | <td class="td_left">Constant "l" (0x6C)</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 601 | </tr> |
| 602 | <tr> |
| 603 | <td><a href="#char">char</a></td> |
| 604 | <td class="td_left">Constant "v" (0x76)</td> |
Reid Spencer | da794e7 | 2004-11-08 08:55:21 +0000 | [diff] [blame] | 605 | <td class="td_left">Constant "v" (0x76)</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 606 | </tr> |
| 607 | <tr> |
| 608 | <td><a href="#char">char</a></td> |
| 609 | <td class="td_left">Constant "m" (0x6D)</td> |
Reid Spencer | da794e7 | 2004-11-08 08:55:21 +0000 | [diff] [blame] | 610 | <td class="td_left">Constant "c" (0x63)</td> |
| 611 | </tr> |
| 612 | <tr> |
| 613 | <td><a href="#char">char</a></td> |
| 614 | <td class="td_left">N/A</td> |
| 615 | <td class="td_left">'0'=null,'1'=gzip,'2'=bzip2</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 616 | </tr> |
| 617 | </tbody> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame] | 618 | </table> |
Reid Spencer | da794e7 | 2004-11-08 08:55:21 +0000 | [diff] [blame] | 619 | <p>In other words, the uncompressed signature is just the characters 'llvm' |
| 620 | while the compressed signature is the characters 'llvc' followed by an ascii |
| 621 | digit ('0', '1', or '2') that indicates the kind of compression used. A value of |
| 622 | '0' indicates that null compression was used. This can happen when compression |
| 623 | was requested on a platform that wasn't configured for gzip or bzip2. A value of |
| 624 | '1' means that the rest of the file is compressed using the gzip algorithm and |
| 625 | should be uncompressed before interpretation. A value of '2' means that the rest |
| 626 | of the file is compressed using the bzip2 algorithm and should be uncompressed |
| 627 | before interpretation. In all cases, the data resulting from uncompression |
| 628 | should be interpreted as if it occurred immediately after the 'llvm' |
| 629 | signature (i.e. the uncompressed data begins with the |
| 630 | <a href="#module">Module Block</a></p> |
| 631 | <p><b>NOTE:</b> As of LLVM 1.4, all bytecode files produced by the LLVM tools |
Reid Spencer | a4213b2 | 2004-11-08 09:10:50 +0000 | [diff] [blame] | 632 | are compressed by default. To disable compression, pass the |
Reid Spencer | da794e7 | 2004-11-08 08:55:21 +0000 | [diff] [blame] | 633 | <tt>--disable-compression</tt> option to the tool, if it supports it. |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame] | 634 | </div> |
| 635 | <!-- _______________________________________________________________________ --> |
| 636 | <div class="doc_subsection"><a name="module">Module Block</a> </div> |
| 637 | <div class="doc_text"> |
| 638 | <p>The module block contains a small pre-amble and all the other blocks in |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 639 | the file. The table below shows the structure of the module block. Note that it |
| 640 | only provides the module identifier, size of the module block, and the format |
| 641 | information. Everything else is contained in other blocks, described in other |
| 642 | sections.</p> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 643 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 644 | <tbody> |
| 645 | <tr> |
| 646 | <th><b>Type</b></th> |
| 647 | <th class="td_left"><b>Field Description</b></th> |
| 648 | </tr> |
| 649 | <tr> |
Reid Spencer | 5bc74d5 | 2004-08-16 19:24:36 +0000 | [diff] [blame] | 650 | <td><a href="#unsigned">unsigned</a><br></td> |
| 651 | <td class="td_left"><a href="#mod_header">Module Block Identifier |
| 652 | (0x01)</a></td> |
| 653 | </tr> |
| 654 | <tr> |
| 655 | <td><a href="#unsigned">unsigned</a></td> |
| 656 | <td class="td_left"><a href="#mod_header">Module Block Size</a></td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 657 | </tr> |
| 658 | <tr> |
| 659 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
| 660 | <td class="td_left"><a href="#format">Format Information</a></td> |
| 661 | </tr> |
| 662 | <tr> |
| 663 | <td><a href="#block">block</a></td> |
| 664 | <td class="td_left"><a href="#globaltypes">Global Type Pool</a></td> |
| 665 | </tr> |
| 666 | <tr> |
| 667 | <td><a href="#block">block</a></td> |
| 668 | <td class="td_left"><a href="#globalinfo">Module Globals Info</a></td> |
| 669 | </tr> |
| 670 | <tr> |
| 671 | <td><a href="#block">block</a></td> |
| 672 | <td class="td_left"><a href="#constantpool">Module Constant Pool</a></td> |
| 673 | </tr> |
| 674 | <tr> |
| 675 | <td><a href="#block">block</a>*</td> |
| 676 | <td class="td_left"><a href="#functiondefs">Function Definitions</a></td> |
| 677 | </tr> |
| 678 | <tr> |
| 679 | <td><a href="#block">block</a></td> |
Reid Spencer | 8996e55 | 2004-08-17 00:49:03 +0000 | [diff] [blame] | 680 | <td class="td_left"><a href="#symtab">Module Symbol Table</a></td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 681 | </tr> |
| 682 | </tbody> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 683 | </table> |
| 684 | </div> |
Reid Spencer | 5bc74d5 | 2004-08-16 19:24:36 +0000 | [diff] [blame] | 685 | |
| 686 | <!-- _______________________________________________________________________ --> |
| 687 | <div class="doc_subsubsection"><a name="mod_header">Module Block Header</a></div> |
| 688 | <div class="doc_text"> |
| 689 | <p>The block header for the module block uses a longer format than the other |
| 690 | blocks in a bytecode file. Specifically, instead of encoding the type and size |
| 691 | of the block into a 32-bit integer with 5-bits for type and 27-bits for size, |
| 692 | the module block header uses two 32-bit unsigned values, one for type, and one |
| 693 | for size. While the 2<sup>27</sup> byte limit on block size is sufficient for the blocks |
| 694 | contained in the module, it isn't sufficient for the module block itself |
| 695 | because we want to ensure that bytecode files as large as 2<sup>32</sup> bytes |
| 696 | are possible. For this reason, the module block (and only the module block) |
| 697 | uses a long format header.</p> |
| 698 | </div> |
| 699 | |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 700 | <!-- _______________________________________________________________________ --> |
| 701 | <div class="doc_subsubsection"><a name="format">Format Information</a></div> |
| 702 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 703 | <p>The format information field is encoded into a <a href="#uint32_vbr">uint32_vbr</a> |
| 704 | as shown in the following table.</p> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 705 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 706 | <tbody> |
| 707 | <tr> |
| 708 | <th><b>Type</b></th> |
| 709 | <th class="td_left"><b>Description</b></th> |
| 710 | </tr> |
| 711 | <tr> |
| 712 | <td><a href="#bit">bit(0)</a></td> |
| 713 | <td class="td_left">Target is big endian?</td> |
| 714 | </tr> |
| 715 | <tr> |
| 716 | <td><a href="#bit">bit(1)</a></td> |
| 717 | <td class="td_left">On target pointers are 64-bit?</td> |
| 718 | </tr> |
| 719 | <tr> |
| 720 | <td><a href="#bit">bit(2)</a></td> |
| 721 | <td class="td_left">Target has no endianess?</td> |
| 722 | </tr> |
| 723 | <tr> |
| 724 | <td><a href="#bit">bit(3)</a></td> |
| 725 | <td class="td_left">Target has no pointer size?</td> |
| 726 | </tr> |
| 727 | <tr> |
| 728 | <td><a href="#bit">bit(4-31)</a></td> |
| 729 | <td class="td_left">Bytecode format version</td> |
| 730 | </tr> |
| 731 | </tbody> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 732 | </table> |
| 733 | <p> |
| 734 | Of particular note, the bytecode format number is simply a 28-bit |
| 735 | monotonically increase integer that identifies the version of the bytecode |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 736 | format (which is not directly related to the LLVM release number). The |
| 737 | bytecode versions defined so far are (note that this document only |
| 738 | describes the latest version, 1.3):</p> |
Chris Lattner | 2b90565 | 2004-05-24 05:35:17 +0000 | [diff] [blame] | 739 | <ul> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 740 | <li>#0: LLVM 1.0 & 1.1</li> |
| 741 | <li>#1: LLVM 1.2</li> |
| 742 | <li>#2: LLVM 1.2.5 (not released)</li> |
| 743 | <li>#3: LLVM 1.3<br> |
| 744 | </li> |
Chris Lattner | 2b90565 | 2004-05-24 05:35:17 +0000 | [diff] [blame] | 745 | </ul> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 746 | <p>Note that we plan to eventually expand the target description |
| 747 | capabilities |
| 748 | of bytecode files to <a href="http://llvm.cs.uiuc.edu/PR263">target |
| 749 | triples</a>. |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 750 | </p> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 751 | </div> |
| 752 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 753 | <div class="doc_subsection"><a name="globaltypes">Global Type Pool</a> </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 754 | <div class="doc_text"> |
Chris Lattner | 2b90565 | 2004-05-24 05:35:17 +0000 | [diff] [blame] | 755 | <p>The global type pool consists of type definitions. Their order of appearance |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 756 | in the file determines their type slot number (0 based). Slot numbers are |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 757 | used to replace pointers in the intermediate representation. Each slot number |
| 758 | uniquely identifies one entry in a type plane (a collection of values of the |
| 759 | same type). Since all values have types and are associated with the order in |
| 760 | which the type pool is written, the global type pool <em>must</em> be written |
| 761 | as the first block of a module. If it is not, attempts to read the file will |
| 762 | fail because both forward and backward type resolution will not be possible.</p> |
| 763 | <p>The type pool is simply a list of type definitions, as shown in the |
| 764 | table below.</p> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 765 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 766 | <tbody> |
| 767 | <tr> |
| 768 | <th><b>Type</b></th> |
| 769 | <th class="td_left"><b>Field Description</b></th> |
| 770 | </tr> |
| 771 | <tr> |
| 772 | <td><a href="#unsigned">block</a></td> |
| 773 | <td class="td_left">Type Pool Identifier (0x06) + Size<br> |
| 774 | </td> |
| 775 | </tr> |
| 776 | <tr> |
| 777 | <td><a href="#llist">llist</a>(<a href="#type">type</a>)</td> |
| 778 | <td class="td_left">A length list of type definitions.</td> |
| 779 | </tr> |
| 780 | </tbody> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame] | 781 | </table> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 782 | </div> |
| 783 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 784 | <div class="doc_subsubsection"><a name="type">Type Definitions</a></div> |
| 785 | <div class="doc_text"> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 786 | <p>Types in the type pool are defined using a different format for each kind |
| 787 | of type, as given in the following sections.</p> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 788 | <h3>Primitive Types</h3> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 789 | <p>The primitive types encompass the basic integer and floating point |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 790 | types. They are encoded simply as their TypeID.</p> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 791 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 792 | <tbody> |
| 793 | <tr> |
| 794 | <th><b>Type</b></th> |
| 795 | <th class="td_left"><b>Description</b></th> |
| 796 | </tr> |
| 797 | <tr> |
| 798 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
| 799 | <td class="td_left">Type ID for the primitive types (values 1 to |
| 800 | 11) <sup>1</sup></td> |
| 801 | </tr> |
| 802 | </tbody> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 803 | </table> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 804 | Notes: |
| 805 | <ol> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 806 | <li>The values for the Type IDs for the primitive types are provided |
| 807 | by the definition of the <code>llvm::Type::TypeID</code> enumeration |
| 808 | in <code>include/llvm/Type.h</code>. The enumeration gives the |
| 809 | following mapping: |
| 810 | <ol> |
| 811 | <li>bool</li> |
| 812 | <li>ubyte</li> |
| 813 | <li>sbyte</li> |
| 814 | <li>ushort</li> |
| 815 | <li>short</li> |
| 816 | <li>uint</li> |
| 817 | <li>int</li> |
| 818 | <li>ulong</li> |
| 819 | <li>long</li> |
| 820 | <li>float</li> |
| 821 | <li>double</li> |
| 822 | </ol> |
| 823 | </li> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 824 | </ol> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 825 | <h3>Function Types</h3> |
| 826 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 827 | <tbody> |
| 828 | <tr> |
| 829 | <th><b>Type</b></th> |
| 830 | <th class="td_left"><b>Description</b></th> |
| 831 | </tr> |
| 832 | <tr> |
| 833 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
| 834 | <td class="td_left">Type ID for function types (13)</td> |
| 835 | </tr> |
| 836 | <tr> |
| 837 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 838 | <td class="td_left">Type slot number of function's return type.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 839 | </tr> |
| 840 | <tr> |
| 841 | <td><a href="#llist">llist</a>(<a href="#uint24_vbr">uint24_vbr</a>)</td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 842 | <td class="td_left">Type slot number of each argument's type.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 843 | </tr> |
| 844 | <tr> |
| 845 | <td><a href="#uint32_vbr">uint32_vbr</a>?</td> |
| 846 | <td class="td_left">Value 0 if this is a varargs function, |
| 847 | missing otherwise.</td> |
| 848 | </tr> |
| 849 | </tbody> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 850 | </table> |
| 851 | <h3>Structure Types</h3> |
| 852 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 853 | <tbody> |
| 854 | <tr> |
| 855 | <th><b>Type</b></th> |
| 856 | <th class="td_left"><b>Description</b></th> |
| 857 | </tr> |
| 858 | <tr> |
| 859 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
| 860 | <td class="td_left">Type ID for structure types (14)</td> |
| 861 | </tr> |
| 862 | <tr> |
| 863 | <td><a href="#zlist">zlist</a>(<a href="#uint24_vbr">uint24_vbr</a>)</td> |
| 864 | <td class="td_left">Slot number of each of the element's fields.</td> |
| 865 | </tr> |
| 866 | </tbody> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 867 | </table> |
| 868 | <h3>Array Types</h3> |
| 869 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 870 | <tbody> |
| 871 | <tr> |
| 872 | <th><b>Type</b></th> |
| 873 | <th class="td_left"><b>Description</b></th> |
| 874 | </tr> |
| 875 | <tr> |
| 876 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
| 877 | <td class="td_left">Type ID for Array Types (15)</td> |
| 878 | </tr> |
| 879 | <tr> |
| 880 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 881 | <td class="td_left">Type slot number of array's element type.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 882 | </tr> |
| 883 | <tr> |
| 884 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
| 885 | <td class="td_left">The number of elements in the array.</td> |
| 886 | </tr> |
| 887 | </tbody> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 888 | </table> |
| 889 | <h3>Pointer Types</h3> |
| 890 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 891 | <tbody> |
| 892 | <tr> |
| 893 | <th><b>Type</b></th> |
| 894 | <th class="td_left"><b>Description</b></th> |
| 895 | </tr> |
| 896 | <tr> |
| 897 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
| 898 | <td class="td_left">Type ID For Pointer Types (16)</td> |
| 899 | </tr> |
| 900 | <tr> |
| 901 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 902 | <td class="td_left">Type slot number of pointer's element type.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 903 | </tr> |
| 904 | </tbody> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 905 | </table> |
| 906 | <h3>Opaque Types</h3> |
| 907 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 908 | <tbody> |
| 909 | <tr> |
| 910 | <th><b>Type</b></th> |
| 911 | <th class="td_left"><b>Description</b></th> |
| 912 | </tr> |
| 913 | <tr> |
| 914 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
| 915 | <td class="td_left">Type ID For Opaque Types (17)</td> |
| 916 | </tr> |
| 917 | </tbody> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 918 | </table> |
Brian Gaeke | 715c90b | 2004-08-20 06:00:58 +0000 | [diff] [blame] | 919 | <h3>Packed Types</h3> |
| 920 | <table> |
| 921 | <tbody> |
| 922 | <tr> |
| 923 | <th><b>Type</b></th> |
| 924 | <th class="td_left"><b>Description</b></th> |
| 925 | </tr> |
| 926 | <tr> |
| 927 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
| 928 | <td class="td_left">Type ID for Packed Types (18)</td> |
| 929 | </tr> |
| 930 | <tr> |
| 931 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
| 932 | <td class="td_left">Slot number of packed vector's element type.</td> |
| 933 | </tr> |
| 934 | <tr> |
| 935 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
| 936 | <td class="td_left">The number of elements in the packed vector.</td> |
| 937 | </tr> |
| 938 | </tbody> |
| 939 | </table> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 940 | </div> |
| 941 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 942 | <div class="doc_subsection"><a name="globalinfo">Module Global Info</a> |
| 943 | </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 944 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 945 | <p>The module global info block contains the definitions of all global |
| 946 | variables including their initializers and the <em>declaration</em> of |
| 947 | all functions. The format is shown in the table below:</p> |
| 948 | <table> |
| 949 | <tbody> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 950 | <tr> |
| 951 | <th><b>Type</b></th> |
| 952 | <th class="td_left"><b>Field Description</b></th> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 953 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 954 | <tr> |
| 955 | <td><a href="#block">block</a></td> |
| 956 | <td class="td_left">Module global info identifier (0x05) + size<br> |
| 957 | </td> |
| 958 | </tr> |
| 959 | <tr> |
| 960 | <td><a href="#zlist">zlist</a>(<a href="#globalvar">globalvar</a>)</td> |
| 961 | <td class="td_left">A zero terminated list of global var |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 962 | definitions occurring in the module.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 963 | </tr> |
| 964 | <tr> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 965 | <td><a href="#zlist">zlist</a>(<a href="#funcfield">funcfield</a>)</td> |
| 966 | <td class="td_left">A zero terminated list of function definitions |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 967 | occurring in the module.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 968 | </tr> |
| 969 | <tr> |
| 970 | <td style="vertical-align: top;"><a href="#llist">llist</a>(<a |
| 971 | href="#string">string</a>)<br> |
| 972 | </td> |
| 973 | <td style="vertical-align: top; text-align: left;">A length list |
| 974 | of strings that specify the names of the libraries that this module |
| 975 | depends upon.<br> |
| 976 | </td> |
| 977 | </tr> |
| 978 | <tr> |
| 979 | <td style="vertical-align: top;"><a href="#string">string</a><br> |
| 980 | </td> |
| 981 | <td style="vertical-align: top; text-align: left;">The target |
| 982 | triple for the module (blank means no target triple specified, i.e. a |
| 983 | platform independent module).<br> |
| 984 | </td> |
| 985 | </tr> |
| 986 | </tbody> |
| 987 | </table> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 988 | </div> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 989 | |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 990 | <!-- _______________________________________________________________________ --> |
| 991 | <div class="doc_subsubsection"><a name="globalvar">Global Variable Field</a> |
| 992 | </div> |
| 993 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 994 | <p>Global variables are written using an <a href="#uint32_vbr">uint32_vbr</a> |
| 995 | that encodes information about the global variable and a list of the |
| 996 | constant initializers for the global var, if any.</p> |
| 997 | <p>The table below provides the bit layout of the first <a |
| 998 | href="#uint32_vbr">uint32_vbr</a> that describes the global variable.</p> |
| 999 | <table> |
| 1000 | <tbody> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 1001 | <tr> |
| 1002 | <th><b>Type</b></th> |
| 1003 | <th class="td_left"><b>Description</b></th> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 1004 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1005 | <tr> |
| 1006 | <td><a href="#bit">bit(0)</a></td> |
| 1007 | <td class="td_left">Is constant?</td> |
| 1008 | </tr> |
| 1009 | <tr> |
| 1010 | <td><a href="#bit">bit(1)</a></td> |
| 1011 | <td class="td_left">Has initializer? Note that this bit |
| 1012 | determines whether the constant initializer field (described below) |
| 1013 | follows. </td> |
| 1014 | </tr> |
| 1015 | <tr> |
| 1016 | <td><a href="#bit">bit(2-4)</a></td> |
| 1017 | <td class="td_left">Linkage type: 0=External, 1=Weak, |
| 1018 | 2=Appending, 3=Internal, 4=LinkOnce</td> |
| 1019 | </tr> |
| 1020 | <tr> |
| 1021 | <td><a href="#bit">bit(5-31)</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1022 | <td class="td_left">Type slot number of type for the global variable.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1023 | </tr> |
| 1024 | </tbody> |
| 1025 | </table> |
| 1026 | <p>The table below provides the format of the constant initializers for |
| 1027 | the global variable field, if it has one.</p> |
| 1028 | <table> |
| 1029 | <tbody> |
| 1030 | <tr> |
| 1031 | <th><b>Type</b></th> |
| 1032 | <th class="td_left"><b>Description</b></th> |
| 1033 | </tr> |
| 1034 | <tr> |
| 1035 | <td>(<a href="#zlist">zlist</a>(<a href="#uint32_vbr">uint32_vbr</a>))? |
| 1036 | </td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1037 | <td class="td_left">An optional zero-terminated list of value slot |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1038 | numbers of the global variable's constant initializer.</td> |
| 1039 | </tr> |
| 1040 | </tbody> |
| 1041 | </table> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1042 | </div> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1043 | |
| 1044 | <!-- _______________________________________________________________________ --> |
| 1045 | <div class="doc_subsubsection"><a name="funcfield">Function Field</a> |
| 1046 | </div> |
| 1047 | <div class="doc_text"> |
| 1048 | <p>Functions are written using an <a href="#uint32_vbr">uint32_vbr</a> |
| 1049 | that encodes information about the function and a set of flags.</p> |
| 1050 | |
| 1051 | <p>The table below provides the bit layout of the <a |
| 1052 | href="#uint32_vbr">uint32_vbr</a> that describes the function.</p> |
| 1053 | |
| 1054 | <table> |
| 1055 | <tbody> |
| 1056 | <tr> |
| 1057 | <th><b>Type</b></th> |
| 1058 | <th class="td_left"><b>Description</b></th> |
| 1059 | </tr> |
| 1060 | <tr> |
Chris Lattner | ced6222 | 2004-11-15 22:54:50 +0000 | [diff] [blame^] | 1061 | <td><a href="#bit">bit(0-3)</a></td> |
| 1062 | <td class="td_left">Reserved for future use. Currently set to 0001.</td> |
| 1063 | </tr> |
| 1064 | <tr> |
| 1065 | <td><a href="#bit">bit(4)</a></td> |
| 1066 | <td class="td_left">If this bit is set to 1, the indicated function is |
| 1067 | external, and there is no <a href="#functiondefs">Function Definiton |
| 1068 | Block</a> in the bytecode file for the function.</td> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1069 | </tr> |
| 1070 | <tr> |
| 1071 | <td><a href="#bit">bit(5-)</a></td> |
| 1072 | <td class="td_left">Type slot number of type for the function.</td> |
| 1073 | </tr> |
| 1074 | </tbody> |
| 1075 | </table> |
| 1076 | |
| 1077 | </div> |
| 1078 | |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 1079 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1080 | <div class="doc_subsection"><a name="constantpool">Constant Pool</a> </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 1081 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1082 | <p>A constant pool defines as set of constant values. There are |
| 1083 | actually two types of constant pool blocks: one for modules and one for |
| 1084 | functions. For modules, the block begins with the constant strings |
| 1085 | encountered anywhere in the module. For functions, the block begins |
| 1086 | with types only encountered in the function. In both cases the header |
| 1087 | is identical. The tables that follow, show the header, module constant |
| 1088 | pool preamble, function constant pool preamble, and the part common to |
| 1089 | both function and module constant pools.</p> |
| 1090 | <p><b>Common Block Header</b></p> |
| 1091 | <table> |
| 1092 | <tbody> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1093 | <tr> |
| 1094 | <th><b>Type</b></th> |
| 1095 | <th class="td_left"><b>Field Description</b></th> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1096 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1097 | <tr> |
| 1098 | <td><a href="#block">block</a></td> |
| 1099 | <td class="td_left">Constant pool identifier (0x03) + size<br> |
| 1100 | </td> |
| 1101 | </tr> |
| 1102 | </tbody> |
| 1103 | </table> |
| 1104 | <p><b>Module Constant Pool Preamble (constant strings)</b></p> |
| 1105 | <table> |
| 1106 | <tbody> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1107 | <tr> |
| 1108 | <th><b>Type</b></th> |
| 1109 | <th class="td_left"><b>Field Description</b></th> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1110 | </tr> |
| 1111 | <tr> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1112 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
| 1113 | <td class="td_left">The number of constant strings that follow.</td> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1114 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1115 | <tr> |
| 1116 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
| 1117 | <td class="td_left">Zero. This identifies the following "plane" |
| 1118 | as containing the constant strings. This is needed to identify it |
| 1119 | uniquely from other constant planes that follow. </td> |
| 1120 | </tr> |
| 1121 | <tr> |
| 1122 | <td><a href="#uint24_vbr">uint24_vbr</a>+</td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1123 | <td class="td_left">Type slot number of the constant string's type. |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1124 | Note that the constant string's type implicitly defines the length of |
| 1125 | the string. </td> |
| 1126 | </tr> |
| 1127 | </tbody> |
| 1128 | </table> |
| 1129 | <p><b>Function Constant Pool Preamble (function types)</b></p> |
| 1130 | <p>The structure of the types for functions is identical to the <a |
| 1131 | href="#globaltypes">Global Type Pool</a>. Please refer to that section |
| 1132 | for the details. </p> |
| 1133 | <p><b>Common Part (other constants)</b></p> |
| 1134 | <table> |
| 1135 | <tbody> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1136 | <tr> |
| 1137 | <th><b>Type</b></th> |
| 1138 | <th class="td_left"><b>Field Description</b></th> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1139 | </tr> |
| 1140 | <tr> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1141 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
| 1142 | <td class="td_left">Number of entries in this type plane.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1143 | </tr> |
| 1144 | <tr> |
| 1145 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1146 | <td class="td_left">Type slot number of this plane.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1147 | </tr> |
| 1148 | <tr> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 1149 | <td><a href="#constant">constant</a>+</td> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1150 | <td class="td_left">The definition of a constant (see below).</td> |
| 1151 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1152 | </tbody> |
| 1153 | </table> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1154 | </div> |
| 1155 | <!-- _______________________________________________________________________ --> |
| 1156 | <div class="doc_subsubsection"><a name="constant">Constant Field</a></div> |
| 1157 | <div class="doc_text"> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1158 | <p>Constants come in many shapes and flavors. The sections that follow |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1159 | define the format for each of them. All constants start with a <a |
| 1160 | href="#uint32_vbr">uint32_vbr</a> encoded integer that provides the |
| 1161 | number of operands for the constant. For primitive, structure, and |
| 1162 | array constants, this will always be zero since those types of |
| 1163 | constants have no operands. In this case, we have the following field |
| 1164 | definitions:</p> |
| 1165 | <ul> |
| 1166 | <li><b>Bool</b>. This is written as an <a href="#uint32_vbr">uint32_vbr</a> |
| 1167 | of value 1U or 0U.</li> |
| 1168 | <li><b>Signed Integers (sbyte,short,int,long)</b>. These are written |
| 1169 | as an <a href="#int64_vbr">int64_vbr</a> with the corresponding value.</li> |
| 1170 | <li><b>Unsigned Integers (ubyte,ushort,uint,ulong)</b>. These are |
| 1171 | written as an <a href="#uint64_vbr">uint64_vbr</a> with the |
| 1172 | corresponding value. </li> |
| 1173 | <li><b>Floating Point</b>. Both the float and double types are |
| 1174 | written literally in binary format.</li> |
| 1175 | <li><b>Arrays</b>. Arrays are written simply as a list of <a |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1176 | href="#uint32_vbr">uint32_vbr</a> encoded value slot numbers to the constant |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1177 | element values.</li> |
| 1178 | <li><b>Structures</b>. Structures are written simply as a list of <a |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1179 | href="#uint32_vbr">uint32_vbr</a> encoded value slot numbers to the constant |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1180 | field values of the structure.</li> |
| 1181 | </ul> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1182 | |
| 1183 | <p>When the number of operands to the constant is one, we have an 'undef' value |
| 1184 | of the specified type.</p> |
| 1185 | |
| 1186 | <p>When the number of operands to the constant is greater than one, we have a |
| 1187 | constant expression and its field format is provided in the table below, and the |
| 1188 | number is equal to the number of operands+1.</p> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1189 | <table> |
| 1190 | <tbody> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1191 | <tr> |
| 1192 | <th><b>Type</b></th> |
| 1193 | <th class="td_left"><b>Field Description</b></th> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1194 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1195 | <tr> |
| 1196 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
| 1197 | <td class="td_left">Op code of the instruction for the constant |
| 1198 | expression.</td> |
| 1199 | </tr> |
| 1200 | <tr> |
| 1201 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1202 | <td class="td_left">The value slot number of the constant value for an |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1203 | operand.<sup>1</sup></td> |
| 1204 | </tr> |
| 1205 | <tr> |
| 1206 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1207 | <td class="td_left">The type slot number for the type of the constant |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1208 | value for an operand.<sup>1</sup></td> |
| 1209 | </tr> |
| 1210 | </tbody> |
| 1211 | </table> |
| 1212 | Notes: |
| 1213 | <ol> |
| 1214 | <li>Both these fields are repeatable but only in pairs.</li> |
| 1215 | </ol> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 1216 | </div> |
| 1217 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1218 | <div class="doc_subsection"><a name="functiondefs">Function Definition</a></div> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1219 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1220 | <p>Function definitions contain the linkage, constant pool or |
| 1221 | compaction table, instruction list, and symbol table for a function. |
| 1222 | The following table shows the structure of a function definition.</p> |
| 1223 | <table> |
| 1224 | <tbody> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1225 | <tr> |
| 1226 | <th><b>Type</b></th> |
| 1227 | <th class="td_left"><b>Field Description</b></th> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1228 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1229 | <tr> |
| 1230 | <td><a href="#block">block</a><br> |
| 1231 | </td> |
| 1232 | <td class="td_left">Function definition block identifier (0x02) + |
| 1233 | size<br> |
| 1234 | </td> |
| 1235 | </tr> |
| 1236 | <tr> |
| 1237 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
| 1238 | <td class="td_left">The linkage type of the function: 0=External, |
| 1239 | 1=Weak, 2=Appending, 3=Internal, 4=LinkOnce<sup>1</sup></td> |
| 1240 | </tr> |
| 1241 | <tr> |
| 1242 | <td><a href="#block">block</a></td> |
| 1243 | <td class="td_left">The <a href="#constantpool">constant pool</a> |
| 1244 | block for this function.<sup>2</sup></td> |
| 1245 | </tr> |
| 1246 | <tr> |
| 1247 | <td><a href="#block">block</a></td> |
| 1248 | <td class="td_left">The <a href="#compactiontable">compaction |
| 1249 | table</a> block for the function.<sup>2</sup></td> |
| 1250 | </tr> |
| 1251 | <tr> |
| 1252 | <td><a href="#block">block</a></td> |
| 1253 | <td class="td_left">The <a href="#instructionlist">instruction |
| 1254 | list</a> for the function.</td> |
| 1255 | </tr> |
| 1256 | <tr> |
| 1257 | <td><a href="#block">block</a></td> |
Reid Spencer | 8996e55 | 2004-08-17 00:49:03 +0000 | [diff] [blame] | 1258 | <td class="td_left">The function's <a href="#symtab">symbol |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1259 | table</a> containing only those symbols pertinent to the function |
| 1260 | (mostly block labels).</td> |
| 1261 | </tr> |
| 1262 | </tbody> |
| 1263 | </table> |
| 1264 | Notes: |
| 1265 | <ol> |
| 1266 | <li>Note that if the linkage type is "External" then none of the |
| 1267 | other fields will be present as the function is defined elsewhere.</li> |
| 1268 | <li>Note that only one of the constant pool or compaction table will |
| 1269 | be written. Compaction tables are only written if they will actually |
| 1270 | save bytecode space. If not, then a regular constant pool is written.</li> |
| 1271 | </ol> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1272 | </div> |
| 1273 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1274 | <div class="doc_subsection"><a name="compactiontable">Compaction Table</a> |
| 1275 | </div> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1276 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1277 | <p>Compaction tables are part of a function definition. They are merely |
| 1278 | a device for reducing the size of bytecode files. The size of a |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1279 | bytecode file is dependent on the <em>values</em> of the slot numbers |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1280 | used because larger values use more bytes in the variable bit rate |
| 1281 | encoding scheme. Furthermore, the compressed instruction format |
| 1282 | reserves only six bits for the type of the instruction. In large |
| 1283 | modules, declaring hundreds or thousands of types, the values of the |
| 1284 | slot numbers can be quite large. However, functions may use only a |
| 1285 | small fraction of the global types. In such cases a compaction table is |
| 1286 | created that maps the global type and value slot numbers to smaller |
| 1287 | values used by a function. Functions will contain either a |
| 1288 | function-specific constant pool <em>or</em> a compaction table but not |
| 1289 | both. Compaction tables have the format shown in the table below.</p> |
| 1290 | <table> |
| 1291 | <tbody> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1292 | <tr> |
| 1293 | <th><b>Type</b></th> |
| 1294 | <th class="td_left"><b>Field Description</b></th> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1295 | </tr> |
| 1296 | <tr> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1297 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
| 1298 | <td class="td_left">The number of types that follow</td> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1299 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1300 | <tr> |
| 1301 | <td><a href="#uint24_vbr">uint24_vbr</a>+</td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1302 | <td class="td_left">The type slot number in the global types of |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1303 | the type that will be referenced in the function with the index of this |
| 1304 | entry in the compaction table.</td> |
| 1305 | </tr> |
| 1306 | <tr> |
| 1307 | <td><a href="#type_len">type_len</a></td> |
| 1308 | <td class="td_left">An encoding of the type and number of values |
| 1309 | that follow. This field's encoding varies depending on the size of the |
| 1310 | type plane. See <a href="#type_len">Type and Length</a> for further |
| 1311 | details.</td> |
| 1312 | </tr> |
| 1313 | <tr> |
| 1314 | <td><a href="#uint32_vbr">uint32_vbr</a>+</td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1315 | <td class="td_left">The value slot number in the global values |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1316 | that will be referenced in the function with the index of this entry in |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1317 | the compaction table.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1318 | </tr> |
| 1319 | </tbody> |
| 1320 | </table> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1321 | </div> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1322 | <!-- _______________________________________________________________________ --> |
| 1323 | <div class="doc_subsubsection"><a name="type_len">Type and Length</a></div> |
| 1324 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1325 | <p>The type and length of a compaction table type plane is encoded |
| 1326 | differently depending on the length of the plane. For planes of length |
| 1327 | 1 or 2, the length is encoded into bits 0 and 1 of a <a |
| 1328 | href="#uint32_vbr">uint32_vbr</a> and the type is encoded into bits |
| 1329 | 2-31. Because type numbers are often small, this often saves an extra |
| 1330 | byte per plane. If the length of the plane is greater than 2 then the |
| 1331 | encoding uses a <a href="#uint32_vbr">uint32_vbr</a> for each of the |
| 1332 | length and type, in that order.</p> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1333 | </div> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1334 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1335 | <div class="doc_subsection"><a name="instructionlist">Instruction List</a></div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 1336 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1337 | <p>The instructions in a function are written as a simple list. Basic |
| 1338 | blocks are inferred by the terminating instruction types. The format of |
| 1339 | the block is given in the following table.</p> |
| 1340 | <table> |
| 1341 | <tbody> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1342 | <tr> |
| 1343 | <th><b>Type</b></th> |
| 1344 | <th class="td_left"><b>Field Description</b></th> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1345 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1346 | <tr> |
| 1347 | <td><a href="#block">block</a><br> |
| 1348 | </td> |
| 1349 | <td class="td_left">Instruction list identifier (0x07) + size<br> |
| 1350 | </td> |
| 1351 | </tr> |
| 1352 | <tr> |
| 1353 | <td><a href="#instruction">instruction</a>+</td> |
| 1354 | <td class="td_left">An instruction. Instructions have a variety |
| 1355 | of formats. See <a href="#instruction">Instructions</a> for details.</td> |
| 1356 | </tr> |
| 1357 | </tbody> |
| 1358 | </table> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 1359 | </div> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1360 | <!-- _______________________________________________________________________ --> |
| 1361 | <div class="doc_subsubsection"><a name="instruction">Instructions</a></div> |
| 1362 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1363 | <p>For brevity, instructions are written in one of four formats, |
| 1364 | depending on the number of operands to the instruction. Each |
| 1365 | instruction begins with a <a href="#uint32_vbr">uint32_vbr</a> that |
| 1366 | encodes the type of the instruction as well as other things. The tables |
Reid Spencer | 8996e55 | 2004-08-17 00:49:03 +0000 | [diff] [blame] | 1367 | that follow describe the format of this first part of each instruction.</p> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1368 | <p><b>Instruction Format 0</b></p> |
| 1369 | <p>This format is used for a few instructions that can't easily be |
Reid Spencer | 8996e55 | 2004-08-17 00:49:03 +0000 | [diff] [blame] | 1370 | shortened because they have large numbers of operands (e.g. PHI Node or |
| 1371 | getelementptr). Each of the opcode, type, and operand fields is found in |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1372 | successive fields.</p> |
| 1373 | <table> |
| 1374 | <tbody> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1375 | <tr> |
| 1376 | <th><b>Type</b></th> |
| 1377 | <th class="td_left"><b>Field Description</b></th> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1378 | </tr> |
| 1379 | <tr> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1380 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1381 | <td class="td_left">Specifies the opcode of the instruction. Note |
| 1382 | that for compatibility with the other instruction formats, the opcode |
| 1383 | is shifted left by 2 bits. Bits 0 and 1 must have value zero for this |
| 1384 | format.</td> |
| 1385 | </tr> |
| 1386 | <tr> |
| 1387 | <td><a href="#uint24_vbr">uint24_vbr</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1388 | <td class="td_left">Provides the type slot number of the result type of |
| 1389 | the instruction.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1390 | </tr> |
| 1391 | <tr> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1392 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
| 1393 | <td class="td_left">The number of operands that follow.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1394 | </tr> |
| 1395 | <tr> |
Reid Spencer | 82c4671 | 2004-07-07 13:34:26 +0000 | [diff] [blame] | 1396 | <td><a href="#uint32_vbr">uint32_vbr</a>+</td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1397 | <td class="td_left">The slot number of the value(s) for the operand(s). |
| 1398 | <sup>1</sup></td> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1399 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1400 | </tbody> |
| 1401 | </table> |
| 1402 | Notes: |
| 1403 | <ol> |
| 1404 | <li>Note that if the instruction is a getelementptr and the type of |
| 1405 | the operand is a sequential type (array or pointer) then the slot |
| 1406 | number is shifted up two bits and the low order bits will encode the |
| 1407 | type of index used, as follows: 0=uint, 1=int, 2=ulong, 3=long.</li> |
| 1408 | </ol> |
| 1409 | <p><b>Instruction Format 1</b></p> |
| 1410 | <p>This format encodes the opcode, type and a single operand into a |
| 1411 | single <a href="#uint32_vbr">uint32_vbr</a> as follows:</p> |
| 1412 | <table> |
| 1413 | <tbody> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1414 | <tr> |
| 1415 | <th><b>Bits</b></th> |
| 1416 | <th><b>Type</b></th> |
| 1417 | <th class="td_left"><b>Field Description</b></th> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1418 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1419 | <tr> |
| 1420 | <td>0-1</td> |
| 1421 | <td>constant "1"</td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1422 | <td class="td_left">These two bits must be the value 1 which identifies |
| 1423 | this as an instruction of format 1.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1424 | </tr> |
| 1425 | <tr> |
| 1426 | <td>2-7</td> |
Reid Spencer | 8996e55 | 2004-08-17 00:49:03 +0000 | [diff] [blame] | 1427 | <td><a href="#opcode">opcode</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1428 | <td class="td_left">Specifies the opcode of the instruction. Note that |
| 1429 | the maximum opcode value is 63.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1430 | </tr> |
| 1431 | <tr> |
| 1432 | <td>8-19</td> |
| 1433 | <td><a href="#unsigned">unsigned</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1434 | <td class="td_left">Specifies the slot number of the type for this |
| 1435 | instruction. Maximum slot number is 2<sup>12</sup>-1=4095.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1436 | </tr> |
| 1437 | <tr> |
| 1438 | <td>20-31</td> |
| 1439 | <td><a href="#unsigned">unsigned</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1440 | <td class="td_left">Specifies the slot number of the value for the |
| 1441 | first operand. Maximum slot number is 2<sup>12</sup>-1=4095. Note that |
| 1442 | the value 2<sup>12</sup>-1 denotes zero operands.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1443 | </tr> |
| 1444 | </tbody> |
| 1445 | </table> |
| 1446 | <p><b>Instruction Format 2</b></p> |
| 1447 | <p>This format encodes the opcode, type and two operands into a single <a |
| 1448 | href="#uint32_vbr">uint32_vbr</a> as follows:</p> |
| 1449 | <table> |
| 1450 | <tbody> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1451 | <tr> |
| 1452 | <th><b>Bits</b></th> |
| 1453 | <th><b>Type</b></th> |
| 1454 | <th class="td_left"><b>Field Description</b></th> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1455 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1456 | <tr> |
| 1457 | <td>0-1</td> |
| 1458 | <td>constant "2"</td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1459 | <td class="td_left">These two bits must be the value 2 which identifies |
| 1460 | this as an instruction of format 2.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1461 | </tr> |
| 1462 | <tr> |
| 1463 | <td>2-7</td> |
| 1464 | <td><a href="#opcodes">opcode</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1465 | <td class="td_left">Specifies the opcode of the instruction. Note that |
| 1466 | the maximum opcode value is 63.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1467 | </tr> |
| 1468 | <tr> |
| 1469 | <td>8-15</td> |
| 1470 | <td><a href="#unsigned">unsigned</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1471 | <td class="td_left">Specifies the slot number of the type for this |
| 1472 | instruction. Maximum slot number is 2<sup>8</sup>-1=255.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1473 | </tr> |
| 1474 | <tr> |
| 1475 | <td>16-23</td> |
| 1476 | <td><a href="#unsigned">unsigned</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1477 | <td class="td_left">Specifies the slot number of the value for the first |
| 1478 | operand. Maximum slot number is 2<sup>8</sup>-1=255.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1479 | </tr> |
| 1480 | <tr> |
| 1481 | <td>24-31</td> |
| 1482 | <td><a href="#unsigned">unsigned</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1483 | <td class="td_left">Specifies the slot number of the value for the second |
| 1484 | operand. Maximum slot number is 2<sup>8</sup>-1=255.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1485 | </tr> |
| 1486 | </tbody> |
| 1487 | </table> |
| 1488 | <p><b>Instruction Format 3</b></p> |
| 1489 | <p>This format encodes the opcode, type and three operands into a |
| 1490 | single <a href="#uint32_vbr">uint32_vbr</a> as follows:</p> |
| 1491 | <table> |
| 1492 | <tbody> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1493 | <tr> |
| 1494 | <th><b>Bits</b></th> |
| 1495 | <th><b>Type</b></th> |
| 1496 | <th class="td_left"><b>Field Description</b></th> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1497 | </tr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1498 | <tr> |
| 1499 | <td>0-1</td> |
| 1500 | <td>constant "3"</td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1501 | <td class="td_left">These two bits must be the value 3 which identifies |
| 1502 | this as an instruction of format 3.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1503 | </tr> |
| 1504 | <tr> |
| 1505 | <td>2-7</td> |
| 1506 | <td><a href="#opcodes">opcode</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1507 | <td class="td_left">Specifies the opcode of the instruction. Note that |
| 1508 | the maximum opcode value is 63.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1509 | </tr> |
| 1510 | <tr> |
| 1511 | <td>8-13</td> |
| 1512 | <td><a href="#unsigned">unsigned</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1513 | <td class="td_left">Specifies the slot number of the type for this |
| 1514 | instruction. Maximum slot number is 2<sup>6</sup>-1=63.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1515 | </tr> |
| 1516 | <tr> |
| 1517 | <td>14-19</td> |
| 1518 | <td><a href="#unsigned">unsigned</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1519 | <td class="td_left">Specifies the slot number of the value for the first |
| 1520 | operand. Maximum slot number is 2<sup>6</sup>-1=63.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1521 | </tr> |
| 1522 | <tr> |
| 1523 | <td>20-25</td> |
| 1524 | <td><a href="#unsigned">unsigned</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1525 | <td class="td_left">Specifies the slot number of the value for the second |
| 1526 | operand. Maximum slot number is 2<sup>6</sup>-1=63.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1527 | </tr> |
| 1528 | <tr> |
| 1529 | <td>26-31</td> |
| 1530 | <td><a href="#unsigned">unsigned</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1531 | <td class="td_left">Specifies the slot number of the value for the third |
| 1532 | operand. Maximum slot number is 2<sup>6</sup>-1=63.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1533 | </tr> |
| 1534 | </tbody> |
| 1535 | </table> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1536 | </div> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1537 | |
| 1538 | <!-- _______________________________________________________________________ --> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1539 | <div class="doc_subsection"><a name="opcodes">Instruction Opcodes</a></div> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1540 | <div class="doc_text"> |
| 1541 | <p>Instructions encode an opcode that identifies the kind of instruction. |
| 1542 | Opcodes are an enumerated integer value. The specific values used depend on |
| 1543 | the version of LLVM you're using. The opcode values are defined in the |
Misha Brukman | a36b6e5 | 2004-11-07 00:59:58 +0000 | [diff] [blame] | 1544 | <a href="http://llvm.cs.uiuc.edu/cvsweb/cvsweb.cgi/llvm/include/llvm/Instruction.def"> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1545 | <tt>include/llvm/Instruction.def</tt></a> file. You should check there for the |
| 1546 | most recent definitions. The table below provides the opcodes defined as of |
Nate Begeman | 52ca9e4 | 2004-08-27 07:59:37 +0000 | [diff] [blame] | 1547 | the writing of this document. The table associates each opcode mnemonic with |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1548 | its enumeration value and the bytecode and LLVM version numbers in which the |
| 1549 | opcode was introduced.</p> |
| 1550 | <table> |
| 1551 | <tbody> |
| 1552 | <tr> |
| 1553 | <th>Opcode</th> |
| 1554 | <th>Number</th> |
| 1555 | <th>Bytecode Version</th> |
| 1556 | <th>LLVM Version</th> |
| 1557 | </tr> |
| 1558 | <tr><td colspan="4"><b>Terminator Instructions</b></td></tr> |
| 1559 | <tr><td>Ret</td><td>1</td><td>1</td><td>1.0</td></tr> |
| 1560 | <tr><td>Br</td><td>2</td><td>1</td><td>1.0</td></tr> |
| 1561 | <tr><td>Switch</td><td>3</td><td>1</td><td>1.0</td></tr> |
| 1562 | <tr><td>Invoke</td><td>4</td><td>1</td><td>1.0</td></tr> |
| 1563 | <tr><td>Unwind</td><td>5</td><td>1</td><td>1.0</td></tr> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1564 | <tr><td>Unreachable</td><td>6</td><td>1</td><td>1.4</td></tr> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1565 | <tr><td colspan="4"><b>Binary Operators</b></td></tr> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1566 | <tr><td>Add</td><td>7</td><td>1</td><td>1.0</td></tr> |
| 1567 | <tr><td>Sub</td><td>8</td><td>1</td><td>1.0</td></tr> |
| 1568 | <tr><td>Mul</td><td>9</td><td>1</td><td>1.0</td></tr> |
| 1569 | <tr><td>Div</td><td>10</td><td>1</td><td>1.0</td></tr> |
| 1570 | <tr><td>Rem</td><td>11</td><td>1</td><td>1.0</td></tr> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1571 | <tr><td colspan="4"><b>Logical Operators</b></td></tr> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1572 | <tr><td>And</td><td>12</td><td>1</td><td>1.0</td></tr> |
| 1573 | <tr><td>Or</td><td>13</td><td>1</td><td>1.0</td></tr> |
| 1574 | <tr><td>Xor</td><td>14</td><td>1</td><td>1.0</td></tr> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1575 | <tr><td colspan="4"><b>Binary Comparison Operators</b></td></tr> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1576 | <tr><td>SetEQ</td><td>15</td><td>1</td><td>1.0</td></tr> |
| 1577 | <tr><td>SetNE</td><td>16</td><td>1</td><td>1.0</td></tr> |
| 1578 | <tr><td>SetLE</td><td>17</td><td>1</td><td>1.0</td></tr> |
| 1579 | <tr><td>SetGE</td><td>18</td><td>1</td><td>1.0</td></tr> |
| 1580 | <tr><td>SetLT</td><td>19</td><td>1</td><td>1.0</td></tr> |
| 1581 | <tr><td>SetGT</td><td>20</td><td>1</td><td>1.0</td></tr> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1582 | <tr><td colspan="4"><b>Memory Operators</b></td></tr> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1583 | <tr><td>Malloc</td><td>21</td><td>1</td><td>1.0</td></tr> |
| 1584 | <tr><td>Free</td><td>22</td><td>1</td><td>1.0</td></tr> |
| 1585 | <tr><td>Alloca</td><td>23</td><td>1</td><td>1.0</td></tr> |
| 1586 | <tr><td>Load</td><td>24</td><td>1</td><td>1.0</td></tr> |
| 1587 | <tr><td>Store</td><td>25</td><td>1</td><td>1.0</td></tr> |
| 1588 | <tr><td>GetElementPtr</td><td>26</td><td>1</td><td>1.0</td></tr> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1589 | <tr><td colspan="4"><b>Other Operators</b></td></tr> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1590 | <tr><td>PHI</td><td>27</td><td>1</td><td>1.0</td></tr> |
| 1591 | <tr><td>Cast</td><td>28</td><td>1</td><td>1.0</td></tr> |
| 1592 | <tr><td>Call</td><td>29</td><td>1</td><td>1.0</td></tr> |
| 1593 | <tr><td>Shl</td><td>30</td><td>1</td><td>1.0</td></tr> |
| 1594 | <tr><td>Shr</td><td>31</td><td>1</td><td>1.0</td></tr> |
| 1595 | <tr><td>VANext</td><td>32</td><td>1</td><td>1.0</td></tr> |
| 1596 | <tr><td>VAArg</td><td>33</td><td>1</td><td>1.0</td></tr> |
| 1597 | <tr><td>Select</td><td>34</td><td>2</td><td>1.2</td></tr> |
| 1598 | <tr><td>UserOp1</td><td>35</td><td>1</td><td>1.0</td></tr> |
| 1599 | <tr><td>UserOp2</td><td>36</td><td>1</td><td>1.0</td></tr> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1600 | </tbody> |
| 1601 | </table> |
| 1602 | </div> |
| 1603 | |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 1604 | <!-- _______________________________________________________________________ --> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame] | 1605 | <div class="doc_subsection"><a name="symtab">Symbol Table</a> </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 1606 | <div class="doc_text"> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1607 | <p>A symbol table can be put out in conjunction with a module or a function. A |
| 1608 | symbol table has a list of name/type associations followed by a list of |
| 1609 | name/value associations. The name/value associations are organized into "type |
| 1610 | planes" so that all values of a common type are listed together. Each type |
| 1611 | plane starts with the number of entries in the plane and the type slot number |
| 1612 | for all the values in that plane (so the type can be looked up in the global |
| 1613 | type pool). For each entry in a type plane, the slot number of the value and |
| 1614 | the name associated with that value are written. The format is given in the |
| 1615 | table below. </p> |
Reid Spencer | 2cc3615 | 2004-07-05 19:04:27 +0000 | [diff] [blame] | 1616 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1617 | <tbody> |
| 1618 | <tr> |
| 1619 | <th><b>Type</b></th> |
| 1620 | <th class="td_left"><b>Field Description</b></th> |
| 1621 | </tr> |
| 1622 | <tr> |
| 1623 | <td><a href="#block">block</a><br> |
| 1624 | </td> |
| 1625 | <td class="td_left">Symbol Table Identifier (0x04)</td> |
| 1626 | </tr> |
| 1627 | <tr> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1628 | <td><a href="#llist">llist</a>(<a href="#symtab_entry">type_entry</a>)</td> |
Reid Spencer | 8996e55 | 2004-08-17 00:49:03 +0000 | [diff] [blame] | 1629 | <td class="td_left">A length list of symbol table entries for |
| 1630 | <tt>Type</tt>s |
| 1631 | </td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1632 | </tr> |
| 1633 | <tr> |
Reid Spencer | 8996e55 | 2004-08-17 00:49:03 +0000 | [diff] [blame] | 1634 | <td><a href="#zlist">llist</a>(<a href="#symtab_plane">symtab_plane</a>)</td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1635 | <td class="td_left">A length list of "type planes" of symbol table |
Reid Spencer | 8996e55 | 2004-08-17 00:49:03 +0000 | [diff] [blame] | 1636 | entries for <tt>Value</tt>s</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1637 | </tr> |
| 1638 | </tbody> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame] | 1639 | </table> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 1640 | </div> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1641 | |
| 1642 | <!-- _______________________________________________________________________ --> |
| 1643 | <div class="doc_subsubsection"> <a name="type_entry">Symbol Table Type |
| 1644 | Entry</a> |
| 1645 | </div> |
| 1646 | <div class="doc_text"> |
| 1647 | <p>A symbol table type entry associates a name with a type. The name is provided |
| 1648 | simply as an array of chars. The type is provided as a type slot number (index) |
| 1649 | into the global type pool. The format is given in the following table:</p> |
| 1650 | <table> |
| 1651 | <tbody> |
| 1652 | <tr> |
| 1653 | <th><b>Type</b></th> |
| 1654 | <th class="td_left"><b>Field Description</b></th> |
| 1655 | </tr> |
| 1656 | <tr> |
| 1657 | <td><a href="#uint32_vbr">uint24_vbr</a></td> |
| 1658 | <td class="td_left">Type slot number of the type being given a |
| 1659 | name relative to the global type pool. |
| 1660 | </td> |
| 1661 | </tr> |
| 1662 | <tr> |
| 1663 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
| 1664 | <td class="td_left">Length of the character array that follows.</td> |
| 1665 | </tr> |
| 1666 | <tr> |
| 1667 | <td><a href="#char">char</a>+</td> |
| 1668 | <td class="td_left">The characters of the name.</td> |
| 1669 | </tr> |
| 1670 | </tbody> |
| 1671 | </table> |
| 1672 | </div> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1673 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1674 | <div class="doc_subsubsection"> <a name="symtab_plane">Symbol Table |
| 1675 | Plane</a> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1676 | </div> |
| 1677 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1678 | <p>A symbol table plane provides the symbol table entries for all |
| 1679 | values of a common type. The encoding is given in the following table:</p> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1680 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1681 | <tbody> |
| 1682 | <tr> |
| 1683 | <th><b>Type</b></th> |
| 1684 | <th class="td_left"><b>Field Description</b></th> |
| 1685 | </tr> |
| 1686 | <tr> |
| 1687 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
| 1688 | <td class="td_left">Number of entries in this plane.</td> |
| 1689 | </tr> |
| 1690 | <tr> |
| 1691 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1692 | <td class="td_left">Type slot number of type for all values in this plane..</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1693 | </tr> |
| 1694 | <tr> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1695 | <td><a href="#value_entry">value_entry</a>+</td> |
| 1696 | <td class="td_left">The symbol table entries for to associate values with |
| 1697 | names.</td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1698 | </tr> |
| 1699 | </tbody> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1700 | </table> |
| 1701 | </div> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1702 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1703 | <div class="doc_subsubsection"><a name="value_entry">Symbol Table Value |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1704 | Entry</a> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1705 | </div> |
| 1706 | <div class="doc_text"> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1707 | <p>A symbol table value entry provides the assocation between a value and the |
| 1708 | name given to the value. The value is referenced by its slot number. The |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1709 | format is given in the following table:</p> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1710 | <table> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1711 | <tbody> |
| 1712 | <tr> |
| 1713 | <th><b>Type</b></th> |
| 1714 | <th class="td_left"><b>Field Description</b></th> |
| 1715 | </tr> |
| 1716 | <tr> |
| 1717 | <td><a href="#uint32_vbr">uint24_vbr</a></td> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1718 | <td class="td_left">Value slot number of the value being given a name. |
Reid Spencer | 8996e55 | 2004-08-17 00:49:03 +0000 | [diff] [blame] | 1719 | </td> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1720 | </tr> |
| 1721 | <tr> |
| 1722 | <td><a href="#uint32_vbr">uint32_vbr</a></td> |
| 1723 | <td class="td_left">Length of the character array that follows.</td> |
| 1724 | </tr> |
| 1725 | <tr> |
| 1726 | <td><a href="#char">char</a>+</td> |
| 1727 | <td class="td_left">The characters of the name.</td> |
| 1728 | </tr> |
| 1729 | </tbody> |
Reid Spencer | 51f31e0 | 2004-07-05 22:28:02 +0000 | [diff] [blame] | 1730 | </table> |
| 1731 | </div> |
Reid Spencer | 09daa63 | 2004-08-18 20:06:19 +0000 | [diff] [blame] | 1732 | |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 1733 | <!-- *********************************************************************** --> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1734 | <div class="doc_section"> <a name="versiondiffs">Version Differences</a> |
| 1735 | </div> |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 1736 | <!-- *********************************************************************** --> |
| 1737 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1738 | <p>This section describes the differences in the Bytecode Format across |
| 1739 | LLVM |
| 1740 | versions. The versions are listed in reverse order because it assumes |
| 1741 | the current version is as documented in the previous sections. Each |
| 1742 | section here |
Chris Lattner | 1cc070c | 2004-07-05 18:05:48 +0000 | [diff] [blame] | 1743 | describes the differences between that version and the one that <i>follows</i>. |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 1744 | </p> |
| 1745 | </div> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1746 | |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 1747 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 43dfdb7 | 2004-08-18 20:17:05 +0000 | [diff] [blame] | 1748 | <div class="doc_subsection"><a name="vers13">Version 1.3 Differences From |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1749 | 1.4</a></div> |
Reid Spencer | cf549e1 | 2004-08-17 07:43:43 +0000 | [diff] [blame] | 1750 | <!-- _______________________________________________________________________ --> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1751 | |
| 1752 | <div class="doc_subsubsection">Unreachable Instruction</div> |
| 1753 | <div class="doc_text"> |
| 1754 | <p>The LLVM <a href="LangRef.html#i_unreachable">Unreachable</a> instruction |
| 1755 | was added in version 1.4 of LLVM. This caused all instruction numbers after |
| 1756 | it to shift down by one.</p> |
| 1757 | </div> |
| 1758 | |
| 1759 | <div class="doc_subsubsection">Function Flags</div> |
| 1760 | <div class="doc_text"> |
| 1761 | <p>LLVM bytecode versions prior to 1.4 did not include the 5 bit offset |
| 1762 | in <a href="#funcfield">the function list</a> in the <a |
| 1763 | href="#globalinfo">Module Global Info</a> block.</p> |
| 1764 | </div> |
| 1765 | |
| 1766 | <div class="doc_subsubsection">Function Flags</div> |
| 1767 | <div class="doc_text"> |
| 1768 | <p>LLVM bytecode versions prior to 1.4 did not include the 'undef' constant |
| 1769 | value, which affects the encoding of <a href="#constant">Constant |
| 1770 | Fields</a>.</p> |
| 1771 | </div> |
| 1772 | |
Chris Lattner | 1dfc8e5 | 2004-10-16 00:29:30 +0000 | [diff] [blame] | 1773 | <!-- |
Reid Spencer | cf549e1 | 2004-08-17 07:43:43 +0000 | [diff] [blame] | 1774 | <div class="doc_subsubsection">Aligned Data</div> |
| 1775 | <div class="doc_text"> |
| 1776 | <p>In version 1.3, certain data items were aligned to 32-bit boundaries. In |
| 1777 | version 1.4, alignment of data was done away with completely. The need for |
| 1778 | alignment has gone away and the only thing it adds is bytecode file size |
| 1779 | overhead. In most cases this overhead was small. However, in functions with |
| 1780 | large numbers of format 0 instructions (GEPs and PHIs with lots of parameters) |
| 1781 | or regular instructions with large valued operands (e.g. because there's just |
| 1782 | a lot of instructions in the function) the overhead can be extreme. In one |
| 1783 | test case, the overhead was 44,000 bytes (34% of the total file size). |
| 1784 | Consequently in release 1.4, the decision was made to eliminate alignment |
| 1785 | altogether.</p> |
| 1786 | <p>In version 1.3 format, the following bytecode constructs were aligned (i.e. |
| 1787 | they were followed by one to three bytes of padding):</p> |
| 1788 | <ul> |
| 1789 | <li>All blocks.</li> |
| 1790 | <li>Instructions using the long format (format 0).</li> |
| 1791 | <li>All call instructions that called a var args function.</li> |
| 1792 | <li>The target triple (a string field at the end of the module block).</li> |
| 1793 | <li>The version field (immediately following the signature).</li> |
| 1794 | </ul> |
| 1795 | <p>None of these constructs are aligned in version 1.4</p> |
| 1796 | </div> |
Chris Lattner | 1dfc8e5 | 2004-10-16 00:29:30 +0000 | [diff] [blame] | 1797 | --> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1798 | |
Reid Spencer | cf549e1 | 2004-08-17 07:43:43 +0000 | [diff] [blame] | 1799 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1800 | <div class="doc_subsection"><a name="vers12">Version 1.2 Differences |
| 1801 | From 1.3</a></div> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1802 | <!-- _______________________________________________________________________ --> |
Chris Lattner | a1dad81 | 2004-10-16 18:03:55 +0000 | [diff] [blame] | 1803 | |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1804 | <div class="doc_subsubsection">Type Derives From Value</div> |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 1805 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1806 | <p>In version 1.2, the Type class in the LLVM IR derives from the Value |
| 1807 | class. This is not the case in version 1.3. Consequently, in version |
| 1808 | 1.2 the notion of a "Type Type" was used to write out values that were |
| 1809 | Types. The types always occuped plane 12 (corresponding to the |
| 1810 | TypeTyID) of any type planed set of values. In 1.3 this representation |
| 1811 | is not convenient because the TypeTyID (12) is not present and its |
| 1812 | value is now used for LabelTyID. Consequently, the data structures |
| 1813 | written that involve types do so by writing all the types first and |
| 1814 | then each of the value planes according to those types. In version 1.2, |
| 1815 | the types would have been written intermingled with the values.</p> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1816 | </div> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1817 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1818 | <div class="doc_subsubsection">Restricted getelementptr Types</div> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1819 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1820 | <p>In version 1.2, the getelementptr instruction required a ubyte type |
| 1821 | index for accessing a structure field and a long type index for |
| 1822 | accessing an array element. Consequently, it was only possible to |
| 1823 | access structures of 255 or fewer elements. Starting in version 1.3, |
| 1824 | this restriction was lifted. Structures must now be indexed with uint |
| 1825 | constants. Arrays may now be indexed with int, uint, long, or ulong |
| 1826 | typed values. The consequence of this was that the bytecode format had |
| 1827 | to change in order to accommodate the larger range of structure indices.</p> |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 1828 | </div> |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 1829 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1830 | <div class="doc_subsubsection">Short Block Headers</div> |
| 1831 | <div class="doc_text"> |
| 1832 | <p>In version 1.2, block headers were always 8 bytes being comprised of |
| 1833 | both an unsigned integer type and an unsigned integer size. For very |
| 1834 | small modules, these block headers turn out to be a large fraction of |
| 1835 | the total bytecode file size. In an attempt to make these small files |
| 1836 | smaller, the type and size information was encoded into a single |
| 1837 | unsigned integer (4 bytes) comprised of 5 bits for the block type |
| 1838 | (maximum 31 block types) and 27 bits for the block size (max |
| 1839 | ~134MBytes). These limits seemed sufficient for any blocks or sizes |
| 1840 | forseen in the future. Note that the module block, which encloses all |
| 1841 | the other blocks is still written as 8 bytes since bytecode files |
| 1842 | larger than 134MBytes might be possible.</p> |
| 1843 | </div> |
| 1844 | <!-- _______________________________________________________________________ --> |
| 1845 | <div class="doc_subsubsection">Dependent Libraries and Target Triples</div> |
| 1846 | <div class="doc_text"> |
| 1847 | <p>In version 1.2, the bytecode format does not store module's target |
| 1848 | triple or dependent. These fields have been added to the end of the <a |
| 1849 | href="#globalinfo">module global info block</a>. The purpose of these |
| 1850 | fields is to allow a front end compiler to specifiy that the generated |
| 1851 | module is specific to a particular target triple (operating |
| 1852 | system/manufacturer/processor) which makes it non-portable; and to |
| 1853 | allow front end compilers to specify the list of libraries that the |
| 1854 | module depends on for successful linking.</p> |
| 1855 | </div> |
| 1856 | <!-- _______________________________________________________________________ --> |
| 1857 | <div class="doc_subsubsection">Types Restricted to 24-bits</div> |
| 1858 | <div class="doc_text"> |
| 1859 | <p>In version 1.2, type slot identifiers were written as 32-bit VBR |
| 1860 | quantities. In 1.3 this has been reduced to 24-bits in order to ensure |
| 1861 | that it is not possible to overflow the type field of a global variable |
| 1862 | definition. 24-bits for type slot numbers is deemed sufficient for any |
| 1863 | practical use of LLVM.</p> |
| 1864 | </div> |
| 1865 | <!-- _______________________________________________________________________ --> |
| 1866 | <!-- _______________________________________________________________________ --> |
| 1867 | <div class="doc_subsection"><a name="vers11">Version 1.1 Differences |
| 1868 | From 1.2 </a></div> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1869 | <!-- _______________________________________________________________________ --> |
| 1870 | <div class="doc_subsubsection">Explicit Primitive Zeros</div> |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 1871 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1872 | <p>In version 1.1, the zero value for primitives was explicitly encoded |
| 1873 | into the bytecode format. Since these zero values are constant values |
| 1874 | in the LLVM IR and never change, there is no reason to explicitly |
| 1875 | encode them. This explicit encoding was removed in version 1.2.</p> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1876 | </div> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1877 | <!-- _______________________________________________________________________ --> |
| 1878 | <div class="doc_subsubsection">Inconsistent Module Global Info</div> |
| 1879 | <div class="doc_text"> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1880 | <p>In version 1.1, the Module Global Info block was not aligned causing |
| 1881 | the next block to be read in on an unaligned boundary. This problem was |
| 1882 | corrected in version 1.2.<br> |
| 1883 | <br> |
| 1884 | </p> |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 1885 | </div> |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 1886 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1887 | <div class="doc_subsection"><a name="vers10">Version 1.0 Differences |
| 1888 | From 1.1</a></div> |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 1889 | <div class="doc_text"> |
Reid Spencer | 1ab929c | 2004-07-05 08:18:07 +0000 | [diff] [blame] | 1890 | <p>None. Version 1.0 and 1.1 bytecode formats are identical.</p> |
Reid Spencer | 7c76d33 | 2004-06-08 07:41:41 +0000 | [diff] [blame] | 1891 | </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 1892 | <!-- *********************************************************************** --> |
| 1893 | <hr> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1894 | <address> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img |
| 1895 | src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> |
| 1896 | <a href="http://validator.w3.org/check/referer"><img |
| 1897 | src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> |
| 1898 | <a href="mailto:rspencer@x10sys.com">Reid Spencer</a> and <a |
| 1899 | href="mailto:sabre@nondot.org">Chris Lattner</a><br> |
| 1900 | <a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a><br> |
| 1901 | Last modified: $Date$ |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 1902 | </address> |
Reid Spencer | 9bd2be2 | 2004-07-29 00:13:04 +0000 | [diff] [blame] | 1903 | </body> |
| 1904 | </html> |