Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
| 3 | <html> |
| 4 | <head> |
| 5 | <title>LLVM Bytecode File Format</title> |
| 6 | <link rel="stylesheet" href="llvm.css" type="text/css"> |
| 7 | <style> |
| 8 | table, tr, td { border: 2px solid gray } |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 9 | th { border: 2px solid gray; font-weight: bold; } |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 10 | table { border-collapse: collapse; margin-top: 1em margin-bottom: 1em } |
| 11 | </style> |
| 12 | </head> |
| 13 | <body> |
| 14 | <div class="doc_title"> LLVM Bytecode File Format </div> |
| 15 | <ol> |
| 16 | <li><a href="#abstract">Abstract</a></li> |
| 17 | <li><a href="#general">General Concepts</a></li> |
| 18 | <ol> |
| 19 | <li><a href="#blocks">Blocks</a></li> |
| 20 | <li><a href="#lists">Lists</a></li> |
| 21 | <li><a href="#fields">Fields</a></li> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 22 | <li><a href="#encoding">Encoding Rules</a></li> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 23 | <li><a href="#align">Alignment</a></li> |
| 24 | </ol> |
| 25 | <li><a href="#details">Detailed Layout</a> |
| 26 | <ol> |
| 27 | <li><a href="#notation">Notation</a></li> |
| 28 | <li><a href="#blocktypes">Blocks Types</a></li> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 29 | <li><a href="#signature">Signature Block</a></li> |
| 30 | <li><a href="#module">Module Block</a></li> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 31 | <li><a href="#typeool">Global Type Pool</a></li> |
| 32 | <li><a href="#modinfo">Module Info Block</a></li> |
| 33 | <li><a href="#constants">Global Constant Pool</a></li> |
| 34 | <li><a href="#functions">Function Blocks</a><li> |
| 35 | <li><a href="#symtab">Module Symbol Table</a><li> |
| 36 | </ol> |
| 37 | </li> |
| 38 | </ol> |
| 39 | <div class="doc_text"> |
| 40 | <p><b>Written by <a href="mailto:rspencer@x10sys.com">Reid Spencer</a> |
| 41 | and <a href="mailto:sabre@nondot.org">Chris Lattner</a></b></p> |
| 42 | <p> </p> |
| 43 | </div> |
| 44 | <!-- *********************************************************************** --> |
| 45 | <div class="doc_section"> <a name="abstract">Abstract </a></div> |
| 46 | <!-- *********************************************************************** --> |
| 47 | <div class="doc_text"> |
| 48 | <p>This document is an (after the fact) specification of the LLVM bytecode |
| 49 | file format. It documents the binary encoding rules of the bytecode file format |
| 50 | so that equivalent systems can encode bytecode files correctly. The LLVM |
| 51 | bytecode representation is used to store the intermediate representation on |
| 52 | disk in compacted form. |
| 53 | </p> |
| 54 | </div> |
| 55 | <!-- *********************************************************************** --> |
| 56 | <div class="doc_section"> <a name="general">General Concepts</a> </div> |
| 57 | <!-- *********************************************************************** --> |
| 58 | <div class="doc_text"> |
| 59 | <p>This section describes the general concepts of the bytecode file format |
| 60 | without getting into bit and byte level specifics.</p> |
| 61 | </div> |
| 62 | <!-- _______________________________________________________________________ --> |
| 63 | <div class="doc_subsection"><a name="blocks">Blocks</a> </div> |
| 64 | <div class="doc_text"> |
| 65 | <p>LLVM bytecode files consist simply of a sequence of blocks of bytes. |
| 66 | Each block begins with an identification value that determines the type of |
| 67 | the next block. The possible types of blocks are described below in the section |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 68 | <a href="#blocktypes">Block Types</a>. The block identifier is used because |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 69 | it is possible for entire blocks to be omitted from the file if they are |
| 70 | empty. The block identifier helps the reader determine which kind of block is |
| 71 | next in the file.</p> |
Reid Spencer | 939290f | 2004-05-22 05:56:41 +0000 | [diff] [blame] | 72 | <p>The following block identifiers are currently in use |
| 73 | (from llvm/Bytecode/Format.h):</p> |
| 74 | <ol> |
| 75 | <li><b>Module (0x01)</b>.</li> |
| 76 | <li><b>Function (0x11)</b>.</li> |
| 77 | <li><b>ConstantPool (0x12)</b>.</li> |
| 78 | <li><b>SymbolTable (0x13)</b>.</li> |
| 79 | <li><b>ModuleGlobalInfo (0x14)</b>.</li> |
| 80 | <li><b>GlobalTypePlane (0x15)</b>.</li> |
| 81 | <li><b>BasicBlock (0x31)</b>.</li> |
| 82 | <li><b>InstructionList (0x32)</b>.</li> |
| 83 | <li><b>CompactionTable (0x33)</b>.</li> |
| 84 | </ol> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 85 | <p> All blocks are variable length. They consume just enough bytes to express |
| 86 | their contents. Each block begins with an integer identifier and the length |
| 87 | of the block.</p> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 88 | </div> |
| 89 | <!-- _______________________________________________________________________ --> |
| 90 | <div class="doc_subsection"><a name="lists">Lists</a> </div> |
| 91 | <div class="doc_text"> |
| 92 | <p>Most blocks are constructed of lists of information. Lists can be constructed |
| 93 | of other lists, etc. This decomposition of information follows the containment |
| 94 | hierarchy of the LLVM Intermediate Representation. For example, a function is |
| 95 | composed of a list of basic blocks. Each basic block is composed of a set of |
| 96 | instructions. This list of list nesting and hierarchy is maintained in the |
| 97 | bytecode file.</p> |
| 98 | <p>A list is encoded into the file simply by encoding the number of entries as |
| 99 | an integer followed by each of the entries. The reader knows when the list is |
| 100 | done because it will have filled the list with the required numbe of entries. |
| 101 | </p> |
| 102 | </div> |
| 103 | <!-- _______________________________________________________________________ --> |
| 104 | <div class="doc_subsection"><a name="fields">Fields</a> </div> |
| 105 | <div class="doc_text"> |
| 106 | <p>Fields are units of information that LLVM knows how to write atomically. |
| 107 | Most fields have a uniform length or some kind of length indication built into |
| 108 | their encoding. For example, a constant string (array of SByte or UByte) is |
| 109 | written simply as the length followed by the characters. Although this is |
| 110 | similar to a list, constant strings are treated atomically and are thus |
| 111 | fields.</p> |
| 112 | <p>Fields use a condensed bit format specific to the type of information |
| 113 | they must contain. As few bits as possible are written for each field. The |
| 114 | sections that follow will provide the details on how these fields are |
| 115 | written and how the bits are to be interpreted.</p> |
| 116 | </div> |
| 117 | <!-- _______________________________________________________________________ --> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 118 | <div class="doc_subsection"><a name="encoding">Encoding Primitives</a> </div> |
| 119 | <div class="doc_text"> |
| 120 | <p>Each field that can be put out is encoded into the file using a small set |
| 121 | of primitives. The rules for these primitives are described below.</p> |
| 122 | <h3>Variable Bit Rate Encoding</h3> |
| 123 | <p>To minimize the number of bytes written for small quantities, an encoding |
| 124 | scheme similar to UTF-8 is used to write integer data. The scheme is known as |
| 125 | variable bit rate (vbr) encoding. In this encoding, the high bit of each |
| 126 | byte is used to indicate if more bytes follow. If (byte & 0x80) is non-zero |
| 127 | in any given byte, it means there is another byte immediately following that |
| 128 | also contributes to the value. For the final byte (byte & 0x80) is false |
| 129 | (the high bit is not set). In each byte only the low seven bits contribute to |
| 130 | the value. Consequently 32-bit quantities can take from one to <em>five</em> |
| 131 | bytes to encode. In general, smaller quantities will encode in fewer bytes, |
| 132 | as follows:</p> |
| 133 | <table class="doc_table_nw"> |
| 134 | <tr> |
| 135 | <th>Byte #</th> |
| 136 | <th>Significant Bits</th> |
| 137 | <th>Maximum Value</th> |
| 138 | </tr> |
| 139 | <tr><td>1</td><td>0-6</td><td>127</td></tr> |
| 140 | <tr><td>2</td><td>7-13</td><td>16,383</td></tr> |
| 141 | <tr><td>3</td><td>14-20</td><td>2,097,151</td></tr> |
| 142 | <tr><td>4</td><td>21-27</td><td>268,435,455</td></tr> |
| 143 | <tr><td>5</td><td>28-34</td><td>34,359,738,367</td></tr> |
| 144 | <tr><td>6</td><td>35-41</td><td>4,398,046,511,103</td></tr> |
| 145 | <tr><td>7</td><td>42-48</td><td>562,949,953,421,311</td></tr> |
| 146 | <tr><td>8</td><td>49-55</td><td>72,057,594,037,927,935</td></tr> |
| 147 | <tr><td>9</td><td>56-62</td><td>9,223,372,036,854,775,807</td></tr> |
| 148 | <tr><td>10</td><td>63-69</td><td>1,180,591,620,717,411,303,423</td></tr> |
| 149 | </table> |
| 150 | <p>Note that in practice, the tenth byte could only encode bits 63 and 64 |
| 151 | since the maximum quantity to use this encoding is a 64-bit integer.</p> |
| 152 | <p>The table below defines the encoding rules for type names used in the |
| 153 | descriptions of blocks and fields in the next section. Any type name with |
| 154 | the suffix <em>_vbr</em> indicate a quantity that is encoded using |
| 155 | variable bit rate encoding as described above.</p> |
| 156 | <table class="doc_table" > |
| 157 | <tr> |
| 158 | <th><b>Type</b></th> |
| 159 | <th align="left"><b>Rule</b></th> |
| 160 | </tr> |
| 161 | <tr> |
| 162 | <td>unsigned</td> |
| 163 | <td align="left">A 32-bit unsigned integer that always occupies four |
| 164 | consecutive bytes. The unsigned integer is encoded using LSB first |
| 165 | ordering. That is bits 2<sup>0</sup> through 2<sup>7</sup> are in the |
| 166 | byte with the lowest file offset (little endian).</td> |
| 167 | </tr><tr> |
| 168 | <td>uint_vbr</td> |
| 169 | <td align="left">A 32-bit unsigned integer that occupies from one to five |
| 170 | bytes using variable bit rate encoding.</td> |
| 171 | </tr><tr> |
| 172 | <td>uint64_vbr</td> |
| 173 | <td align="left">A 64-bit unsigned integer that occupies from one to ten |
| 174 | bytes using variable bit rate encoding.</td> |
| 175 | </tr><tr> |
| 176 | <td>int64_vbr</td> |
| 177 | <td align="left">A 64-bit signed integer that occupies from one to ten |
| 178 | bytes using variable bit rate encoding.</td> |
| 179 | </tr><tr> |
| 180 | <td>char</td> |
| 181 | <td align="left">A single unsigned character encoded into one byte</td> |
| 182 | </tr><tr> |
| 183 | <td>bit</td> |
| 184 | <td align="left">A single bit within a byte.</td> |
| 185 | </tr><tr> |
| 186 | <td>string</td> |
| 187 | <td align="left">A uint_vbr indicating the length of the character string |
| 188 | immediately followed by the characters of the string. There is no |
| 189 | terminating null byte in the string. Characters are interpreted as unsigned |
| 190 | char and are generally US-ASCII encoded.</td> |
| 191 | </tr><tr> |
| 192 | <td>data</td> |
| 193 | <td align="left">An arbitrarily long segment of data to which no |
| 194 | interpretation is implied. This is used for float, double, and constant |
| 195 | initializers.</td> |
| 196 | </tr> |
| 197 | </table> |
| 198 | </div> |
| 199 | <!-- _______________________________________________________________________ --> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 200 | <div class="doc_subsection"><a name="align">Alignment</a> </div> |
| 201 | <div class="doc_text"> |
| 202 | <p>To support cross-platform differences, the bytecode file is aligned on |
| 203 | certain boundaries. This means that a small amount of padding (at most 3 bytes) |
| 204 | will be added to ensure that the next entry is aligned to a 32-bit boundary. |
| 205 | </p> |
| 206 | </div> |
| 207 | <!-- *********************************************************************** --> |
| 208 | <div class="doc_section"> <a name="details">Detailed Layout</a> </div> |
| 209 | <!-- *********************************************************************** --> |
| 210 | <div class="doc_text"> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 211 | <p>This section provides the detailed layout of the LLVM bytecode file format. |
| 212 | bit and byte level specifics.</p> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 213 | </div> |
| 214 | <!-- _______________________________________________________________________ --> |
| 215 | <div class="doc_subsection"><a name="notation">Notation</a></div> |
| 216 | <div class="doc_text"> |
| 217 | <p>The descriptions of the bytecode format that follow describe the bit |
| 218 | fields in detail. These descriptions are provided in tabular form. Each table |
| 219 | has four columns that specify:</p> |
| 220 | <ol> |
| 221 | <li><b>Byte(s)</b>. The offset in bytes of the field from the start of |
| 222 | its container (block, list, other field).<li> |
| 223 | <li><b>Bit(s)</b>. The offset in bits of the field from the start of |
| 224 | the byte field. Bits are always little endian. That is, bit addresses with |
| 225 | smaller values have smaller address (i.e. 2^0 is at bit 0, 2^1 at 1, etc.) |
| 226 | </li> |
| 227 | <li><b>Align?</b> Indicates if this field is aligned to 32 bits or not. |
| 228 | This indicates where the <em>next</em> field starts, always on a 32 bit |
| 229 | boundary.</li> |
Reid Spencer | 939290f | 2004-05-22 05:56:41 +0000 | [diff] [blame] | 230 | <li><b>Type</b>. The basic type of information contained in the field.</li> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 231 | <li><b>Description</b>. Descripts the contents of the field.</li> |
| 232 | </ol> |
| 233 | </div> |
| 234 | <!-- _______________________________________________________________________ --> |
| 235 | <div class="doc_subsection"><a name="blocktypes">Block Types</a></div> |
| 236 | <div class="doc_text"> |
| 237 | <p>The bytecode format encodes the intermediate representation into groups |
| 238 | of bytes known as blocks. The blocks are written sequentially to the file in |
| 239 | the following order:</p> |
| 240 | <ol> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 241 | <li><a href="#signature">Signature</a>. This block contains the file signature |
| 242 | (magic number) that identifies the file as LLVM bytecode.</li> |
| 243 | <li><a href="#module">Module Block</a>. This is the top level block in a |
| 244 | bytecode file. It contains all the other blocks.</li> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 245 | <li><a href="#gtypepool">Global Type Pool</a>. This block contains all the |
| 246 | global (module) level types.</li> |
| 247 | <li><a href="#modinfo">Module Info</a>. This block contains the types of the |
| 248 | global variables and functions in the module as well as the constant |
| 249 | initializers for the global variables</li> |
| 250 | <li><a href="#constants">Constants</a>. This block contains all the global |
| 251 | constants except function arguments, global values and constant strings.</li> |
| 252 | <li><a href="#functions">Functions</a>. One function block is written for |
| 253 | each function in the module. </li> |
| 254 | <li><a href="$symtab">Symbol Table</a>. The module level symbol table that |
| 255 | provides names for the various other entries in the file is the final block |
| 256 | written.</li> |
| 257 | </ol> |
| 258 | </div> |
| 259 | <!-- _______________________________________________________________________ --> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 260 | <div class="doc_subsection"><a name="signature">Signature Block</a> </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 261 | <div class="doc_text"> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 262 | <p>The signature block occurs in every LLVM bytecode file and is always first. |
| 263 | It simply provides a few bytes of data to identify the file as being an LLVM |
| 264 | bytecode file. This block is always four bytes in length and differs from the |
| 265 | other blocks because there is no identifier and no block length at the start |
| 266 | of the block. Essentially, this block is just the "magic number" for the file. |
| 267 | <table class="doc_table_nw" > |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 268 | <tr> |
| 269 | <th><b>Byte(s)</b></th> |
| 270 | <th><b>Bit(s)</b></th> |
| 271 | <th><b>Align?</b></th> |
Reid Spencer | 939290f | 2004-05-22 05:56:41 +0000 | [diff] [blame] | 272 | <th><b>Type</b></th> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 273 | <th align="left"><b>Field Description</b></th> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 274 | </tr><tr> |
| 275 | <td>00</td><td>-</td><td>No</td><td>char</td> |
Reid Spencer | 939290f | 2004-05-22 05:56:41 +0000 | [diff] [blame] | 276 | <td align="left">Constant "l" (0x6C)</td> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 277 | </tr><tr> |
| 278 | <td>01</td><td>-</td><td>No</td><td>char</td> |
Reid Spencer | 939290f | 2004-05-22 05:56:41 +0000 | [diff] [blame] | 279 | <td align="left">Constant "l" (0x6C)</td> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 280 | </tr><tr> |
| 281 | <td>02</td><td>-</td><td>No</td><td>char</td> |
Reid Spencer | 939290f | 2004-05-22 05:56:41 +0000 | [diff] [blame] | 282 | <td align="left">Constant "v" (0x76)</td> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 283 | </tr><tr> |
| 284 | <td>03</td><td>-</td><td>No</td><td>char</td> |
Reid Spencer | 939290f | 2004-05-22 05:56:41 +0000 | [diff] [blame] | 285 | <td align="left">Constant "m" (0x6D)</td> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 286 | </tr> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 287 | </table> |
| 288 | </div> |
| 289 | <!-- _______________________________________________________________________ --> |
| 290 | <div class="doc_subsection"><a name="module">Module Block</a> </div> |
| 291 | <div class="doc_text"> |
| 292 | <p>The module block contains a small pre-amble and all the other blocks in |
| 293 | the file. Of particular note, the bytecode format number is simply a 28-bit |
| 294 | monotonically increase integer that identifiers the version of the bytecode |
| 295 | format. While the bytecode format version is not related to the LLVM release |
| 296 | (it doesn't automatically get increased with each new LLVM release), there is |
| 297 | a definite correspondence between the bytecode format version and the LLVM |
| 298 | release.</p> |
| 299 | <p>The table below shows the format of the module block header. The blocks it |
| 300 | contains are detailed in other sections.</p> |
| 301 | <table class="doc_table_nw" > |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 302 | <tr> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 303 | <th><b>Byte(s)</b></th> |
| 304 | <th><b>Bit(s)</b></th> |
| 305 | <th><b>Align?</b></th> |
| 306 | <th><b>Type</b></th> |
| 307 | <th align="left"><b>Field Description</b></th> |
| 308 | </tr><tr> |
| 309 | <td>04-07</td><td>-</td><td>No</td><td>unsigned</td> |
| 310 | <td align="left">Module Identifier (0x01)</td> |
| 311 | </tr><tr> |
| 312 | <td>08-11</td><td>-</td><td>No</td><td>unsigned</td> |
| 313 | <td align="left">Size of the module block in bytes</td> |
| 314 | </tr><tr> |
| 315 | <td>12-15</td><td>00</td><td>Yes</td><td>uint32_vbr</td> |
| 316 | <td align="left">Format Information</td> |
| 317 | </tr><tr> |
| 318 | <td>''</td><td>0</td><td>-</td><td>bit</td> |
| 319 | <td align="left">Big Endian?</td> |
| 320 | </tr><tr> |
| 321 | <td>''</td><td>1</td><td>-</td><td>bit</td> |
| 322 | <td align="left">Pointers Are 64-bit?</td> |
| 323 | </tr><tr> |
| 324 | <td>''</td><td>2</td><td>-</td><td>bit</td> |
| 325 | <td align="left">Has No Endianess?</td> |
| 326 | </tr><tr> |
| 327 | <td>''</td><td>3</td><td>-</td><td>bit</td> |
| 328 | <td align="left">Has No Pointer Size?</td> |
| 329 | </tr><tr> |
| 330 | <td>''</td><td>4-31</td><td>-</td><td>bit</td> |
| 331 | <td align="left">Bytecode Format Version</td> |
| 332 | </tr><tr> |
| 333 | <td>16-end</td><td>-</td><td>-</td><td>blocks</td> |
| 334 | <td align="left">The remaining bytes in the block consist |
| 335 | solely of other block types in sequence.</td> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 336 | </tr> |
| 337 | </table> |
| 338 | </div> |
| 339 | <!-- _______________________________________________________________________ --> |
| 340 | <div class="doc_subsection"><a name="gtypepool">Global Type Pool</a> </div> |
| 341 | <div class="doc_text"> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 342 | <p>The global type pool consists of type definitions. Their order of appearnce |
| 343 | in the file determines their slot number (0 based). Slot numbers are used to |
| 344 | replace pointers in the intermediate representation. Each slot number uniquely |
| 345 | identifies one entry in a type plane (a collection of values of the same type). |
| 346 | Since all values have types and are associated with the order in which the type |
| 347 | pool is written, the global type pool <em>must</em> be written as the first |
| 348 | block of a module. If it is not, attempts to read the file will fail because |
| 349 | both forward and backward type resolution will not be possible.</p> |
| 350 | <p>The type pool is simply a list of types definitions, as shown in the table |
| 351 | below.</p> |
| 352 | <table class="doc_table_nw" > |
| 353 | <tr> |
| 354 | <th><b>Byte(s)</b></th> |
| 355 | <th><b>Bit(s)</b></th> |
| 356 | <th><b>Align?</b></th> |
| 357 | <th><b>Type</b></th> |
| 358 | <th align="left"><b>Field Description</b></th> |
| 359 | </tr><tr> |
| 360 | <td>00-03</td><td>-</td><td>No</td><td>unsigned</td> |
| 361 | <td align="left">Type Pool Identifier (0x13)</td> |
| 362 | </tr><tr> |
| 363 | <td>04-07</td><td>-</td><td>No</td><td>unsigned</td> |
| 364 | <td align="left">Size in bytes of the symbol table block.</td> |
| 365 | </tr><tr> |
| 366 | <td>08-11<sup>1</sup></td><td>-</td><td>No</td><td>uint32_vbr</td> |
| 367 | <td align="left">Number of entries in type plane</td> |
| 368 | </tr><tr> |
| 369 | <td>12-15<sup>1</sup></td><td>-</td><td>No</td><td>uint32_vbr</td> |
| 370 | <td align="left">Type plane index for following entries</td> |
| 371 | </tr><tr> |
| 372 | <td>16-end<sup>1,2</sup></td><td>-</td><td>No</td><td>type</td> |
| 373 | <td align="left">Each of the type definitions.</td> |
| 374 | </tr><tr> |
| 375 | <td align="left" colspan="5"><sup>1</sup>Maximum length shown, |
| 376 | may be smaller<br><sup>2</sup>Repeated field. |
| 377 | </tr> |
| 378 | </table> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 379 | </div> |
| 380 | <!-- _______________________________________________________________________ --> |
| 381 | <div class="doc_subsection"><a name="modinfo">Module Info</a> </div> |
| 382 | <div class="doc_text"> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 383 | <p>To be determined.</p> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 384 | </div> |
| 385 | <!-- _______________________________________________________________________ --> |
| 386 | <div class="doc_subsection"><a name="constants">Constants</a> </div> |
| 387 | <div class="doc_text"> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 388 | <p>To be determined.</p> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 389 | </div> |
| 390 | <!-- _______________________________________________________________________ --> |
| 391 | <div class="doc_subsection"><a name="functions">Functions</a> </div> |
| 392 | <div class="doc_text"> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 393 | <p>To be determined.</p> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 394 | </div> |
| 395 | <!-- _______________________________________________________________________ --> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 396 | <div class="doc_subsection"><a name="symtab">Symbol Table</a> </div> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 397 | <div class="doc_text"> |
Reid Spencer | b39021b | 2004-05-23 17:05:09 +0000 | [diff] [blame^] | 398 | <p>A symbol table can be put out in conjunction with a module or a function. |
| 399 | A symbol table is a list of type planes. Each type plane starts with the number |
| 400 | of entries in the plane and the type plane's slot number (so the type can be |
| 401 | looked up in the global type pool). For each entry in a type plane, the slot |
| 402 | number of the value and the name associated with that value are written. The |
| 403 | format is given in the table below. </p> |
| 404 | <table class="doc_table_nw" > |
| 405 | <tr> |
| 406 | <th><b>Byte(s)</b></th> |
| 407 | <th><b>Bit(s)</b></th> |
| 408 | <th><b>Align?</b></th> |
| 409 | <th><b>Type</b></th> |
| 410 | <th align="left"><b>Field Description</b></th> |
| 411 | </tr><tr> |
| 412 | <td>00-03</td><td>-</td><td>No</td><td>unsigned</td> |
| 413 | <td align="left">Symbol Table Identifier (0x13)</td> |
| 414 | </tr><tr> |
| 415 | <td>04-07</td><td>-</td><td>No</td><td>unsigned</td> |
| 416 | <td align="left">Size in bytes of the symbol table block.</td> |
| 417 | </tr><tr> |
| 418 | <td>08-11<sup>1</sup></td><td>-</td><td>No</td><td>uint32_vbr</td> |
| 419 | <td align="left">Number of entries in type plane</td> |
| 420 | </tr><tr> |
| 421 | <td>12-15<sup>1</sup></td><td>-</td><td>No</td><td>uint32_vbr</td> |
| 422 | <td align="left">Type plane index for following entries</td> |
| 423 | </tr><tr> |
| 424 | <td>16-19<sup>1,2</sup></td><td>-</td><td>No</td><td>uint32_vbr</td> |
| 425 | <td align="left">Slot number of a value.</td> |
| 426 | </tr><tr> |
| 427 | <td>variable<sup>1,2</sup></td><td>-</td><td>No</td><td>string</td> |
| 428 | <td align="left">Name of the value in the symbol table.</td> |
| 429 | </tr> |
| 430 | <tr> |
| 431 | <td align="left" colspan="5"><sup>1</sup>Maximum length shown, |
| 432 | may be smaller<br><sup>2</sup>Repeated field. |
| 433 | </tr> |
| 434 | </table> |
Reid Spencer | 5002661 | 2004-05-22 02:28:36 +0000 | [diff] [blame] | 435 | </div> |
| 436 | |
| 437 | <!-- *********************************************************************** --> |
| 438 | <hr> |
| 439 | <address> |
| 440 | <a href="http://jigsaw.w3.org/css-validator/check/referer"><img |
| 441 | src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> |
| 442 | <a href="http://validator.w3.org/check/referer"><img |
| 443 | src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /></a> |
| 444 | |
| 445 | <a href="mailto:rspencer@x10sys.com">Reid Spencer</a> and |
| 446 | <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> |
| 447 | <a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a><br> |
| 448 | Last modified: $Date$ |
| 449 | </address> |
| 450 | </body> |
| 451 | </html> |
| 452 | <!-- vim: sw=2 |
| 453 | --> |