blob: 3215586f8646cb2e59b90afdf8475ed6fb8c841a [file] [log] [blame]
Misha Brukmandaa4cb02004-03-01 17:47:27 +00001<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
Misha Brukman9d0919f2003-11-08 01:05:38 +00003<html>
4<head>
5 <title>LLVM Assembly Language Reference Manual</title>
6 <link rel="stylesheet" href="llvm.css" type="text/css">
7</head>
8<body>
Chris Lattner261efe92003-11-25 01:02:51 +00009<div class="doc_title"> LLVM Language Reference Manual </div>
Chris Lattner00950542001-06-06 20:29:01 +000010<ol>
Misha Brukman9d0919f2003-11-08 01:05:38 +000011 <li><a href="#abstract">Abstract</a></li>
12 <li><a href="#introduction">Introduction</a></li>
13 <li><a href="#identifiers">Identifiers</a></li>
Chris Lattner00950542001-06-06 20:29:01 +000014 <li><a href="#typesystem">Type System</a>
15 <ol>
Chris Lattner261efe92003-11-25 01:02:51 +000016 <li><a href="#t_primitive">Primitive Types</a>
17 <ol>
Misha Brukman9d0919f2003-11-08 01:05:38 +000018 <li><a href="#t_classifications">Type Classifications</a></li>
Chris Lattner261efe92003-11-25 01:02:51 +000019 </ol>
20 </li>
Chris Lattner00950542001-06-06 20:29:01 +000021 <li><a href="#t_derived">Derived Types</a>
22 <ol>
Chris Lattner261efe92003-11-25 01:02:51 +000023 <li><a href="#t_array">Array Type</a></li>
Misha Brukman9d0919f2003-11-08 01:05:38 +000024 <li><a href="#t_function">Function Type</a></li>
25 <li><a href="#t_pointer">Pointer Type</a></li>
Chris Lattner261efe92003-11-25 01:02:51 +000026 <li><a href="#t_struct">Structure Type</a></li>
27<!-- <li><a href="#t_packed" >Packed Type</a> -->
28 </ol>
29 </li>
30 </ol>
31 </li>
Chris Lattner00950542001-06-06 20:29:01 +000032 <li><a href="#highlevel">High Level Structure</a>
33 <ol>
Misha Brukman9d0919f2003-11-08 01:05:38 +000034 <li><a href="#modulestructure">Module Structure</a></li>
35 <li><a href="#globalvars">Global Variables</a></li>
36 <li><a href="#functionstructure">Function Structure</a></li>
Chris Lattner261efe92003-11-25 01:02:51 +000037 </ol>
38 </li>
Chris Lattner00950542001-06-06 20:29:01 +000039 <li><a href="#instref">Instruction Reference</a>
40 <ol>
41 <li><a href="#terminators">Terminator Instructions</a>
42 <ol>
Chris Lattner261efe92003-11-25 01:02:51 +000043 <li><a href="#i_ret">'<tt>ret</tt>' Instruction</a></li>
44 <li><a href="#i_br">'<tt>br</tt>' Instruction</a></li>
Misha Brukman9d0919f2003-11-08 01:05:38 +000045 <li><a href="#i_switch">'<tt>switch</tt>' Instruction</a></li>
46 <li><a href="#i_invoke">'<tt>invoke</tt>' Instruction</a></li>
Chris Lattner261efe92003-11-25 01:02:51 +000047 <li><a href="#i_unwind">'<tt>unwind</tt>' Instruction</a></li>
48 </ol>
49 </li>
Chris Lattner00950542001-06-06 20:29:01 +000050 <li><a href="#binaryops">Binary Operations</a>
51 <ol>
Chris Lattner261efe92003-11-25 01:02:51 +000052 <li><a href="#i_add">'<tt>add</tt>' Instruction</a></li>
53 <li><a href="#i_sub">'<tt>sub</tt>' Instruction</a></li>
54 <li><a href="#i_mul">'<tt>mul</tt>' Instruction</a></li>
55 <li><a href="#i_div">'<tt>div</tt>' Instruction</a></li>
56 <li><a href="#i_rem">'<tt>rem</tt>' Instruction</a></li>
Misha Brukman9d0919f2003-11-08 01:05:38 +000057 <li><a href="#i_setcc">'<tt>set<i>cc</i></tt>' Instructions</a></li>
Chris Lattner261efe92003-11-25 01:02:51 +000058 </ol>
59 </li>
Chris Lattner00950542001-06-06 20:29:01 +000060 <li><a href="#bitwiseops">Bitwise Binary Operations</a>
61 <ol>
Misha Brukman9d0919f2003-11-08 01:05:38 +000062 <li><a href="#i_and">'<tt>and</tt>' Instruction</a></li>
Chris Lattner261efe92003-11-25 01:02:51 +000063 <li><a href="#i_or">'<tt>or</tt>' Instruction</a></li>
Misha Brukman9d0919f2003-11-08 01:05:38 +000064 <li><a href="#i_xor">'<tt>xor</tt>' Instruction</a></li>
65 <li><a href="#i_shl">'<tt>shl</tt>' Instruction</a></li>
66 <li><a href="#i_shr">'<tt>shr</tt>' Instruction</a></li>
Chris Lattner261efe92003-11-25 01:02:51 +000067 </ol>
68 </li>
Chris Lattner00950542001-06-06 20:29:01 +000069 <li><a href="#memoryops">Memory Access Operations</a>
70 <ol>
Chris Lattner261efe92003-11-25 01:02:51 +000071 <li><a href="#i_malloc">'<tt>malloc</tt>' Instruction</a></li>
72 <li><a href="#i_free">'<tt>free</tt>' Instruction</a></li>
73 <li><a href="#i_alloca">'<tt>alloca</tt>' Instruction</a></li>
74 <li><a href="#i_load">'<tt>load</tt>' Instruction</a></li>
75 <li><a href="#i_store">'<tt>store</tt>' Instruction</a></li>
76 <li><a href="#i_getelementptr">'<tt>getelementptr</tt>' Instruction</a></li>
77 </ol>
78 </li>
Chris Lattner00950542001-06-06 20:29:01 +000079 <li><a href="#otherops">Other Operations</a>
80 <ol>
Chris Lattner261efe92003-11-25 01:02:51 +000081 <li><a href="#i_phi">'<tt>phi</tt>' Instruction</a></li>
Misha Brukman9d0919f2003-11-08 01:05:38 +000082 <li><a href="#i_cast">'<tt>cast .. to</tt>' Instruction</a></li>
Chris Lattner261efe92003-11-25 01:02:51 +000083 <li><a href="#i_call">'<tt>call</tt>' Instruction</a></li>
Misha Brukman9d0919f2003-11-08 01:05:38 +000084 <li><a href="#i_vanext">'<tt>vanext</tt>' Instruction</a></li>
Chris Lattner261efe92003-11-25 01:02:51 +000085 <li><a href="#i_vaarg">'<tt>vaarg</tt>' Instruction</a></li>
Chris Lattner00950542001-06-06 20:29:01 +000086 </ol>
Chris Lattner261efe92003-11-25 01:02:51 +000087 </li>
Chris Lattner00950542001-06-06 20:29:01 +000088 </ol>
Chris Lattner261efe92003-11-25 01:02:51 +000089 </li>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +000090 <li><a href="#intrinsics">Intrinsic Functions</a>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +000091 <ol>
Chris Lattner261efe92003-11-25 01:02:51 +000092 <li><a href="#int_varargs">Variable Argument Handling Intrinsics</a>
93 <ol>
94 <li><a href="#i_va_start">'<tt>llvm.va_start</tt>' Intrinsic</a></li>
95 <li><a href="#i_va_end">'<tt>llvm.va_end</tt>' Intrinsic</a></li>
96 <li><a href="#i_va_copy">'<tt>llvm.va_copy</tt>' Intrinsic</a></li>
97 </ol>
98 </li>
Chris Lattner10610642004-02-14 04:08:35 +000099 <li><a href="#int_codegen">Code Generator Intrinsics</a>
100 <ol>
101 <li><a href="#i_returnaddress">'<tt>llvm.returnaddress</tt>' Intrinsic</a></li>
102 <li><a href="#i_frameaddress">'<tt>llvm.frameaddress</tt>' Intrinsic</a></li>
103 </ol>
104 </li>
Chris Lattner33aec9e2004-02-12 17:01:32 +0000105 <li><a href="#int_libc">Standard C Library Intrinsics</a>
106 <ol>
107 <li><a href="#i_memcpy">'<tt>llvm.memcpy</tt>' Intrinsic</a></li>
Chris Lattner0eb51b42004-02-12 18:10:10 +0000108 <li><a href="#i_memmove">'<tt>llvm.memmove</tt>' Intrinsic</a></li>
Chris Lattner10610642004-02-14 04:08:35 +0000109 <li><a href="#i_memset">'<tt>llvm.memset</tt>' Intrinsic</a></li>
Chris Lattner33aec9e2004-02-12 17:01:32 +0000110 </ol>
111 </li>
Chris Lattner8ff75902004-01-06 05:31:32 +0000112 <li><a href="#int_debugger">Debugger intrinsics</a>
Chris Lattner261efe92003-11-25 01:02:51 +0000113 </ol>
114 </li>
Chris Lattner00950542001-06-06 20:29:01 +0000115</ol>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000116<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +0000117<p><b>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>
118and <a href="mailto:vadve@cs.uiuc.edu">Vikram Adve</a></b></p>
119<p> </p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000120</div>
Chris Lattner00950542001-06-06 20:29:01 +0000121<!-- *********************************************************************** -->
Chris Lattner261efe92003-11-25 01:02:51 +0000122<div class="doc_section"> <a name="abstract">Abstract </a></div>
123<!-- *********************************************************************** -->
Misha Brukman9d0919f2003-11-08 01:05:38 +0000124<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +0000125<p>This document is a reference manual for the LLVM assembly language.
126LLVM is an SSA based representation that provides type safety,
127low-level operations, flexibility, and the capability of representing
128'all' high-level languages cleanly. It is the common code
129representation used throughout all phases of the LLVM compilation
130strategy.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000131</div>
Chris Lattner00950542001-06-06 20:29:01 +0000132<!-- *********************************************************************** -->
Chris Lattner261efe92003-11-25 01:02:51 +0000133<div class="doc_section"> <a name="introduction">Introduction</a> </div>
134<!-- *********************************************************************** -->
Misha Brukman9d0919f2003-11-08 01:05:38 +0000135<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +0000136<p>The LLVM code representation is designed to be used in three
137different forms: as an in-memory compiler IR, as an on-disk bytecode
138representation (suitable for fast loading by a Just-In-Time compiler),
139and as a human readable assembly language representation. This allows
140LLVM to provide a powerful intermediate representation for efficient
141compiler transformations and analysis, while providing a natural means
142to debug and visualize the transformations. The three different forms
143of LLVM are all equivalent. This document describes the human readable
144representation and notation.</p>
145<p>The LLVM representation aims to be a light-weight and low-level
146while being expressive, typed, and extensible at the same time. It
147aims to be a "universal IR" of sorts, by being at a low enough level
148that high-level ideas may be cleanly mapped to it (similar to how
149microprocessors are "universal IR's", allowing many source languages to
150be mapped to them). By providing type information, LLVM can be used as
151the target of optimizations: for example, through pointer analysis, it
152can be proven that a C automatic variable is never accessed outside of
153the current function... allowing it to be promoted to a simple SSA
154value instead of a memory location.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000155</div>
Chris Lattner00950542001-06-06 20:29:01 +0000156<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000157<div class="doc_subsubsection"> <a name="wellformed">Well-Formedness</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000158<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +0000159<p>It is important to note that this document describes 'well formed'
160LLVM assembly language. There is a difference between what the parser
161accepts and what is considered 'well formed'. For example, the
162following instruction is syntactically okay, but not well formed:</p>
163<pre> %x = <a href="#i_add">add</a> int 1, %x<br></pre>
164<p>...because the definition of <tt>%x</tt> does not dominate all of
165its uses. The LLVM infrastructure provides a verification pass that may
166be used to verify that an LLVM module is well formed. This pass is
167automatically run by the parser after parsing input assembly, and by
168the optimizer before it outputs bytecode. The violations pointed out
169by the verifier pass indicate bugs in transformation passes or input to
170the parser.</p>
171<!-- Describe the typesetting conventions here. --> </div>
Chris Lattner00950542001-06-06 20:29:01 +0000172<!-- *********************************************************************** -->
Chris Lattner261efe92003-11-25 01:02:51 +0000173<div class="doc_section"> <a name="identifiers">Identifiers</a> </div>
Chris Lattner00950542001-06-06 20:29:01 +0000174<!-- *********************************************************************** -->
Misha Brukman9d0919f2003-11-08 01:05:38 +0000175<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +0000176<p>LLVM uses three different forms of identifiers, for different
177purposes:</p>
Chris Lattner00950542001-06-06 20:29:01 +0000178<ol>
Chris Lattner261efe92003-11-25 01:02:51 +0000179 <li>Numeric constants are represented as you would expect: 12, -3
180123.421, etc. Floating point constants have an optional hexidecimal
181notation.</li>
182 <li>Named values are represented as a string of characters with a '%'
183prefix. For example, %foo, %DivisionByZero,
184%a.really.long.identifier. The actual regular expression used is '<tt>%[a-zA-Z$._][a-zA-Z$._0-9]*</tt>'.
185Identifiers which require other characters in their names can be
186surrounded with quotes. In this way, anything except a <tt>"</tt>
187character can be used in a name.</li>
188 <li>Unnamed values are represented as an unsigned numeric value with
189a '%' prefix. For example, %12, %2, %44.</li>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000190</ol>
Chris Lattner261efe92003-11-25 01:02:51 +0000191<p>LLVM requires the values start with a '%' sign for two reasons:
192Compilers don't need to worry about name clashes with reserved words,
193and the set of reserved words may be expanded in the future without
194penalty. Additionally, unnamed identifiers allow a compiler to quickly
195come up with a temporary variable without having to avoid symbol table
196conflicts.</p>
197<p>Reserved words in LLVM are very similar to reserved words in other
198languages. There are keywords for different opcodes ('<tt><a
199 href="#i_add">add</a></tt>', '<tt><a href="#i_cast">cast</a></tt>', '<tt><a
200 href="#i_ret">ret</a></tt>', etc...), for primitive type names ('<tt><a
201 href="#t_void">void</a></tt>', '<tt><a href="#t_uint">uint</a></tt>',
202etc...), and others. These reserved words cannot conflict with
203variable names, because none of them start with a '%' character.</p>
204<p>Here is an example of LLVM code to multiply the integer variable '<tt>%X</tt>'
205by 8:</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000206<p>The easy way:</p>
Chris Lattner261efe92003-11-25 01:02:51 +0000207<pre> %result = <a href="#i_mul">mul</a> uint %X, 8<br></pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000208<p>After strength reduction:</p>
Chris Lattner261efe92003-11-25 01:02:51 +0000209<pre> %result = <a href="#i_shl">shl</a> uint %X, ubyte 3<br></pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000210<p>And the hard way:</p>
Chris Lattner261efe92003-11-25 01:02:51 +0000211<pre> <a href="#i_add">add</a> uint %X, %X <i>; yields {uint}:%0</i>
212 <a
213 href="#i_add">add</a> uint %0, %0 <i>; yields {uint}:%1</i>
214 %result = <a
215 href="#i_add">add</a> uint %1, %1<br></pre>
216<p>This last way of multiplying <tt>%X</tt> by 8 illustrates several
217important lexical features of LLVM:</p>
Chris Lattner00950542001-06-06 20:29:01 +0000218<ol>
Chris Lattner261efe92003-11-25 01:02:51 +0000219 <li>Comments are delimited with a '<tt>;</tt>' and go until the end
220of line.</li>
221 <li>Unnamed temporaries are created when the result of a computation
222is not assigned to a named value.</li>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000223 <li>Unnamed temporaries are numbered sequentially</li>
224</ol>
Chris Lattner261efe92003-11-25 01:02:51 +0000225<p>...and it also show a convention that we follow in this document.
226When demonstrating instructions, we will follow an instruction with a
227comment that defines the type and name of value produced. Comments are
228shown in italic text.</p>
229<p>The one non-intuitive notation for constants is the optional
230hexidecimal form of floating point constants. For example, the form '<tt>double
Chris Lattner2b7d3202002-05-06 03:03:22 +00002310x432ff973cafa8000</tt>' is equivalent to (but harder to read than) '<tt>double
Chris Lattner261efe92003-11-25 01:02:51 +00002324.5e+15</tt>' which is also supported by the parser. The only time
233hexadecimal floating point constants are useful (and the only time that
234they are generated by the disassembler) is when an FP constant has to
235be emitted that is not representable as a decimal floating point number
236exactly. For example, NaN's, infinities, and other special cases are
237represented in their IEEE hexadecimal format so that assembly and
238disassembly do not cause any bits to change in the constants.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000239</div>
Chris Lattner00950542001-06-06 20:29:01 +0000240<!-- *********************************************************************** -->
Chris Lattner261efe92003-11-25 01:02:51 +0000241<div class="doc_section"> <a name="typesystem">Type System</a> </div>
242<!-- *********************************************************************** -->
Misha Brukman9d0919f2003-11-08 01:05:38 +0000243<div class="doc_text">
Misha Brukman9d0919f2003-11-08 01:05:38 +0000244<p>The LLVM type system is one of the most important features of the
Chris Lattner261efe92003-11-25 01:02:51 +0000245intermediate representation. Being typed enables a number of
246optimizations to be performed on the IR directly, without having to do
247extra analyses on the side before the transformation. A strong type
248system makes it easier to read the generated code and enables novel
249analyses and transformations that are not feasible to perform on normal
250three address code representations.</p>
Chris Lattner7bae3952002-06-25 18:03:17 +0000251<!-- The written form for the type system was heavily influenced by the
252syntactic problems with types in the C language<sup><a
Chris Lattner261efe92003-11-25 01:02:51 +0000253href="#rw_stroustrup">1</a></sup>.<p> --> </div>
Chris Lattner00950542001-06-06 20:29:01 +0000254<!-- ======================================================================= -->
Chris Lattner261efe92003-11-25 01:02:51 +0000255<div class="doc_subsection"> <a name="t_primitive">Primitive Types</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000256<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +0000257<p>The primitive types are the fundemental building blocks of the LLVM
258system. The current set of primitive types are as follows:</p>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000259
260<table border="0" style="align: center">
Chris Lattner261efe92003-11-25 01:02:51 +0000261 <tbody>
262 <tr>
263 <td>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000264 <table border="1" cellspacing="0" cellpadding="4" style="align: center">
Chris Lattner261efe92003-11-25 01:02:51 +0000265 <tbody>
266 <tr>
267 <td><tt>void</tt></td>
268 <td>No value</td>
269 </tr>
270 <tr>
271 <td><tt>ubyte</tt></td>
272 <td>Unsigned 8 bit value</td>
273 </tr>
274 <tr>
275 <td><tt>ushort</tt></td>
276 <td>Unsigned 16 bit value</td>
277 </tr>
278 <tr>
279 <td><tt>uint</tt></td>
280 <td>Unsigned 32 bit value</td>
281 </tr>
282 <tr>
283 <td><tt>ulong</tt></td>
284 <td>Unsigned 64 bit value</td>
285 </tr>
286 <tr>
287 <td><tt>float</tt></td>
288 <td>32 bit floating point value</td>
289 </tr>
290 <tr>
291 <td><tt>label</tt></td>
292 <td>Branch destination</td>
293 </tr>
294 </tbody>
295 </table>
296 </td>
297 <td valign="top">
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000298 <table border="1" cellspacing="0" cellpadding="4">
Chris Lattner261efe92003-11-25 01:02:51 +0000299 <tbody>
300 <tr>
301 <td><tt>bool</tt></td>
302 <td>True or False value</td>
303 </tr>
304 <tr>
305 <td><tt>sbyte</tt></td>
306 <td>Signed 8 bit value</td>
307 </tr>
308 <tr>
309 <td><tt>short</tt></td>
310 <td>Signed 16 bit value</td>
311 </tr>
312 <tr>
313 <td><tt>int</tt></td>
314 <td>Signed 32 bit value</td>
315 </tr>
316 <tr>
317 <td><tt>long</tt></td>
318 <td>Signed 64 bit value</td>
319 </tr>
320 <tr>
321 <td><tt>double</tt></td>
322 <td>64 bit floating point value</td>
323 </tr>
324 </tbody>
325 </table>
326 </td>
327 </tr>
328 </tbody>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000329</table>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000330
Misha Brukman9d0919f2003-11-08 01:05:38 +0000331</div>
Chris Lattner00950542001-06-06 20:29:01 +0000332<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000333<div class="doc_subsubsection"> <a name="t_classifications">Type
334Classifications</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000335<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +0000336<p>These different primitive types fall into a few useful
337classifications:</p>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000338
339<table border="1" cellspacing="0" cellpadding="4">
Chris Lattner261efe92003-11-25 01:02:51 +0000340 <tbody>
341 <tr>
342 <td><a name="t_signed">signed</a></td>
343 <td><tt>sbyte, short, int, long, float, double</tt></td>
344 </tr>
345 <tr>
346 <td><a name="t_unsigned">unsigned</a></td>
347 <td><tt>ubyte, ushort, uint, ulong</tt></td>
348 </tr>
349 <tr>
350 <td><a name="t_integer">integer</a></td>
351 <td><tt>ubyte, sbyte, ushort, short, uint, int, ulong, long</tt></td>
352 </tr>
353 <tr>
354 <td><a name="t_integral">integral</a></td>
355 <td><tt>bool, ubyte, sbyte, ushort, short, uint, int, ulong, long</tt></td>
356 </tr>
357 <tr>
358 <td><a name="t_floating">floating point</a></td>
359 <td><tt>float, double</tt></td>
360 </tr>
361 <tr>
362 <td><a name="t_firstclass">first class</a></td>
363 <td><tt>bool, ubyte, sbyte, ushort, short,<br>
364uint, int, ulong, long, float, double, <a href="#t_pointer">pointer</a></tt></td>
365 </tr>
366 </tbody>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000367</table>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000368
Chris Lattner261efe92003-11-25 01:02:51 +0000369<p>The <a href="#t_firstclass">first class</a> types are perhaps the
370most important. Values of these types are the only ones which can be
371produced by instructions, passed as arguments, or used as operands to
372instructions. This means that all structures and arrays must be
373manipulated either by pointer or by component.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000374</div>
Chris Lattner00950542001-06-06 20:29:01 +0000375<!-- ======================================================================= -->
Chris Lattner261efe92003-11-25 01:02:51 +0000376<div class="doc_subsection"> <a name="t_derived">Derived Types</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000377<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +0000378<p>The real power in LLVM comes from the derived types in the system.
379This is what allows a programmer to represent arrays, functions,
380pointers, and other useful types. Note that these derived types may be
381recursive: For example, it is possible to have a two dimensional array.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000382</div>
Chris Lattner00950542001-06-06 20:29:01 +0000383<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000384<div class="doc_subsubsection"> <a name="t_array">Array Type</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000385<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +0000386<h5>Overview:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000387<p>The array type is a very simple derived type that arranges elements
Chris Lattner261efe92003-11-25 01:02:51 +0000388sequentially in memory. The array type requires a size (number of
389elements) and an underlying data type.</p>
Chris Lattner7faa8832002-04-14 06:13:44 +0000390<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000391<pre> [&lt;# elements&gt; x &lt;elementtype&gt;]<br></pre>
392<p>The number of elements is a constant integer value, elementtype may
393be any type with a size.</p>
Chris Lattner7faa8832002-04-14 06:13:44 +0000394<h5>Examples:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000395<p> <tt>[40 x int ]</tt>: Array of 40 integer values.<br>
396<tt>[41 x int ]</tt>: Array of 41 integer values.<br>
397<tt>[40 x uint]</tt>: Array of 40 unsigned integer values.</p>
398<p> </p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000399<p>Here are some examples of multidimensional arrays:</p>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000400
Misha Brukman9d0919f2003-11-08 01:05:38 +0000401<table border="0" cellpadding="0" cellspacing="0">
Chris Lattner261efe92003-11-25 01:02:51 +0000402 <tbody>
403 <tr>
404 <td><tt>[3 x [4 x int]]</tt></td>
405 <td>: 3x4 array integer values.</td>
406 </tr>
407 <tr>
408 <td><tt>[12 x [10 x float]]</tt></td>
409 <td>: 12x10 array of single precision floating point values.</td>
410 </tr>
411 <tr>
412 <td><tt>[2 x [3 x [4 x uint]]]</tt></td>
413 <td>: 2x3x4 array of unsigned integer values.</td>
414 </tr>
415 </tbody>
Chris Lattner00950542001-06-06 20:29:01 +0000416</table>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000417
Misha Brukman9d0919f2003-11-08 01:05:38 +0000418</div>
Chris Lattner00950542001-06-06 20:29:01 +0000419<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000420<div class="doc_subsubsection"> <a name="t_function">Function Type</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000421<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +0000422<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000423<p>The function type can be thought of as a function signature. It
424consists of a return type and a list of formal parameter types.
John Criswell009900b2003-11-25 21:45:46 +0000425Function types are usually used to build virtual function tables
Chris Lattner261efe92003-11-25 01:02:51 +0000426(which are structures of pointers to functions), for indirect function
427calls, and when defining a function.</p>
John Criswell009900b2003-11-25 21:45:46 +0000428<p>
429The return type of a function type cannot be an aggregate type.
430</p>
Chris Lattner00950542001-06-06 20:29:01 +0000431<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000432<pre> &lt;returntype&gt; (&lt;parameter list&gt;)<br></pre>
433<p>Where '<tt>&lt;parameter list&gt;</tt>' is a comma-separated list of
434type specifiers. Optionally, the parameter list may include a type <tt>...</tt>,
Chris Lattner27f71f22003-09-03 00:41:47 +0000435which indicates that the function takes a variable number of arguments.
436Variable argument functions can access their arguments with the <a
Chris Lattner261efe92003-11-25 01:02:51 +0000437 href="#int_varargs">variable argument handling intrinsic</a> functions.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000438<h5>Examples:</h5>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000439
Misha Brukman9d0919f2003-11-08 01:05:38 +0000440<table border="0" cellpadding="0" cellspacing="0">
Chris Lattner261efe92003-11-25 01:02:51 +0000441 <tbody>
442 <tr>
443 <td><tt>int (int)</tt></td>
444 <td>: function taking an <tt>int</tt>, returning an <tt>int</tt></td>
445 </tr>
446 <tr>
447 <td><tt>float (int, int *) *</tt></td>
448 <td>: <a href="#t_pointer">Pointer</a> to a function that takes
449an <tt>int</tt> and a <a href="#t_pointer">pointer</a> to <tt>int</tt>,
450returning <tt>float</tt>.</td>
451 </tr>
452 <tr>
453 <td><tt>int (sbyte *, ...)</tt></td>
454 <td>: A vararg function that takes at least one <a
455 href="#t_pointer">pointer</a> to <tt>sbyte</tt> (signed char in C),
456which returns an integer. This is the signature for <tt>printf</tt>
457in LLVM.</td>
458 </tr>
459 </tbody>
Chris Lattner00950542001-06-06 20:29:01 +0000460</table>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000461
Misha Brukman9d0919f2003-11-08 01:05:38 +0000462</div>
Chris Lattner00950542001-06-06 20:29:01 +0000463<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000464<div class="doc_subsubsection"> <a name="t_struct">Structure Type</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000465<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +0000466<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000467<p>The structure type is used to represent a collection of data members
468together in memory. The packing of the field types is defined to match
469the ABI of the underlying processor. The elements of a structure may
470be any type that has a size.</p>
471<p>Structures are accessed using '<tt><a href="#i_load">load</a></tt>
472and '<tt><a href="#i_store">store</a></tt>' by getting a pointer to a
473field with the '<tt><a href="#i_getelementptr">getelementptr</a></tt>'
474instruction.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000475<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000476<pre> { &lt;type list&gt; }<br></pre>
Chris Lattner00950542001-06-06 20:29:01 +0000477<h5>Examples:</h5>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000478
Misha Brukman9d0919f2003-11-08 01:05:38 +0000479<table border="0" cellpadding="0" cellspacing="0">
Chris Lattner261efe92003-11-25 01:02:51 +0000480 <tbody>
481 <tr>
482 <td><tt>{ int, int, int }</tt></td>
483 <td>: a triple of three <tt>int</tt> values</td>
484 </tr>
485 <tr>
486 <td><tt>{ float, int (int) * }</tt></td>
487 <td>: A pair, where the first element is a <tt>float</tt> and the
488second element is a <a href="#t_pointer">pointer</a> to a <a
489 href="t_function">function</a> that takes an <tt>int</tt>, returning
490an <tt>int</tt>.</td>
491 </tr>
492 </tbody>
Chris Lattner00950542001-06-06 20:29:01 +0000493</table>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000494
Misha Brukman9d0919f2003-11-08 01:05:38 +0000495</div>
Chris Lattner00950542001-06-06 20:29:01 +0000496<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000497<div class="doc_subsubsection"> <a name="t_pointer">Pointer Type</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000498<div class="doc_text">
Chris Lattner7faa8832002-04-14 06:13:44 +0000499<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000500<p>As in many languages, the pointer type represents a pointer or
501reference to another object, which must live in memory.</p>
Chris Lattner7faa8832002-04-14 06:13:44 +0000502<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000503<pre> &lt;type&gt; *<br></pre>
Chris Lattner7faa8832002-04-14 06:13:44 +0000504<h5>Examples:</h5>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000505
Misha Brukman9d0919f2003-11-08 01:05:38 +0000506<table border="0" cellpadding="0" cellspacing="0">
Chris Lattner261efe92003-11-25 01:02:51 +0000507 <tbody>
508 <tr>
509 <td><tt>[4x int]*</tt></td>
510 <td>: <a href="#t_pointer">pointer</a> to <a href="#t_array">array</a>
511of four <tt>int</tt> values</td>
512 </tr>
513 <tr>
514 <td><tt>int (int *) *</tt></td>
515 <td>: A <a href="#t_pointer">pointer</a> to a <a
516 href="t_function">function</a> that takes an <tt>int</tt>, returning
517an <tt>int</tt>.</td>
518 </tr>
519 </tbody>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000520</table>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000521
Misha Brukman9d0919f2003-11-08 01:05:38 +0000522</div>
Chris Lattner261efe92003-11-25 01:02:51 +0000523<!-- _______________________________________________________________________ --><!--
Misha Brukman9d0919f2003-11-08 01:05:38 +0000524<div class="doc_subsubsection">
525 <a name="t_packed">Packed Type</a>
526</div>
527
528<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +0000529
530Mention/decide that packed types work with saturation or not. Maybe have a packed+saturated type in addition to just a packed type.<p>
531
532Packed types should be 'nonsaturated' because standard data types are not saturated. Maybe have a saturated packed type?<p>
533
Misha Brukman9d0919f2003-11-08 01:05:38 +0000534</div>
535
Chris Lattner261efe92003-11-25 01:02:51 +0000536--><!-- *********************************************************************** -->
537<div class="doc_section"> <a name="highlevel">High Level Structure</a> </div>
538<!-- *********************************************************************** --><!-- ======================================================================= -->
539<div class="doc_subsection"> <a name="modulestructure">Module Structure</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000540<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +0000541<p>LLVM programs are composed of "Module"s, each of which is a
542translation unit of the input programs. Each module consists of
543functions, global variables, and symbol table entries. Modules may be
544combined together with the LLVM linker, which merges function (and
545global variable) definitions, resolves forward declarations, and merges
546symbol table entries. Here is an example of the "hello world" module:</p>
547<pre><i>; Declare the string constant as a global constant...</i>
548<a href="#identifiers">%.LC0</a> = <a href="#linkage_internal">internal</a> <a
549 href="#globalvars">constant</a> <a href="#t_array">[13 x sbyte]</a> c"hello world\0A\00" <i>; [13 x sbyte]*</i>
Chris Lattner2b7d3202002-05-06 03:03:22 +0000550
Chris Lattner27f71f22003-09-03 00:41:47 +0000551<i>; External declaration of the puts function</i>
552<a href="#functionstructure">declare</a> int %puts(sbyte*) <i>; int(sbyte*)* </i>
Chris Lattner2b7d3202002-05-06 03:03:22 +0000553
554<i>; Definition of main function</i>
Chris Lattner27f71f22003-09-03 00:41:47 +0000555int %main() { <i>; int()* </i>
Chris Lattner2b7d3202002-05-06 03:03:22 +0000556 <i>; Convert [13x sbyte]* to sbyte *...</i>
Chris Lattner261efe92003-11-25 01:02:51 +0000557 %cast210 = <a
558 href="#i_getelementptr">getelementptr</a> [13 x sbyte]* %.LC0, long 0, long 0 <i>; sbyte*</i>
Chris Lattner2b7d3202002-05-06 03:03:22 +0000559
560 <i>; Call puts function to write out the string to stdout...</i>
Chris Lattner261efe92003-11-25 01:02:51 +0000561 <a
562 href="#i_call">call</a> int %puts(sbyte* %cast210) <i>; int</i>
563 <a
564 href="#i_ret">ret</a> int 0<br>}<br></pre>
565<p>This example is made up of a <a href="#globalvars">global variable</a>
566named "<tt>.LC0</tt>", an external declaration of the "<tt>puts</tt>"
567function, and a <a href="#functionstructure">function definition</a>
568for "<tt>main</tt>".</p>
569<a name="linkage"> In general, a module is made up of a list of global
570values, where both functions and global variables are global values.
571Global values are represented by a pointer to a memory location (in
572this case, a pointer to an array of char, and a pointer to a function),
573and have one of the following linkage types:</a>
574<p> </p>
Chris Lattner27f71f22003-09-03 00:41:47 +0000575<dl>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000576 <dt><tt><b><a name="linkage_internal">internal</a></b></tt> </dt>
Chris Lattner261efe92003-11-25 01:02:51 +0000577 <dd>Global values with internal linkage are only directly accessible
578by objects in the current module. In particular, linking code into a
579module with an internal global value may cause the internal to be
580renamed as necessary to avoid collisions. Because the symbol is
581internal to the module, all references can be updated. This
582corresponds to the notion of the '<tt>static</tt>' keyword in C, or the
583idea of "anonymous namespaces" in C++.
584 <p> </p>
585 </dd>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000586 <dt><tt><b><a name="linkage_linkonce">linkonce</a></b></tt>: </dt>
Chris Lattner261efe92003-11-25 01:02:51 +0000587 <dd>"<tt>linkonce</tt>" linkage is similar to <tt>internal</tt>
588linkage, with the twist that linking together two modules defining the
589same <tt>linkonce</tt> globals will cause one of the globals to be
590discarded. This is typically used to implement inline functions.
591Unreferenced <tt>linkonce</tt> globals are allowed to be discarded.
592 <p> </p>
593 </dd>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000594 <dt><tt><b><a name="linkage_weak">weak</a></b></tt>: </dt>
Chris Lattner261efe92003-11-25 01:02:51 +0000595 <dd>"<tt>weak</tt>" linkage is exactly the same as <tt>linkonce</tt>
596linkage, except that unreferenced <tt>weak</tt> globals may not be
597discarded. This is used to implement constructs in C such as "<tt>int
598X;</tt>" at global scope.
599 <p> </p>
600 </dd>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000601 <dt><tt><b><a name="linkage_appending">appending</a></b></tt>: </dt>
Chris Lattner261efe92003-11-25 01:02:51 +0000602 <dd>"<tt>appending</tt>" linkage may only be applied to global
603variables of pointer to array type. When two global variables with
604appending linkage are linked together, the two global arrays are
605appended together. This is the LLVM, typesafe, equivalent of having
606the system linker append together "sections" with identical names when
607.o files are linked.
608 <p> </p>
609 </dd>
Misha Brukmandaa4cb02004-03-01 17:47:27 +0000610 <dt><tt><b><a name="linkage_external">externally visible</a></b></tt>:</dt>
Chris Lattner261efe92003-11-25 01:02:51 +0000611 <dd>If none of the above identifiers are used, the global is
612externally visible, meaning that it participates in linkage and can be
613used to resolve external symbol references.
614 <p> </p>
615 </dd>
Chris Lattner261efe92003-11-25 01:02:51 +0000616</dl>
617<p> </p>
618<p><a name="linkage_external">For example, since the "<tt>.LC0</tt>"
619variable is defined to be internal, if another module defined a "<tt>.LC0</tt>"
620variable and was linked with this one, one of the two would be renamed,
621preventing a collision. Since "<tt>main</tt>" and "<tt>puts</tt>" are
622external (i.e., lacking any linkage declarations), they are accessible
623outside of the current module. It is illegal for a function <i>declaration</i>
624to have any linkage type other than "externally visible".</a></p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000625</div>
Chris Lattner9ee5d222004-03-08 16:49:10 +0000626
Chris Lattner00950542001-06-06 20:29:01 +0000627<!-- ======================================================================= -->
Chris Lattner9ee5d222004-03-08 16:49:10 +0000628<div class="doc_subsection">
629 <a name="globalvars">Global Variables</a>
630</div>
631
Misha Brukman9d0919f2003-11-08 01:05:38 +0000632<div class="doc_text">
Chris Lattner9ee5d222004-03-08 16:49:10 +0000633
Chris Lattner261efe92003-11-25 01:02:51 +0000634<p>Global variables define regions of memory allocated at compilation
635time instead of run-time. Global variables may optionally be
636initialized. A variable may be defined as a global "constant", which
637indicates that the contents of the variable will never be modified
Chris Lattner9ee5d222004-03-08 16:49:10 +0000638(opening options for optimization).</p>
639
Chris Lattner261efe92003-11-25 01:02:51 +0000640<p>As SSA values, global variables define pointer values that are in
641scope (i.e. they dominate) for all basic blocks in the program. Global
642variables always define a pointer to their "content" type because they
643describe a region of memory, and all memory objects in LLVM are
644accessed through pointers.</p>
Chris Lattner9ee5d222004-03-08 16:49:10 +0000645
Misha Brukman9d0919f2003-11-08 01:05:38 +0000646</div>
Chris Lattner9ee5d222004-03-08 16:49:10 +0000647
648
Chris Lattner2b7d3202002-05-06 03:03:22 +0000649<!-- ======================================================================= -->
Chris Lattner9ee5d222004-03-08 16:49:10 +0000650<div class="doc_subsection">
651 <a name="functionstructure">Functions</a>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000652</div>
Chris Lattner9ee5d222004-03-08 16:49:10 +0000653
654<div class="doc_text">
655
656<p>LLVM function definitions are composed of a (possibly empty) argument list,
657an opening curly brace, a list of basic blocks, and a closing curly brace. LLVM
658function declarations are defined with the "<tt>declare</tt>" keyword, a
659function name, and a function signature.</p>
660
661<p>A function definition contains a list of basic blocks, forming the CFG for
662the function. Each basic block may optionally start with a label (giving the
663basic block a symbol table entry), contains a list of instructions, and ends
664with a <a href="#terminators">terminator</a> instruction (such as a branch or
665function return).</p>
666
667<p>The first basic block in program is special in two ways: it is immediately
668executed on entrance to the function, and it is not allowed to have predecessor
669basic blocks (i.e. there can not be any branches to the entry block of a
670function). Because the block can have no predecessors, it also cannot have any
671<a href="#i_phi">PHI nodes</a>.</p>
672
673<p>LLVM functions are identified by their name and type signature. Hence, two
674functions with the same name but different parameter lists or return values are
675considered different functions, and LLVM will resolves references to each
676appropriately.</p>
677
678</div>
679
680
Chris Lattner00950542001-06-06 20:29:01 +0000681<!-- *********************************************************************** -->
Chris Lattner261efe92003-11-25 01:02:51 +0000682<div class="doc_section"> <a name="instref">Instruction Reference</a> </div>
683<!-- *********************************************************************** -->
Misha Brukman9d0919f2003-11-08 01:05:38 +0000684<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +0000685<p>The LLVM instruction set consists of several different
686classifications of instructions: <a href="#terminators">terminator
687instructions</a>, <a href="#binaryops">binary instructions</a>, <a
688 href="#memoryops">memory instructions</a>, and <a href="#otherops">other
689instructions</a>.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000690</div>
Chris Lattner00950542001-06-06 20:29:01 +0000691<!-- ======================================================================= -->
Chris Lattner261efe92003-11-25 01:02:51 +0000692<div class="doc_subsection"> <a name="terminators">Terminator
693Instructions</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000694<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +0000695<p>As mentioned <a href="#functionstructure">previously</a>, every
696basic block in a program ends with a "Terminator" instruction, which
697indicates which block should be executed after the current block is
698finished. These terminator instructions typically yield a '<tt>void</tt>'
699value: they produce control flow, not values (the one exception being
700the '<a href="#i_invoke"><tt>invoke</tt></a>' instruction).</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000701<p>There are five different terminator instructions: the '<a
Chris Lattner261efe92003-11-25 01:02:51 +0000702 href="#i_ret"><tt>ret</tt></a>' instruction, the '<a href="#i_br"><tt>br</tt></a>'
703instruction, the '<a href="#i_switch"><tt>switch</tt></a>' instruction,
704the '<a href="#i_invoke"><tt>invoke</tt></a>' instruction, and the '<a
705 href="#i_unwind"><tt>unwind</tt></a>' instruction.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000706</div>
Chris Lattner00950542001-06-06 20:29:01 +0000707<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000708<div class="doc_subsubsection"> <a name="i_ret">'<tt>ret</tt>'
709Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000710<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +0000711<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000712<pre> ret &lt;type&gt; &lt;value&gt; <i>; Return a value from a non-void function</i>
Chris Lattner7faa8832002-04-14 06:13:44 +0000713 ret void <i>; Return from void function</i>
Chris Lattner00950542001-06-06 20:29:01 +0000714</pre>
Chris Lattner00950542001-06-06 20:29:01 +0000715<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000716<p>The '<tt>ret</tt>' instruction is used to return control flow (and a
717value) from a function, back to the caller.</p>
718<p>There are two forms of the '<tt>ret</tt>' instructruction: one that
719returns a value and then causes control flow, and one that just causes
720control flow to occur.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000721<h5>Arguments:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000722<p>The '<tt>ret</tt>' instruction may return any '<a
723 href="#t_firstclass">first class</a>' type. Notice that a function is
724not <a href="#wellformed">well formed</a> if there exists a '<tt>ret</tt>'
725instruction inside of the function that returns a value that does not
726match the return type of the function.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000727<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000728<p>When the '<tt>ret</tt>' instruction is executed, control flow
729returns back to the calling function's context. If the caller is a "<a
730 href="#i_call"><tt>call</tt></a> instruction, execution continues at
731the instruction after the call. If the caller was an "<a
732 href="#i_invoke"><tt>invoke</tt></a>" instruction, execution continues
733at the beginning "normal" of the destination block. If the instruction
734returns a value, that value shall set the call or invoke instruction's
735return value.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000736<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000737<pre> ret int 5 <i>; Return an integer value of 5</i>
Chris Lattner7faa8832002-04-14 06:13:44 +0000738 ret void <i>; Return from a void function</i>
Chris Lattner00950542001-06-06 20:29:01 +0000739</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000740</div>
Chris Lattner00950542001-06-06 20:29:01 +0000741<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000742<div class="doc_subsubsection"> <a name="i_br">'<tt>br</tt>' Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000743<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +0000744<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000745<pre> br bool &lt;cond&gt;, label &lt;iftrue&gt;, label &lt;iffalse&gt;<br> br label &lt;dest&gt; <i>; Unconditional branch</i>
Chris Lattner00950542001-06-06 20:29:01 +0000746</pre>
Chris Lattner00950542001-06-06 20:29:01 +0000747<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000748<p>The '<tt>br</tt>' instruction is used to cause control flow to
749transfer to a different basic block in the current function. There are
750two forms of this instruction, corresponding to a conditional branch
751and an unconditional branch.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000752<h5>Arguments:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000753<p>The conditional branch form of the '<tt>br</tt>' instruction takes a
754single '<tt>bool</tt>' value and two '<tt>label</tt>' values. The
755unconditional form of the '<tt>br</tt>' instruction takes a single '<tt>label</tt>'
756value as a target.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000757<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000758<p>Upon execution of a conditional '<tt>br</tt>' instruction, the '<tt>bool</tt>'
759argument is evaluated. If the value is <tt>true</tt>, control flows
760to the '<tt>iftrue</tt>' <tt>label</tt> argument. If "cond" is <tt>false</tt>,
761control flows to the '<tt>iffalse</tt>' <tt>label</tt> argument.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000762<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000763<pre>Test:<br> %cond = <a href="#i_setcc">seteq</a> int %a, %b<br> br bool %cond, label %IfEqual, label %IfUnequal<br>IfEqual:<br> <a
764 href="#i_ret">ret</a> int 1<br>IfUnequal:<br> <a href="#i_ret">ret</a> int 0<br></pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000765</div>
Chris Lattner00950542001-06-06 20:29:01 +0000766<!-- _______________________________________________________________________ -->
Chris Lattnerc88c17b2004-02-24 04:54:45 +0000767<div class="doc_subsubsection">
768 <a name="i_switch">'<tt>switch</tt>' Instruction</a>
769</div>
770
Misha Brukman9d0919f2003-11-08 01:05:38 +0000771<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +0000772<h5>Syntax:</h5>
Chris Lattnerc88c17b2004-02-24 04:54:45 +0000773
774<pre>
775 switch &lt;intty&gt; &lt;value&gt;, label &lt;defaultdest&gt; [ &lt;intty&gt; &lt;val&gt;, label &lt;dest&gt; ... ]
776</pre>
777
Chris Lattner00950542001-06-06 20:29:01 +0000778<h5>Overview:</h5>
Chris Lattnerc88c17b2004-02-24 04:54:45 +0000779
780<p>The '<tt>switch</tt>' instruction is used to transfer control flow to one of
781several different places. It is a generalization of the '<tt>br</tt>'
Misha Brukman9d0919f2003-11-08 01:05:38 +0000782instruction, allowing a branch to occur to one of many possible
783destinations.</p>
Chris Lattnerc88c17b2004-02-24 04:54:45 +0000784
785
Chris Lattner00950542001-06-06 20:29:01 +0000786<h5>Arguments:</h5>
Chris Lattnerc88c17b2004-02-24 04:54:45 +0000787
788<p>The '<tt>switch</tt>' instruction uses three parameters: an integer
789comparison value '<tt>value</tt>', a default '<tt>label</tt>' destination, and
790an array of pairs of comparison value constants and '<tt>label</tt>'s. The
791table is not allowed to contain duplicate constant entries.</p>
792
Chris Lattner00950542001-06-06 20:29:01 +0000793<h5>Semantics:</h5>
Chris Lattnerc88c17b2004-02-24 04:54:45 +0000794
Chris Lattner261efe92003-11-25 01:02:51 +0000795<p>The <tt>switch</tt> instruction specifies a table of values and
796destinations. When the '<tt>switch</tt>' instruction is executed, this
797table is searched for the given value. If the value is found, the
798corresponding destination is branched to, otherwise the default value
799it transfered to.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000800
Chris Lattnerc88c17b2004-02-24 04:54:45 +0000801<h5>Implementation:</h5>
802
803<p>Depending on properties of the target machine and the particular
804<tt>switch</tt> instruction, this instruction may be code generated in different
805ways, for example as a series of chained conditional branches, or with a lookup
806table.</p>
807
808<h5>Example:</h5>
809
810<pre>
811 <i>; Emulate a conditional br instruction</i>
812 %Val = <a href="#i_cast">cast</a> bool %value to int
813 switch int %Val, label %truedest [int 0, label %falsedest ]
814
815 <i>; Emulate an unconditional br instruction</i>
816 switch uint 0, label %dest [ ]
817
818 <i>; Implement a jump table:</i>
819 switch uint %val, label %otherwise [ uint 0, label %onzero
820 uint 1, label %onone
821 uint 2, label %ontwo ]
Chris Lattner00950542001-06-06 20:29:01 +0000822</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000823</div>
Chris Lattner00950542001-06-06 20:29:01 +0000824<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000825<div class="doc_subsubsection"> <a name="i_invoke">'<tt>invoke</tt>'
826Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000827<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +0000828<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000829<pre> &lt;result&gt; = invoke &lt;ptr to function ty&gt; %&lt;function ptr val&gt;(&lt;function args&gt;)<br> to label &lt;normal label&gt; except label &lt;exception label&gt;<br></pre>
Chris Lattner6536cfe2002-05-06 22:08:29 +0000830<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000831<p>The '<tt>invoke</tt>' instruction causes control to transfer to a
832specified function, with the possibility of control flow transfer to
833either the '<tt>normal</tt>' <tt>label</tt> label or the '<tt>exception</tt>'<tt>label</tt>.
834If the callee function returns with the "<tt><a href="#i_ret">ret</a></tt>"
835instruction, control flow will return to the "normal" label. If the
836callee (or any indirect callees) returns with the "<a href="#i_unwind"><tt>unwind</tt></a>"
837instruction, control is interrupted, and continued at the dynamically
838nearest "except" label.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000839<h5>Arguments:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000840<p>This instruction requires several arguments:</p>
Chris Lattner00950542001-06-06 20:29:01 +0000841<ol>
Chris Lattner261efe92003-11-25 01:02:51 +0000842 <li>'<tt>ptr to function ty</tt>': shall be the signature of the
843pointer to function value being invoked. In most cases, this is a
844direct function invocation, but indirect <tt>invoke</tt>s are just as
845possible, branching off an arbitrary pointer to function value. </li>
846 <li>'<tt>function ptr val</tt>': An LLVM value containing a pointer
847to a function to be invoked. </li>
848 <li>'<tt>function args</tt>': argument list whose types match the
849function signature argument types. If the function signature indicates
850the function accepts a variable number of arguments, the extra
851arguments can be specified. </li>
852 <li>'<tt>normal label</tt>': the label reached when the called
853function executes a '<tt><a href="#i_ret">ret</a></tt>' instruction. </li>
854 <li>'<tt>exception label</tt>': the label reached when a callee
855returns with the <a href="#i_unwind"><tt>unwind</tt></a> instruction. </li>
Chris Lattner00950542001-06-06 20:29:01 +0000856</ol>
Chris Lattner00950542001-06-06 20:29:01 +0000857<h5>Semantics:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000858<p>This instruction is designed to operate as a standard '<tt><a
Chris Lattner261efe92003-11-25 01:02:51 +0000859 href="#i_call">call</a></tt>' instruction in most regards. The
860primary difference is that it establishes an association with a label,
861which is used by the runtime library to unwind the stack.</p>
862<p>This instruction is used in languages with destructors to ensure
863that proper cleanup is performed in the case of either a <tt>longjmp</tt>
864or a thrown exception. Additionally, this is important for
865implementation of '<tt>catch</tt>' clauses in high-level languages that
866support them.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000867<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000868<pre> %retval = invoke int %Test(int 15)<br> to label %Continue<br> except label %TestCleanup <i>; {int}:retval set</i>
Chris Lattner00950542001-06-06 20:29:01 +0000869</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000870</div>
Chris Lattner27f71f22003-09-03 00:41:47 +0000871<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000872<div class="doc_subsubsection"> <a name="i_unwind">'<tt>unwind</tt>'
873Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000874<div class="doc_text">
Chris Lattner27f71f22003-09-03 00:41:47 +0000875<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000876<pre> unwind<br></pre>
Chris Lattner27f71f22003-09-03 00:41:47 +0000877<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000878<p>The '<tt>unwind</tt>' instruction unwinds the stack, continuing
879control flow at the first callee in the dynamic call stack which used
880an <a href="#i_invoke"><tt>invoke</tt></a> instruction to perform the
881call. This is primarily used to implement exception handling.</p>
Chris Lattner27f71f22003-09-03 00:41:47 +0000882<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000883<p>The '<tt>unwind</tt>' intrinsic causes execution of the current
884function to immediately halt. The dynamic call stack is then searched
885for the first <a href="#i_invoke"><tt>invoke</tt></a> instruction on
886the call stack. Once found, execution continues at the "exceptional"
887destination block specified by the <tt>invoke</tt> instruction. If
888there is no <tt>invoke</tt> instruction in the dynamic call chain,
889undefined behavior results.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000890</div>
Chris Lattner00950542001-06-06 20:29:01 +0000891<!-- ======================================================================= -->
Chris Lattner261efe92003-11-25 01:02:51 +0000892<div class="doc_subsection"> <a name="binaryops">Binary Operations</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000893<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +0000894<p>Binary operators are used to do most of the computation in a
895program. They require two operands, execute an operation on them, and
896produce a single value. The result value of a binary operator is not
897necessarily the same type as its operands.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000898<p>There are several different binary operators:</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000899</div>
Chris Lattner00950542001-06-06 20:29:01 +0000900<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000901<div class="doc_subsubsection"> <a name="i_add">'<tt>add</tt>'
902Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000903<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +0000904<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000905<pre> &lt;result&gt; = add &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {ty}:result</i>
Chris Lattner00950542001-06-06 20:29:01 +0000906</pre>
Chris Lattner00950542001-06-06 20:29:01 +0000907<h5>Overview:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000908<p>The '<tt>add</tt>' instruction returns the sum of its two operands.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000909<h5>Arguments:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000910<p>The two arguments to the '<tt>add</tt>' instruction must be either <a
Chris Lattner261efe92003-11-25 01:02:51 +0000911 href="#t_integer">integer</a> or <a href="#t_floating">floating point</a>
912values. Both arguments must have identical types.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000913<h5>Semantics:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000914<p>The value produced is the integer or floating point sum of the two
915operands.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000916<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000917<pre> &lt;result&gt; = add int 4, %var <i>; yields {int}:result = 4 + %var</i>
Chris Lattner00950542001-06-06 20:29:01 +0000918</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000919</div>
Chris Lattner00950542001-06-06 20:29:01 +0000920<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000921<div class="doc_subsubsection"> <a name="i_sub">'<tt>sub</tt>'
922Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000923<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +0000924<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000925<pre> &lt;result&gt; = sub &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {ty}:result</i>
Chris Lattner00950542001-06-06 20:29:01 +0000926</pre>
Chris Lattner00950542001-06-06 20:29:01 +0000927<h5>Overview:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000928<p>The '<tt>sub</tt>' instruction returns the difference of its two
929operands.</p>
Chris Lattner261efe92003-11-25 01:02:51 +0000930<p>Note that the '<tt>sub</tt>' instruction is used to represent the '<tt>neg</tt>'
931instruction present in most other intermediate representations.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000932<h5>Arguments:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000933<p>The two arguments to the '<tt>sub</tt>' instruction must be either <a
Chris Lattner261efe92003-11-25 01:02:51 +0000934 href="#t_integer">integer</a> or <a href="#t_floating">floating point</a>
935values. Both arguments must have identical types.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000936<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000937<p>The value produced is the integer or floating point difference of
938the two operands.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000939<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000940<pre> &lt;result&gt; = sub int 4, %var <i>; yields {int}:result = 4 - %var</i>
Chris Lattner00950542001-06-06 20:29:01 +0000941 &lt;result&gt; = sub int 0, %val <i>; yields {int}:result = -%var</i>
942</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000943</div>
Chris Lattner00950542001-06-06 20:29:01 +0000944<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000945<div class="doc_subsubsection"> <a name="i_mul">'<tt>mul</tt>'
946Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000947<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +0000948<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000949<pre> &lt;result&gt; = mul &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {ty}:result</i>
Chris Lattner00950542001-06-06 20:29:01 +0000950</pre>
Chris Lattner00950542001-06-06 20:29:01 +0000951<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000952<p>The '<tt>mul</tt>' instruction returns the product of its two
953operands.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000954<h5>Arguments:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000955<p>The two arguments to the '<tt>mul</tt>' instruction must be either <a
Chris Lattner261efe92003-11-25 01:02:51 +0000956 href="#t_integer">integer</a> or <a href="#t_floating">floating point</a>
957values. Both arguments must have identical types.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000958<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000959<p>The value produced is the integer or floating point product of the
Misha Brukman9d0919f2003-11-08 01:05:38 +0000960two operands.</p>
Chris Lattner261efe92003-11-25 01:02:51 +0000961<p>There is no signed vs unsigned multiplication. The appropriate
962action is taken based on the type of the operand.</p>
Chris Lattner00950542001-06-06 20:29:01 +0000963<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000964<pre> &lt;result&gt; = mul int 4, %var <i>; yields {int}:result = 4 * %var</i>
Chris Lattner00950542001-06-06 20:29:01 +0000965</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000966</div>
Chris Lattner00950542001-06-06 20:29:01 +0000967<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +0000968<div class="doc_subsubsection"> <a name="i_div">'<tt>div</tt>'
969Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +0000970<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +0000971<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +0000972<pre> &lt;result&gt; = div &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {ty}:result</i>
973</pre>
974<h5>Overview:</h5>
975<p>The '<tt>div</tt>' instruction returns the quotient of its two
976operands.</p>
977<h5>Arguments:</h5>
978<p>The two arguments to the '<tt>div</tt>' instruction must be either <a
979 href="#t_integer">integer</a> or <a href="#t_floating">floating point</a>
980values. Both arguments must have identical types.</p>
981<h5>Semantics:</h5>
982<p>The value produced is the integer or floating point quotient of the
983two operands.</p>
984<h5>Example:</h5>
985<pre> &lt;result&gt; = div int 4, %var <i>; yields {int}:result = 4 / %var</i>
986</pre>
987</div>
988<!-- _______________________________________________________________________ -->
989<div class="doc_subsubsection"> <a name="i_rem">'<tt>rem</tt>'
990Instruction</a> </div>
991<div class="doc_text">
992<h5>Syntax:</h5>
993<pre> &lt;result&gt; = rem &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {ty}:result</i>
994</pre>
995<h5>Overview:</h5>
996<p>The '<tt>rem</tt>' instruction returns the remainder from the
997division of its two operands.</p>
998<h5>Arguments:</h5>
999<p>The two arguments to the '<tt>rem</tt>' instruction must be either <a
1000 href="#t_integer">integer</a> or <a href="#t_floating">floating point</a>
1001values. Both arguments must have identical types.</p>
1002<h5>Semantics:</h5>
1003<p>This returns the <i>remainder</i> of a division (where the result
1004has the same sign as the divisor), not the <i>modulus</i> (where the
1005result has the same sign as the dividend) of a value. For more
1006information about the difference, see: <a
1007 href="http://mathforum.org/dr.math/problems/anne.4.28.99.html">The
1008Math Forum</a>.</p>
1009<h5>Example:</h5>
1010<pre> &lt;result&gt; = rem int 4, %var <i>; yields {int}:result = 4 % %var</i>
1011</pre>
1012</div>
1013<!-- _______________________________________________________________________ -->
1014<div class="doc_subsubsection"> <a name="i_setcc">'<tt>set<i>cc</i></tt>'
1015Instructions</a> </div>
1016<div class="doc_text">
1017<h5>Syntax:</h5>
1018<pre> &lt;result&gt; = seteq &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {bool}:result</i>
Chris Lattner00950542001-06-06 20:29:01 +00001019 &lt;result&gt; = setne &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {bool}:result</i>
1020 &lt;result&gt; = setlt &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {bool}:result</i>
1021 &lt;result&gt; = setgt &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {bool}:result</i>
1022 &lt;result&gt; = setle &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {bool}:result</i>
1023 &lt;result&gt; = setge &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {bool}:result</i>
1024</pre>
Chris Lattner261efe92003-11-25 01:02:51 +00001025<h5>Overview:</h5>
1026<p>The '<tt>set<i>cc</i></tt>' family of instructions returns a boolean
1027value based on a comparison of their two operands.</p>
1028<h5>Arguments:</h5>
1029<p>The two arguments to the '<tt>set<i>cc</i></tt>' instructions must
1030be of <a href="#t_firstclass">first class</a> type (it is not possible
1031to compare '<tt>label</tt>'s, '<tt>array</tt>'s, '<tt>structure</tt>'
1032or '<tt>void</tt>' values, etc...). Both arguments must have identical
1033types.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001034<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001035<p>The '<tt>seteq</tt>' instruction yields a <tt>true</tt> '<tt>bool</tt>'
1036value if both operands are equal.<br>
1037The '<tt>setne</tt>' instruction yields a <tt>true</tt> '<tt>bool</tt>'
1038value if both operands are unequal.<br>
1039The '<tt>setlt</tt>' instruction yields a <tt>true</tt> '<tt>bool</tt>'
1040value if the first operand is less than the second operand.<br>
1041The '<tt>setgt</tt>' instruction yields a <tt>true</tt> '<tt>bool</tt>'
1042value if the first operand is greater than the second operand.<br>
1043The '<tt>setle</tt>' instruction yields a <tt>true</tt> '<tt>bool</tt>'
1044value if the first operand is less than or equal to the second operand.<br>
1045The '<tt>setge</tt>' instruction yields a <tt>true</tt> '<tt>bool</tt>'
1046value if the first operand is greater than or equal to the second
1047operand.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001048<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001049<pre> &lt;result&gt; = seteq int 4, 5 <i>; yields {bool}:result = false</i>
Chris Lattner00950542001-06-06 20:29:01 +00001050 &lt;result&gt; = setne float 4, 5 <i>; yields {bool}:result = true</i>
1051 &lt;result&gt; = setlt uint 4, 5 <i>; yields {bool}:result = true</i>
1052 &lt;result&gt; = setgt sbyte 4, 5 <i>; yields {bool}:result = false</i>
1053 &lt;result&gt; = setle sbyte 4, 5 <i>; yields {bool}:result = true</i>
1054 &lt;result&gt; = setge sbyte 4, 5 <i>; yields {bool}:result = false</i>
1055</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001056</div>
Chris Lattner00950542001-06-06 20:29:01 +00001057<!-- ======================================================================= -->
Chris Lattner261efe92003-11-25 01:02:51 +00001058<div class="doc_subsection"> <a name="bitwiseops">Bitwise Binary
1059Operations</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001060<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +00001061<p>Bitwise binary operators are used to do various forms of
1062bit-twiddling in a program. They are generally very efficient
1063instructions, and can commonly be strength reduced from other
1064instructions. They require two operands, execute an operation on them,
1065and produce a single value. The resulting value of the bitwise binary
1066operators is always the same type as its first operand.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001067</div>
Chris Lattner00950542001-06-06 20:29:01 +00001068<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001069<div class="doc_subsubsection"> <a name="i_and">'<tt>and</tt>'
1070Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001071<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +00001072<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001073<pre> &lt;result&gt; = and &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {ty}:result</i>
Chris Lattner00950542001-06-06 20:29:01 +00001074</pre>
Chris Lattner00950542001-06-06 20:29:01 +00001075<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001076<p>The '<tt>and</tt>' instruction returns the bitwise logical and of
1077its two operands.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001078<h5>Arguments:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001079<p>The two arguments to the '<tt>and</tt>' instruction must be <a
Chris Lattner261efe92003-11-25 01:02:51 +00001080 href="#t_integral">integral</a> values. Both arguments must have
1081identical types.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001082<h5>Semantics:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001083<p>The truth table used for the '<tt>and</tt>' instruction is:</p>
Chris Lattner261efe92003-11-25 01:02:51 +00001084<p> </p>
Misha Brukmandaa4cb02004-03-01 17:47:27 +00001085<div style="align: center">
Misha Brukman9d0919f2003-11-08 01:05:38 +00001086<table border="1" cellspacing="0" cellpadding="4">
Chris Lattner261efe92003-11-25 01:02:51 +00001087 <tbody>
1088 <tr>
1089 <td>In0</td>
1090 <td>In1</td>
1091 <td>Out</td>
1092 </tr>
1093 <tr>
1094 <td>0</td>
1095 <td>0</td>
1096 <td>0</td>
1097 </tr>
1098 <tr>
1099 <td>0</td>
1100 <td>1</td>
1101 <td>0</td>
1102 </tr>
1103 <tr>
1104 <td>1</td>
1105 <td>0</td>
1106 <td>0</td>
1107 </tr>
1108 <tr>
1109 <td>1</td>
1110 <td>1</td>
1111 <td>1</td>
1112 </tr>
1113 </tbody>
1114</table>
Misha Brukmandaa4cb02004-03-01 17:47:27 +00001115</div>
Chris Lattner00950542001-06-06 20:29:01 +00001116<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001117<pre> &lt;result&gt; = and int 4, %var <i>; yields {int}:result = 4 &amp; %var</i>
Chris Lattner00950542001-06-06 20:29:01 +00001118 &lt;result&gt; = and int 15, 40 <i>; yields {int}:result = 8</i>
1119 &lt;result&gt; = and int 4, 8 <i>; yields {int}:result = 0</i>
1120</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001121</div>
Chris Lattner00950542001-06-06 20:29:01 +00001122<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001123<div class="doc_subsubsection"> <a name="i_or">'<tt>or</tt>' Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001124<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +00001125<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001126<pre> &lt;result&gt; = or &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {ty}:result</i>
Chris Lattner00950542001-06-06 20:29:01 +00001127</pre>
Chris Lattner261efe92003-11-25 01:02:51 +00001128<h5>Overview:</h5>
1129<p>The '<tt>or</tt>' instruction returns the bitwise logical inclusive
1130or of its two operands.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001131<h5>Arguments:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001132<p>The two arguments to the '<tt>or</tt>' instruction must be <a
Chris Lattner261efe92003-11-25 01:02:51 +00001133 href="#t_integral">integral</a> values. Both arguments must have
1134identical types.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001135<h5>Semantics:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001136<p>The truth table used for the '<tt>or</tt>' instruction is:</p>
Chris Lattner261efe92003-11-25 01:02:51 +00001137<p> </p>
Misha Brukmandaa4cb02004-03-01 17:47:27 +00001138<div style="align: center">
Chris Lattner261efe92003-11-25 01:02:51 +00001139<table border="1" cellspacing="0" cellpadding="4">
1140 <tbody>
1141 <tr>
1142 <td>In0</td>
1143 <td>In1</td>
1144 <td>Out</td>
1145 </tr>
1146 <tr>
1147 <td>0</td>
1148 <td>0</td>
1149 <td>0</td>
1150 </tr>
1151 <tr>
1152 <td>0</td>
1153 <td>1</td>
1154 <td>1</td>
1155 </tr>
1156 <tr>
1157 <td>1</td>
1158 <td>0</td>
1159 <td>1</td>
1160 </tr>
1161 <tr>
1162 <td>1</td>
1163 <td>1</td>
1164 <td>1</td>
1165 </tr>
1166 </tbody>
1167</table>
Misha Brukmandaa4cb02004-03-01 17:47:27 +00001168</div>
Chris Lattner00950542001-06-06 20:29:01 +00001169<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001170<pre> &lt;result&gt; = or int 4, %var <i>; yields {int}:result = 4 | %var</i>
Chris Lattner00950542001-06-06 20:29:01 +00001171 &lt;result&gt; = or int 15, 40 <i>; yields {int}:result = 47</i>
1172 &lt;result&gt; = or int 4, 8 <i>; yields {int}:result = 12</i>
1173</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001174</div>
Chris Lattner00950542001-06-06 20:29:01 +00001175<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001176<div class="doc_subsubsection"> <a name="i_xor">'<tt>xor</tt>'
1177Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001178<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +00001179<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001180<pre> &lt;result&gt; = xor &lt;ty&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields {ty}:result</i>
Chris Lattner00950542001-06-06 20:29:01 +00001181</pre>
Chris Lattner00950542001-06-06 20:29:01 +00001182<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001183<p>The '<tt>xor</tt>' instruction returns the bitwise logical exclusive
1184or of its two operands. The <tt>xor</tt> is used to implement the
1185"one's complement" operation, which is the "~" operator in C.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001186<h5>Arguments:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001187<p>The two arguments to the '<tt>xor</tt>' instruction must be <a
Chris Lattner261efe92003-11-25 01:02:51 +00001188 href="#t_integral">integral</a> values. Both arguments must have
1189identical types.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001190<h5>Semantics:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001191<p>The truth table used for the '<tt>xor</tt>' instruction is:</p>
Chris Lattner261efe92003-11-25 01:02:51 +00001192<p> </p>
Misha Brukmandaa4cb02004-03-01 17:47:27 +00001193<div style="align: center">
Chris Lattner261efe92003-11-25 01:02:51 +00001194<table border="1" cellspacing="0" cellpadding="4">
1195 <tbody>
1196 <tr>
1197 <td>In0</td>
1198 <td>In1</td>
1199 <td>Out</td>
1200 </tr>
1201 <tr>
1202 <td>0</td>
1203 <td>0</td>
1204 <td>0</td>
1205 </tr>
1206 <tr>
1207 <td>0</td>
1208 <td>1</td>
1209 <td>1</td>
1210 </tr>
1211 <tr>
1212 <td>1</td>
1213 <td>0</td>
1214 <td>1</td>
1215 </tr>
1216 <tr>
1217 <td>1</td>
1218 <td>1</td>
1219 <td>0</td>
1220 </tr>
1221 </tbody>
1222</table>
Misha Brukmandaa4cb02004-03-01 17:47:27 +00001223</div>
Chris Lattner261efe92003-11-25 01:02:51 +00001224<p> </p>
Chris Lattner00950542001-06-06 20:29:01 +00001225<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001226<pre> &lt;result&gt; = xor int 4, %var <i>; yields {int}:result = 4 ^ %var</i>
Chris Lattner00950542001-06-06 20:29:01 +00001227 &lt;result&gt; = xor int 15, 40 <i>; yields {int}:result = 39</i>
1228 &lt;result&gt; = xor int 4, 8 <i>; yields {int}:result = 12</i>
Chris Lattner27f71f22003-09-03 00:41:47 +00001229 &lt;result&gt; = xor int %V, -1 <i>; yields {int}:result = ~%V</i>
Chris Lattner00950542001-06-06 20:29:01 +00001230</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001231</div>
Chris Lattner00950542001-06-06 20:29:01 +00001232<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001233<div class="doc_subsubsection"> <a name="i_shl">'<tt>shl</tt>'
1234Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001235<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +00001236<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001237<pre> &lt;result&gt; = shl &lt;ty&gt; &lt;var1&gt;, ubyte &lt;var2&gt; <i>; yields {ty}:result</i>
Chris Lattner00950542001-06-06 20:29:01 +00001238</pre>
Chris Lattner00950542001-06-06 20:29:01 +00001239<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001240<p>The '<tt>shl</tt>' instruction returns the first operand shifted to
1241the left a specified number of bits.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001242<h5>Arguments:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001243<p>The first argument to the '<tt>shl</tt>' instruction must be an <a
Chris Lattner261efe92003-11-25 01:02:51 +00001244 href="#t_integer">integer</a> type. The second argument must be an '<tt>ubyte</tt>'
1245type.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001246<h5>Semantics:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001247<p>The value produced is <tt>var1</tt> * 2<sup><tt>var2</tt></sup>.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001248<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001249<pre> &lt;result&gt; = shl int 4, ubyte %var <i>; yields {int}:result = 4 &lt;&lt; %var</i>
Chris Lattner00950542001-06-06 20:29:01 +00001250 &lt;result&gt; = shl int 4, ubyte 2 <i>; yields {int}:result = 16</i>
1251 &lt;result&gt; = shl int 1, ubyte 10 <i>; yields {int}:result = 1024</i>
1252</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001253</div>
Chris Lattner00950542001-06-06 20:29:01 +00001254<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001255<div class="doc_subsubsection"> <a name="i_shr">'<tt>shr</tt>'
1256Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001257<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +00001258<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001259<pre> &lt;result&gt; = shr &lt;ty&gt; &lt;var1&gt;, ubyte &lt;var2&gt; <i>; yields {ty}:result</i>
Chris Lattner00950542001-06-06 20:29:01 +00001260</pre>
Chris Lattner00950542001-06-06 20:29:01 +00001261<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001262<p>The '<tt>shr</tt>' instruction returns the first operand shifted to
1263the right a specified number of bits.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001264<h5>Arguments:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001265<p>The first argument to the '<tt>shr</tt>' instruction must be an <a
Chris Lattner261efe92003-11-25 01:02:51 +00001266 href="#t_integer">integer</a> type. The second argument must be an '<tt>ubyte</tt>'
1267type.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001268<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001269<p>If the first argument is a <a href="#t_signed">signed</a> type, the
1270most significant bit is duplicated in the newly free'd bit positions.
1271If the first argument is unsigned, zero bits shall fill the empty
1272positions.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001273<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001274<pre> &lt;result&gt; = shr int 4, ubyte %var <i>; yields {int}:result = 4 &gt;&gt; %var</i>
Chris Lattner8c6bb902003-06-18 21:30:51 +00001275 &lt;result&gt; = shr uint 4, ubyte 1 <i>; yields {uint}:result = 2</i>
Chris Lattner00950542001-06-06 20:29:01 +00001276 &lt;result&gt; = shr int 4, ubyte 2 <i>; yields {int}:result = 1</i>
Chris Lattner8c6bb902003-06-18 21:30:51 +00001277 &lt;result&gt; = shr sbyte 4, ubyte 3 <i>; yields {sbyte}:result = 0</i>
1278 &lt;result&gt; = shr sbyte -2, ubyte 1 <i>; yields {sbyte}:result = -1</i>
Chris Lattner00950542001-06-06 20:29:01 +00001279</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001280</div>
Chris Lattner00950542001-06-06 20:29:01 +00001281<!-- ======================================================================= -->
Chris Lattner261efe92003-11-25 01:02:51 +00001282<div class="doc_subsection"> <a name="memoryops">Memory Access
1283Operations</a></div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001284<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +00001285<p>A key design point of an SSA-based representation is how it
1286represents memory. In LLVM, no memory locations are in SSA form, which
1287makes things very simple. This section describes how to read, write,
1288allocate and free memory in LLVM.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001289</div>
Chris Lattner00950542001-06-06 20:29:01 +00001290<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001291<div class="doc_subsubsection"> <a name="i_malloc">'<tt>malloc</tt>'
1292Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001293<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +00001294<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001295<pre> &lt;result&gt; = malloc &lt;type&gt;, uint &lt;NumElements&gt; <i>; yields {type*}:result</i>
Chris Lattner7faa8832002-04-14 06:13:44 +00001296 &lt;result&gt; = malloc &lt;type&gt; <i>; yields {type*}:result</i>
Chris Lattner00950542001-06-06 20:29:01 +00001297</pre>
Chris Lattner00950542001-06-06 20:29:01 +00001298<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001299<p>The '<tt>malloc</tt>' instruction allocates memory from the system
1300heap and returns a pointer to it.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001301<h5>Arguments:</h5>
John Criswell6e4ca612004-02-24 16:13:56 +00001302<p>The '<tt>malloc</tt>' instruction allocates <tt>sizeof(&lt;type&gt;)*NumElements</tt>
1303bytes of memory from the operating system and returns a pointer of the
Chris Lattner261efe92003-11-25 01:02:51 +00001304appropriate type to the program. The second form of the instruction is
1305a shorter version of the first instruction that defaults to allocating
1306one element.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001307<p>'<tt>type</tt>' must be a sized type.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001308<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001309<p>Memory is allocated using the system "<tt>malloc</tt>" function, and
1310a pointer is returned.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001311<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001312<pre> %array = malloc [4 x ubyte ] <i>; yields {[%4 x ubyte]*}:array</i>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001313
Chris Lattner261efe92003-11-25 01:02:51 +00001314 %size = <a
1315 href="#i_add">add</a> uint 2, 2 <i>; yields {uint}:size = uint 4</i>
Chris Lattner7faa8832002-04-14 06:13:44 +00001316 %array1 = malloc ubyte, uint 4 <i>; yields {ubyte*}:array1</i>
1317 %array2 = malloc [12 x ubyte], uint %size <i>; yields {[12 x ubyte]*}:array2</i>
Chris Lattner00950542001-06-06 20:29:01 +00001318</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001319</div>
Chris Lattner00950542001-06-06 20:29:01 +00001320<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001321<div class="doc_subsubsection"> <a name="i_free">'<tt>free</tt>'
1322Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001323<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +00001324<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001325<pre> free &lt;type&gt; &lt;value&gt; <i>; yields {void}</i>
Chris Lattner00950542001-06-06 20:29:01 +00001326</pre>
Chris Lattner00950542001-06-06 20:29:01 +00001327<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001328<p>The '<tt>free</tt>' instruction returns memory back to the unused
1329memory heap, to be reallocated in the future.</p>
1330<p> </p>
Chris Lattner00950542001-06-06 20:29:01 +00001331<h5>Arguments:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001332<p>'<tt>value</tt>' shall be a pointer value that points to a value
1333that was allocated with the '<tt><a href="#i_malloc">malloc</a></tt>'
1334instruction.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001335<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001336<p>Access to the memory pointed to by the pointer is not longer defined
1337after this instruction executes.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001338<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001339<pre> %array = <a href="#i_malloc">malloc</a> [4 x ubyte] <i>; yields {[4 x ubyte]*}:array</i>
Chris Lattner00950542001-06-06 20:29:01 +00001340 free [4 x ubyte]* %array
1341</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001342</div>
Chris Lattner00950542001-06-06 20:29:01 +00001343<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001344<div class="doc_subsubsection"> <a name="i_alloca">'<tt>alloca</tt>'
1345Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001346<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +00001347<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001348<pre> &lt;result&gt; = alloca &lt;type&gt;, uint &lt;NumElements&gt; <i>; yields {type*}:result</i>
Chris Lattner7faa8832002-04-14 06:13:44 +00001349 &lt;result&gt; = alloca &lt;type&gt; <i>; yields {type*}:result</i>
Chris Lattner00950542001-06-06 20:29:01 +00001350</pre>
Chris Lattner00950542001-06-06 20:29:01 +00001351<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001352<p>The '<tt>alloca</tt>' instruction allocates memory on the current
1353stack frame of the procedure that is live until the current function
1354returns to its caller.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001355<h5>Arguments:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001356<p>The the '<tt>alloca</tt>' instruction allocates <tt>sizeof(&lt;type&gt;)*NumElements</tt>
1357bytes of memory on the runtime stack, returning a pointer of the
1358appropriate type to the program. The second form of the instruction is
1359a shorter version of the first that defaults to allocating one element.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001360<p>'<tt>type</tt>' may be any sized type.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001361<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001362<p>Memory is allocated, a pointer is returned. '<tt>alloca</tt>'d
1363memory is automatically released when the function returns. The '<tt>alloca</tt>'
1364instruction is commonly used to represent automatic variables that must
1365have an address available. When the function returns (either with the <tt><a
1366 href="#i_ret">ret</a></tt> or <tt><a href="#i_invoke">invoke</a></tt>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001367instructions), the memory is reclaimed.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001368<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001369<pre> %ptr = alloca int <i>; yields {int*}:ptr</i>
Chris Lattner7faa8832002-04-14 06:13:44 +00001370 %ptr = alloca int, uint 4 <i>; yields {int*}:ptr</i>
Chris Lattner00950542001-06-06 20:29:01 +00001371</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001372</div>
Chris Lattner00950542001-06-06 20:29:01 +00001373<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001374<div class="doc_subsubsection"> <a name="i_load">'<tt>load</tt>'
1375Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001376<div class="doc_text">
Chris Lattner2b7d3202002-05-06 03:03:22 +00001377<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001378<pre> &lt;result&gt; = load &lt;ty&gt;* &lt;pointer&gt;<br> &lt;result&gt; = volatile load &lt;ty&gt;* &lt;pointer&gt;<br></pre>
Chris Lattner2b7d3202002-05-06 03:03:22 +00001379<h5>Overview:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001380<p>The '<tt>load</tt>' instruction is used to read from memory.</p>
Chris Lattner2b7d3202002-05-06 03:03:22 +00001381<h5>Arguments:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001382<p>The argument to the '<tt>load</tt>' instruction specifies the memory
1383address to load from. The pointer must point to a <a
1384 href="t_firstclass">first class</a> type. If the <tt>load</tt> is
1385marked as <tt>volatile</tt> then the optimizer is not allowed to modify
1386the number or order of execution of this <tt>load</tt> with other
1387volatile <tt>load</tt> and <tt><a href="#i_store">store</a></tt>
1388instructions. </p>
Chris Lattner2b7d3202002-05-06 03:03:22 +00001389<h5>Semantics:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001390<p>The location of memory pointed to is loaded.</p>
Chris Lattner2b7d3202002-05-06 03:03:22 +00001391<h5>Examples:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001392<pre> %ptr = <a href="#i_alloca">alloca</a> int <i>; yields {int*}:ptr</i>
1393 <a
1394 href="#i_store">store</a> int 3, int* %ptr <i>; yields {void}</i>
Chris Lattner2b7d3202002-05-06 03:03:22 +00001395 %val = load int* %ptr <i>; yields {int}:val = int 3</i>
1396</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001397</div>
Chris Lattner2b7d3202002-05-06 03:03:22 +00001398<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001399<div class="doc_subsubsection"> <a name="i_store">'<tt>store</tt>'
1400Instruction</a> </div>
Chris Lattner2b7d3202002-05-06 03:03:22 +00001401<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001402<pre> store &lt;ty&gt; &lt;value&gt;, &lt;ty&gt;* &lt;pointer&gt; <i>; yields {void}</i>
Chris Lattnerf0651072003-09-08 18:27:49 +00001403 volatile store &lt;ty&gt; &lt;value&gt;, &lt;ty&gt;* &lt;pointer&gt; <i>; yields {void}</i>
Chris Lattner2b7d3202002-05-06 03:03:22 +00001404</pre>
Chris Lattner2b7d3202002-05-06 03:03:22 +00001405<h5>Overview:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001406<p>The '<tt>store</tt>' instruction is used to write to memory.</p>
Chris Lattner2b7d3202002-05-06 03:03:22 +00001407<h5>Arguments:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001408<p>There are two arguments to the '<tt>store</tt>' instruction: a value
1409to store and an address to store it into. The type of the '<tt>&lt;pointer&gt;</tt>'
1410operand must be a pointer to the type of the '<tt>&lt;value&gt;</tt>'
1411operand. If the <tt>store</tt> is marked as <tt>volatile</tt> then the
1412optimizer is not allowed to modify the number or order of execution of
1413this <tt>store</tt> with other volatile <tt>load</tt> and <tt><a
1414 href="#i_store">store</a></tt> instructions.</p>
1415<h5>Semantics:</h5>
1416<p>The contents of memory are updated to contain '<tt>&lt;value&gt;</tt>'
1417at the location specified by the '<tt>&lt;pointer&gt;</tt>' operand.</p>
Chris Lattner2b7d3202002-05-06 03:03:22 +00001418<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001419<pre> %ptr = <a href="#i_alloca">alloca</a> int <i>; yields {int*}:ptr</i>
1420 <a
1421 href="#i_store">store</a> int 3, int* %ptr <i>; yields {void}</i>
Chris Lattner2b7d3202002-05-06 03:03:22 +00001422 %val = load int* %ptr <i>; yields {int}:val = int 3</i>
1423</pre>
Chris Lattner2b7d3202002-05-06 03:03:22 +00001424<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001425<div class="doc_subsubsection"> <a name="i_getelementptr">'<tt>getelementptr</tt>'
1426Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001427<div class="doc_text">
Chris Lattner7faa8832002-04-14 06:13:44 +00001428<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001429<pre> &lt;result&gt; = getelementptr &lt;ty&gt;* &lt;ptrval&gt;{, long &lt;aidx&gt;|, ubyte &lt;sidx&gt;}*<br></pre>
Chris Lattner7faa8832002-04-14 06:13:44 +00001430<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001431<p>The '<tt>getelementptr</tt>' instruction is used to get the address
1432of a subelement of an aggregate data structure.</p>
Chris Lattner7faa8832002-04-14 06:13:44 +00001433<h5>Arguments:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001434<p>This instruction takes a list of <tt>long</tt> values and <tt>ubyte</tt>
Chris Lattner261efe92003-11-25 01:02:51 +00001435constants that indicate what form of addressing to perform. The actual
1436types of the arguments provided depend on the type of the first pointer
1437argument. The '<tt>getelementptr</tt>' instruction is used to index
1438down through the type levels of a structure.</p>
1439<p>For example, let's consider a C code fragment and how it gets
1440compiled to LLVM:</p>
1441<pre>struct RT {<br> char A;<br> int B[10][20];<br> char C;<br>};<br>struct ST {<br> int X;<br> double Y;<br> struct RT Z;<br>};<br><br>int *foo(struct ST *s) {<br> return &amp;s[1].Z.B[5][13];<br>}<br></pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001442<p>The LLVM code generated by the GCC frontend is:</p>
Chris Lattner261efe92003-11-25 01:02:51 +00001443<pre>%RT = type { sbyte, [10 x [20 x int]], sbyte }<br>%ST = type { int, double, %RT }<br><br>int* "foo"(%ST* %s) {<br> %reg = getelementptr %ST* %s, long 1, ubyte 2, ubyte 1, long 5, long 13<br> ret int* %reg<br>}<br></pre>
Chris Lattner7faa8832002-04-14 06:13:44 +00001444<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001445<p>The index types specified for the '<tt>getelementptr</tt>'
1446instruction depend on the pointer type that is being index into. <a
1447 href="t_pointer">Pointer</a> and <a href="t_array">array</a> types
1448require '<tt>long</tt>' values, and <a href="t_struct">structure</a>
1449types require '<tt>ubyte</tt>' <b>constants</b>.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001450<p>In the example above, the first index is indexing into the '<tt>%ST*</tt>'
Chris Lattner261efe92003-11-25 01:02:51 +00001451type, which is a pointer, yielding a '<tt>%ST</tt>' = '<tt>{ int,
1452double, %RT }</tt>' type, a structure. The second index indexes into
1453the third element of the structure, yielding a '<tt>%RT</tt>' = '<tt>{
1454sbyte, [10 x [20 x int]], sbyte }</tt>' type, another structure. The
1455third index indexes into the second element of the structure, yielding
1456a '<tt>[10 x [20 x int]]</tt>' type, an array. The two dimensions of
1457the array are subscripted into, yielding an '<tt>int</tt>' type. The '<tt>getelementptr</tt>'
1458instruction return a pointer to this element, thus yielding a '<tt>int*</tt>'
1459type.</p>
1460<p>Note that it is perfectly legal to index partially through a
1461structure, returning a pointer to an inner element. Because of this,
1462the LLVM code for the given testcase is equivalent to:</p>
1463<pre>int* "foo"(%ST* %s) {<br> %t1 = getelementptr %ST* %s , long 1 <i>; yields %ST*:%t1</i>
Chris Lattner3dfa10b2002-12-13 06:01:21 +00001464 %t2 = getelementptr %ST* %t1, long 0, ubyte 2 <i>; yields %RT*:%t2</i>
1465 %t3 = getelementptr %RT* %t2, long 0, ubyte 1 <i>; yields [10 x [20 x int]]*:%t3</i>
1466 %t4 = getelementptr [10 x [20 x int]]* %t3, long 0, long 5 <i>; yields [20 x int]*:%t4</i>
1467 %t5 = getelementptr [20 x int]* %t4, long 0, long 13 <i>; yields int*:%t5</i>
Chris Lattner6536cfe2002-05-06 22:08:29 +00001468 ret int* %t5
1469}
1470</pre>
Chris Lattner7faa8832002-04-14 06:13:44 +00001471<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001472<pre> <i>; yields [12 x ubyte]*:aptr</i>
1473 %aptr = getelementptr {int, [12 x ubyte]}* %sptr, long 0, ubyte 1<br></pre>
1474<h5>&nbsp;Note To The Novice:</h5>
1475When using indexing into global arrays with the '<tt>getelementptr</tt>'
1476instruction, you must remember that the&nbsp; </div>
Chris Lattner00950542001-06-06 20:29:01 +00001477<!-- ======================================================================= -->
Chris Lattner261efe92003-11-25 01:02:51 +00001478<div class="doc_subsection"> <a name="otherops">Other Operations</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001479<div class="doc_text">
Chris Lattner261efe92003-11-25 01:02:51 +00001480<p>The instructions in this catagory are the "miscellaneous"
1481instructions, which defy better classification.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001482</div>
Chris Lattner00950542001-06-06 20:29:01 +00001483<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001484<div class="doc_subsubsection"> <a name="i_phi">'<tt>phi</tt>'
1485Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001486<div class="doc_text">
Chris Lattner33ba0d92001-07-09 00:26:23 +00001487<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001488<pre> &lt;result&gt; = phi &lt;ty&gt; [ &lt;val0&gt;, &lt;label0&gt;], ...<br></pre>
Chris Lattner33ba0d92001-07-09 00:26:23 +00001489<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001490<p>The '<tt>phi</tt>' instruction is used to implement the &#966; node in
1491the SSA graph representing the function.</p>
Chris Lattner33ba0d92001-07-09 00:26:23 +00001492<h5>Arguments:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001493<p>The type of the incoming values are specified with the first type
1494field. After this, the '<tt>phi</tt>' instruction takes a list of pairs
1495as arguments, with one pair for each predecessor basic block of the
1496current block. Only values of <a href="#t_firstclass">first class</a>
1497type may be used as the value arguments to the PHI node. Only labels
1498may be used as the label arguments.</p>
1499<p>There must be no non-phi instructions between the start of a basic
1500block and the PHI instructions: i.e. PHI instructions must be first in
1501a basic block.</p>
Chris Lattner33ba0d92001-07-09 00:26:23 +00001502<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001503<p>At runtime, the '<tt>phi</tt>' instruction logically takes on the
1504value specified by the parameter, depending on which basic block we
1505came from in the last <a href="#terminators">terminator</a> instruction.</p>
Chris Lattner6536cfe2002-05-06 22:08:29 +00001506<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001507<pre>Loop: ; Infinite loop that counts from 0 on up...<br> %indvar = phi uint [ 0, %LoopHeader ], [ %nextindvar, %Loop ]<br> %nextindvar = add uint %indvar, 1<br> br label %Loop<br></pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001508</div>
Chris Lattner6536cfe2002-05-06 22:08:29 +00001509<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001510<div class="doc_subsubsection"> <a name="i_cast">'<tt>cast .. to</tt>'
1511Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001512<div class="doc_text">
Chris Lattner6536cfe2002-05-06 22:08:29 +00001513<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001514<pre> &lt;result&gt; = cast &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt; <i>; yields ty2</i>
Chris Lattner6536cfe2002-05-06 22:08:29 +00001515</pre>
Chris Lattner6536cfe2002-05-06 22:08:29 +00001516<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001517<p>The '<tt>cast</tt>' instruction is used as the primitive means to
1518convert integers to floating point, change data type sizes, and break
1519type safety (by casting pointers).</p>
Chris Lattner6536cfe2002-05-06 22:08:29 +00001520<h5>Arguments:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001521<p>The '<tt>cast</tt>' instruction takes a value to cast, which must be
1522a first class value, and a type to cast it to, which must also be a <a
1523 href="#t_firstclass">first class</a> type.</p>
Chris Lattner6536cfe2002-05-06 22:08:29 +00001524<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001525<p>This instruction follows the C rules for explicit casts when
1526determining how the data being cast must change to fit in its new
1527container.</p>
1528<p>When casting to bool, any value that would be considered true in the
1529context of a C '<tt>if</tt>' condition is converted to the boolean '<tt>true</tt>'
Misha Brukman9d0919f2003-11-08 01:05:38 +00001530values, all else are '<tt>false</tt>'.</p>
Chris Lattner261efe92003-11-25 01:02:51 +00001531<p>When extending an integral value from a type of one signness to
1532another (for example '<tt>sbyte</tt>' to '<tt>ulong</tt>'), the value
1533is sign-extended if the <b>source</b> value is signed, and
1534zero-extended if the source value is unsigned. <tt>bool</tt> values
1535are always zero extended into either zero or one.</p>
Chris Lattner33ba0d92001-07-09 00:26:23 +00001536<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001537<pre> %X = cast int 257 to ubyte <i>; yields ubyte:1</i>
Chris Lattner7bae3952002-06-25 18:03:17 +00001538 %Y = cast int 123 to bool <i>; yields bool:true</i>
Chris Lattner33ba0d92001-07-09 00:26:23 +00001539</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001540</div>
Chris Lattner33ba0d92001-07-09 00:26:23 +00001541<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001542<div class="doc_subsubsection"> <a name="i_call">'<tt>call</tt>'
1543Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001544<div class="doc_text">
Chris Lattner00950542001-06-06 20:29:01 +00001545<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001546<pre> &lt;result&gt; = call &lt;ty&gt;* &lt;fnptrval&gt;(&lt;param list&gt;)<br></pre>
Chris Lattner00950542001-06-06 20:29:01 +00001547<h5>Overview:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001548<p>The '<tt>call</tt>' instruction represents a simple function call.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001549<h5>Arguments:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001550<p>This instruction requires several arguments:</p>
Chris Lattner6536cfe2002-05-06 22:08:29 +00001551<ol>
Chris Lattner261efe92003-11-25 01:02:51 +00001552 <li>
1553 <p>'<tt>ty</tt>': shall be the signature of the pointer to function
1554value being invoked. The argument types must match the types implied
1555by this signature.</p>
1556 </li>
1557 <li>
1558 <p>'<tt>fnptrval</tt>': An LLVM value containing a pointer to a
1559function to be invoked. In most cases, this is a direct function
1560invocation, but indirect <tt>call</tt>s are just as possible,
1561calling an arbitrary pointer to function values.</p>
1562 </li>
1563 <li>
1564 <p>'<tt>function args</tt>': argument list whose types match the
1565function signature argument types. If the function signature
1566indicates the function accepts a variable number of arguments, the
1567extra arguments can be specified.</p>
1568 </li>
Chris Lattner6536cfe2002-05-06 22:08:29 +00001569</ol>
Chris Lattner00950542001-06-06 20:29:01 +00001570<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001571<p>The '<tt>call</tt>' instruction is used to cause control flow to
1572transfer to a specified function, with its incoming arguments bound to
1573the specified values. Upon a '<tt><a href="#i_ret">ret</a></tt>'
1574instruction in the called function, control flow continues with the
1575instruction after the function call, and the return value of the
1576function is bound to the result argument. This is a simpler case of
1577the <a href="#i_invoke">invoke</a> instruction.</p>
Chris Lattner00950542001-06-06 20:29:01 +00001578<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001579<pre> %retval = call int %test(int %argc)<br> call int(sbyte*, ...) *%printf(sbyte* %msg, int 12, sbyte 42);<br></pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001580</div>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001581<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001582<div class="doc_subsubsection"> <a name="i_vanext">'<tt>vanext</tt>'
1583Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001584<div class="doc_text">
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001585<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001586<pre> &lt;resultarglist&gt; = vanext &lt;va_list&gt; &lt;arglist&gt;, &lt;argty&gt;<br></pre>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001587<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001588<p>The '<tt>vanext</tt>' instruction is used to access arguments passed
1589through the "variable argument" area of a function call. It is used to
1590implement the <tt>va_arg</tt> macro in C.</p>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001591<h5>Arguments:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001592<p>This instruction takes a <tt>valist</tt> value and the type of the
1593argument. It returns another <tt>valist</tt>.</p>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001594<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001595<p>The '<tt>vanext</tt>' instruction advances the specified <tt>valist</tt>
1596past an argument of the specified type. In conjunction with the <a
1597 href="#i_vaarg"><tt>vaarg</tt></a> instruction, it is used to implement
1598the <tt>va_arg</tt> macro available in C. For more information, see
1599the variable argument handling <a href="#int_varargs">Intrinsic
1600Functions</a>.</p>
1601<p>It is legal for this instruction to be called in a function which
1602does not take a variable number of arguments, for example, the <tt>vfprintf</tt>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001603function.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001604<p><tt>vanext</tt> is an LLVM instruction instead of an <a
Chris Lattner261efe92003-11-25 01:02:51 +00001605 href="#intrinsics">intrinsic function</a> because it takes an type as
1606an argument.</p>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001607<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001608<p>See the <a href="#int_varargs">variable argument processing</a>
1609section.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001610</div>
Chris Lattner8d1a81d2003-10-18 05:51:36 +00001611<!-- _______________________________________________________________________ -->
Chris Lattner261efe92003-11-25 01:02:51 +00001612<div class="doc_subsubsection"> <a name="i_vaarg">'<tt>vaarg</tt>'
1613Instruction</a> </div>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001614<div class="doc_text">
Chris Lattner8d1a81d2003-10-18 05:51:36 +00001615<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001616<pre> &lt;resultval&gt; = vaarg &lt;va_list&gt; &lt;arglist&gt;, &lt;argty&gt;<br></pre>
Chris Lattner8d1a81d2003-10-18 05:51:36 +00001617<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001618<p>The '<tt>vaarg</tt>' instruction is used to access arguments passed
1619through the "variable argument" area of a function call. It is used to
1620implement the <tt>va_arg</tt> macro in C.</p>
Chris Lattner8d1a81d2003-10-18 05:51:36 +00001621<h5>Arguments:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001622<p>This instruction takes a <tt>valist</tt> value and the type of the
1623argument. It returns a value of the specified argument type.</p>
Chris Lattner8d1a81d2003-10-18 05:51:36 +00001624<h5>Semantics:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001625<p>The '<tt>vaarg</tt>' instruction loads an argument of the specified
1626type from the specified <tt>va_list</tt>. In conjunction with the <a
1627 href="#i_vanext"><tt>vanext</tt></a> instruction, it is used to
1628implement the <tt>va_arg</tt> macro available in C. For more
1629information, see the variable argument handling <a href="#int_varargs">Intrinsic
1630Functions</a>.</p>
1631<p>It is legal for this instruction to be called in a function which
1632does not take a variable number of arguments, for example, the <tt>vfprintf</tt>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001633function.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001634<p><tt>vaarg</tt> is an LLVM instruction instead of an <a
Chris Lattner261efe92003-11-25 01:02:51 +00001635 href="#intrinsics">intrinsic function</a> because it takes an type as
1636an argument.</p>
Chris Lattner8d1a81d2003-10-18 05:51:36 +00001637<h5>Example:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001638<p>See the <a href="#int_varargs">variable argument processing</a>
1639section.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001640</div>
Chris Lattner8ff75902004-01-06 05:31:32 +00001641
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001642<!-- *********************************************************************** -->
Chris Lattner261efe92003-11-25 01:02:51 +00001643<div class="doc_section"> <a name="intrinsics">Intrinsic Functions</a> </div>
1644<!-- *********************************************************************** -->
Chris Lattner8ff75902004-01-06 05:31:32 +00001645
Misha Brukman9d0919f2003-11-08 01:05:38 +00001646<div class="doc_text">
Chris Lattner33aec9e2004-02-12 17:01:32 +00001647
1648<p>LLVM supports the notion of an "intrinsic function". These functions have
1649well known names and semantics, and are required to follow certain
1650restrictions. Overall, these instructions represent an extension mechanism for
1651the LLVM language that does not require changing all of the transformations in
1652LLVM to add to the language (or the bytecode reader/writer, the parser,
1653etc...).</p>
1654
1655<p>Intrinsic function names must all start with an "<tt>llvm.</tt>" prefix, this
1656prefix is reserved in LLVM for intrinsic names, thus functions may not be named
1657this. Intrinsic functions must always be external functions: you cannot define
1658the body of intrinsic functions. Intrinsic functions may only be used in call
1659or invoke instructions: it is illegal to take the address of an intrinsic
1660function. Additionally, because intrinsic functions are part of the LLVM
1661language, it is required that they all be documented here if any are added.</p>
1662
1663
1664<p>
1665Adding an intrinsic to LLVM is straight-forward if it is possible to express the
1666concept in LLVM directly (ie, code generator support is not _required_). To do
1667this, extend the default implementation of the IntrinsicLowering class to handle
1668the intrinsic. Code generators use this class to lower intrinsics they do not
1669understand to raw LLVM instructions that they do.
1670</p>
1671
Misha Brukman9d0919f2003-11-08 01:05:38 +00001672</div>
Chris Lattner8ff75902004-01-06 05:31:32 +00001673
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001674<!-- ======================================================================= -->
Chris Lattner8ff75902004-01-06 05:31:32 +00001675<div class="doc_subsection">
1676 <a name="int_varargs">Variable Argument Handling Intrinsics</a>
1677</div>
1678
Misha Brukman9d0919f2003-11-08 01:05:38 +00001679<div class="doc_text">
Misha Brukman9d0919f2003-11-08 01:05:38 +00001680<p>Variable argument support is defined in LLVM with the <a
Chris Lattner261efe92003-11-25 01:02:51 +00001681 href="#i_vanext"><tt>vanext</tt></a> instruction and these three
1682intrinsic functions. These functions are related to the similarly
1683named macros defined in the <tt>&lt;stdarg.h&gt;</tt> header file.</p>
1684<p>All of these functions operate on arguments that use a
1685target-specific value type "<tt>va_list</tt>". The LLVM assembly
1686language reference manual does not define what this type is, so all
1687transformations should be prepared to handle intrinsics with any type
1688used.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001689<p>This example shows how the <a href="#i_vanext"><tt>vanext</tt></a>
Chris Lattner261efe92003-11-25 01:02:51 +00001690instruction and the variable argument handling intrinsic functions are
1691used.</p>
Chris Lattner33aec9e2004-02-12 17:01:32 +00001692<pre>
1693int %test(int %X, ...) {
1694 ; Initialize variable argument processing
1695 %ap = call sbyte* %<a href="#i_va_start">llvm.va_start</a>()
1696
1697 ; Read a single integer argument
1698 %tmp = vaarg sbyte* %ap, int
1699
1700 ; Advance to the next argument
1701 %ap2 = vanext sbyte* %ap, int
1702
1703 ; Demonstrate usage of llvm.va_copy and llvm.va_end
1704 %aq = call sbyte* %<a href="#i_va_copy">llvm.va_copy</a>(sbyte* %ap2)
1705 call void %<a href="#i_va_end">llvm.va_end</a>(sbyte* %aq)
1706
1707 ; Stop processing of arguments.
1708 call void %<a href="#i_va_end">llvm.va_end</a>(sbyte* %ap2)
1709 ret int %tmp
1710}
1711</pre>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001712</div>
Chris Lattner8ff75902004-01-06 05:31:32 +00001713
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001714<!-- _______________________________________________________________________ -->
Chris Lattner8ff75902004-01-06 05:31:32 +00001715<div class="doc_subsubsection">
1716 <a name="i_va_start">'<tt>llvm.va_start</tt>' Intrinsic</a>
1717</div>
1718
1719
Misha Brukman9d0919f2003-11-08 01:05:38 +00001720<div class="doc_text">
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001721<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001722<pre> call va_list ()* %llvm.va_start()<br></pre>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001723<h5>Overview:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001724<p>The '<tt>llvm.va_start</tt>' intrinsic returns a new <tt>&lt;arglist&gt;</tt>
1725for subsequent use by the variable argument intrinsics.</p>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001726<h5>Semantics:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001727<p>The '<tt>llvm.va_start</tt>' intrinsic works just like the <tt>va_start</tt>
Chris Lattner261efe92003-11-25 01:02:51 +00001728macro available in C. In a target-dependent way, it initializes and
1729returns a <tt>va_list</tt> element, so that the next <tt>vaarg</tt>
1730will produce the first variable argument passed to the function. Unlike
1731the C <tt>va_start</tt> macro, this intrinsic does not need to know the
1732last argument of the function, the compiler can figure that out.</p>
1733<p>Note that this intrinsic function is only legal to be called from
1734within the body of a variable argument function.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001735</div>
Chris Lattner8ff75902004-01-06 05:31:32 +00001736
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001737<!-- _______________________________________________________________________ -->
Chris Lattner8ff75902004-01-06 05:31:32 +00001738<div class="doc_subsubsection">
1739 <a name="i_va_end">'<tt>llvm.va_end</tt>' Intrinsic</a>
1740</div>
1741
Misha Brukman9d0919f2003-11-08 01:05:38 +00001742<div class="doc_text">
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001743<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001744<pre> call void (va_list)* %llvm.va_end(va_list &lt;arglist&gt;)<br></pre>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001745<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001746<p>The '<tt>llvm.va_end</tt>' intrinsic destroys <tt>&lt;arglist&gt;</tt>
1747which has been initialized previously with <tt><a href="#i_va_start">llvm.va_start</a></tt>
1748or <tt><a href="#i_va_copy">llvm.va_copy</a></tt>.</p>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001749<h5>Arguments:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001750<p>The argument is a <tt>va_list</tt> to destroy.</p>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001751<h5>Semantics:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001752<p>The '<tt>llvm.va_end</tt>' intrinsic works just like the <tt>va_end</tt>
Chris Lattner261efe92003-11-25 01:02:51 +00001753macro available in C. In a target-dependent way, it destroys the <tt>va_list</tt>.
1754Calls to <a href="#i_va_start"><tt>llvm.va_start</tt></a> and <a
1755 href="#i_va_copy"><tt>llvm.va_copy</tt></a> must be matched exactly
1756with calls to <tt>llvm.va_end</tt>.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001757</div>
Chris Lattner8ff75902004-01-06 05:31:32 +00001758
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001759<!-- _______________________________________________________________________ -->
Chris Lattner8ff75902004-01-06 05:31:32 +00001760<div class="doc_subsubsection">
1761 <a name="i_va_copy">'<tt>llvm.va_copy</tt>' Intrinsic</a>
1762</div>
1763
Misha Brukman9d0919f2003-11-08 01:05:38 +00001764<div class="doc_text">
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001765<h5>Syntax:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001766<pre> call va_list (va_list)* %llvm.va_copy(va_list &lt;destarglist&gt;)<br></pre>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001767<h5>Overview:</h5>
Chris Lattner261efe92003-11-25 01:02:51 +00001768<p>The '<tt>llvm.va_copy</tt>' intrinsic copies the current argument
1769position from the source argument list to the destination argument list.</p>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001770<h5>Arguments:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001771<p>The argument is the <tt>va_list</tt> to copy.</p>
Chris Lattnerd9ad5b32003-05-08 04:57:36 +00001772<h5>Semantics:</h5>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001773<p>The '<tt>llvm.va_copy</tt>' intrinsic works just like the <tt>va_copy</tt>
Chris Lattner261efe92003-11-25 01:02:51 +00001774macro available in C. In a target-dependent way, it copies the source <tt>va_list</tt>
1775element into the returned list. This intrinsic is necessary because the <tt><a
1776 href="i_va_start">llvm.va_start</a></tt> intrinsic may be arbitrarily
1777complex and require memory allocation, for example.</p>
Misha Brukman9d0919f2003-11-08 01:05:38 +00001778</div>
Chris Lattner8ff75902004-01-06 05:31:32 +00001779
Chris Lattner33aec9e2004-02-12 17:01:32 +00001780<!-- ======================================================================= -->
1781<div class="doc_subsection">
Chris Lattner10610642004-02-14 04:08:35 +00001782 <a name="int_codegen">Code Generator Intrinsics</a>
1783</div>
1784
1785<div class="doc_text">
1786<p>
1787These intrinsics are provided by LLVM to expose special features that may only
1788be implemented with code generator support.
1789</p>
1790
1791</div>
1792
1793<!-- _______________________________________________________________________ -->
1794<div class="doc_subsubsection">
1795 <a name="i_returnaddress">'<tt>llvm.returnaddress</tt>' Intrinsic</a>
1796</div>
1797
1798<div class="doc_text">
1799
1800<h5>Syntax:</h5>
1801<pre>
1802 call void* ()* %llvm.returnaddress(uint &lt;level&gt;)
1803</pre>
1804
1805<h5>Overview:</h5>
1806
1807<p>
1808The '<tt>llvm.returnaddress</tt>' intrinsic returns a target-specific value
1809indicating the return address of the current function or one of its callers.
1810</p>
1811
1812<h5>Arguments:</h5>
1813
1814<p>
1815The argument to this intrinsic indicates which function to return the address
1816for. Zero indicates the calling function, one indicates its caller, etc. The
1817argument is <b>required</b> to be a constant integer value.
1818</p>
1819
1820<h5>Semantics:</h5>
1821
1822<p>
1823The '<tt>llvm.returnaddress</tt>' intrinsic either returns a pointer indicating
1824the return address of the specified call frame, or zero if it cannot be
1825identified. The value returned by this intrinsic is likely to be incorrect or 0
1826for arguments other than zero, so it should only be used for debugging purposes.
1827</p>
1828
1829<p>
1830Note that calling this intrinsic does not prevent function inlining or other
1831aggressive transformations, so the value returned may not that of the obvious
1832source-language caller.
1833</p>
1834</div>
1835
1836
1837<!-- _______________________________________________________________________ -->
1838<div class="doc_subsubsection">
1839 <a name="i_frameaddress">'<tt>llvm.frameaddress</tt>' Intrinsic</a>
1840</div>
1841
1842<div class="doc_text">
1843
1844<h5>Syntax:</h5>
1845<pre>
1846 call void* ()* %llvm.frameaddress(uint &lt;level&gt;)
1847</pre>
1848
1849<h5>Overview:</h5>
1850
1851<p>
1852The '<tt>llvm.frameaddress</tt>' intrinsic returns the target-specific frame
1853pointer value for the specified stack frame.
1854</p>
1855
1856<h5>Arguments:</h5>
1857
1858<p>
1859The argument to this intrinsic indicates which function to return the frame
1860pointer for. Zero indicates the calling function, one indicates its caller,
1861etc. The argument is <b>required</b> to be a constant integer value.
1862</p>
1863
1864<h5>Semantics:</h5>
1865
1866<p>
1867The '<tt>llvm.frameaddress</tt>' intrinsic either returns a pointer indicating
1868the frame address of the specified call frame, or zero if it cannot be
1869identified. The value returned by this intrinsic is likely to be incorrect or 0
1870for arguments other than zero, so it should only be used for debugging purposes.
1871</p>
1872
1873<p>
1874Note that calling this intrinsic does not prevent function inlining or other
1875aggressive transformations, so the value returned may not that of the obvious
1876source-language caller.
1877</p>
1878</div>
1879
1880
1881<!-- ======================================================================= -->
1882<div class="doc_subsection">
Chris Lattner33aec9e2004-02-12 17:01:32 +00001883 <a name="int_libc">Standard C Library Intrinsics</a>
1884</div>
1885
1886<div class="doc_text">
1887<p>
Chris Lattner10610642004-02-14 04:08:35 +00001888LLVM provides intrinsics for a few important standard C library functions.
1889These intrinsics allow source-language front-ends to pass information about the
1890alignment of the pointer arguments to the code generator, providing opportunity
1891for more efficient code generation.
Chris Lattner33aec9e2004-02-12 17:01:32 +00001892</p>
1893
1894</div>
1895
1896<!-- _______________________________________________________________________ -->
1897<div class="doc_subsubsection">
1898 <a name="i_memcpy">'<tt>llvm.memcpy</tt>' Intrinsic</a>
1899</div>
1900
1901<div class="doc_text">
1902
1903<h5>Syntax:</h5>
1904<pre>
1905 call void (sbyte*, sbyte*, uint, uint)* %llvm.memcpy(sbyte* &lt;dest&gt;, sbyte* &lt;src&gt;,
1906 uint &lt;len&gt;, uint &lt;align&gt;)
1907</pre>
1908
1909<h5>Overview:</h5>
1910
1911<p>
1912The '<tt>llvm.memcpy</tt>' intrinsic copies a block of memory from the source
1913location to the destination location.
1914</p>
1915
1916<p>
1917Note that, unlike the standard libc function, the <tt>llvm.memcpy</tt> intrinsic
1918does not return a value, and takes an extra alignment argument.
1919</p>
1920
1921<h5>Arguments:</h5>
1922
1923<p>
1924The first argument is a pointer to the destination, the second is a pointer to
1925the source. The third argument is an (arbitrarily sized) integer argument
1926specifying the number of bytes to copy, and the fourth argument is the alignment
1927of the source and destination locations.
1928</p>
1929
Chris Lattner3301ced2004-02-12 21:18:15 +00001930<p>
1931If the call to this intrinisic has an alignment value that is not 0 or 1, then
1932the caller guarantees that the size of the copy is a multiple of the alignment
1933and that both the source and destination pointers are aligned to that boundary.
1934</p>
1935
Chris Lattner33aec9e2004-02-12 17:01:32 +00001936<h5>Semantics:</h5>
1937
1938<p>
1939The '<tt>llvm.memcpy</tt>' intrinsic copies a block of memory from the source
1940location to the destination location, which are not allowed to overlap. It
1941copies "len" bytes of memory over. If the argument is known to be aligned to
1942some boundary, this can be specified as the fourth argument, otherwise it should
1943be set to 0 or 1.
1944</p>
1945</div>
1946
1947
Chris Lattner0eb51b42004-02-12 18:10:10 +00001948<!-- _______________________________________________________________________ -->
1949<div class="doc_subsubsection">
1950 <a name="i_memmove">'<tt>llvm.memmove</tt>' Intrinsic</a>
1951</div>
1952
1953<div class="doc_text">
1954
1955<h5>Syntax:</h5>
1956<pre>
1957 call void (sbyte*, sbyte*, uint, uint)* %llvm.memmove(sbyte* &lt;dest&gt;, sbyte* &lt;src&gt;,
1958 uint &lt;len&gt;, uint &lt;align&gt;)
1959</pre>
1960
1961<h5>Overview:</h5>
1962
1963<p>
1964The '<tt>llvm.memmove</tt>' intrinsic moves a block of memory from the source
1965location to the destination location. It is similar to the '<tt>llvm.memcpy</tt>'
1966intrinsic but allows the two memory locations to overlap.
1967</p>
1968
1969<p>
1970Note that, unlike the standard libc function, the <tt>llvm.memmove</tt> intrinsic
1971does not return a value, and takes an extra alignment argument.
1972</p>
1973
1974<h5>Arguments:</h5>
1975
1976<p>
1977The first argument is a pointer to the destination, the second is a pointer to
1978the source. The third argument is an (arbitrarily sized) integer argument
1979specifying the number of bytes to copy, and the fourth argument is the alignment
1980of the source and destination locations.
1981</p>
1982
Chris Lattner3301ced2004-02-12 21:18:15 +00001983<p>
1984If the call to this intrinisic has an alignment value that is not 0 or 1, then
1985the caller guarantees that the size of the copy is a multiple of the alignment
1986and that both the source and destination pointers are aligned to that boundary.
1987</p>
1988
Chris Lattner0eb51b42004-02-12 18:10:10 +00001989<h5>Semantics:</h5>
1990
1991<p>
1992The '<tt>llvm.memmove</tt>' intrinsic copies a block of memory from the source
1993location to the destination location, which may overlap. It
1994copies "len" bytes of memory over. If the argument is known to be aligned to
1995some boundary, this can be specified as the fourth argument, otherwise it should
1996be set to 0 or 1.
1997</p>
1998</div>
1999
Chris Lattner8ff75902004-01-06 05:31:32 +00002000
Chris Lattner10610642004-02-14 04:08:35 +00002001<!-- _______________________________________________________________________ -->
2002<div class="doc_subsubsection">
2003 <a name="i_memset">'<tt>llvm.memset</tt>' Intrinsic</a>
2004</div>
2005
2006<div class="doc_text">
2007
2008<h5>Syntax:</h5>
2009<pre>
2010 call void (sbyte*, ubyte, uint, uint)* %llvm.memset(sbyte* &lt;dest&gt;, ubyte &lt;val&gt;,
2011 uint &lt;len&gt;, uint &lt;align&gt;)
2012</pre>
2013
2014<h5>Overview:</h5>
2015
2016<p>
2017The '<tt>llvm.memset</tt>' intrinsic fills a block of memory with a particular
2018byte value.
2019</p>
2020
2021<p>
2022Note that, unlike the standard libc function, the <tt>llvm.memset</tt> intrinsic
2023does not return a value, and takes an extra alignment argument.
2024</p>
2025
2026<h5>Arguments:</h5>
2027
2028<p>
2029The first argument is a pointer to the destination to fill, the second is the
2030byte value to fill it with, the third argument is an (arbitrarily sized) integer
2031argument specifying the number of bytes to fill, and the fourth argument is the
2032known alignment of destination location.
2033</p>
2034
2035<p>
2036If the call to this intrinisic has an alignment value that is not 0 or 1, then
2037the caller guarantees that the size of the copy is a multiple of the alignment
2038and that the destination pointer is aligned to that boundary.
2039</p>
2040
2041<h5>Semantics:</h5>
2042
2043<p>
2044The '<tt>llvm.memset</tt>' intrinsic fills "len" bytes of memory starting at the
2045destination location. If the argument is known to be aligned to some boundary,
2046this can be specified as the fourth argument, otherwise it should be set to 0 or
20471.
2048</p>
2049</div>
2050
2051
Chris Lattner8ff75902004-01-06 05:31:32 +00002052<!-- ======================================================================= -->
2053<div class="doc_subsection">
2054 <a name="int_debugger">Debugger Intrinsics</a>
2055</div>
2056
2057<div class="doc_text">
2058<p>
2059The LLVM debugger intrinsics (which all start with <tt>llvm.dbg.</tt> prefix),
2060are described in the <a
2061href="SourceLevelDebugging.html#format_common_intrinsics">LLVM Source Level
2062Debugging</a> document.
2063</p>
2064</div>
2065
2066
Chris Lattner00950542001-06-06 20:29:01 +00002067<!-- *********************************************************************** -->
Chris Lattner00950542001-06-06 20:29:01 +00002068<hr>
Misha Brukmandaa4cb02004-03-01 17:47:27 +00002069<address>
2070 <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
2071 src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
2072 <a href="http://validator.w3.org/check/referer"><img
2073 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /></a>
2074
2075 <a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
2076 <a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a><br>
2077 Last modified: $Date$
2078</address>
Misha Brukman9d0919f2003-11-08 01:05:38 +00002079</body>
2080</html>