diff options
-rw-r--r-- | docs/LangRef.html | 2855 | ||||
-rw-r--r-- | docs/ProgrammersManual.html | 3292 | ||||
-rw-r--r-- | docs/llvm.css | 2 |
3 files changed, 2684 insertions, 3465 deletions
diff --git a/docs/LangRef.html b/docs/LangRef.html index 0b639c0099..05de0bd4cf 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -1,582 +1,508 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" - "http://www.w3.org/TR/html4/strict.dtd"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>LLVM Assembly Language Reference Manual</title> <link rel="stylesheet" href="llvm.css" type="text/css"> </head> <body> - -<div class="doc_title"> - LLVM Language Reference Manual -</div> - +<div class="doc_title"> LLVM Language Reference Manual </div> <ol> <li><a href="#abstract">Abstract</a></li> <li><a href="#introduction">Introduction</a></li> <li><a href="#identifiers">Identifiers</a></li> <li><a href="#typesystem">Type System</a> <ol> - <li><a href="#t_primitive">Primitive Types</a> - <ol> + <li><a href="#t_primitive">Primitive Types</a> + <ol> <li><a href="#t_classifications">Type Classifications</a></li> - </ol></li> + </ol> + </li> <li><a href="#t_derived">Derived Types</a> <ol> - <li><a href="#t_array" >Array Type</a></li> + <li><a href="#t_array">Array Type</a></li> <li><a href="#t_function">Function Type</a></li> <li><a href="#t_pointer">Pointer Type</a></li> - <li><a href="#t_struct" >Structure Type</a></li> - <!-- <li><a href="#t_packed" >Packed Type</a> --> - </ol></li> - </ol></li> + <li><a href="#t_struct">Structure Type</a></li> +<!-- <li><a href="#t_packed" >Packed Type</a> --> + </ol> + </li> + </ol> + </li> <li><a href="#highlevel">High Level Structure</a> <ol> <li><a href="#modulestructure">Module Structure</a></li> <li><a href="#globalvars">Global Variables</a></li> <li><a href="#functionstructure">Function Structure</a></li> - </ol></li> + </ol> + </li> <li><a href="#instref">Instruction Reference</a> <ol> <li><a href="#terminators">Terminator Instructions</a> <ol> - <li><a href="#i_ret" >'<tt>ret</tt>' Instruction</a></li> - <li><a href="#i_br" >'<tt>br</tt>' Instruction</a></li> + <li><a href="#i_ret">'<tt>ret</tt>' Instruction</a></li> + <li><a href="#i_br">'<tt>br</tt>' Instruction</a></li> <li><a href="#i_switch">'<tt>switch</tt>' Instruction</a></li> <li><a href="#i_invoke">'<tt>invoke</tt>' Instruction</a></li> - <li><a href="#i_unwind" >'<tt>unwind</tt>' Instruction</a></li> - </ol></li> + <li><a href="#i_unwind">'<tt>unwind</tt>' Instruction</a></li> + </ol> + </li> <li><a href="#binaryops">Binary Operations</a> <ol> - <li><a href="#i_add" >'<tt>add</tt>' Instruction</a></li> - <li><a href="#i_sub" >'<tt>sub</tt>' Instruction</a></li> - <li><a href="#i_mul" >'<tt>mul</tt>' Instruction</a></li> - <li><a href="#i_div" >'<tt>div</tt>' Instruction</a></li> - <li><a href="#i_rem" >'<tt>rem</tt>' Instruction</a></li> + <li><a href="#i_add">'<tt>add</tt>' Instruction</a></li> + <li><a href="#i_sub">'<tt>sub</tt>' Instruction</a></li> + <li><a href="#i_mul">'<tt>mul</tt>' Instruction</a></li> + <li><a href="#i_div">'<tt>div</tt>' Instruction</a></li> + <li><a href="#i_rem">'<tt>rem</tt>' Instruction</a></li> <li><a href="#i_setcc">'<tt>set<i>cc</i></tt>' Instructions</a></li> - </ol></li> + </ol> + </li> <li><a href="#bitwiseops">Bitwise Binary Operations</a> <ol> <li><a href="#i_and">'<tt>and</tt>' Instruction</a></li> - <li><a href="#i_or" >'<tt>or</tt>' Instruction</a></li> + <li><a href="#i_or">'<tt>or</tt>' Instruction</a></li> <li><a href="#i_xor">'<tt>xor</tt>' Instruction</a></li> <li><a href="#i_shl">'<tt>shl</tt>' Instruction</a></li> <li><a href="#i_shr">'<tt>shr</tt>' Instruction</a></li> - </ol></li> + </ol> + </li> <li><a href="#memoryops">Memory Access Operations</a> <ol> - <li><a href="#i_malloc" >'<tt>malloc</tt>' Instruction</a></li> - <li><a href="#i_free" >'<tt>free</tt>' Instruction</a></li> - <li><a href="#i_alloca" >'<tt>alloca</tt>' Instruction</a></li> - <li><a href="#i_load" >'<tt>load</tt>' Instruction</a></li> - <li><a href="#i_store" >'<tt>store</tt>' Instruction</a></li> - <li><a href="#i_getelementptr">'<tt>getelementptr</tt>' Instruction</a></li> - </ol></li> + <li><a href="#i_malloc">'<tt>malloc</tt>' Instruction</a></li> + <li><a href="#i_free">'<tt>free</tt>' Instruction</a></li> + <li><a href="#i_alloca">'<tt>alloca</tt>' Instruction</a></li> + <li><a href="#i_load">'<tt>load</tt>' Instruction</a></li> + <li><a href="#i_store">'<tt>store</tt>' Instruction</a></li> + <li><a href="#i_getelementptr">'<tt>getelementptr</tt>' Instruction</a></li> + </ol> + </li> <li><a href="#otherops">Other Operations</a> <ol> - <li><a href="#i_phi" >'<tt>phi</tt>' Instruction</a></li> + <li><a href="#i_phi">'<tt>phi</tt>' Instruction</a></li> <li><a href="#i_cast">'<tt>cast .. to</tt>' Instruction</a></li> - <li><a href="#i_call" >'<tt>call</tt>' Instruction</a></li> + <li><a href="#i_call">'<tt>call</tt>' Instruction</a></li> <li><a href="#i_vanext">'<tt>vanext</tt>' Instruction</a></li> - <li><a href="#i_vaarg" >'<tt>vaarg</tt>' Instruction</a></li> + <li><a href="#i_vaarg">'<tt>vaarg</tt>' Instruction</a></li> </ol> + </li> </ol> + </li> <li><a href="#intrinsics">Intrinsic Functions</a> - <ol> - <li><a href="#int_varargs">Variable Argument Handling Intrinsics</a> <ol> - <li><a href="#i_va_start">'<tt>llvm.va_start</tt>' Intrinsic</a></li> - <li><a href="#i_va_end" >'<tt>llvm.va_end</tt>' Intrinsic</a></li> - <li><a href="#i_va_copy" >'<tt>llvm.va_copy</tt>' Intrinsic</a></li> - </ol></li> - </ol></li> - + <li><a href="#int_varargs">Variable Argument Handling Intrinsics</a> + <ol> + <li><a href="#i_va_start">'<tt>llvm.va_start</tt>' Intrinsic</a></li> + <li><a href="#i_va_end">'<tt>llvm.va_end</tt>' Intrinsic</a></li> + <li><a href="#i_va_copy">'<tt>llvm.va_copy</tt>' Intrinsic</a></li> + </ol> + </li> + </ol> + </li> </ol> - <div class="doc_text"> - <p><b>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a> and <A href="mailto:vadve@cs.uiuc.edu">Vikram Adve</a></b><p> +<p><b>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a> +and <a href="mailto:vadve@cs.uiuc.edu">Vikram Adve</a></b></p> +<p> </p> </div> - <!-- *********************************************************************** --> -<div class="doc_section"> - <a name="abstract">Abstract -</div> +<div class="doc_section"> <a name="abstract">Abstract </a></div> <!-- *********************************************************************** --> - <div class="doc_text"> - -<p>This document is a reference manual for the LLVM assembly language. LLVM is -an SSA based representation that provides type safety, low-level operations, -flexibility, and the capability of representing 'all' high-level languages -cleanly. It is the common code representation used throughout all phases of the -LLVM compilation strategy.</p> - +<p>This document is a reference manual for the LLVM assembly language. +LLVM is an SSA based representation that provides type safety, +low-level operations, flexibility, and the capability of representing +'all' high-level languages cleanly. It is the common code +representation used throughout all phases of the LLVM compilation +strategy.</p> </div> - <!-- *********************************************************************** --> -<div class="doc_section"> - <a name="introduction">Introduction</a> -</div> +<div class="doc_section"> <a name="introduction">Introduction</a> </div> <!-- *********************************************************************** --> - <div class="doc_text"> - -<p>The LLVM code representation is designed to be used in three different forms: -as an in-memory compiler IR, as an on-disk bytecode representation (suitable for -fast loading by a Just-In-Time compiler), and as a human readable assembly -language representation. This allows LLVM to provide a powerful intermediate -representation for efficient compiler transformations and analysis, while -providing a natural means to debug and visualize the transformations. The three -different forms of LLVM are all equivalent. This document describes the human -readable representation and notation.</p> - -<p>The LLVM representation aims to be a light-weight and low-level while being -expressive, typed, and extensible at the same time. It aims to be a "universal -IR" of sorts, by being at a low enough level that high-level ideas may be -cleanly mapped to it (similar to how microprocessors are "universal IR's", -allowing many source languages to be mapped to them). By providing type -information, LLVM can be used as the target of optimizations: for example, -through pointer analysis, it can be proven that a C automatic variable is never -accessed outside of the current function... allowing it to be promoted to a -simple SSA value instead of a memory location.</p> - +<p>The LLVM code representation is designed to be used in three +different forms: as an in-memory compiler IR, as an on-disk bytecode +representation (suitable for fast loading by a Just-In-Time compiler), +and as a human readable assembly language representation. This allows +LLVM to provide a powerful intermediate representation for efficient +compiler transformations and analysis, while providing a natural means +to debug and visualize the transformations. The three different forms +of LLVM are all equivalent. This document describes the human readable +representation and notation.</p> +<p>The LLVM representation aims to be a light-weight and low-level +while being expressive, typed, and extensible at the same time. It +aims to be a "universal IR" of sorts, by being at a low enough level +that high-level ideas may be cleanly mapped to it (similar to how +microprocessors are "universal IR's", allowing many source languages to +be mapped to them). By providing type information, LLVM can be used as +the target of optimizations: for example, through pointer analysis, it +can be proven that a C automatic variable is never accessed outside of +the current function... allowing it to be promoted to a simple SSA +value instead of a memory location.</p> </div> - <!-- _______________________________________________________________________ --> -<div class="doc_subsubsection"> - <a name="wellformed">Well-Formedness</a> -</div> - +<div class="doc_subsubsection"> <a name="wellformed">Well-Formedness</a> </div> <div class="doc_text"> - -<p>It is important to note that this document describes 'well formed' LLVM -assembly language. There is a difference between what the parser accepts and -what is considered 'well formed'. For example, the following instruction is -syntactically okay, but not well formed:</p> - -<pre> - %x = <a href="#i_add">add</a> int 1, %x -</pre> - -<p>...because the definition of <tt>%x</tt> does not dominate all of its uses. -The LLVM infrastructure provides a verification pass that may be used to verify -that an LLVM module is well formed. This pass is automatically run by the -parser after parsing input assembly, and by the optimizer before it outputs -bytecode. The violations pointed out by the verifier pass indicate bugs in -transformation passes or input to the parser.</p> - -<!-- Describe the typesetting conventions here. --> - -</div> - +<p>It is important to note that this document describes 'well formed' +LLVM assembly language. There is a difference between what the parser +accepts and what is considered 'well formed'. For example, the +following instruction is syntactically okay, but not well formed:</p> +<pre> %x = <a href="#i_add">add</a> int 1, %x<br></pre> +<p>...because the definition of <tt>%x</tt> does not dominate all of +its uses. The LLVM infrastructure provides a verification pass that may +be used to verify that an LLVM module is well formed. This pass is +automatically run by the parser after parsing input assembly, and by +the optimizer before it outputs bytecode. The violations pointed out +by the verifier pass indicate bugs in transformation passes or input to +the parser.</p> +<!-- Describe the typesetting conventions here. --> </div> <!-- *********************************************************************** --> -<div class="doc_section"> - <a name="identifiers">Identifiers</a> -</div> +<div class="doc_section"> <a name="identifiers">Identifiers</a> </div> <!-- *********************************************************************** --> - <div class="doc_text"> - -<p>LLVM uses three different forms of identifiers, for different purposes:</p> - +<p>LLVM uses three different forms of identifiers, for different +purposes:</p> <ol> - - <li>Numeric constants are represented as you would expect: 12, -3 123.421, - etc. Floating point constants have an optional hexidecimal notation.</li> - - <li>Named values are represented as a string of characters with a '%' prefix. - For example, %foo, %DivisionByZero, %a.really.long.identifier. The actual - regular expression used is '<tt>%[a-zA-Z$._][a-zA-Z$._0-9]*</tt>'. - Identifiers which require other characters in their names can be surrounded - with quotes. In this way, anything except a <tt>"</tt> character can be used - in a name.</li> - - <li>Unnamed values are represented as an unsigned numeric value with a '%' - prefix. For example, %12, %2, %44.</li> - + <li>Numeric constants are represented as you would expect: 12, -3 +123.421, etc. Floating point constants have an optional hexidecimal +notation.</li> + <li>Named values are represented as a string of characters with a '%' +prefix. For example, %foo, %DivisionByZero, +%a.really.long.identifier. The actual regular expression used is '<tt>%[a-zA-Z$._][a-zA-Z$._0-9]*</tt>'. +Identifiers which require other characters in their names can be +surrounded with quotes. In this way, anything except a <tt>"</tt> +character can be used in a name.</li> + <li>Unnamed values are represented as an unsigned numeric value with +a '%' prefix. For example, %12, %2, %44.</li> </ol> - -<p>LLVM requires the values start with a '%' sign for two reasons: Compilers -don't need to worry about name clashes with reserved words, and the set of -reserved words may be expanded in the future without penalty. Additionally, -unnamed identifiers allow a compiler to quickly come up with a temporary -variable without having to avoid symbol table conflicts.</p> - -<p>Reserved words in LLVM are very similar to reserved words in other languages. -There are keywords for different opcodes ('<tt><a href="#i_add">add</a></tt>', -'<tt><a href="#i_cast">cast</a></tt>', '<tt><a href="#i_ret">ret</a></tt>', -etc...), for primitive type names ('<tt><a href="#t_void">void</a></tt>', -'<tt><a href="#t_uint">uint</a></tt>', etc...), and others. These reserved -words cannot conflict with variable names, because none of them start with a '%' -character.</p> - -<p>Here is an example of LLVM code to multiply the integer variable -'<tt>%X</tt>' by 8:</p> - +<p>LLVM requires the values start with a '%' sign for two reasons: +Compilers don't need to worry about name clashes with reserved words, +and the set of reserved words may be expanded in the future without +penalty. Additionally, unnamed identifiers allow a compiler to quickly +come up with a temporary variable without having to avoid symbol table +conflicts.</p> +<p>Reserved words in LLVM are very similar to reserved words in other +languages. There are keywords for different opcodes ('<tt><a + href="#i_add">add</a></tt>', '<tt><a href="#i_cast">cast</a></tt>', '<tt><a + href="#i_ret">ret</a></tt>', etc...), for primitive type names ('<tt><a + href="#t_void">void</a></tt>', '<tt><a href="#t_uint">uint</a></tt>', +etc...), and others. These reserved words cannot conflict with +variable names, because none of them start with a '%' character.</p> +<p>Here is an example of LLVM code to multiply the integer variable '<tt>%X</tt>' +by 8:</p> <p>The easy way:</p> - -<pre> - %result = <a href="#i_mul">mul</a> uint %X, 8 -</pre> - +<pre> %result = <a href="#i_mul">mul</a> uint %X, 8<br></pre> <p>After strength reduction:</p> - -<pre> - %result = <a href="#i_shl">shl</a> uint %X, ubyte 3 -</pre> - +<pre> %result = <a href="#i_shl">shl</a> uint %X, ubyte 3<br></pre> <p>And the hard way:</p> - -<pre> - <a href="#i_add">add</a> uint %X, %X <i>; yields {uint}:%0</i> - <a href="#i_add">add</a> uint %0, %0 <i>; yields {uint}:%1</i> - %result = <a href="#i_add">add</a> uint %1, %1 -</pre> - -<p>This last way of multiplying <tt>%X</tt> by 8 illustrates several important -lexical features of LLVM:</p> - +<pre> <a href="#i_add">add</a> uint %X, %X <i>; yields {uint}:%0</i> + <a + href="#i_add">add</a> uint %0, %0 <i>; yields {uint}:%1</i> + %result = <a + href="#i_add">add</a> uint %1, %1<br></pre> +<p>This last way of multiplying <tt>%X</tt> by 8 illustrates several +important lexical features of LLVM:</p> <ol> - <li>Comments are delimited with a '<tt>;</tt>' and go until the end of - line.</li> - - <li>Unnamed temporaries are created when the result of a computation is not - assigned to a named value.</li> - + <li>Comments are delimited with a '<tt>;</tt>' and go until the end +of line.</li> + <li>Unnamed temporaries are created when the result of a computation +is not assigned to a named value.</li> <li>Unnamed temporaries are numbered sequentially</li> </ol> - -<p>...and it also show a convention that we follow in this document. When -demonstrating instructions, we will follow an instruction with a comment that -defines the type and name of value produced. Comments are shown in italic -text.</p> - -<p>The one non-intuitive notation for constants is the optional hexidecimal form -of floating point constants. For example, the form '<tt>double +<p>...and it also show a convention that we follow in this document. +When demonstrating instructions, we will follow an instruction with a +comment that defines the type and name of value produced. Comments are +shown in italic text.</p> +<p>The one non-intuitive notation for constants is the optional +hexidecimal form of floating point constants. For example, the form '<tt>double 0x432ff973cafa8000</tt>' is equivalent to (but harder to read than) '<tt>double -4.5e+15</tt>' which is also supported by the parser. The only time hexadecimal -floating point constants are useful (and the only time that they are generated -by the disassembler) is when an FP constant has to be emitted that is not -representable as a decimal floating point number exactly. For example, NaN's, -infinities, and other special cases are represented in their IEEE hexadecimal -format so that assembly and disassembly do not cause any bits to change in the -constants.</p> - +4.5e+15</tt>' which is also supported by the parser. The only time +hexadecimal floating point constants are useful (and the only time that +they are generated by the disassembler) is when an FP constant has to +be emitted that is not representable as a decimal floating point number +exactly. For example, NaN's, infinities, and other special cases are +represented in their IEEE hexadecimal format so that assembly and +disassembly do not cause any bits to change in the constants.</p> </div> - <!-- *********************************************************************** --> -<div class="doc_section"> - <a name="typesystem">Type System</a> -</div> +<div class="doc_section"> <a name="typesystem">Type System</a> </div> <!-- *********************************************************************** --> - <div class="doc_text"> - <p>The LLVM type system is one of the most important features of the -intermediate representation. Being typed enables a number of optimizations to -be performed on the IR directly, without having to do extra analyses on the side -before the transformation. A strong type system makes it easier to read the -generated code and enables novel analyses and transformations that are not -feasible to perform on normal three address code representations.</p> - +intermediate representation. Being typed enables a number of +optimizations to be performed on the IR directly, without having to do +extra analyses on the side before the transformation. A strong type +system makes it easier to read the generated code and enables novel +analyses and transformations that are not feasible to perform on normal +three address code representations.</p> <!-- The written form for the type system was heavily influenced by the syntactic problems with types in the C language<sup><a -href="#rw_stroustrup">1</a></sup>.<p> --> - -</div> - +href="#rw_stroustrup">1</a></sup>.<p> --> </div> <!-- ======================================================================= --> -<div class="doc_subsection"> - <a name="t_primitive">Primitive Types</a> -</div> - +<div class="doc_subsection"> <a name="t_primitive">Primitive Types</a> </div> <div class="doc_text"> - -<p>The primitive types are the fundemental building blocks of the LLVM system. -The current set of primitive types are as follows:</p> - +<p>The primitive types are the fundemental building blocks of the LLVM +system. The current set of primitive types are as follows:</p> <p> <table border="0" align="center"> -<tr> -<td> - -<table border="1" cellspacing="0" cellpadding="4" align="center"> -<tr><td><tt>void</tt></td> <td>No value</td></tr> -<tr><td><tt>ubyte</tt></td> <td>Unsigned 8 bit value</td></tr> -<tr><td><tt>ushort</tt></td><td>Unsigned 16 bit value</td></tr> -<tr><td><tt>uint</tt></td> <td>Unsigned 32 bit value</td></tr> -<tr><td><tt>ulong</tt></td> <td>Unsigned 64 bit value</td></tr> -<tr><td><tt>float</tt></td> <td>32 bit floating point value</td></tr> -<tr><td><tt>label</tt></td> <td>Branch destination</td></tr> -</table> - -</td><td valign=top> - -<table border="1" cellspacing="0" cellpadding="4" align=center"> -<tr><td><tt>bool</tt></td> <td>True or False value</td></tr> -<tr><td><tt>sbyte</tt></td> <td>Signed 8 bit value</td></tr> -<tr><td><tt>short</tt></td> <td>Signed 16 bit value</td></tr> -<tr><td><tt>int</tt></td> <td>Signed 32 bit value</td></tr> -<tr><td><tt>long</tt></td> <td>Signed 64 bit value</td></tr> -<tr><td><tt>double</tt></td><td>64 bit floating point value</td></tr> -</table> - -</td> -</tr> + <tbody> + <tr> + <td> + <table border="1" cellspacing="0" cellpadding="4" align="center"> + <tbody> + <tr> + <td><tt>void</tt></td> + <td>No value</td> + </tr> + <tr> + <td><tt>ubyte</tt></td> + <td>Unsigned 8 bit value</td> + </tr> + <tr> + <td><tt>ushort</tt></td> + <td>Unsigned 16 bit value</td> + </tr> + <tr> + <td><tt>uint</tt></td> + <td>Unsigned 32 bit value</td> + </tr> + <tr> + <td><tt>ulong</tt></td> + <td>Unsigned 64 bit value</td> + </tr> + <tr> + <td><tt>float</tt></td> + <td>32 bit floating point value</td> + </tr> + <tr> + <td><tt>label</tt></td> + <td>Branch destination</td> + </tr> + </tbody> + </table> + </td> + <td valign="top"> + <table border="1" cellspacing="0" cellpadding="4" align="center""> + <tbody> + <tr> + <td><tt>bool</tt></td> + <td>True or False value</td> + </tr> + <tr> + <td><tt>sbyte</tt></td> + <td>Signed 8 bit value</td> + </tr> + <tr> + <td><tt>short</tt></td> + <td>Signed 16 bit value</td> + </tr> + <tr> + <td><tt>int</tt></td> + <td>Signed 32 bit value</td> + </tr> + <tr> + <td><tt>long</tt></td> + <td>Signed 64 bit value</td> + </tr> + <tr> + <td><tt>double</tt></td> + <td>64 bit floating point value</td> + </tr> + </tbody> + </table> + </td> + </tr> + </tbody> </table> </p> - </div> - <!-- _______________________________________________________________________ --> -<div class="doc_subsubsection"> - <a name="t_classifications">Type Classifications</a> -</div> - +<div class="doc_subsubsection"> <a name="t_classifications">Type +Classifications</a> </div> <div class="doc_text"> - -<p>These different primitive types fall into a few useful classifications:</p> - +<p>These different primitive types fall into a few useful +classifications:</p> <p> <table border="1" cellspacing="0" cellpadding="4" align="center"> -<tr> - <td><a name="t_signed">signed</td> - <td><tt>sbyte, short, int, long, float, double</tt></td> -</tr> -<tr> - <td><a name="t_unsigned">unsigned</td> - <td><tt>ubyte, ushort, uint, ulong</tt></td> -</tr> -<tr> - <td><a name="t_integer">integer</td> - <td><tt>ubyte, sbyte, ushort, short, uint, int, ulong, long</tt></td> -</tr> -<tr> - <td><a name="t_integral">integral</td> - <td><tt>bool, ubyte, sbyte, ushort, short, uint, int, ulong, long</tt></td> -</tr> -<tr> - <td><a name="t_floating">floating point</td> - <td><tt>float, double</tt></td> -</tr> -<tr> - <td><a name="t_firstclass">first class</td> - <td><tt>bool, ubyte, sbyte, ushort, short,<br> - uint, int, ulong, long, float, double, - <a href="#t_pointer">pointer</a></tt></td> -</tr> + <tbody> + <tr> + <td><a name="t_signed">signed</a></td> + <td><tt>sbyte, short, int, long, float, double</tt></td> + </tr> + <tr> + <td><a name="t_unsigned">unsigned</a></td> + <td><tt>ubyte, ushort, uint, ulong</tt></td> + </tr> + <tr> + <td><a name="t_integer">integer</a></td> + <td><tt>ubyte, sbyte, ushort, short, uint, int, ulong, long</tt></td> + </tr> + <tr> + <td><a name="t_integral">integral</a></td> + <td><tt>bool, ubyte, sbyte, ushort, short, uint, int, ulong, long</tt></td> + </tr> + <tr> + <td><a name="t_floating">floating point</a></td> + <td><tt>float, double</tt></td> + </tr> + <tr> + <td><a name="t_firstclass">first class</a></td> + <td><tt>bool, ubyte, sbyte, ushort, short,<br> +uint, int, ulong, long, float, double, <a href="#t_pointer">pointer</a></tt></td> + </tr> + </tbody> </table> </p> - -<p>The <a href="#t_firstclass">first class</a> types are perhaps the most -important. Values of these types are the only ones which can be produced by -instructions, passed as arguments, or used as operands to instructions. This -means that all structures and arrays must be manipulated either by pointer or by -component.</p> - +<p>The <a href="#t_firstclass">first class</a> types are perhaps the +most important. Values of these types are the only ones which can be +produced by instructions, passed as arguments, or used as operands to +instructions. This means that all structures and arrays must be +manipulated either by pointer or by component.</p> </div> - <!-- ======================================================================= --> -<div class="doc_subsection"> - <a name="t_derived">Derived Types</a> -</div> - +<div class="doc_subsection"> <a name="t_derived">Derived Types</a> </div> <div class="doc_text"> - -<p>The real power in LLVM comes from the derived types in the system. This is -what allows a programmer to represent arrays, functions, pointers, and other -useful types. Note that these derived types may be recursive: For example, it -is possible to have a two dimensional array.</p> - +<p>The real power in LLVM comes from the derived types in the system. +This is what allows a programmer to represent arrays, functions, +pointers, and other useful types. Note that these derived types may be +recursive: For example, it is possible to have a two dimensional array.</p> </div> - <!-- _______________________________________________________________________ --> -<div class="doc_subsubsection"> - <a name="t_array">Array Type</a> -</div> - +<div class="doc_subsubsection"> <a name="t_array">Array Type</a> </div> <div class="doc_text"> - <h5>Overview:</h5> - <p>The array type is a very simple derived type that arranges elements -sequentially in memory. The array type requires a size (number of elements) and -an underlying data type.</p> - +sequentially in memory. The array type requires a size (number of +elements) and an underlying data type.</p> <h5>Syntax:</h5> - -<pre> - [<# elements> x <elementtype>] -</pre> - -<p>The number of elements is a constant integer value, elementtype may be any -type with a size.</p> - +<pre> [<# elements> x <elementtype>]<br></pre> +<p>The number of elements is a constant integer value, elementtype may +be any type with a size.</p> <h5>Examples:</h5> - -<p> - <tt>[40 x int ]</tt>: Array of 40 integer values.<br> - <tt>[41 x int ]</tt>: Array of 41 integer values.<br> - <tt>[40 x uint]</tt>: Array of 40 unsigned integer values.<p> -</p> - +<p> <tt>[40 x int ]</tt>: Array of 40 integer values.<br> +<tt>[41 x int ]</tt>: Array of 41 integer values.<br> +<tt>[40 x uint]</tt>: Array of 40 unsigned integer values.</p> +<p> </p> <p>Here are some examples of multidimensional arrays:</p> - <p> <table border="0" cellpadding="0" cellspacing="0"> -<tr> - <td><tt>[3 x [4 x int]]</tt></td> - <td>: 3x4 array integer values.</td> -</tr> -<tr> - <td><tt>[12 x [10 x float]]</tt></td> - <td>: 12x10 array of single precision floating point values.</td> -</tr> -<tr> - <td><tt>[2 x [3 x [4 x uint]]]</tt></td> - <td>: 2x3x4 array of unsigned integer values.</td> -</tr> + <tbody> + <tr> + <td><tt>[3 x [4 x int]]</tt></td> + <td>: 3x4 array integer values.</td> + </tr> + <tr> + <td><tt>[12 x [10 x float]]</tt></td> + <td>: 12x10 array of single precision floating point values.</td> + </tr> + <tr> + <td><tt>[2 x [3 x [4 x uint]]]</tt></td> + <td>: 2x3x4 array of unsigned integer values.</td> + </tr> + </tbody> </table> </p> - </div> - <!-- _______________________________________________________________________ --> -<div class="doc_subsubsection"> - <a name="t_function">Function Type</a> -</div> - +<div class="doc_subsubsection"> <a name="t_function">Function Type</a> </div> <div class="doc_text"> - <h5>Overview:</h5> - -<p>The function type can be thought of as a function signature. It consists of -a return type and a list of formal parameter types. Function types are usually -used when to build virtual function tables (which are structures of pointers to -functions), for indirect function calls, and when defining a function.</p> - +<p>The function type can be thought of as a function signature. It +consists of a return type and a list of formal parameter types. +Function types are usually used when to build virtual function tables +(which are structures of pointers to functions), for indirect function +calls, and when defining a function.</p> <h5>Syntax:</h5> - -<pre> - <returntype> (<parameter list>) -</pre> - -<p>Where '<tt><parameter list></tt>' is a comma-separated list of type -specifiers. Optionally, the parameter list may include a type <tt>...</tt>, +<pre> <returntype> (<parameter list>)<br></pre> +<p>Where '<tt><parameter list></tt>' is a comma-separated list of +type specifiers. Optionally, the parameter list may include a type <tt>...</tt>, which indicates that the function takes a variable number of arguments. Variable argument functions can access their arguments with the <a -href="#int_varargs">variable argument handling intrinsic</a> functions.</p> - + href="#int_varargs">variable argument handling intrinsic</a> functions.</p> <h5>Examples:</h5> - <p> <table border="0" cellpadding="0" cellspacing="0"> - -<tr> |