blob: 56fc0afce9c20a1e16b3f8a04fdbf808c479ec6a [file] [log] [blame]
Reid Spencere831f0b2004-07-29 00:13:04 +00001<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Reid Spencer9acd4122004-05-22 02:28:36 +00002<html>
3<head>
Reid Spencer375d7842004-08-18 20:06:19 +00004 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Reid Spencer9acd4122004-05-22 02:28:36 +00005 <title>LLVM Bytecode File Format</title>
6 <link rel="stylesheet" href="llvm.css" type="text/css">
Reid Spencer4e0352d2004-07-05 08:18:07 +00007 <style type="text/css">
Reid Spencer435a1ab2004-08-03 20:21:05 +00008 TR, TD { border: 2px solid gray; padding-left: 4pt; padding-right: 4pt;
9 padding-top: 2pt; padding-bottom: 2pt; }
Reid Spencer4e0352d2004-07-05 08:18:07 +000010 TH { border: 2px solid gray; font-weight: bold; font-size: 105%; }
Reid Spencer9ce11e42004-07-05 19:04:27 +000011 TABLE { text-align: center; border: 2px solid black;
Reid Spencer435a1ab2004-08-03 20:21:05 +000012 border-collapse: collapse; margin-top: 1em; margin-left: 1em;
13 margin-right: 1em; margin-bottom: 1em; }
Reid Spencer9ce11e42004-07-05 19:04:27 +000014 .td_left { border: 2px solid gray; text-align: left; }
Reid Spencer9acd4122004-05-22 02:28:36 +000015 </style>
16</head>
17<body>
Reid Spencere831f0b2004-07-29 00:13:04 +000018<div class="doc_title"> LLVM Bytecode File Format </div>
Reid Spencer9acd4122004-05-22 02:28:36 +000019<ol>
20 <li><a href="#abstract">Abstract</a></li>
Reid Spencer4e0352d2004-07-05 08:18:07 +000021 <li><a href="#concepts">Concepts</a>
Reid Spencer9acd4122004-05-22 02:28:36 +000022 <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 Spencer8e32af02004-07-07 13:34:26 +000027 <li><a href="#vbr">Variable Bit-Rate Encoding</a></li>
Reid Spencer4e0352d2004-07-05 08:18:07 +000028 <li><a href="#encoding">Encoding Primitives</a></li>
29 <li><a href="#slots">Slots</a></li>
30 </ol>
31 </li>
Reid Spencere2f97b32004-07-05 22:28:02 +000032 <li><a href="#general">General Structure</a> </li>
33 <li><a href="#blockdefs">Block Definitions</a>
Reid Spencer4e0352d2004-07-05 08:18:07 +000034 <ol>
Reid Spencereca340b2004-05-23 17:05:09 +000035 <li><a href="#signature">Signature Block</a></li>
36 <li><a href="#module">Module Block</a></li>
Reid Spencer4e0352d2004-07-05 08:18:07 +000037 <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>
Chris Lattnerdb137582005-11-05 22:20:06 +000041 <li><a href="#instructionlist">Instructions List</a></li>
42 <li><a href="#instructions">Instructions</a></li>
Reid Spencer4e0352d2004-07-05 08:18:07 +000043 <li><a href="#symtab">Symbol Table</a></li>
Reid Spencer9acd4122004-05-22 02:28:36 +000044 </ol>
45 </li>
Reid Spencerb14a0a62004-06-08 07:41:41 +000046 <li><a href="#versiondiffs">Version Differences</a>
47 <ol>
Chris Lattnercd196a92004-10-16 18:03:55 +000048 <li><a href="#vers13">Version 1.3 Differences From 1.4</a></li>
Reid Spencerb14a0a62004-06-08 07:41:41 +000049 <li><a href="#vers12">Version 1.2 Differences From 1.3</a></li>
50 <li><a href="#vers11">Version 1.1 Differences From 1.2</a></li>
51 <li><a href="#vers10">Version 1.0 Differences From 1.1</a></li>
52 </ol>
53 </li>
Reid Spencer9acd4122004-05-22 02:28:36 +000054</ol>
Chris Lattnere7d5ec22004-05-25 17:44:58 +000055<div class="doc_author">
56<p>Written by <a href="mailto:rspencer@x10sys.com">Reid Spencer</a>
57</p>
Reid Spencer9acd4122004-05-22 02:28:36 +000058</div>
59<!-- *********************************************************************** -->
60<div class="doc_section"> <a name="abstract">Abstract </a></div>
61<!-- *********************************************************************** -->
62<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +000063<p>This document describes the LLVM bytecode file format. It specifies
64the binary encoding rules of the bytecode file format so that
65equivalent systems can encode bytecode files correctly. The LLVM
66bytecode representation is used to store the intermediate
67representation on disk in compacted form.</p>
68<p>The LLVM bytecode format may change in the future, but LLVM will
69always be backwards compatible with older formats. This document will
70only describe the most current version of the bytecode format. See <a
71 href="#versiondiffs">Version Differences</a> for the details on how
72the current version is different from previous versions.</p>
Reid Spencer9acd4122004-05-22 02:28:36 +000073</div>
74<!-- *********************************************************************** -->
Reid Spencer4e0352d2004-07-05 08:18:07 +000075<div class="doc_section"> <a name="concepts">Concepts</a> </div>
Reid Spencer9acd4122004-05-22 02:28:36 +000076<!-- *********************************************************************** -->
77<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +000078<p>This section describes the general concepts of the bytecode file
79format without getting into specific layout details. It is recommended
80that you read this section thoroughly before interpreting the detailed
81descriptions.</p>
Reid Spencer9acd4122004-05-22 02:28:36 +000082</div>
83<!-- _______________________________________________________________________ -->
84<div class="doc_subsection"><a name="blocks">Blocks</a> </div>
85<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +000086<p>LLVM bytecode files consist simply of a sequence of blocks of bytes
87using a binary encoding Each block begins with an header of two
88unsigned integers. The first value identifies the type of block and the
89second value provides the size of the block in bytes. The block
90identifier is used because it is possible for entire blocks to be
91omitted from the file if they are empty. The block identifier helps the
92reader determine which kind of block is next in the file. Note that
93blocks can be nested within other blocks.</p>
94<p> All blocks are variable length, and the block header specifies the
95size of the block. All blocks begin on a byte index that is aligned to
96an even 32-bit boundary. That is, the first block is 32-bit aligned
97because it starts at offset 0. Each block is padded with zero fill
98bytes to ensure that the next block also starts on a 32-bit boundary.</p>
Reid Spencer9acd4122004-05-22 02:28:36 +000099</div>
100<!-- _______________________________________________________________________ -->
101<div class="doc_subsection"><a name="lists">Lists</a> </div>
102<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +0000103<p>LLVM Bytecode blocks often contain lists of things of a similar
104type. For example, a function contains a list of instructions and a
105function type contains a list of argument types. There are two basic
106types of lists: length lists (<a href="#llist">llist</a>), and null
107terminated lists (<a href="#zlist">zlist</a>), as described below in
108the <a href="#encoding">Encoding Primitives</a>.</p>
Reid Spencer9acd4122004-05-22 02:28:36 +0000109</div>
110<!-- _______________________________________________________________________ -->
111<div class="doc_subsection"><a name="fields">Fields</a> </div>
112<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +0000113<p>Fields are units of information that LLVM knows how to write atomically. Most
114fields have a uniform length or some kind of length indication built into their
115encoding. For example, a constant string (array of bytes) is written simply as
116the length followed by the characters. Although this is similar to a list,
117constant strings are treated atomically and are thus fields.</p>
Reid Spencer9acd4122004-05-22 02:28:36 +0000118<p>Fields use a condensed bit format specific to the type of information
119they must contain. As few bits as possible are written for each field. The
Reid Spencere831f0b2004-07-29 00:13:04 +0000120sections that follow will provide the details on how these fields are
Reid Spencer9acd4122004-05-22 02:28:36 +0000121written and how the bits are to be interpreted.</p>
122</div>
123<!-- _______________________________________________________________________ -->
Reid Spencer4e0352d2004-07-05 08:18:07 +0000124<div class="doc_subsection"><a name="align">Alignment</a> </div>
Reid Spencer49ad21c2004-05-25 15:47:57 +0000125<div class="doc_text">
Reid Spencer40e93a42004-08-03 20:33:56 +0000126 <p>To support cross-platform differences, the bytecode file is aligned on
127 certain boundaries. This means that a small amount of padding (at most 3
128 bytes) will be added to ensure that the next entry is aligned to a 32-bit
129 boundary.</p>
Chris Lattnere7d5ec22004-05-25 17:44:58 +0000130</div>
Reid Spencer49ad21c2004-05-25 15:47:57 +0000131<!-- _______________________________________________________________________ -->
Reid Spencere831f0b2004-07-29 00:13:04 +0000132<div class="doc_subsection"><a name="vbr">Variable Bit-Rate Encoding</a>
Reid Spencer8e32af02004-07-07 13:34:26 +0000133</div>
Reid Spencere831f0b2004-07-29 00:13:04 +0000134<div class="doc_text">
135<p>Most of the values written to LLVM bytecode files are small integers. To
136minimize the number of bytes written for these quantities, an encoding scheme
137similar to UTF-8 is used to write integer data. The scheme is known as
138variable bit rate (vbr) encoding. In this encoding, the high bit of
139each byte is used to indicate if more bytes follow. If (byte &amp;
1400x80) is non-zero in any given byte, it means there is another byte
141immediately following that also contributes to the value. For the final
142byte (byte &amp; 0x80) is false (the high bit is not set). In each byte
143only the low seven bits contribute to the value. Consequently 32-bit
144quantities can take from one to <em>five</em> bytes to encode. In
145general, smaller quantities will encode in fewer bytes, as follows:</p>
146<table>
147 <tbody>
148 <tr>
149 <th>Byte #</th>
150 <th>Significant Bits</th>
151 <th>Maximum Value</th>
152 </tr>
153 <tr>
154 <td>1</td>
155 <td>0-6</td>
156 <td>127</td>
157 </tr>
158 <tr>
159 <td>2</td>
160 <td>7-13</td>
161 <td>16,383</td>
162 </tr>
163 <tr>
164 <td>3</td>
165 <td>14-20</td>
166 <td>2,097,151</td>
167 </tr>
168 <tr>
169 <td>4</td>
170 <td>21-27</td>
171 <td>268,435,455</td>
172 </tr>
173 <tr>
174 <td>5</td>
175 <td>28-34</td>
176 <td>34,359,738,367</td>
177 </tr>
178 <tr>
179 <td>6</td>
180 <td>35-41</td>
181 <td>4,398,046,511,103</td>
182 </tr>
183 <tr>
184 <td>7</td>
185 <td>42-48</td>
186 <td>562,949,953,421,311</td>
187 </tr>
188 <tr>
189 <td>8</td>
190 <td>49-55</td>
191 <td>72,057,594,037,927,935</td>
192 </tr>
193 <tr>
194 <td>9</td>
195 <td>56-62</td>
196 <td>9,223,372,036,854,775,807</td>
197 </tr>
198 <tr>
199 <td>10</td>
200 <td>63-69</td>
201 <td>1,180,591,620,717,411,303,423</td>
202 </tr>
203 </tbody>
204</table>
205<p>Note that in practice, the tenth byte could only encode bit 63 since
206the maximum quantity to use this encoding is a 64-bit integer.</p>
207<p><em>Signed</em> VBR values are encoded with the standard vbr
208encoding, but with the sign bit as the low order bit instead of the
209high order bit. This allows small negative quantities to be encoded
210efficiently. For example, -3
211is encoded as "((3 &lt;&lt; 1) | 1)" and 3 is encoded as "(3 &lt;&lt;
2121) | 0)", emitted with the standard vbr encoding above.</p>
213</div>
Reid Spencer8e32af02004-07-07 13:34:26 +0000214<!-- _______________________________________________________________________ -->
215<div class="doc_subsection"><a name="encoding">Encoding Primitives</a> </div>
216<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +0000217<p>Each field in the bytecode format is encoded into the file using a
218small set of primitive formats. The table below defines the encoding
219rules for the various primitives used and gives them each a type name.
220The type names used in the descriptions of blocks and fields in the <a
221 href="#details">Detailed Layout</a>next section. Any type name with
222the suffix <em>_vbr</em> indicates a quantity that is encoded using
223variable bit rate encoding as described above.</p>
224<table class="doc_table">
225 <tbody>
226 <tr>
227 <th><b>Type</b></th>
228 <th class="td_left"><b>Rule</b></th>
229 </tr>
230 <tr>
231 <td><a name="unsigned"><b>unsigned</b></a></td>
232 <td class="td_left">A 32-bit unsigned integer that always occupies four
Reid Spencereca340b2004-05-23 17:05:09 +0000233 consecutive bytes. The unsigned integer is encoded using LSB first
234 ordering. That is bits 2<sup>0</sup> through 2<sup>7</sup> are in the
235 byte with the lowest file offset (little endian).</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000236 </tr>
237 <tr>
Reid Spencer02d7f922004-08-03 20:57:56 +0000238 <td style="vertical-align: top;"><a name="uint24_vbr">
239 <b>uint24_vbr</b></a></td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000240 <td style="vertical-align: top; text-align: left;">A 24-bit unsigned
241 integer that occupies from one to four bytes using variable bit rate
242 encoding.</td>
243 </tr>
244 <tr>
245 <td><a name="uint32_vbr"><b>uint32_vbr</b></a></td>
Reid Spencera54f1102004-08-03 19:20:18 +0000246 <td class="td_left">A 32-bit unsigned integer that occupies from one to
247 five bytes using variable bit rate encoding.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000248 </tr>
249 <tr>
250 <td><a name="uint64_vbr"><b>uint64_vbr</b></a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000251 <td class="td_left">A 64-bit unsigned integer that occupies from one to
252 ten bytes using variable bit rate encoding.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000253 </tr>
254 <tr>
255 <td><a name="int64_vbr"><b>int64_vbr</b></a></td>
Reid Spencera54f1102004-08-03 19:20:18 +0000256 <td class="td_left">A 64-bit signed integer that occupies from one to ten
257 bytes using the signed variable bit rate encoding.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000258 </tr>
259 <tr>
260 <td><a name="char"><b>char</b></a></td>
Reid Spencera54f1102004-08-03 19:20:18 +0000261 <td class="td_left">A single unsigned character encoded into one byte</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000262 </tr>
263 <tr>
264 <td><a name="bit"><b>bit(n-m)</b></a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000265 <td class="td_left">A set of bit within some larger integer field. The
266 values of <code>n</code> and <code>m</code> specify the inclusive range
267 of bits that define the subfield. The value for <code>m</code> may be
268 omitted if its the same as <code>n</code>.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000269 </tr>
270 <tr>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000271 <td style="vertical-align: top;"><b><a name="float"><b>float</b></a></b>
272 </td>
273 <td style="vertical-align: top; text-align: left;">A floating point
274 value encoded as a 32-bit IEEE value written in little-endian form.<br>
Reid Spencere831f0b2004-07-29 00:13:04 +0000275 </td>
276 </tr>
277 <tr>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000278 <td style="vertical-align: top;"><b><b><a name="double"><b>double</b></a>
279 </b></b></td>
280 <td style="vertical-align: top; text-align: left;">A floating point value
281 encoded as a64-bit IEEE value written in little-endian form</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000282 </tr>
283 <tr>
284 <td><a name="string"><b>string</b></a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000285 <td class="td_left">A uint32_vbr indicating the type of the constant
286 string which also includes its length, immediately followed by the
287 characters of the string. There is no terminating null byte in the
288 string.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000289 </tr>
290 <tr>
291 <td><a name="data"><b>data</b></a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000292 <td class="td_left">An arbitrarily long segment of data to which no
293 interpretation is implied. This is used for constant initializers.<br>
Reid Spencere831f0b2004-07-29 00:13:04 +0000294 </td>
295 </tr>
296 <tr>
297 <td><a name="llist"><b>llist(x)</b></a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000298 <td class="td_left">A length list of x. This means the list is encoded
299 as an <a href="#uint32_vbr">uint32_vbr</a> providing the length of the
300 list, followed by a sequence of that many "x" items. This implies that
301 the reader should iterate the number of times provided by the length.
302 </td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000303 </tr>
304 <tr>
305 <td><a name="zlist"><b>zlist(x)</b></a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000306 <td class="td_left">A zero-terminated list of x. This means the list is
307 encoded as a sequence of an indeterminate number of "x" items, followed
308 by an <a href="#uint32_vbr">uint32_vbr</a> terminating value. This
309 implies that none of the "x" items can have a zero value (or else the
310 list terminates).</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000311 </tr>
312 <tr>
313 <td><a name="block"><b>block</b></a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000314 <td class="td_left">A block of data that is logically related. A block
315 is an unsigned 32-bit integer that encodes the type of the block in
316 the low 5 bits and the size of the block in the high 27 bits. The
317 length does not include the block header or any alignment bytes at the
318 end of the block. Blocks may compose other blocks. </td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000319 </tr>
320 </tbody>
Reid Spencereca340b2004-05-23 17:05:09 +0000321</table>
322</div>
323<!-- _______________________________________________________________________ -->
Reid Spencer8e32af02004-07-07 13:34:26 +0000324<div class="doc_subsection"><a name="notation">Field Notation</a> </div>
325<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +0000326<p>In the detailed block and field descriptions that follow, a regex
327like notation is used to describe optional and repeated fields. A very
328limited subset of regex is used to describe these, as given in the
329following table: </p>
330<table class="doc_table">
331 <tbody>
Reid Spencer8e32af02004-07-07 13:34:26 +0000332 <tr>
333 <th><b>Character</b></th>
334 <th class="td_left"><b>Meaning</b></th>
Reid Spencere831f0b2004-07-29 00:13:04 +0000335 </tr>
336 <tr>
Reid Spencer8e32af02004-07-07 13:34:26 +0000337 <td><b><code>?</code></b></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000338 <td class="td_left">The question mark indicates 0 or 1 occurrences of
339 the thing preceding it.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000340 </tr>
341 <tr>
Reid Spencer8e32af02004-07-07 13:34:26 +0000342 <td><b><code>*</code></b></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000343 <td class="td_left">The asterisk indicates 0 or more occurrences of the
344 thing preceding it.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000345 </tr>
346 <tr>
Reid Spencer8e32af02004-07-07 13:34:26 +0000347 <td><b><code>+</code></b></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000348 <td class="td_left">The plus sign indicates 1 or more occurrences of the
349 thing preceding it.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000350 </tr>
351 <tr>
Reid Spencer8e32af02004-07-07 13:34:26 +0000352 <td><b><code>()</code></b></td>
353 <td class="td_left">Parentheses are used for grouping.</td>
Reid Spencer8e32af02004-07-07 13:34:26 +0000354 </tr>
Reid Spencere831f0b2004-07-29 00:13:04 +0000355 <tr>
356 <td><b><code>,</code></b></td>
357 <td class="td_left">The comma separates sequential fields.</td>
358 </tr>
359 </tbody>
360</table>
361<p>So, for example, consider the following specifications:</p>
362<div class="doc_code">
363<ol>
364 <li><code>string?</code></li>
365 <li><code>(uint32_vbr,uin32_vbr)+</code></li>
366 <li><code>(unsigned?,uint32_vbr)*</code></li>
367 <li><code>(llist(unsigned))?</code></li>
368</ol>
Reid Spencer8e32af02004-07-07 13:34:26 +0000369</div>
Reid Spencere831f0b2004-07-29 00:13:04 +0000370<p>with the following interpretations:</p>
371<ol>
372 <li>An optional string. Matches either nothing or a single string</li>
373 <li>One or more pairs of uint32_vbr.</li>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000374 <li>Zero or more occurrences of either an unsigned followed by a uint32_vbr
375 or just a uint32_vbr.</li>
Reid Spencere831f0b2004-07-29 00:13:04 +0000376 <li>An optional length list of unsigned values.</li>
377</ol>
378</div>
Reid Spencer8e32af02004-07-07 13:34:26 +0000379<!-- _______________________________________________________________________ -->
Reid Spencer4e0352d2004-07-05 08:18:07 +0000380<div class="doc_subsection"><a name="slots">Slots</a> </div>
Reid Spencer9acd4122004-05-22 02:28:36 +0000381<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +0000382<p>The bytecode format uses the notion of a "slot" to reference Types
383and Values. Since the bytecode file is a <em>direct</em> representation of
384LLVM's intermediate representation, there is a need to represent pointers in
Reid Spencerb958c7e2007-02-02 02:30:19 +0000385the file. Slots are used for this purpose. For example, if one has the
386following assembly:
Reid Spencer4e0352d2004-07-05 08:18:07 +0000387</p>
Reid Spencere831f0b2004-07-29 00:13:04 +0000388<div class="doc_code"><code> %MyType = type { int, sbyte }<br>
389%MyVar = external global %MyType
Reid Spencer8e32af02004-07-07 13:34:26 +0000390</code></div>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000391<p>there are two definitions. The definition of <tt>%MyVar</tt> uses
392<tt>%MyType</tt>.
Reid Spencere831f0b2004-07-29 00:13:04 +0000393In the C++ IR this linkage between <tt>%MyVar</tt> and <tt>%MyType</tt>
394is explicit through the use of C++ pointers. In bytecode, however, there's no
395ability to store memory addresses. Instead, we compute and write out
396slot numbers for every Type and Value written to the file.</p>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000397<p>A slot number is simply an unsigned 32-bit integer encoded in the variable
398bit rate scheme (see <a href="#encoding">encoding</a>). This ensures that
399low slot numbers are encoded in one byte. Through various bits of magic LLVM
400attempts to always keep the slot numbers low. The first attempt is to associate
Reid Spencere831f0b2004-07-29 00:13:04 +0000401slot numbers with their "type plane". That is, Values of the same type
402are written to the bytecode file in a list (sequentially). Their order in
403that list determines their slot number. This means that slot #1 doesn't mean
404anything unless you also specify for which type you want slot #1. Types are
Reid Spencer375d7842004-08-18 20:06:19 +0000405always written to the file first (in the <a href="#globaltypes">Global Type
406Pool</a>) and in such a way that both forward and backward references of the
407types can often be resolved with a single pass through the type pool. </p>
Reid Spencer8ad541d2007-01-31 00:26:08 +0000408<p>In summary then, a slot number can be thought of as just a vbr encoded index
Reid Spencer375d7842004-08-18 20:06:19 +0000409into a list of Type* or Value*. To keep slot numbers low, Value* are indexed by
410two slot numbers: the "type plane index" (type slot) and the "value index"
411(value slot).</p>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000412</div>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000413<!-- *********************************************************************** -->
Reid Spencere2f97b32004-07-05 22:28:02 +0000414<div class="doc_section"> <a name="general">General Structure</a> </div>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000415<!-- *********************************************************************** -->
416<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +0000417<p>This section provides the general structure of the LLVM bytecode
418file format. The bytecode file format requires blocks to be in a
419certain order and nested in a particular way so that an LLVM module can
420be constructed efficiently from the contents of the file. This ordering
421defines a general structure for bytecode files as shown below. The
422table below shows the order in which all block types may appear. Please
423note that some of the blocks are optional and some may be repeated. The
424structure is fairly loose because optional blocks, if empty, are
425completely omitted from the file.</p>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000426<table>
Reid Spencere831f0b2004-07-29 00:13:04 +0000427 <tbody>
428 <tr>
429 <th>ID</th>
430 <th>Parent</th>
431 <th>Optional?</th>
432 <th>Repeated?</th>
433 <th>Level</th>
434 <th>Block Type</th>
435 <th>Description</th>
436 </tr>
437 <tr>
438 <td>N/A</td>
439 <td>File</td>
440 <td>No</td>
441 <td>No</td>
442 <td>0</td>
443 <td class="td_left"><a href="#signature">Signature</a></td>
444 <td class="td_left">This contains the file signature (magic
445number) that identifies the file as LLVM bytecode.</td>
446 </tr>
447 <tr>
448 <td>0x01</td>
449 <td>File</td>
450 <td>No</td>
451 <td>No</td>
452 <td>0</td>
453 <td class="td_left"><a href="#module">Module</a></td>
454 <td class="td_left">This is the top level block in a bytecode
455file. It contains all the other blocks. </td>
456 </tr>
457 <tr>
458 <td>0x06</td>
459 <td>Module</td>
460 <td>No</td>
461 <td>No</td>
462 <td>1</td>
463 <td class="td_left">&nbsp;&nbsp;&nbsp;<a href="#globaltypes">Global&nbsp;Type&nbsp;Pool</a></td>
464 <td class="td_left">This block contains all the global (module)
465level types.</td>
466 </tr>
467 <tr>
468 <td>0x05</td>
469 <td>Module</td>
470 <td>No</td>
471 <td>No</td>
472 <td>1</td>
473 <td class="td_left">&nbsp;&nbsp;&nbsp;<a href="#globalinfo">Module&nbsp;Globals&nbsp;Info</a></td>
474 <td class="td_left">This block contains the type, constness, and
475linkage for each of the global variables in the module. It also
476contains the type of the functions and the constant initializers.</td>
477 </tr>
478 <tr>
479 <td>0x03</td>
480 <td>Module</td>
481 <td>Yes</td>
482 <td>No</td>
483 <td>1</td>
484 <td class="td_left">&nbsp;&nbsp;&nbsp;<a href="#constantpool">Module&nbsp;Constant&nbsp;Pool</a></td>
485 <td class="td_left">This block contains all the global constants
486except function arguments, global values and constant strings.</td>
487 </tr>
488 <tr>
489 <td>0x02</td>
490 <td>Module</td>
491 <td>Yes</td>
492 <td>Yes</td>
493 <td>1</td>
494 <td class="td_left">&nbsp;&nbsp;&nbsp;<a href="#functiondefs">Function&nbsp;Definitions</a>*</td>
495 <td class="td_left">One function block is written for each
496function in the module. The function block contains the instructions,
Reid Spencer8ad541d2007-01-31 00:26:08 +0000497type constant pool, and symbol table for the function.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000498 </tr>
499 <tr>
500 <td>0x03</td>
501 <td>Function</td>
502 <td>Yes</td>
503 <td>No</td>
504 <td>2</td>
505 <td class="td_left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a
506 href="#constantpool">Function&nbsp;Constant&nbsp;Pool</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000507 <td class="td_left">Any constants (including types) used solely within
508 the function are emitted here in the function constant pool. </td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000509 </tr>
510 <tr>
Reid Spencere831f0b2004-07-29 00:13:04 +0000511 <td>0x07</td>
512 <td>Function</td>
513 <td>No</td>
514 <td>No</td>
515 <td>2</td>
516 <td class="td_left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a
517 href="#instructionlist">Instruction&nbsp;List</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000518 <td class="td_left">This block contains all the instructions of the
519 function. The basic blocks are inferred by terminating instructions.
520 </td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000521 </tr>
522 <tr>
523 <td>0x04</td>
524 <td>Function</td>
525 <td>Yes</td>
526 <td>No</td>
527 <td>2</td>
528 <td class="td_left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a
529 href="#symtab">Function&nbsp;Symbol&nbsp;Table</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000530 <td class="td_left">This symbol table provides the names for the function
531 specific values used (basic block labels mostly).</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000532 </tr>
533 <tr>
534 <td>0x04</td>
535 <td>Module</td>
536 <td>Yes</td>
537 <td>No</td>
538 <td>1</td>
539 <td class="td_left">&nbsp;&nbsp;&nbsp;<a href="#symtab">Module&nbsp;Symbol&nbsp;Table</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000540 <td class="td_left">This symbol table provides the names for the various
541 entries in the file that are not function specific (global vars, and
542 functions mostly).</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000543 </tr>
544 </tbody>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000545</table>
Reid Spencere831f0b2004-07-29 00:13:04 +0000546<p>Use the links in the table for details about the contents of each of
547the block types.</p>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000548</div>
Reid Spencer9acd4122004-05-22 02:28:36 +0000549<!-- *********************************************************************** -->
Reid Spencere2f97b32004-07-05 22:28:02 +0000550<div class="doc_section"> <a name="blockdefs">Block Definitions</a> </div>
Reid Spencer9acd4122004-05-22 02:28:36 +0000551<!-- *********************************************************************** -->
552<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +0000553<p>This section provides the detailed layout of the individual block
554types in the LLVM bytecode file format. </p>
Reid Spencer9acd4122004-05-22 02:28:36 +0000555</div>
Reid Spencer9acd4122004-05-22 02:28:36 +0000556<!-- _______________________________________________________________________ -->
Reid Spencereca340b2004-05-23 17:05:09 +0000557<div class="doc_subsection"><a name="signature">Signature Block</a> </div>
Reid Spencer9acd4122004-05-22 02:28:36 +0000558<div class="doc_text">
Chris Lattnera0390ec2004-05-24 05:35:17 +0000559<p>The signature occurs in every LLVM bytecode file and is always first.
Reid Spencereca340b2004-05-23 17:05:09 +0000560It simply provides a few bytes of data to identify the file as being an LLVM
561bytecode file. This block is always four bytes in length and differs from the
562other blocks because there is no identifier and no block length at the start
563of the block. Essentially, this block is just the "magic number" for the file.
Reid Spencere831f0b2004-07-29 00:13:04 +0000564</p>
Reid Spencer812aa2ba2004-11-08 08:55:21 +0000565<p>There are two types of signatures for LLVM bytecode: uncompressed and
566compressed as shown in the table below. </p>
Reid Spencer9ce11e42004-07-05 19:04:27 +0000567<table>
Reid Spencere831f0b2004-07-29 00:13:04 +0000568 <tbody>
569 <tr>
570 <th><b>Type</b></th>
Reid Spencer812aa2ba2004-11-08 08:55:21 +0000571 <th class="td_left"><b>Uncompressed</b></th>
572 <th class="td_left"><b>Compressed</b></th>
Reid Spencere831f0b2004-07-29 00:13:04 +0000573 </tr>
574 <tr>
575 <td><a href="#char">char</a></td>
576 <td class="td_left">Constant "l" (0x6C)</td>
Reid Spencer812aa2ba2004-11-08 08:55:21 +0000577 <td class="td_left">Constant "l" (0x6C)</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000578 </tr>
579 <tr>
580 <td><a href="#char">char</a></td>
581 <td class="td_left">Constant "l" (0x6C)</td>
Reid Spencer812aa2ba2004-11-08 08:55:21 +0000582 <td class="td_left">Constant "l" (0x6C)</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000583 </tr>
584 <tr>
585 <td><a href="#char">char</a></td>
586 <td class="td_left">Constant "v" (0x76)</td>
Reid Spencer812aa2ba2004-11-08 08:55:21 +0000587 <td class="td_left">Constant "v" (0x76)</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000588 </tr>
589 <tr>
590 <td><a href="#char">char</a></td>
591 <td class="td_left">Constant "m" (0x6D)</td>
Reid Spencer812aa2ba2004-11-08 08:55:21 +0000592 <td class="td_left">Constant "c" (0x63)</td>
593 </tr>
594 <tr>
595 <td><a href="#char">char</a></td>
596 <td class="td_left">N/A</td>
597 <td class="td_left">'0'=null,'1'=gzip,'2'=bzip2</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000598 </tr>
599 </tbody>
Reid Spencereca340b2004-05-23 17:05:09 +0000600</table>
Reid Spencer812aa2ba2004-11-08 08:55:21 +0000601<p>In other words, the uncompressed signature is just the characters 'llvm'
602while the compressed signature is the characters 'llvc' followed by an ascii
603digit ('0', '1', or '2') that indicates the kind of compression used. A value of
604'0' indicates that null compression was used. This can happen when compression
605was requested on a platform that wasn't configured for gzip or bzip2. A value of
606'1' means that the rest of the file is compressed using the gzip algorithm and
607should be uncompressed before interpretation. A value of '2' means that the rest
608of the file is compressed using the bzip2 algorithm and should be uncompressed
609before interpretation. In all cases, the data resulting from uncompression
610should be interpreted as if it occurred immediately after the 'llvm'
611signature (i.e. the uncompressed data begins with the
612<a href="#module">Module Block</a></p>
613<p><b>NOTE:</b> As of LLVM 1.4, all bytecode files produced by the LLVM tools
Reid Spencer1619c722004-11-08 09:10:50 +0000614are compressed by default. To disable compression, pass the
Reid Spencer812aa2ba2004-11-08 08:55:21 +0000615<tt>--disable-compression</tt> option to the tool, if it supports it.
Reid Spencereca340b2004-05-23 17:05:09 +0000616</div>
617<!-- _______________________________________________________________________ -->
618<div class="doc_subsection"><a name="module">Module Block</a> </div>
619<div class="doc_text">
620<p>The module block contains a small pre-amble and all the other blocks in
Reid Spencer4e0352d2004-07-05 08:18:07 +0000621the file. The table below shows the structure of the module block. Note that it
622only provides the module identifier, size of the module block, and the format
623information. Everything else is contained in other blocks, described in other
624sections.</p>
Reid Spencer9ce11e42004-07-05 19:04:27 +0000625<table>
Reid Spencere831f0b2004-07-29 00:13:04 +0000626 <tbody>
627 <tr>
628 <th><b>Type</b></th>
629 <th class="td_left"><b>Field Description</b></th>
630 </tr>
631 <tr>
Reid Spencerf57b8b92004-08-16 19:24:36 +0000632 <td><a href="#unsigned">unsigned</a><br></td>
633 <td class="td_left"><a href="#mod_header">Module Block Identifier
634 (0x01)</a></td>
635 </tr>
636 <tr>
637 <td><a href="#unsigned">unsigned</a></td>
638 <td class="td_left"><a href="#mod_header">Module Block Size</a></td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000639 </tr>
640 <tr>
641 <td><a href="#uint32_vbr">uint32_vbr</a></td>
642 <td class="td_left"><a href="#format">Format Information</a></td>
643 </tr>
644 <tr>
645 <td><a href="#block">block</a></td>
646 <td class="td_left"><a href="#globaltypes">Global Type Pool</a></td>
647 </tr>
648 <tr>
649 <td><a href="#block">block</a></td>
650 <td class="td_left"><a href="#globalinfo">Module Globals Info</a></td>
651 </tr>
652 <tr>
653 <td><a href="#block">block</a></td>
654 <td class="td_left"><a href="#constantpool">Module Constant Pool</a></td>
655 </tr>
656 <tr>
657 <td><a href="#block">block</a>*</td>
658 <td class="td_left"><a href="#functiondefs">Function Definitions</a></td>
659 </tr>
660 <tr>
661 <td><a href="#block">block</a></td>
Reid Spencer9a910812004-08-17 00:49:03 +0000662 <td class="td_left"><a href="#symtab">Module Symbol Table</a></td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000663 </tr>
664 </tbody>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000665</table>
666</div>
Reid Spencerf57b8b92004-08-16 19:24:36 +0000667
668<!-- _______________________________________________________________________ -->
669<div class="doc_subsubsection"><a name="mod_header">Module Block Header</a></div>
670<div class="doc_text">
671 <p>The block header for the module block uses a longer format than the other
672 blocks in a bytecode file. Specifically, instead of encoding the type and size
673 of the block into a 32-bit integer with 5-bits for type and 27-bits for size,
674 the module block header uses two 32-bit unsigned values, one for type, and one
Reid Spencerb958c7e2007-02-02 02:30:19 +0000675 for size. While the 2<sup>27</sup> byte limit on block size is sufficient
676 for the blocks contained in the module, it isn't sufficient for the module
677 block itself because we want to ensure that bytecode files as large as
678 2<sup>32</sup> bytes are possible. For this reason, the module block (and
679 only the module block) uses a long format header.</p>
Reid Spencerf57b8b92004-08-16 19:24:36 +0000680</div>
681
Reid Spencer4e0352d2004-07-05 08:18:07 +0000682<!-- _______________________________________________________________________ -->
683<div class="doc_subsubsection"><a name="format">Format Information</a></div>
684<div class="doc_text">
Owen Anderson8ce4b1b2007-01-27 19:23:25 +0000685<p>The format information field is encoded into a <a href="#uint32_vbr">uint32_vbr</a>.</p>
686
687<p>Of particular note, the bytecode format number is simply a 32-bit
John Criswell2bbe7112005-10-24 16:20:10 +0000688monotonically increasing integer that identifies the version of the bytecode
Reid Spencere831f0b2004-07-29 00:13:04 +0000689format (which is not directly related to the LLVM release number). The
690bytecode versions defined so far are (note that this document only
Owen Anderson8ce4b1b2007-01-27 19:23:25 +0000691describes the latest version, 2.0):</p>
Chris Lattnera0390ec2004-05-24 05:35:17 +0000692<ul>
Reid Spencere831f0b2004-07-29 00:13:04 +0000693 <li>#0: LLVM 1.0 &amp; 1.1</li>
694 <li>#1: LLVM 1.2</li>
695 <li>#2: LLVM 1.2.5 (not released)</li>
John Criswellf23e9712005-10-24 17:10:57 +0000696 <li>#3: LLVM 1.3</li>
697 <li>#4: LLVM 1.3.x (not released)</li>
Owen Anderson8ce4b1b2007-01-27 19:23:25 +0000698 <li>#5: LLVM 1.4 through 1.8</li>
699 <li>#6: LLVM 1.9</li>
700 <li>#7: LLVM 2.0 and newer</li>
Chris Lattnera0390ec2004-05-24 05:35:17 +0000701</ul>
Reid Spencer9acd4122004-05-22 02:28:36 +0000702</div>
703<!-- _______________________________________________________________________ -->
Reid Spencer4e0352d2004-07-05 08:18:07 +0000704<div class="doc_subsection"><a name="globaltypes">Global Type Pool</a> </div>
Reid Spencer9acd4122004-05-22 02:28:36 +0000705<div class="doc_text">
Chris Lattnera0390ec2004-05-24 05:35:17 +0000706<p>The global type pool consists of type definitions. Their order of appearance
Reid Spencer375d7842004-08-18 20:06:19 +0000707in the file determines their type slot number (0 based). Slot numbers are
Reid Spencere831f0b2004-07-29 00:13:04 +0000708used to replace pointers in the intermediate representation. Each slot number
709uniquely identifies one entry in a type plane (a collection of values of the
710same type). Since all values have types and are associated with the order in
711which the type pool is written, the global type pool <em>must</em> be written
712as the first block of a module. If it is not, attempts to read the file will
713fail because both forward and backward type resolution will not be possible.</p>
714<p>The type pool is simply a list of type definitions, as shown in the
715table below.</p>
Reid Spencer9ce11e42004-07-05 19:04:27 +0000716<table>
Reid Spencere831f0b2004-07-29 00:13:04 +0000717 <tbody>
718 <tr>
719 <th><b>Type</b></th>
720 <th class="td_left"><b>Field Description</b></th>
721 </tr>
722 <tr>
723 <td><a href="#unsigned">block</a></td>
724 <td class="td_left">Type Pool Identifier (0x06) + Size<br>
725 </td>
726 </tr>
727 <tr>
728 <td><a href="#llist">llist</a>(<a href="#type">type</a>)</td>
729 <td class="td_left">A length list of type definitions.</td>
730 </tr>
731 </tbody>
Reid Spencereca340b2004-05-23 17:05:09 +0000732</table>
Reid Spencer9acd4122004-05-22 02:28:36 +0000733</div>
734<!-- _______________________________________________________________________ -->
Reid Spencer4e0352d2004-07-05 08:18:07 +0000735<div class="doc_subsubsection"><a name="type">Type Definitions</a></div>
736<div class="doc_text">
Reid Spencer8e32af02004-07-07 13:34:26 +0000737<p>Types in the type pool are defined using a different format for each kind
738of type, as given in the following sections.</p>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000739<h3>Primitive Types</h3>
Reid Spencere831f0b2004-07-29 00:13:04 +0000740<p>The primitive types encompass the basic integer and floating point
Reid Spencer375d7842004-08-18 20:06:19 +0000741types. They are encoded simply as their TypeID.</p>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000742<table>
Reid Spencere831f0b2004-07-29 00:13:04 +0000743 <tbody>
744 <tr>
745 <th><b>Type</b></th>
746 <th class="td_left"><b>Description</b></th>
747 </tr>
748 <tr>
749 <td><a href="#uint24_vbr">uint24_vbr</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000750 <td class="td_left">Type ID for the primitive types (values 1 to 11)
751 <sup>1</sup></td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000752 </tr>
753 </tbody>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000754</table>
Reid Spencer9ce11e42004-07-05 19:04:27 +0000755Notes:
756<ol>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000757 <li>The values for the Type IDs for the primitive types are provided by the
758 definition of the <code>llvm::Type::TypeID</code> enumeration in
759 <code>include/llvm/Type.h</code>. The enumeration gives the following mapping:
Reid Spencere831f0b2004-07-29 00:13:04 +0000760 <ol>
761 <li>bool</li>
762 <li>ubyte</li>
763 <li>sbyte</li>
764 <li>ushort</li>
765 <li>short</li>
766 <li>uint</li>
767 <li>int</li>
768 <li>ulong</li>
769 <li>long</li>
770 <li>float</li>
771 <li>double</li>
772 </ol>
773 </li>
Reid Spencer9ce11e42004-07-05 19:04:27 +0000774</ol>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000775<h3>Function Types</h3>
776<table>
Reid Spencere831f0b2004-07-29 00:13:04 +0000777 <tbody>
778 <tr>
779 <th><b>Type</b></th>
780 <th class="td_left"><b>Description</b></th>
781 </tr>
782 <tr>
783 <td><a href="#uint24_vbr">uint24_vbr</a></td>
784 <td class="td_left">Type ID for function types (13)</td>
785 </tr>
786 <tr>
787 <td><a href="#uint24_vbr">uint24_vbr</a></td>
Reid Spencer375d7842004-08-18 20:06:19 +0000788 <td class="td_left">Type slot number of function's return type.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000789 </tr>
790 <tr>
791 <td><a href="#llist">llist</a>(<a href="#uint24_vbr">uint24_vbr</a>)</td>
Reid Spencer375d7842004-08-18 20:06:19 +0000792 <td class="td_left">Type slot number of each argument's type.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000793 </tr>
794 <tr>
795 <td><a href="#uint32_vbr">uint32_vbr</a>?</td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000796 <td class="td_left">Value 0 if this is a varargs function, missing
797 otherwise.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000798 </tr>
799 </tbody>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000800</table>
801<h3>Structure Types</h3>
802<table>
Reid Spencere831f0b2004-07-29 00:13:04 +0000803 <tbody>
804 <tr>
805 <th><b>Type</b></th>
806 <th class="td_left"><b>Description</b></th>
807 </tr>
808 <tr>
809 <td><a href="#uint24_vbr">uint24_vbr</a></td>
810 <td class="td_left">Type ID for structure types (14)</td>
811 </tr>
812 <tr>
813 <td><a href="#zlist">zlist</a>(<a href="#uint24_vbr">uint24_vbr</a>)</td>
814 <td class="td_left">Slot number of each of the element's fields.</td>
815 </tr>
816 </tbody>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000817</table>
818<h3>Array Types</h3>
819<table>
Reid Spencere831f0b2004-07-29 00:13:04 +0000820 <tbody>
821 <tr>
822 <th><b>Type</b></th>
823 <th class="td_left"><b>Description</b></th>
824 </tr>
825 <tr>
826 <td><a href="#uint24_vbr">uint24_vbr</a></td>
827 <td class="td_left">Type ID for Array Types (15)</td>
828 </tr>
829 <tr>
830 <td><a href="#uint24_vbr">uint24_vbr</a></td>
Reid Spencer375d7842004-08-18 20:06:19 +0000831 <td class="td_left">Type slot number of array's element type.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000832 </tr>
833 <tr>
834 <td><a href="#uint32_vbr">uint32_vbr</a></td>
835 <td class="td_left">The number of elements in the array.</td>
836 </tr>
837 </tbody>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000838</table>
839<h3>Pointer Types</h3>
840<table>
Reid Spencere831f0b2004-07-29 00:13:04 +0000841 <tbody>
842 <tr>
843 <th><b>Type</b></th>
844 <th class="td_left"><b>Description</b></th>
845 </tr>
846 <tr>
847 <td><a href="#uint24_vbr">uint24_vbr</a></td>
848 <td class="td_left">Type ID For Pointer Types (16)</td>
849 </tr>
850 <tr>
851 <td><a href="#uint24_vbr">uint24_vbr</a></td>
Reid Spencer375d7842004-08-18 20:06:19 +0000852 <td class="td_left">Type slot number of pointer's element type.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000853 </tr>
854 </tbody>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000855</table>
856<h3>Opaque Types</h3>
857<table>
Reid Spencere831f0b2004-07-29 00:13:04 +0000858 <tbody>
859 <tr>
860 <th><b>Type</b></th>
861 <th class="td_left"><b>Description</b></th>
862 </tr>
863 <tr>
864 <td><a href="#uint24_vbr">uint24_vbr</a></td>
865 <td class="td_left">Type ID For Opaque Types (17)</td>
866 </tr>
867 </tbody>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000868</table>
Reid Spencerebe725b2007-02-15 03:08:48 +0000869<h3>Vector Types</h3>
Brian Gaeke02209042004-08-20 06:00:58 +0000870<table>
871 <tbody>
872 <tr>
873 <th><b>Type</b></th>
874 <th class="td_left"><b>Description</b></th>
875 </tr>
876 <tr>
877 <td><a href="#uint24_vbr">uint24_vbr</a></td>
Reid Spencerebe725b2007-02-15 03:08:48 +0000878 <td class="td_left">Type ID for Vector Types (18)</td>
Brian Gaeke02209042004-08-20 06:00:58 +0000879 </tr>
880 <tr>
881 <td><a href="#uint24_vbr">uint24_vbr</a></td>
Reid Spencerebe725b2007-02-15 03:08:48 +0000882 <td class="td_left">Slot number of the vector's element type.</td>
Brian Gaeke02209042004-08-20 06:00:58 +0000883 </tr>
884 <tr>
885 <td><a href="#uint32_vbr">uint32_vbr</a></td>
Reid Spencerebe725b2007-02-15 03:08:48 +0000886 <td class="td_left">The number of elements in the vector.</td>
Brian Gaeke02209042004-08-20 06:00:58 +0000887 </tr>
888 </tbody>
889</table>
Andrew Lenharth78f93892006-12-08 17:50:05 +0000890<h3>Packed Structure Types</h3>
891<table>
892 <tbody>
893 <tr>
894 <th><b>Type</b></th>
895 <th class="td_left"><b>Description</b></th>
896 </tr>
897 <tr>
898 <td><a href="#uint24_vbr">uint24_vbr</a></td>
899 <td class="td_left">Type ID for packed structure types (19)</td>
900 </tr>
901 <tr>
902 <td><a href="#zlist">zlist</a>(<a href="#uint24_vbr">uint24_vbr</a>)</td>
903 <td class="td_left">Slot number of each of the element's fields.</td>
904 </tr>
905 </tbody>
906</table>
Reid Spencer4e0352d2004-07-05 08:18:07 +0000907</div>
908<!-- _______________________________________________________________________ -->
Reid Spencere831f0b2004-07-29 00:13:04 +0000909<div class="doc_subsection"><a name="globalinfo">Module Global Info</a>
910</div>
Reid Spencer9acd4122004-05-22 02:28:36 +0000911<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +0000912<p>The module global info block contains the definitions of all global
913variables including their initializers and the <em>declaration</em> of
914all functions. The format is shown in the table below:</p>
915<table>
916 <tbody>
Reid Spencer9ce11e42004-07-05 19:04:27 +0000917 <tr>
918 <th><b>Type</b></th>
919 <th class="td_left"><b>Field Description</b></th>
Reid Spencer9ce11e42004-07-05 19:04:27 +0000920 </tr>
Reid Spencere831f0b2004-07-29 00:13:04 +0000921 <tr>
922 <td><a href="#block">block</a></td>
Chris Lattnera10387b2006-01-23 23:38:09 +0000923 <td class="td_left">Module global info identifier (0x05) + size</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000924 </tr>
925 <tr>
926 <td><a href="#zlist">zlist</a>(<a href="#globalvar">globalvar</a>)</td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000927 <td class="td_left">A zero terminated list of global var definitions
928 occurring in the module.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000929 </tr>
930 <tr>
Chris Lattnercd196a92004-10-16 18:03:55 +0000931 <td><a href="#zlist">zlist</a>(<a href="#funcfield">funcfield</a>)</td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000932 <td class="td_left">A zero terminated list of function definitions
933 occurring in the module.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000934 </tr>
935 <tr>
Chris Lattnera10387b2006-01-23 23:38:09 +0000936 <td><a href="#llist">llist</a>(<a href="#string">string</a>)</td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000937 <td class="td_left">A length list of strings that specify the names of
938 the libraries that this module depends upon.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000939 </tr>
940 <tr>
Chris Lattnera10387b2006-01-23 23:38:09 +0000941 <td><a href="#string">string</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000942 <td class="td_left">The target triple for the module (blank means no
943 target triple specified, i.e. a platform-independent module).</td>
Owen Anderson8ce4b1b2007-01-27 19:23:25 +0000944 </tr>
945 <tr>
946 <td><a href="#string">string</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000947 <td class="td_left">The data layout string describing the endianness,
948 pointer size, and type alignments for which the module was written
949 (blank means no data layout specified, i.e. a platform-independent
950 module).</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000951 </tr>
Chris Lattner7bf26c12005-11-12 01:46:21 +0000952 <tr>
Chris Lattnera10387b2006-01-23 23:38:09 +0000953 <td><a href="#llist">llist</a>(<a href="#string">string</a>)</td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000954 <td class="td_left">A length list of strings that defines a table of
955 section strings for globals. A global's SectionID is an index into
956 this table.</td>
Chris Lattnera10387b2006-01-23 23:38:09 +0000957 </tr>
958 <tr>
959 <td><a href="#string">string</a></td>
960 <td class="td_left">The inline asm block for this module.</td>
Chris Lattner7bf26c12005-11-12 01:46:21 +0000961 </tr>
Reid Spencere831f0b2004-07-29 00:13:04 +0000962 </tbody>
963</table>
Reid Spencer9acd4122004-05-22 02:28:36 +0000964</div>
Chris Lattnercd196a92004-10-16 18:03:55 +0000965
Reid Spencer9ce11e42004-07-05 19:04:27 +0000966<!-- _______________________________________________________________________ -->
967<div class="doc_subsubsection"><a name="globalvar">Global Variable Field</a>
968</div>
Chris Lattner84acbcc2005-11-06 07:20:25 +0000969
Reid Spencer9ce11e42004-07-05 19:04:27 +0000970<div class="doc_text">
Chris Lattner84acbcc2005-11-06 07:20:25 +0000971
Reid Spencere831f0b2004-07-29 00:13:04 +0000972<p>Global variables are written using an <a href="#uint32_vbr">uint32_vbr</a>
Chris Lattner84acbcc2005-11-06 07:20:25 +0000973that encodes information about the global variable, an optional extension vbr,
974and a an optional initializers for the global var.</p>
975
Reid Spencere831f0b2004-07-29 00:13:04 +0000976<p>The table below provides the bit layout of the first <a
977 href="#uint32_vbr">uint32_vbr</a> that describes the global variable.</p>
Chris Lattner84acbcc2005-11-06 07:20:25 +0000978
Reid Spencere831f0b2004-07-29 00:13:04 +0000979<table>
980 <tbody>
Reid Spencer8e32af02004-07-07 13:34:26 +0000981 <tr>
982 <th><b>Type</b></th>
983 <th class="td_left"><b>Description</b></th>
Reid Spencer8e32af02004-07-07 13:34:26 +0000984 </tr>
Reid Spencere831f0b2004-07-29 00:13:04 +0000985 <tr>
986 <td><a href="#bit">bit(0)</a></td>
987 <td class="td_left">Is constant?</td>
988 </tr>
989 <tr>
990 <td><a href="#bit">bit(1)</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +0000991 <td class="td_left">Has initializer? Note that this bit determines
992 whether the constant initializer field (described below) follows.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000993 </tr>
994 <tr>
995 <td><a href="#bit">bit(2-4)</a></td>
996 <td class="td_left">Linkage type: 0=External, 1=Weak,
Anton Korobeynikovd61d39e2006-09-14 18:23:27 +0000997 2=Appending, 3=Internal, 4=LinkOnce, 5=DllImport,
998 6=DllExport, 7=ExternWeak</td>
Reid Spencere831f0b2004-07-29 00:13:04 +0000999 </tr>
1000 <tr>
Lauro Ramos Venancio0ab204b2007-04-12 19:52:46 +00001001 <td><a href="#bit">bit(5)</a></td>
1002 <td class="td_left">Is Thread Local?</td>
1003 </tr>
1004 <tr>
1005 <td><a href="#bit">bit(6-31)</a></td>
Reid Spencer375d7842004-08-18 20:06:19 +00001006 <td class="td_left">Type slot number of type for the global variable.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001007 </tr>
1008 </tbody>
1009</table>
Chris Lattner84acbcc2005-11-06 07:20:25 +00001010
1011<p>When the Linkage type is set to 3 (internal) and the initializer field is set
1012to 0 (an invalid combination), an extension word follows the first <a
1013href="#uint32_vbr">uint32_vbr</a> which encodes the real linkage and init flag,
1014and can includes more information:</p>
1015
1016<table>
1017 <tbody>
1018 <tr>
1019 <th><b>Type</b></th>
1020 <th class="td_left"><b>Description</b></th>
1021 </tr>
1022 <tr>
1023 <td><a href="#bit">bit(0)</a></td>
1024 <td class="td_left">Has initializer? Indicates the real value of the "Has
1025 initializer" field for the global. </td>
1026 </tr>
1027 <tr>
1028 <td><a href="#bit">bit(2-4)</a></td>
1029 <td class="td_left">Linkage type: Indicates the real value of the "linkage
1030 type" field for the global.</td>
1031 </tr>
1032 <tr>
1033 <td><a href="#bit">bit(4-8)</a></td>
1034 <td class="td_left">The log-base-2 of the alignment for the global.</td>
1035 </tr>
1036 <tr>
Chris Lattner7bf26c12005-11-12 01:46:21 +00001037 <td><a href="#bit">bit(9)</a></td>
1038 <td class="td_left">If this bit is set, a SectionID follows this vbr.</td>
1039 </tr>
1040 <tr>
Anton Korobeynikova0554d92007-01-12 19:20:47 +00001041 <td><a href="#bit">bit(10-12)</a></td>
1042 <td class="td_left">Visibility style: 0=Default, 1=Hidden.</td>
1043 </tr>
1044 <tr>
1045 <td><a href="#bit">bit(13-31)</a></td>
Chris Lattner84acbcc2005-11-06 07:20:25 +00001046 <td class="td_left">Currently unassigned.</td>
1047 </tr>
1048 </tbody>
1049</table>
1050
Chris Lattner7bf26c12005-11-12 01:46:21 +00001051<p>If the SectionID bit is set above, the following field is included:</p>
Chris Lattner84acbcc2005-11-06 07:20:25 +00001052
Reid Spencere831f0b2004-07-29 00:13:04 +00001053<table>
1054 <tbody>
1055 <tr>
1056 <th><b>Type</b></th>
1057 <th class="td_left"><b>Description</b></th>
1058 </tr>
1059 <tr>
Chris Lattner7bf26c12005-11-12 01:46:21 +00001060 <td><a href="#uint32_vbr">uint32_vbr</a>
Reid Spencere831f0b2004-07-29 00:13:04 +00001061 </td>
Chris Lattner7bf26c12005-11-12 01:46:21 +00001062 <td class="td_left">An optional section ID number, specifying the string
1063 to use for the section of the global. This an index (+1) of an entry
Reid Spencerb958c7e2007-02-02 02:30:19 +00001064 into the SectionID llist in the
1065 <a href="#globalinfo">Module Global Info</a> block. If this value is
1066 0 or not present, the global has an empty section string.</td>
Chris Lattner7bf26c12005-11-12 01:46:21 +00001067 </tr>
1068 </tbody>
1069</table>
1070
1071<p>If the "Has initializer" field is set, the following field is included:</p>
1072
1073<table>
1074 <tbody>
1075 <tr>
1076 <th><b>Type</b></th>
1077 <th class="td_left"><b>Description</b></th>
1078 </tr>
1079 <tr>
1080 <td><a href="#uint32_vbr">uint32_vbr</a>
1081 </td>
1082 <td class="td_left">An optional value slot number for the global
1083 variable's constant initializer.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001084 </tr>
1085 </tbody>
1086</table>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001087</div>
Chris Lattnercd196a92004-10-16 18:03:55 +00001088
1089<!-- _______________________________________________________________________ -->
1090<div class="doc_subsubsection"><a name="funcfield">Function Field</a>
1091</div>
1092<div class="doc_text">
1093<p>Functions are written using an <a href="#uint32_vbr">uint32_vbr</a>
Chris Lattner84acbcc2005-11-06 07:20:25 +00001094that encodes information about the function and a set of flags. If needed,
1095an extension word may follow this first field.</p>
Chris Lattnercd196a92004-10-16 18:03:55 +00001096
1097<p>The table below provides the bit layout of the <a
1098href="#uint32_vbr">uint32_vbr</a> that describes the function.</p>
1099
1100<table>
1101 <tbody>
1102 <tr>
1103 <th><b>Type</b></th>
1104 <th class="td_left"><b>Description</b></th>
1105 </tr>
1106 <tr>
Chris Lattner97f5c0e2004-11-15 22:54:50 +00001107 <td><a href="#bit">bit(0-3)</a></td>
Chris Lattner0132aff2005-05-06 22:57:40 +00001108 <td class="td_left">
Chris Lattner9e0781f2005-11-06 07:48:11 +00001109 Encodes the calling convention number of the function. The
Chris Lattner0132aff2005-05-06 22:57:40 +00001110 CC number of the function is the value of this field minus one.
1111 </td>
Chris Lattner97f5c0e2004-11-15 22:54:50 +00001112 </tr>
1113 <tr>
1114 <td><a href="#bit">bit(4)</a></td>
1115 <td class="td_left">If this bit is set to 1, the indicated function is
Reid Spencerb958c7e2007-02-02 02:30:19 +00001116 external, and there is no
1117 <a href="#functiondefs">Function Definiton Block</a> in the bytecode
1118 file for the function. If the function is external and has
1119 <tt>dllimport or extern_weak</tt> linkage additional field in the
1120 extension word is used to indicate the actual linkage type.</td>
Chris Lattnercd196a92004-10-16 18:03:55 +00001121 </tr>
1122 <tr>
Chris Lattner84acbcc2005-11-06 07:20:25 +00001123 <td><a href="#bit">bit(5-30)</a></td>
Chris Lattnercd196a92004-10-16 18:03:55 +00001124 <td class="td_left">Type slot number of type for the function.</td>
1125 </tr>
Anton Korobeynikovd61d39e2006-09-14 18:23:27 +00001126 <tr>
Chris Lattner84acbcc2005-11-06 07:20:25 +00001127 <td><a href="#bit">bit(31)</a></td>
1128 <td class="td_left">Indicates whether an extension word follows.</td>
1129 </tr>
1130 </tbody>
1131</table>
1132
1133<p>If bit(31) is set, an additional <a href="#uint32_vbr">uint32_vbr</a> word
1134follows with the following fields:</p>
1135
1136<table>
1137 <tbody>
1138 <tr>
1139 <th><b>Type</b></th>
1140 <th class="td_left"><b>Description</b></th>
1141 </tr>
1142 <tr>
1143 <td><a href="#bit">bit(0-4)</a></td>
1144 <td class="td_left">The log-base-2 of the alignment for the function.</td>
1145 </tr>
1146 <tr>
Chris Lattner9e0781f2005-11-06 07:48:11 +00001147 <td><a href="#bit">bit(5-9)</a></td>
1148 <td class="td_left">The top nibble of the calling convention.</td>
1149 </tr>
1150 <tr>
Chris Lattner7bf26c12005-11-12 01:46:21 +00001151 <td><a href="#bit">bit(10)</a></td>
1152 <td class="td_left">If this bit is set, a SectionID follows this vbr.</td>
1153 </tr>
1154 <tr>
Anton Korobeynikovd61d39e2006-09-14 18:23:27 +00001155 <td><a href="#bit">bit(11-12)</a></td>
1156 <td class="td_left">Linkage type for external functions. 0 - External
1157 linkage, 1 - DLLImport linkage, 2 - External weak linkage.</td>
1158 </tr>
1159 <tr>
1160 <td><a href="#bit">bit(13-31)</a></td>
Chris Lattner84acbcc2005-11-06 07:20:25 +00001161 <td class="td_left">Currently unassigned.</td>
1162 </tr>
Chris Lattnercd196a92004-10-16 18:03:55 +00001163 </tbody>
1164</table>
1165
Chris Lattner7bf26c12005-11-12 01:46:21 +00001166<p>If the SectionID bit is set above, the following field is included:</p>
1167
1168<table>
1169 <tbody>
1170 <tr>
1171 <th><b>Type</b></th>
1172 <th class="td_left"><b>Description</b></th>
1173 </tr>
1174 <tr>
1175 <td><a href="#uint32_vbr">uint32_vbr</a>
1176 </td>
1177 <td class="td_left">An optional section ID number, specifying the string
1178 to use for the section of the function. This an index (+1) of an entry
Reid Spencerb958c7e2007-02-02 02:30:19 +00001179 into the SectionID llist in the
1180 <a href="#globalinfo">Module Global Info</a> block. If this value is
1181 0 or not present, the function has an empty section string.</td>
Chris Lattner7bf26c12005-11-12 01:46:21 +00001182 </tr>
1183 </tbody>
1184</table>
1185
Chris Lattnercd196a92004-10-16 18:03:55 +00001186</div>
1187
Reid Spencer9acd4122004-05-22 02:28:36 +00001188<!-- _______________________________________________________________________ -->
Reid Spencer4e0352d2004-07-05 08:18:07 +00001189<div class="doc_subsection"><a name="constantpool">Constant Pool</a> </div>
Reid Spencer9acd4122004-05-22 02:28:36 +00001190<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +00001191<p>A constant pool defines as set of constant values. There are
1192actually two types of constant pool blocks: one for modules and one for
1193functions. For modules, the block begins with the constant strings
1194encountered anywhere in the module. For functions, the block begins
1195with types only encountered in the function. In both cases the header
1196is identical. The tables that follow, show the header, module constant
1197pool preamble, function constant pool preamble, and the part common to
1198both function and module constant pools.</p>
1199<p><b>Common Block Header</b></p>
1200<table>
1201 <tbody>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001202 <tr>
1203 <th><b>Type</b></th>
1204 <th class="td_left"><b>Field Description</b></th>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001205 </tr>
Reid Spencere831f0b2004-07-29 00:13:04 +00001206 <tr>
1207 <td><a href="#block">block</a></td>
1208 <td class="td_left">Constant pool identifier (0x03) + size<br>
1209 </td>
1210 </tr>
1211 </tbody>
1212</table>
1213<p><b>Module Constant Pool Preamble (constant strings)</b></p>
1214<table>
1215 <tbody>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001216 <tr>
1217 <th><b>Type</b></th>
1218 <th class="td_left"><b>Field Description</b></th>
Reid Spencere831f0b2004-07-29 00:13:04 +00001219 </tr>
1220 <tr>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001221 <td><a href="#uint32_vbr">uint32_vbr</a></td>
1222 <td class="td_left">The number of constant strings that follow.</td>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001223 </tr>
Reid Spencere831f0b2004-07-29 00:13:04 +00001224 <tr>
1225 <td><a href="#uint32_vbr">uint32_vbr</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001226 <td class="td_left">Zero. This identifies the following "plane" as
1227 containing the constant strings. This is needed to identify it uniquely
1228 from other constant planes that follow. </td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001229 </tr>
1230 <tr>
1231 <td><a href="#uint24_vbr">uint24_vbr</a>+</td>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001232 <td class="td_left">Type slot number of the constant string's type. Note
1233 that the constant string's type implicitly defines the length of the
1234 string. </td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001235 </tr>
1236 </tbody>
1237</table>
1238<p><b>Function Constant Pool Preamble (function types)</b></p>
1239<p>The structure of the types for functions is identical to the <a
1240 href="#globaltypes">Global Type Pool</a>. Please refer to that section
1241for the details. </p>
1242<p><b>Common Part (other constants)</b></p>
1243<table>
1244 <tbody>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001245 <tr>
1246 <th><b>Type</b></th>
1247 <th class="td_left"><b>Field Description</b></th>
Reid Spencere831f0b2004-07-29 00:13:04 +00001248 </tr>
1249 <tr>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001250 <td><a href="#uint32_vbr">uint32_vbr</a></td>
1251 <td class="td_left">Number of entries in this type plane.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001252 </tr>
1253 <tr>
1254 <td><a href="#uint24_vbr">uint24_vbr</a></td>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001255 <td class="td_left">Type slot number of this plane.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001256 </tr>
1257 <tr>
Reid Spencer8e32af02004-07-07 13:34:26 +00001258 <td><a href="#constant">constant</a>+</td>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001259 <td class="td_left">The definition of a constant (see below).</td>
1260 </tr>
Reid Spencere831f0b2004-07-29 00:13:04 +00001261 </tbody>
1262</table>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001263</div>
Chris Lattner4e27e8d2006-01-25 23:31:53 +00001264
Reid Spencer9ce11e42004-07-05 19:04:27 +00001265<!-- _______________________________________________________________________ -->
Chris Lattner4e27e8d2006-01-25 23:31:53 +00001266<div class="doc_subsubsection"><a name="constant">Simple Constant Pool
1267Entries</a></div>
1268
Reid Spencer9ce11e42004-07-05 19:04:27 +00001269<div class="doc_text">
Chris Lattner4e27e8d2006-01-25 23:31:53 +00001270
1271<p>Constant pool entries come in many shapes and flavors. The sections that
1272follow define the format for each of them. All constants start with a <a
Reid Spencere831f0b2004-07-29 00:13:04 +00001273 href="#uint32_vbr">uint32_vbr</a> encoded integer that provides the
1274number of operands for the constant. For primitive, structure, and
Chris Lattner4e27e8d2006-01-25 23:31:53 +00001275array constants, this will always be zero to indicate that the form of the
1276constant is solely determined by its type. In this case, we have the following
1277field definitions, based on type:</p>
1278
Reid Spencere831f0b2004-07-29 00:13:04 +00001279<ul>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001280 <li><b>Bool</b>. This is written as an <a href="#uint32_vbr">uint32_vbr</a> of
1281 value 1U or 0U.</li>
Reid Spencerccaec8e2007-02-28 02:33:06 +00001282 <li><b>Signed Integers (sbyte,short,int,long) &le; 64 bits</b>. These are
1283 written as an <a href="#int64_vbr">int64_vbr</a> with the corresponding
1284 value.</li>
1285 <li><b>Unsigned Integers (ubyte,ushort,uint,ulong) &le; 64 bits</b>. These
1286 are written as an <a href="#uint64_vbr">uint64_vbr</a> with the corresponding
1287 value. </li>
1288 <li><b>Integers &gt; 64 bits</b>. These are written as a length followed by a
1289 series of 64-bit words. The length specifies the number of words that follow.
1290 Any zero-valued high order words are elided. Words with the least significant
1291 bits are written to the lowest file offsets (little endian). The length is
1292 written as an <a href="#uint32_vbr">uint32_vbr</a>. Each word of the value
1293 is written as an <a href="#uint64_vbr">uint64_vbr</a>.</li>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001294 <li><b>Floating Point</b>. Both the float and double types are written
1295 literally in binary format.</li>
1296 <li><b>Arrays</b>. Arrays are written simply as a list of
1297 <a href="#uint32_vbr">uint32_vbr</a> encoded value slot numbers to the
1298 constant element values.</li>
1299 <li><b>Structures</b>. Structures are written simply as a list of
1300 <a href="#uint32_vbr">uint32_vbr</a> encoded value slot numbers to the
1301 constant field values of the structure.</li>
Reid Spencere831f0b2004-07-29 00:13:04 +00001302</ul>
Chris Lattnercd196a92004-10-16 18:03:55 +00001303
Chris Lattner4e27e8d2006-01-25 23:31:53 +00001304</div>
1305
1306<!-- _______________________________________________________________________ -->
Anton Korobeynikova0554d92007-01-12 19:20:47 +00001307<div class="doc_subsubsection">Undef Entries</div>
Chris Lattner4e27e8d2006-01-25 23:31:53 +00001308
1309<div class="doc_text">
Chris Lattnercd196a92004-10-16 18:03:55 +00001310<p>When the number of operands to the constant is one, we have an 'undef' value
1311of the specified type.</p>
Chris Lattner4e27e8d2006-01-25 23:31:53 +00001312</div>
Chris Lattnercd196a92004-10-16 18:03:55 +00001313
Chris Lattner4e27e8d2006-01-25 23:31:53 +00001314<!-- _______________________________________________________________________ -->
Anton Korobeynikova0554d92007-01-12 19:20:47 +00001315<div class="doc_subsubsection">Inline Assembler Entries</div>
Chris Lattner4e27e8d2006-01-25 23:31:53 +00001316
1317<div class="doc_text">
1318<p>Inline Assembler entries are stored in the constant pool, though they are not
1319 officially LLVM constants. These entries are marked with a value of
1320 "4294967295" (all ones) for the number of operands. They are encoded as
1321 follows:</p>
1322
1323<table>
1324 <tbody>
1325 <tr>
1326 <th><b>Type</b></th>
1327 <th class="td_left"><b>Field Description</b></th>
1328 </tr>
1329 <tr>
1330 <td><a href="#string">string</a></td>
1331 <td class="td_left">The asm string.</td>
1332 </tr>
1333 <tr>
1334 <td><a href="#string">string</a></td>
1335 <td class="td_left">The constraints string.</td>
1336 </tr>
1337 <tr>
1338 <td><a href="#uint32_vbr">uint32_vbr</a></td>
Anton Korobeynikova0554d92007-01-12 19:20:47 +00001339 <td class="td_left">Flags</td>
Chris Lattner4e27e8d2006-01-25 23:31:53 +00001340 </tr>
1341 </tbody>
1342</table>
1343
1344<p>Currently, the only defined flag, the low bit, indicates whether or not the
1345 inline assembler has side effects.</p>
1346
1347</div>
1348
1349<!-- _______________________________________________________________________ -->
Anton Korobeynikova0554d92007-01-12 19:20:47 +00001350<div class="doc_subsubsection">Constant Expression Entries</div>
Chris Lattner4e27e8d2006-01-25 23:31:53 +00001351
1352<div class="doc_text">
1353
1354<p>Otherwise, we have a constant expression. The format of the constant
1355expression is specified in the table below, and the number is equal to the
1356number of operands+1.</p>
Reid Spencere831f0b2004-07-29 00:13:04 +00001357<table>
1358 <tbody>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001359 <tr>
1360 <th><b>Type</b></th>
1361 <th class="td_left"><b>Field Description</b></th>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001362 </tr>
Reid Spencere831f0b2004-07-29 00:13:04 +00001363 <tr>
1364 <td><a href="#uint32_vbr">uint32_vbr</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001365 <td class="td_left">Op code of the instruction for the constant
1366 expression.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001367 </tr>
1368 <tr>
1369 <td><a href="#uint32_vbr">uint32_vbr</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001370 <td class="td_left">The value slot number of the constant value for an
1371 operand.<sup>1</sup></td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001372 </tr>
1373 <tr>
1374 <td><a href="#uint24_vbr">uint24_vbr</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001375 <td class="td_left">The type slot number for the type of the constant
1376 value for an operand.<sup>1</sup></td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001377 </tr>
1378 </tbody>
1379</table>
1380Notes:
1381<ol>
1382 <li>Both these fields are repeatable but only in pairs.</li>
1383</ol>
Reid Spencer9acd4122004-05-22 02:28:36 +00001384</div>
1385<!-- _______________________________________________________________________ -->
Reid Spencere2f97b32004-07-05 22:28:02 +00001386<div class="doc_subsection"><a name="functiondefs">Function Definition</a></div>
Reid Spencer4e0352d2004-07-05 08:18:07 +00001387<div class="doc_text">
Reid Spencer8ad541d2007-01-31 00:26:08 +00001388<p>Function definitions contain the linkage, constant pool, instruction list,
1389and symbol table for a function. The following table shows the structure of
1390a function definition.</p>
Reid Spencere831f0b2004-07-29 00:13:04 +00001391<table>
1392 <tbody>
Reid Spencere2f97b32004-07-05 22:28:02 +00001393 <tr>
1394 <th><b>Type</b></th>
1395 <th class="td_left"><b>Field Description</b></th>
Reid Spencere2f97b32004-07-05 22:28:02 +00001396 </tr>
Reid Spencere831f0b2004-07-29 00:13:04 +00001397 <tr>
1398 <td><a href="#block">block</a><br>
1399 </td>
1400 <td class="td_left">Function definition block identifier (0x02) +
1401size<br>
1402 </td>
1403 </tr>
1404 <tr>
1405 <td><a href="#uint32_vbr">uint32_vbr</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001406 <td class="td_left">
1407 <a href="#funclinkage_and_visibility">The linkage and visibility</a>
1408 style field</td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001409 </tr>
1410 <tr>
1411 <td><a href="#block">block</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001412 <td class="td_left">The <a href="#constantpool">constant pool</a> block
1413 for this function.<sup>2</sup></td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001414 </tr>
1415 <tr>
1416 <td><a href="#block">block</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001417 <td class="td_left">The <a href="#instructionlist">instruction list</a>
1418 for the function.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001419 </tr>
1420 <tr>
1421 <td><a href="#block">block</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001422 <td class="td_left">The function's <a href="#symtab">symbol table</a>
1423 containing only those symbols pertinent to the function (mostly block
1424 labels).</td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001425 </tr>
1426 </tbody>
1427</table>
1428Notes:
1429<ol>
1430 <li>Note that if the linkage type is "External" then none of the
1431other fields will be present as the function is defined elsewhere.</li>
Reid Spencere831f0b2004-07-29 00:13:04 +00001432</ol>
Anton Korobeynikova0554d92007-01-12 19:20:47 +00001433
1434<!-- _______________________________________________________________________ -->
1435<div class="doc_subsubsection"><a name="funclinkage_and_visibility">Linkage and
1436 visibility word</a>
Reid Spencer4e0352d2004-07-05 08:18:07 +00001437</div>
Anton Korobeynikova0554d92007-01-12 19:20:47 +00001438<div class="doc_text">
1439
1440<table>
1441 <tbody>
1442 <tr>
1443 <th><b>Type</b></th>
1444 <th class="td_left"><b>Field Description</b></th>
1445 </tr>
1446 <tr>
1447 <td><a href="#bit">bit(0-15)</a></td>
1448 <td class="td_left">The linkage type of the function: 0=External, 1=Weak,
Reid Spencerb958c7e2007-02-02 02:30:19 +00001449 2=Appending, 3=Internal, 4=LinkOnce, 5=DllImport,
1450 6=DllExport<sup>1</sup></td>
Anton Korobeynikova0554d92007-01-12 19:20:47 +00001451 </tr>
1452 <tr>
Anton Korobeynikov725ad642007-01-23 12:43:53 +00001453 <td><a href="#bit">bit(16-18)</a></td>
Anton Korobeynikova0554d92007-01-12 19:20:47 +00001454 <td class="td_left">Visibility style: 0=Default, 1=Hidden.</td>
1455 </tr>
Anton Korobeynikov725ad642007-01-23 12:43:53 +00001456 <tr>
1457 <td><a href="#bit">bit(19-31)</a></td>
Reid Spencer8ad541d2007-01-31 00:26:08 +00001458 <td class="td_left">Currently unassigned.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001459 </tr>
1460 </tbody>
1461</table>
Reid Spencer4e0352d2004-07-05 08:18:07 +00001462</div>
Reid Spencer8ad541d2007-01-31 00:26:08 +00001463
Reid Spencer4e0352d2004-07-05 08:18:07 +00001464<!-- _______________________________________________________________________ -->
Reid Spencer375d7842004-08-18 20:06:19 +00001465<div class="doc_subsection"><a name="instructionlist">Instruction List</a></div>
Reid Spencer9acd4122004-05-22 02:28:36 +00001466<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +00001467<p>The instructions in a function are written as a simple list. Basic
1468blocks are inferred by the terminating instruction types. The format of
1469the block is given in the following table.</p>
1470<table>
1471 <tbody>
Reid Spencere2f97b32004-07-05 22:28:02 +00001472 <tr>
1473 <th><b>Type</b></th>
1474 <th class="td_left"><b>Field Description</b></th>
Reid Spencere2f97b32004-07-05 22:28:02 +00001475 </tr>
Reid Spencere831f0b2004-07-29 00:13:04 +00001476 <tr>
1477 <td><a href="#block">block</a><br>
1478 </td>
1479 <td class="td_left">Instruction list identifier (0x07) + size<br>
1480 </td>
1481 </tr>
1482 <tr>
1483 <td><a href="#instruction">instruction</a>+</td>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001484 <td class="td_left">An instruction. Instructions have a variety of
1485 formats. See <a href="#instruction">Instructions</a> for details.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001486 </tr>
1487 </tbody>
1488</table>
Reid Spencer9acd4122004-05-22 02:28:36 +00001489</div>
Chris Lattnerdb137582005-11-05 22:20:06 +00001490
Reid Spencere2f97b32004-07-05 22:28:02 +00001491<!-- _______________________________________________________________________ -->
Chris Lattnerdb137582005-11-05 22:20:06 +00001492<div class="doc_subsection"><a name="instructions">Instructions</a></div>
1493
Reid Spencere2f97b32004-07-05 22:28:02 +00001494<div class="doc_text">
Chris Lattnerdb137582005-11-05 22:20:06 +00001495<p>Instructions are written out one at a time as distinct units. Each
1496instruction
1497record contains at least an <a href="#opcodes">opcode</a> and a type field,
Chris Lattner16025ee2005-11-05 22:32:06 +00001498and may contain a <a href="#instoperands">list of operands</a> (whose
1499interpretation depends on the opcode). Based on the number of operands, the
Chris Lattnerdb137582005-11-05 22:20:06 +00001500<a href="#instencode">instruction is encoded</a> in a
1501dense format that tries to encoded each instruction into 32-bits if
1502possible. </p>
Reid Spencere2f97b32004-07-05 22:28:02 +00001503</div>
Reid Spencer375d7842004-08-18 20:06:19 +00001504
1505<!-- _______________________________________________________________________ -->
Chris Lattnerdb137582005-11-05 22:20:06 +00001506<div class="doc_subsubsection"><a name="opcodes">Instruction Opcodes</a></div>
Reid Spencer375d7842004-08-18 20:06:19 +00001507<div class="doc_text">
1508 <p>Instructions encode an opcode that identifies the kind of instruction.
1509 Opcodes are an enumerated integer value. The specific values used depend on
1510 the version of LLVM you're using. The opcode values are defined in the
Reid Spencerca058542006-03-14 05:39:39 +00001511 <a href="http://llvm.org/cvsweb/cvsweb.cgi/llvm/include/llvm/Instruction.def">
Reid Spencer375d7842004-08-18 20:06:19 +00001512 <tt>include/llvm/Instruction.def</tt></a> file. You should check there for the
1513 most recent definitions. The table below provides the opcodes defined as of
Nate Begeman0c1e6802004-08-27 07:59:37 +00001514 the writing of this document. The table associates each opcode mnemonic with
Reid Spencer375d7842004-08-18 20:06:19 +00001515 its enumeration value and the bytecode and LLVM version numbers in which the
1516 opcode was introduced.</p>
1517 <table>
1518 <tbody>
1519 <tr>
1520 <th>Opcode</th>
1521 <th>Number</th>
1522 <th>Bytecode Version</th>
1523 <th>LLVM Version</th>
1524 </tr>
1525 <tr><td colspan="4"><b>Terminator Instructions</b></td></tr>
1526 <tr><td>Ret</td><td>1</td><td>1</td><td>1.0</td></tr>
1527 <tr><td>Br</td><td>2</td><td>1</td><td>1.0</td></tr>
1528 <tr><td>Switch</td><td>3</td><td>1</td><td>1.0</td></tr>
1529 <tr><td>Invoke</td><td>4</td><td>1</td><td>1.0</td></tr>
1530 <tr><td>Unwind</td><td>5</td><td>1</td><td>1.0</td></tr>
Chris Lattnercd196a92004-10-16 18:03:55 +00001531 <tr><td>Unreachable</td><td>6</td><td>1</td><td>1.4</td></tr>
Reid Spencer375d7842004-08-18 20:06:19 +00001532 <tr><td colspan="4"><b>Binary Operators</b></td></tr>
Chris Lattnercd196a92004-10-16 18:03:55 +00001533 <tr><td>Add</td><td>7</td><td>1</td><td>1.0</td></tr>
1534 <tr><td>Sub</td><td>8</td><td>1</td><td>1.0</td></tr>
1535 <tr><td>Mul</td><td>9</td><td>1</td><td>1.0</td></tr>
Reid Spencer2970eeb2007-01-31 01:18:59 +00001536 <tr><td>UDiv</td><td>10</td><td>6</td><td>1.9</td></tr>
1537 <tr><td>SDiv</td><td>11</td><td>6</td><td>1.9</td></tr>
1538 <tr><td>FDiv</td><td>12</td><td>6</td><td>1.9</td></tr>
1539 <tr><td>URem</td><td>13</td><td>6</td><td>1.9</td></tr>
1540 <tr><td>SRem</td><td>14</td><td>6</td><td>1.9</td></tr>
1541 <tr><td>FRem</td><td>15</td><td>6</td><td>1.9</td></tr>
Reid Spencer375d7842004-08-18 20:06:19 +00001542 <tr><td colspan="4"><b>Logical Operators</b></td></tr>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001543 <tr><td>Shl</td><td>16</td><td>1</td><td>1.0</td></tr>
1544 <tr><td>LShr</td><td>17</td><td>6</td><td>1.9</td></tr>
1545 <tr><td>AShr</td><td>18</td><td>6</td><td>1.9</td></tr>
1546 <tr><td>And</td><td>19</td><td>1</td><td>1.0</td></tr>
1547 <tr><td>Or</td><td>20</td><td>1</td><td>1.0</td></tr>
1548 <tr><td>Xor</td><td>21</td><td>1</td><td>1.0</td></tr>
Reid Spencer375d7842004-08-18 20:06:19 +00001549 <tr><td colspan="4"><b>Memory Operators</b></td></tr>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001550 <tr><td>Malloc</td><td>22</td><td>1</td><td>1.0</td></tr>
1551 <tr><td>Free</td><td>23</td><td>1</td><td>1.0</td></tr>
1552 <tr><td>Alloca</td><td>24</td><td>1</td><td>1.0</td></tr>
1553 <tr><td>Load</td><td>25</td><td>1</td><td>1.0</td></tr>
1554 <tr><td>Store</td><td>26</td><td>1</td><td>1.0</td></tr>
1555 <tr><td>GetElementPtr</td><td>27</td><td>1</td><td>1.0</td></tr>
Reid Spencer216b9e32007-01-31 00:38:46 +00001556 <tr><td colspan="4"><b>Cast Operators</b></td></tr>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001557 <tr><td>Trunc</td><td>28</td><td>7</td><td>2.0</td></tr>
1558 <tr><td>ZExt</td><td>29</td><td>7</td><td>2.0</td></tr>
1559 <tr><td>SExt</td><td>30</td><td>7</td><td>2.0</td></tr>
1560 <tr><td>FPToUI</td><td>31</td><td>7</td><td>2.0</td></tr>
1561 <tr><td>FPToSI</td><td>32</td><td>7</td><td>2.0</td></tr>
1562 <tr><td>UIToFP</td><td>33</td><td>7</td><td>2.0</td></tr>
1563 <tr><td>SIToFP</td><td>34</td><td>7</td><td>2.0</td></tr>
1564 <tr><td>FPTrunc</td><td>35</td><td>7</td><td>2.0</td></tr>
1565 <tr><td>FPExt</td><td>36</td><td>7</td><td>2.0</td></tr>
1566 <tr><td>PtrToInt</td><td>37</td><td>7</td><td>2.0</td></tr>
1567 <tr><td>IntToPtr</td><td>38</td><td>7</td><td>2.0</td></tr>
1568 <tr><td>BitCast</td><td>39</td><td>7</td><td>2.0</td></tr>
Reid Spencer375d7842004-08-18 20:06:19 +00001569 <tr><td colspan="4"><b>Other Operators</b></td></tr>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001570 <tr><td>ICmp</td><td>40</td><td>7</td><td>2.0</td></tr>
1571 <tr><td>FCmp</td><td>41</td><td>7</td><td>2.0</td></tr>
1572 <tr><td>PHI</td><td>42</td><td>1</td><td>1.0</td></tr>
1573 <tr><td>Call</td><td>43</td><td>1</td><td>1.0</td></tr>
Reid Spencer216b9e32007-01-31 00:38:46 +00001574 <tr><td>Select</td><td>44</td><td>2</td><td>1.2</td></tr>
1575 <tr><td>UserOp1</td><td>45</td><td>1</td><td>1.0</td></tr>
1576 <tr><td>UserOp2</td><td>46</td><td>1</td><td>1.0</td></tr>
1577 <tr><td>VAArg</td><td>47</td><td>5</td><td>1.5</td></tr>
1578 <tr><td>ExtractElement</td><td>48</td><td>5</td><td>1.5</td></tr>
1579 <tr><td>InsertElement</td><td>49</td><td>5</td><td>1.5</td></tr>
1580 <tr><td>ShuffleElement</td><td>50</td><td>5</td><td>1.5</td></tr>
Reid Spencer621fd112005-05-14 00:06:06 +00001581 <tr><td colspan="4">
1582 <b>Pseudo Instructions<a href="#pi_note">*</a></b>
1583 </td></tr>
1584 <tr><td>Invoke+CC </td><td>56</td><td>5</td><td>1.5</td></tr>
1585 <tr><td>Invoke+FastCC</td><td>57</td><td>5</td><td>1.5</td></tr>
1586 <tr><td>Call+CC</td><td>58</td><td>5</td><td>1.5</td></tr>
1587 <tr><td>Call+FastCC+TailCall</td><td>59</td><td>5</td><td>1.5</td></tr>
1588 <tr><td>Call+FastCC</td><td>60</td><td>5</td><td>1.5</td></tr>
1589 <tr><td>Call+CCC+TailCall</td><td>61</td><td>5</td><td>1.5</td></tr>
Christopher Lambbff50202007-04-21 08:16:25 +00001590 <tr><td>Load+Attributes</td><td>62</td><td>7</td><td>2.0</td></tr>
1591 <tr><td>Store+Attributes</td><td>63</td><td>7</td><td>2.0</td></tr>
Reid Spencer375d7842004-08-18 20:06:19 +00001592 </tbody>
1593 </table>
Reid Spencer375d7842004-08-18 20:06:19 +00001594
Reid Spencer621fd112005-05-14 00:06:06 +00001595<p><b><a name="pi_note">* Note: </a></b>
Chris Lattnerdb137582005-11-05 22:20:06 +00001596These aren't really opcodes from an LLVM language perspective. They encode
Reid Spencer621fd112005-05-14 00:06:06 +00001597information into other opcodes without reserving space for that information.
Christopher Lambbff50202007-04-21 08:16:25 +00001598For example, opcode=63 is an Attributed Store. The opcode for this
Reid Spencer621fd112005-05-14 00:06:06 +00001599instruction is 25 (Store) but we encode it as 63 to indicate that is a Volatile
1600Store. The same is done for the calling conventions and tail calls.
1601In each of these entries in range 56-63, the opcode is documented as the base
1602opcode (Invoke, Call, Store) plus some set of modifiers, as follows:</p>
1603<dl>
1604 <dt>CC</dt>
Chris Lattnerf47e4c12005-05-14 01:30:15 +00001605 <dd>This means an arbitrary calling convention is specified
1606 in a VBR that follows the opcode. This is used when the instruction cannot
1607 be encoded with one of the more compact forms.
Reid Spencer621fd112005-05-14 00:06:06 +00001608 </dd>
1609 <dt>FastCC</dt>
1610 <dd>This indicates that the Call or Invoke is using the FastCC calling
Chris Lattnerf47e4c12005-05-14 01:30:15 +00001611 convention.</dd>
Reid Spencer621fd112005-05-14 00:06:06 +00001612 <dt>CCC</dt>
Chris Lattnerf47e4c12005-05-14 01:30:15 +00001613 <dd>This indicates that the Call or Invoke is using the native "C" calling
1614 convention.</dd>
Reid Spencer621fd112005-05-14 00:06:06 +00001615 <dt>TailCall</dt>
Chris Lattnerf47e4c12005-05-14 01:30:15 +00001616 <dd>This indicates that the Call has the 'tail' modifier.</dd>
Reid Spencer621fd112005-05-14 00:06:06 +00001617</dl>
Chris Lattnerdb137582005-11-05 22:20:06 +00001618</div>
1619
Chris Lattner16025ee2005-11-05 22:32:06 +00001620<!-- _______________________________________________________________________ -->
1621<div class="doc_subsubsection"><a name="instoperands">Instruction
1622Operands</a></div>
1623
1624<div class="doc_text">
1625<p>
1626Based on the instruction opcode and type, the bytecode format implicitly (to
1627save space) specifies the interpretation of the operand list. For most
1628instructions, the type of each operand is implicit from the type of the
1629instruction itself (e.g. the type of operands of a binary operator must match
1630the type of the instruction). As such, the bytecode format generally only
1631encodes the value number of the operand, not the type.</p>
1632
1633<p>In some cases, however, this is not sufficient. This section enumerates
1634those cases:</p>
1635
1636<ul>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001637 <li>getelementptr: the slot numbers for sequential type indexes are shifted
1638 up two bits. This allows the low order bits will encode the type of index
1639 used, as follows: 0=uint, 1=int, 2=ulong, 3=long.</li>
1640 <li>cast: the result type number is encoded as the second operand.</li>
1641 <li>alloca/malloc: If the allocation has an explicit alignment, the log2 of
1642 the alignment is encoded as the second operand.</li>
1643 <li>call: If the tail marker and calling convention cannot be
1644 <a href="#pi_note">encoded into the opcode</a> of the call, it is passed as
1645 an additional operand. The low bit of the operand is a flag indicating
1646 whether the call is a tail call. The rest of the bits contain the calling
1647 convention number (shifted left by one bit).</li>
Chris Lattner16025ee2005-11-05 22:32:06 +00001648</ul>
1649</div>
Chris Lattnerdb137582005-11-05 22:20:06 +00001650
1651<!-- _______________________________________________________________________ -->
1652<div class="doc_subsubsection"><a name="instencode">Instruction
1653Encoding</a></div>
1654
1655<div class="doc_text">
1656<p>For brevity, instructions are written in one of four formats,
1657depending on the number of operands to the instruction. Each
1658instruction begins with a <a href="#uint32_vbr">uint32_vbr</a> that
1659encodes the type of the instruction as well as other things. The tables
1660that follow describe the format of this first part of each instruction.</p>
1661<p><b>Instruction Format 0</b></p>
1662<p>This format is used for a few instructions that can't easily be
1663shortened because they have large numbers of operands (e.g. PHI Node or
1664getelementptr). Each of the opcode, type, and operand fields is found in
1665successive fields.</p>
1666<table>
1667 <tbody>
1668 <tr>
1669 <th><b>Type</b></th>
1670 <th class="td_left"><b>Field Description</b></th>
1671 </tr>
1672 <tr>
1673 <td><a href="#uint32_vbr">uint32_vbr</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001674 <td class="td_left">Specifies the opcode of the instruction. Note that
1675 for compatibility with the other instruction formats, the opcode is
1676 shifted left by 2 bits. Bits 0 and 1 must have value zero for this
1677 format.</td>
Chris Lattnerdb137582005-11-05 22:20:06 +00001678 </tr>
1679 <tr>
1680 <td><a href="#uint24_vbr">uint24_vbr</a></td>
1681 <td class="td_left">Provides the type slot number of the result type of
1682 the instruction.</td>
1683 </tr>
1684 <tr>
1685 <td><a href="#uint32_vbr">uint32_vbr</a></td>
1686 <td class="td_left">The number of operands that follow.</td>
1687 </tr>
1688 <tr>
1689 <td><a href="#uint32_vbr">uint32_vbr</a>+</td>
1690 <td class="td_left">The slot number of the value(s) for the operand(s).
Chris Lattner16025ee2005-11-05 22:32:06 +00001691 </td>
Chris Lattnerdb137582005-11-05 22:20:06 +00001692 </tr>
1693 </tbody>
1694</table>
Chris Lattner16025ee2005-11-05 22:32:06 +00001695
Chris Lattnerdb137582005-11-05 22:20:06 +00001696<p><b>Instruction Format 1</b></p>
1697<p>This format encodes the opcode, type and a single operand into a
1698single <a href="#uint32_vbr">uint32_vbr</a> as follows:</p>
1699<table>
1700 <tbody>
1701 <tr>
1702 <th><b>Bits</b></th>
1703 <th><b>Type</b></th>
1704 <th class="td_left"><b>Field Description</b></th>
1705 </tr>
1706 <tr>
1707 <td>0-1</td>
1708 <td>constant "1"</td>
1709 <td class="td_left">These two bits must be the value 1 which identifies
1710 this as an instruction of format 1.</td>
1711 </tr>
1712 <tr>
1713 <td>2-7</td>
1714 <td><a href="#instructions">opcode</a></td>
1715 <td class="td_left">Specifies the opcode of the instruction. Note that
1716 the maximum opcode value is 63.</td>
1717 </tr>
1718 <tr>
1719 <td>8-19</td>
1720 <td><a href="#unsigned">unsigned</a></td>
1721 <td class="td_left">Specifies the slot number of the type for this
1722 instruction. Maximum slot number is 2<sup>12</sup>-1=4095.</td>
1723 </tr>
1724 <tr>
1725 <td>20-31</td>
1726 <td><a href="#unsigned">unsigned</a></td>
1727 <td class="td_left">Specifies the slot number of the value for the
1728 first operand. Maximum slot number is 2<sup>12</sup>-1=4095. Note that
1729 the value 2<sup>12</sup>-1 denotes zero operands.</td>
1730 </tr>
1731 </tbody>
1732</table>
1733<p><b>Instruction Format 2</b></p>
1734<p>This format encodes the opcode, type and two operands into a single <a
1735 href="#uint32_vbr">uint32_vbr</a> as follows:</p>
1736<table>
1737 <tbody>
1738 <tr>
1739 <th><b>Bits</b></th>
1740 <th><b>Type</b></th>
1741 <th class="td_left"><b>Field Description</b></th>
1742 </tr>
1743 <tr>
1744 <td>0-1</td>
1745 <td>constant "2"</td>
1746 <td class="td_left">These two bits must be the value 2 which identifies
1747 this as an instruction of format 2.</td>
1748 </tr>
1749 <tr>
1750 <td>2-7</td>
1751 <td><a href="#instructions">opcode</a></td>
1752 <td class="td_left">Specifies the opcode of the instruction. Note that
1753 the maximum opcode value is 63.</td>
1754 </tr>
1755 <tr>
1756 <td>8-15</td>
1757 <td><a href="#unsigned">unsigned</a></td>
1758 <td class="td_left">Specifies the slot number of the type for this
1759 instruction. Maximum slot number is 2<sup>8</sup>-1=255.</td>
1760 </tr>
1761 <tr>
1762 <td>16-23</td>
1763 <td><a href="#unsigned">unsigned</a></td>
1764 <td class="td_left">Specifies the slot number of the value for the first
1765 operand. Maximum slot number is 2<sup>8</sup>-1=255.</td>
1766 </tr>
1767 <tr>
1768 <td>24-31</td>
1769 <td><a href="#unsigned">unsigned</a></td>
1770 <td class="td_left">Specifies the slot number of the value for the second
1771 operand. Maximum slot number is 2<sup>8</sup>-1=255.</td>
1772 </tr>
1773 </tbody>
1774</table>
1775<p><b>Instruction Format 3</b></p>
1776<p>This format encodes the opcode, type and three operands into a
1777single <a href="#uint32_vbr">uint32_vbr</a> as follows:</p>
1778<table>
1779 <tbody>
1780 <tr>
1781 <th><b>Bits</b></th>
1782 <th><b>Type</b></th>
1783 <th class="td_left"><b>Field Description</b></th>
1784 </tr>
1785 <tr>
1786 <td>0-1</td>
1787 <td>constant "3"</td>
1788 <td class="td_left">These two bits must be the value 3 which identifies
1789 this as an instruction of format 3.</td>
1790 </tr>
1791 <tr>
1792 <td>2-7</td>
1793 <td><a href="#instructions">opcode</a></td>
1794 <td class="td_left">Specifies the opcode of the instruction. Note that
1795 the maximum opcode value is 63.</td>
1796 </tr>
1797 <tr>
1798 <td>8-13</td>
1799 <td><a href="#unsigned">unsigned</a></td>
1800 <td class="td_left">Specifies the slot number of the type for this
1801 instruction. Maximum slot number is 2<sup>6</sup>-1=63.</td>
1802 </tr>
1803 <tr>
1804 <td>14-19</td>
1805 <td><a href="#unsigned">unsigned</a></td>
1806 <td class="td_left">Specifies the slot number of the value for the first
1807 operand. Maximum slot number is 2<sup>6</sup>-1=63.</td>
1808 </tr>
1809 <tr>
1810 <td>20-25</td>
1811 <td><a href="#unsigned">unsigned</a></td>
1812 <td class="td_left">Specifies the slot number of the value for the second
1813 operand. Maximum slot number is 2<sup>6</sup>-1=63.</td>
1814 </tr>
1815 <tr>
1816 <td>26-31</td>
1817 <td><a href="#unsigned">unsigned</a></td>
1818 <td class="td_left">Specifies the slot number of the value for the third
1819 operand. Maximum slot number is 2<sup>6</sup>-1=63.</td>
1820 </tr>
1821 </tbody>
1822</table>
1823</div>
Reid Spencer621fd112005-05-14 00:06:06 +00001824
Reid Spencer9acd4122004-05-22 02:28:36 +00001825<!-- _______________________________________________________________________ -->
Reid Spencereca340b2004-05-23 17:05:09 +00001826<div class="doc_subsection"><a name="symtab">Symbol Table</a> </div>
Reid Spencer9acd4122004-05-22 02:28:36 +00001827<div class="doc_text">
Reid Spencer375d7842004-08-18 20:06:19 +00001828<p>A symbol table can be put out in conjunction with a module or a function. A
1829symbol table has a list of name/type associations followed by a list of
1830name/value associations. The name/value associations are organized into "type
1831planes" so that all values of a common type are listed together. Each type
1832plane starts with the number of entries in the plane and the type slot number
1833for all the values in that plane (so the type can be looked up in the global
1834type pool). For each entry in a type plane, the slot number of the value and
1835the name associated with that value are written. The format is given in the
1836table below. </p>
Reid Spencer9ce11e42004-07-05 19:04:27 +00001837<table>
Reid Spencere831f0b2004-07-29 00:13:04 +00001838 <tbody>
1839 <tr>
1840 <th><b>Type</b></th>
1841 <th class="td_left"><b>Field Description</b></th>
1842 </tr>
1843 <tr>
1844 <td><a href="#block">block</a><br>
1845 </td>
1846 <td class="td_left">Symbol Table Identifier (0x04)</td>
1847 </tr>
1848 <tr>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001849 <td><a href="#llist">llist</a>(<a href="#symtab_entry">type_entry</a>)
1850 </td>
Reid Spencer9a910812004-08-17 00:49:03 +00001851 <td class="td_left">A length list of symbol table entries for
1852 <tt>Type</tt>s
1853 </td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001854 </tr>
1855 <tr>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001856 <td><a href="#zlist">llist</a>(<a href="#symtab_plane">symtab_plane</a>)
1857 </td>
Reid Spencer375d7842004-08-18 20:06:19 +00001858 <td class="td_left">A length list of "type planes" of symbol table
Reid Spencer9a910812004-08-17 00:49:03 +00001859 entries for <tt>Value</tt>s</td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001860 </tr>
1861 </tbody>
Reid Spencereca340b2004-05-23 17:05:09 +00001862</table>
Reid Spencer9acd4122004-05-22 02:28:36 +00001863</div>
Reid Spencer375d7842004-08-18 20:06:19 +00001864
1865<!-- _______________________________________________________________________ -->
1866<div class="doc_subsubsection"> <a name="type_entry">Symbol Table Type
1867Entry</a>
1868</div>
1869<div class="doc_text">
1870<p>A symbol table type entry associates a name with a type. The name is provided
1871simply as an array of chars. The type is provided as a type slot number (index)
1872into the global type pool. The format is given in the following table:</p>
1873<table>
1874 <tbody>
1875 <tr>
1876 <th><b>Type</b></th>
1877 <th class="td_left"><b>Field Description</b></th>
1878 </tr>
1879 <tr>
1880 <td><a href="#uint32_vbr">uint24_vbr</a></td>
1881 <td class="td_left">Type slot number of the type being given a
1882 name relative to the global type pool.
1883 </td>
1884 </tr>
1885 <tr>
1886 <td><a href="#uint32_vbr">uint32_vbr</a></td>
1887 <td class="td_left">Length of the character array that follows.</td>
1888 </tr>
1889 <tr>
1890 <td><a href="#char">char</a>+</td>
1891 <td class="td_left">The characters of the name.</td>
1892 </tr>
1893 </tbody>
1894</table>
1895</div>
Reid Spencere2f97b32004-07-05 22:28:02 +00001896<!-- _______________________________________________________________________ -->
Reid Spencere831f0b2004-07-29 00:13:04 +00001897<div class="doc_subsubsection"> <a name="symtab_plane">Symbol Table
1898Plane</a>
Reid Spencere2f97b32004-07-05 22:28:02 +00001899</div>
1900<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +00001901<p>A symbol table plane provides the symbol table entries for all
1902values of a common type. The encoding is given in the following table:</p>
Reid Spencere2f97b32004-07-05 22:28:02 +00001903<table>
Reid Spencere831f0b2004-07-29 00:13:04 +00001904 <tbody>
1905 <tr>
1906 <th><b>Type</b></th>
1907 <th class="td_left"><b>Field Description</b></th>
1908 </tr>
1909 <tr>
1910 <td><a href="#uint32_vbr">uint32_vbr</a></td>
1911 <td class="td_left">Number of entries in this plane.</td>
1912 </tr>
1913 <tr>
1914 <td><a href="#uint32_vbr">uint32_vbr</a></td>
Reid Spencerb958c7e2007-02-02 02:30:19 +00001915 <td class="td_left">Type slot number of type for all values in this plane.
1916 </td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001917 </tr>
1918 <tr>
Reid Spencer375d7842004-08-18 20:06:19 +00001919 <td><a href="#value_entry">value_entry</a>+</td>
1920 <td class="td_left">The symbol table entries for to associate values with
1921 names.</td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001922 </tr>
1923 </tbody>
Reid Spencere2f97b32004-07-05 22:28:02 +00001924</table>
1925</div>
Reid Spencere2f97b32004-07-05 22:28:02 +00001926<!-- _______________________________________________________________________ -->
Reid Spencer375d7842004-08-18 20:06:19 +00001927<div class="doc_subsubsection"><a name="value_entry">Symbol Table Value
Reid Spencere831f0b2004-07-29 00:13:04 +00001928Entry</a>
Reid Spencere2f97b32004-07-05 22:28:02 +00001929</div>
1930<div class="doc_text">
Reid Spencer375d7842004-08-18 20:06:19 +00001931<p>A symbol table value entry provides the assocation between a value and the
1932name given to the value. The value is referenced by its slot number. The
Reid Spencere831f0b2004-07-29 00:13:04 +00001933format is given in the following table:</p>
Reid Spencere2f97b32004-07-05 22:28:02 +00001934<table>
Reid Spencere831f0b2004-07-29 00:13:04 +00001935 <tbody>
1936 <tr>
1937 <th><b>Type</b></th>
1938 <th class="td_left"><b>Field Description</b></th>
1939 </tr>
1940 <tr>
1941 <td><a href="#uint32_vbr">uint24_vbr</a></td>
Reid Spencer375d7842004-08-18 20:06:19 +00001942 <td class="td_left">Value slot number of the value being given a name.
Reid Spencer9a910812004-08-17 00:49:03 +00001943 </td>
Reid Spencere831f0b2004-07-29 00:13:04 +00001944 </tr>
1945 <tr>
1946 <td><a href="#uint32_vbr">uint32_vbr</a></td>
1947 <td class="td_left">Length of the character array that follows.</td>
1948 </tr>
1949 <tr>
1950 <td><a href="#char">char</a>+</td>
1951 <td class="td_left">The characters of the name.</td>
1952 </tr>
1953 </tbody>
Reid Spencere2f97b32004-07-05 22:28:02 +00001954</table>
1955</div>
Reid Spencer375d7842004-08-18 20:06:19 +00001956
Reid Spencerb14a0a62004-06-08 07:41:41 +00001957<!-- *********************************************************************** -->
Reid Spencere831f0b2004-07-29 00:13:04 +00001958<div class="doc_section"> <a name="versiondiffs">Version Differences</a>
1959</div>
Reid Spencerb14a0a62004-06-08 07:41:41 +00001960<!-- *********************************************************************** -->
1961<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +00001962<p>This section describes the differences in the Bytecode Format across
1963LLVM
1964versions. The versions are listed in reverse order because it assumes
1965the current version is as documented in the previous sections. Each
1966section here
Chris Lattnere5589ea2004-07-05 18:05:48 +00001967describes the differences between that version and the one that <i>follows</i>.
Reid Spencerb14a0a62004-06-08 07:41:41 +00001968</p>
1969</div>
Chris Lattnercd196a92004-10-16 18:03:55 +00001970
Reid Spencerb14a0a62004-06-08 07:41:41 +00001971<!-- _______________________________________________________________________ -->
Reid Spencer3cff8a042004-08-18 20:17:05 +00001972<div class="doc_subsection"><a name="vers13">Version 1.3 Differences From
Chris Lattnercd196a92004-10-16 18:03:55 +00001973 1.4</a></div>
Reid Spencer0b85d032004-08-17 07:43:43 +00001974<!-- _______________________________________________________________________ -->
Chris Lattnercd196a92004-10-16 18:03:55 +00001975
1976<div class="doc_subsubsection">Unreachable Instruction</div>
1977<div class="doc_text">
1978 <p>The LLVM <a href="LangRef.html#i_unreachable">Unreachable</a> instruction
1979 was added in version 1.4 of LLVM. This caused all instruction numbers after
1980 it to shift down by one.</p>
1981</div>
1982
1983<div class="doc_subsubsection">Function Flags</div>
1984<div class="doc_text">
1985 <p>LLVM bytecode versions prior to 1.4 did not include the 5 bit offset
1986 in <a href="#funcfield">the function list</a> in the <a
1987 href="#globalinfo">Module Global Info</a> block.</p>
1988</div>
1989
1990<div class="doc_subsubsection">Function Flags</div>
1991<div class="doc_text">
1992 <p>LLVM bytecode versions prior to 1.4 did not include the 'undef' constant
Reid Spencerb958c7e2007-02-02 02:30:19 +00001993 value, which affects the encoding of <a href="#constant">Constant Fields</a>.
1994 </p>
Chris Lattnercd196a92004-10-16 18:03:55 +00001995</div>
1996
Chris Lattnercd196a92004-10-16 18:03:55 +00001997
Reid Spencer0b85d032004-08-17 07:43:43 +00001998<!-- _______________________________________________________________________ -->
Reid Spencere831f0b2004-07-29 00:13:04 +00001999<div class="doc_subsection"><a name="vers12">Version 1.2 Differences
2000From 1.3</a></div>
Reid Spencer4e0352d2004-07-05 08:18:07 +00002001<!-- _______________________________________________________________________ -->
Chris Lattnercd196a92004-10-16 18:03:55 +00002002
Reid Spencer4e0352d2004-07-05 08:18:07 +00002003<div class="doc_subsubsection">Type Derives From Value</div>
Reid Spencerb14a0a62004-06-08 07:41:41 +00002004<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +00002005<p>In version 1.2, the Type class in the LLVM IR derives from the Value
2006class. This is not the case in version 1.3. Consequently, in version
20071.2 the notion of a "Type Type" was used to write out values that were
2008Types. The types always occuped plane 12 (corresponding to the
2009TypeTyID) of any type planed set of values. In 1.3 this representation
2010is not convenient because the TypeTyID (12) is not present and its
2011value is now used for LabelTyID. Consequently, the data structures
2012written that involve types do so by writing all the types first and
2013then each of the value planes according to those types. In version 1.2,
2014the types would have been written intermingled with the values.</p>
Reid Spencer4e0352d2004-07-05 08:18:07 +00002015</div>
Reid Spencer4e0352d2004-07-05 08:18:07 +00002016<!-- _______________________________________________________________________ -->
Reid Spencere831f0b2004-07-29 00:13:04 +00002017<div class="doc_subsubsection">Restricted getelementptr Types</div>
Reid Spencer4e0352d2004-07-05 08:18:07 +00002018<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +00002019<p>In version 1.2, the getelementptr instruction required a ubyte type
2020index for accessing a structure field and a long type index for
2021accessing an array element. Consequently, it was only possible to
2022access structures of 255 or fewer elements. Starting in version 1.3,
2023this restriction was lifted. Structures must now be indexed with uint
2024constants. Arrays may now be indexed with int, uint, long, or ulong
2025typed values. The consequence of this was that the bytecode format had
2026to change in order to accommodate the larger range of structure indices.</p>
Reid Spencerb14a0a62004-06-08 07:41:41 +00002027</div>
Reid Spencerb14a0a62004-06-08 07:41:41 +00002028<!-- _______________________________________________________________________ -->
Reid Spencere831f0b2004-07-29 00:13:04 +00002029<div class="doc_subsubsection">Short Block Headers</div>
2030<div class="doc_text">
2031<p>In version 1.2, block headers were always 8 bytes being comprised of
2032both an unsigned integer type and an unsigned integer size. For very
2033small modules, these block headers turn out to be a large fraction of
2034the total bytecode file size. In an attempt to make these small files
2035smaller, the type and size information was encoded into a single
2036unsigned integer (4 bytes) comprised of 5 bits for the block type
2037(maximum 31 block types) and 27 bits for the block size (max
2038~134MBytes). These limits seemed sufficient for any blocks or sizes
2039forseen in the future. Note that the module block, which encloses all
2040the other blocks is still written as 8 bytes since bytecode files
2041larger than 134MBytes might be possible.</p>
2042</div>
2043<!-- _______________________________________________________________________ -->
2044<div class="doc_subsubsection">Dependent Libraries and Target Triples</div>
2045<div class="doc_text">
2046<p>In version 1.2, the bytecode format does not store module's target
2047triple or dependent. These fields have been added to the end of the <a
2048 href="#globalinfo">module global info block</a>. The purpose of these
2049fields is to allow a front end compiler to specifiy that the generated
2050module is specific to a particular target triple (operating
2051system/manufacturer/processor) which makes it non-portable; and to
2052allow front end compilers to specify the list of libraries that the
2053module depends on for successful linking.</p>
2054</div>
2055<!-- _______________________________________________________________________ -->
2056<div class="doc_subsubsection">Types Restricted to 24-bits</div>
2057<div class="doc_text">
2058<p>In version 1.2, type slot identifiers were written as 32-bit VBR
2059quantities. In 1.3 this has been reduced to 24-bits in order to ensure
2060that it is not possible to overflow the type field of a global variable
2061definition. 24-bits for type slot numbers is deemed sufficient for any
2062practical use of LLVM.</p>
2063</div>
2064<!-- _______________________________________________________________________ -->
2065<!-- _______________________________________________________________________ -->
2066<div class="doc_subsection"><a name="vers11">Version 1.1 Differences
2067From 1.2 </a></div>
Reid Spencer4e0352d2004-07-05 08:18:07 +00002068<!-- _______________________________________________________________________ -->
2069<div class="doc_subsubsection">Explicit Primitive Zeros</div>
Reid Spencerb14a0a62004-06-08 07:41:41 +00002070<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +00002071<p>In version 1.1, the zero value for primitives was explicitly encoded
2072into the bytecode format. Since these zero values are constant values
2073in the LLVM IR and never change, there is no reason to explicitly
2074encode them. This explicit encoding was removed in version 1.2.</p>
Reid Spencer4e0352d2004-07-05 08:18:07 +00002075</div>
Reid Spencer4e0352d2004-07-05 08:18:07 +00002076<!-- _______________________________________________________________________ -->
2077<div class="doc_subsubsection">Inconsistent Module Global Info</div>
2078<div class="doc_text">
Reid Spencere831f0b2004-07-29 00:13:04 +00002079<p>In version 1.1, the Module Global Info block was not aligned causing
2080the next block to be read in on an unaligned boundary. This problem was
2081corrected in version 1.2.<br>
2082<br>
2083</p>
Reid Spencerb14a0a62004-06-08 07:41:41 +00002084</div>
Reid Spencerb14a0a62004-06-08 07:41:41 +00002085<!-- _______________________________________________________________________ -->
Reid Spencere831f0b2004-07-29 00:13:04 +00002086<div class="doc_subsection"><a name="vers10">Version 1.0 Differences
2087From 1.1</a></div>
Reid Spencerb14a0a62004-06-08 07:41:41 +00002088<div class="doc_text">
Reid Spencer4e0352d2004-07-05 08:18:07 +00002089<p>None. Version 1.0 and 1.1 bytecode formats are identical.</p>
Reid Spencerb14a0a62004-06-08 07:41:41 +00002090</div>
Reid Spencer9acd4122004-05-22 02:28:36 +00002091<!-- *********************************************************************** -->
2092<hr>
Reid Spencere831f0b2004-07-29 00:13:04 +00002093<address> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
2094 src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
2095<a href="http://validator.w3.org/check/referer"><img
2096 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
2097<a href="mailto:rspencer@x10sys.com">Reid Spencer</a> and <a
2098 href="mailto:sabre@nondot.org">Chris Lattner</a><br>
Reid Spencerca058542006-03-14 05:39:39 +00002099<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Reid Spencere831f0b2004-07-29 00:13:04 +00002100Last modified: $Date$
Reid Spencer9acd4122004-05-22 02:28:36 +00002101</address>
Reid Spencere831f0b2004-07-29 00:13:04 +00002102</body>
2103</html>