+<!-- _______________________________________________________________________ -->
+<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 to build virtual function tables
+(which are structures of pointers to functions), for indirect function
+calls, and when defining a function.</p>
+<p>
+The return type of a function type cannot be an aggregate type.
+</p>
+<h5>Syntax:</h5>
+<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>
+<h5>Examples:</h5>
+<table class="layout">
+ <tr class="layout">
+ <td class="left">
+ <tt>int (int)</tt> <br/>
+ <tt>float (int, int *) *</tt><br/>
+ <tt>int (sbyte *, ...)</tt><br/>
+ </td>
+ <td class="left">
+ function taking an <tt>int</tt>, returning an <tt>int</tt><br/>
+ <a href="#t_pointer">Pointer</a> to a function that takes an
+ <tt>int</tt> and a <a href="#t_pointer">pointer</a> to <tt>int</tt>,
+ returning <tt>float</tt>.<br/>
+ A vararg function that takes at least one <a href="#t_pointer">pointer</a>
+ to <tt>sbyte</tt> (signed char in C), which returns an integer. This is
+ the signature for <tt>printf</tt> in LLVM.<br/>
+ </td>
+ </tr>
+</table>
+
+</div>
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="t_struct">Structure Type</a> </div>
+<div class="doc_text">
+<h5>Overview:</h5>
+<p>The structure type is used to represent a collection of data members
+together in memory. The packing of the field types is defined to match
+the ABI of the underlying processor. The elements of a structure may
+be any type that has a size.</p>
+<p>Structures are accessed using '<tt><a href="#i_load">load</a></tt>
+and '<tt><a href="#i_store">store</a></tt>' by getting a pointer to a
+field with the '<tt><a href="#i_getelementptr">getelementptr</a></tt>'
+instruction.</p>
+<h5>Syntax:</h5>
+<pre> { <type list> }<br></pre>
+<h5>Examples:</h5>
+<table class="layout">
+ <tr class="layout">
+ <td class="left">
+ <tt>{ int, int, int }</tt><br/>
+ <tt>{ float, int (int) * }</tt><br/>
+ </td>
+ <td class="left">
+ a triple of three <tt>int</tt> values<br/>
+ A pair, where the first element is a <tt>float</tt> and the second element
+ is a <a href="#t_pointer">pointer</a> to a <a href="#t_function">function</a>
+ that takes an <tt>int</tt>, returning an <tt>int</tt>.<br/>
+ </td>
+ </tr>
+</table>
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="t_pointer">Pointer Type</a> </div>
+<div class="doc_text">
+<h5>Overview:</h5>
+<p>As in many languages, the pointer type represents a pointer or
+reference to another object, which must live in memory.</p>
+<h5>Syntax:</h5>
+<pre> <type> *<br></pre>
+<h5>Examples:</h5>
+<table class="layout">
+ <tr class="layout">
+ <td class="left">
+ <tt>[4x int]*</tt><br/>
+ <tt>int (int *) *</tt><br/>
+ </td>
+ <td class="left">
+ A <a href="#t_pointer">pointer</a> to <a href="#t_array">array</a> of
+ four <tt>int</tt> values<br/>
+ A <a href="#t_pointer">pointer</a> to a <a
+ href="#t_function">function</a> that takes an <tt>int*</tt>, returning an
+ <tt>int</tt>.<br/>
+ </td>
+ </tr>
+</table>
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="t_packed">Packed Type</a> </div>
+<div class="doc_text">
+
+<h5>Overview:</h5>
+
+<p>A packed type is a simple derived type that represents a vector
+of elements. Packed types are used when multiple primitive data
+are operated in parallel using a single instruction (SIMD).
+A packed type requires a size (number of
+elements) and an underlying primitive data type. Vectors must have a power
+of two length (1, 2, 4, 8, 16 ...). Packed types are
+considered <a href="#t_firstclass">first class</a>.</p>
+
+<h5>Syntax:</h5>
+
+<pre>
+ < <# elements> x <elementtype> >
+</pre>
+
+<p>The number of elements is a constant integer value; elementtype may
+be any integral or floating point type.</p>
+
+<h5>Examples:</h5>
+
+<table class="layout">
+ <tr class="layout">
+ <td class="left">
+ <tt><4 x int></tt><br/>
+ <tt><8 x float></tt><br/>
+ <tt><2 x uint></tt><br/>
+ </td>
+ <td class="left">
+ Packed vector of 4 integer values.<br/>
+ Packed vector of 8 floating-point values.<br/>
+ Packed vector of 2 unsigned integer values.<br/>
+ </td>
+ </tr>
+</table>
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="t_opaque">Opaque Type</a> </div>
+<div class="doc_text">
+
+<h5>Overview:</h5>
+
+<p>Opaque types are used to represent unknown types in the system. This
+corresponds (for example) to the C notion of a foward declared structure type.
+In LLVM, opaque types can eventually be resolved to any type (not just a
+structure type).</p>
+
+<h5>Syntax:</h5>
+
+<pre>
+ opaque
+</pre>
+
+<h5>Examples:</h5>
+
+<table class="layout">
+ <tr class="layout">
+ <td class="left">
+ <tt>opaque</tt>
+ </td>
+ <td class="left">
+ An opaque type.<br/>
+ </td>
+ </tr>
+</table>
+</div>
+
+
+<!-- *********************************************************************** -->
+<div class="doc_section"> <a name="constants">Constants</a> </div>
+<!-- *********************************************************************** -->
+
+<div class="doc_text">
+
+<p>LLVM has several different basic types of constants. This section describes
+them all and their syntax.</p>
+
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsection"><a name="simpleconstants">Simple Constants</a></div>
+
+<div class="doc_text">
+
+<dl>
+ <dt><b>Boolean constants</b></dt>
+
+ <dd>The two strings '<tt>true</tt>' and '<tt>false</tt>' are both valid
+ constants of the <tt><a href="#t_primitive">bool</a></tt> type.
+ </dd>
+
+ <dt><b>Integer constants</b></dt>
+
+ <dd>Standard integers (such as '4') are constants of the <a
+ href="#t_integer">integer</a> type. Negative numbers may be used with signed
+ integer types.
+ </dd>
+
+ <dt><b>Floating point constants</b></dt>
+
+ <dd>Floating point constants use standard decimal notation (e.g. 123.421),
+ exponential notation (e.g. 1.23421e+2), or a more precise hexadecimal
+ notation (see below). Floating point constants must have a <a
+ href="#t_floating">floating point</a> type. </dd>
+
+ <dt><b>Null pointer constants</b></dt>
+
+ <dd>The identifier '<tt>null</tt>' is recognized as a null pointer constant
+ and must be of <a href="#t_pointer">pointer type</a>.</dd>
+
+</dl>
+
+<p>The one non-intuitive notation for constants is the optional hexadecimal 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>'. The only time hexadecimal floating point constants are required
+(and the only time that they are generated by the disassembler) is when a
+floating point constant must be emitted but it cannot be represented as a
+decimal floating point number. For example, NaN's, infinities, and other
+special values 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_subsection"><a name="aggregateconstants">Aggregate Constants</a>
+</div>
+
+<div class="doc_text">
+<p>Aggregate constants arise from aggregation of simple constants
+and smaller aggregate constants.</p>
+
+<dl>
+ <dt><b>Structure constants</b></dt>
+
+ <dd>Structure constants are represented with notation similar to structure
+ type definitions (a comma separated list of elements, surrounded by braces
+ (<tt>{}</tt>)). For example: "<tt>{ int 4, float 17.0, int* %G }</tt>",
+ where "<tt>%G</tt>" is declared as "<tt>%G = external global int</tt>". Structure constants
+ must have <a href="#t_struct">structure type</a>, and the number and
+ types of elements must match those specified by the type.
+ </dd>
+
+ <dt><b>Array constants</b></dt>
+
+ <dd>Array constants are represented with notation similar to array type
+ definitions (a comma separated list of elements, surrounded by square brackets
+ (<tt>[]</tt>)). For example: "<tt>[ int 42, int 11, int 74 ]</tt>". Array
+ constants must have <a href="#t_array">array type</a>, and the number and
+ types of elements must match those specified by the type.
+ </dd>
+
+ <dt><b>Packed constants</b></dt>
+
+ <dd>Packed constants are represented with notation similar to packed type
+ definitions (a comma separated list of elements, surrounded by
+ less-than/greater-than's (<tt><></tt>)). For example: "<tt>< int 42,
+ int 11, int 74, int 100 ></tt>". Packed constants must have <a
+ href="#t_packed">packed type</a>, and the number and types of elements must
+ match those specified by the type.
+ </dd>
+
+ <dt><b>Zero initialization</b></dt>
+
+ <dd>The string '<tt>zeroinitializer</tt>' can be used to zero initialize a
+ value to zero of <em>any</em> type, including scalar and aggregate types.
+ This is often used to avoid having to print large zero initializers (e.g. for
+ large arrays) and is always exactly equivalent to using explicit zero
+ initializers.
+ </dd>
+</dl>
+
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsection">
+ <a name="globalconstants">Global Variable and Function Addresses</a>
+</div>
+
+<div class="doc_text">
+
+<p>The addresses of <a href="#globalvars">global variables</a> and <a
+href="#functionstructure">functions</a> are always implicitly valid (link-time)
+constants. These constants are explicitly referenced when the <a
+href="#identifiers">identifier for the global</a> is used and always have <a
+href="#t_pointer">pointer</a> type. For example, the following is a legal LLVM
+file:</p>
+
+<pre>
+ %X = global int 17
+ %Y = global int 42
+ %Z = global [2 x int*] [ int* %X, int* %Y ]
+</pre>
+
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsection"><a name="undefvalues">Undefined Values</a></div>
+<div class="doc_text">
+ <p>The string '<tt>undef</tt>' is recognized as a type-less constant that has
+ no specific value. Undefined values may be of any type and be used anywhere
+ a constant is permitted.</p>
+
+ <p>Undefined values indicate to the compiler that the program is well defined
+ no matter what value is used, giving the compiler more freedom to optimize.
+ </p>
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsection"><a name="constantexprs">Constant Expressions</a>
+</div>
+
+<div class="doc_text">
+
+<p>Constant expressions are used to allow expressions involving other constants
+to be used as constants. Constant expressions may be of any <a
+href="#t_firstclass">first class</a> type and may involve any LLVM operation
+that does not have side effects (e.g. load and call are not supported). The
+following is the syntax for constant expressions:</p>
+
+<dl>
+ <dt><b><tt>cast ( CST to TYPE )</tt></b></dt>
+
+ <dd>Cast a constant to another type.</dd>
+
+ <dt><b><tt>getelementptr ( CSTPTR, IDX0, IDX1, ... )</tt></b></dt>
+
+ <dd>Perform the <a href="#i_getelementptr">getelementptr operation</a> on
+ constants. As with the <a href="#i_getelementptr">getelementptr</a>
+ instruction, the index list may have zero or more indexes, which are required
+ to make sense for the type of "CSTPTR".</dd>
+
+ <dt><b><tt>select ( COND, VAL1, VAL2 )</tt></b></dt>
+
+ <dd>Perform the <a href="#i_select">select operation</a> on
+ constants.
+
+ <dt><b><tt>extractelement ( VAL, IDX )</tt></b></dt>
+
+ <dd>Perform the <a href="#i_extractelement">extractelement
+ operation</a> on constants.
+
+ <dt><b><tt>insertelement ( VAL, ELT, IDX )</tt></b></dt>
+
+ <dd>Perform the <a href="#i_insertelement">insertelement
+ operation</a> on constants.
+
+
+ <dt><b><tt>shufflevector ( VEC1, VEC2, IDXMASK )</tt></b></dt>
+
+ <dd>Perform the <a href="#i_shufflevector">shufflevector
+ operation</a> on constants.
+
+ <dt><b><tt>OPCODE ( LHS, RHS )</tt></b></dt>
+
+ <dd>Perform the specified operation of the LHS and RHS constants. OPCODE may
+ be any of the <a href="#binaryops">binary</a> or <a href="#bitwiseops">bitwise
+ binary</a> operations. The constraints on operands are the same as those for
+ the corresponding instruction (e.g. no bitwise operations on floating point
+ values are allowed).</dd>
+</dl>
+</div>
+
+<!-- *********************************************************************** -->
+<div class="doc_section"> <a name="othervalues">Other Values</a> </div>
+<!-- *********************************************************************** -->
+
+<!-- ======================================================================= -->
+<div class="doc_subsection">
+<a name="inlineasm">Inline Assembler Expressions</a>
+</div>
+
+<div class="doc_text">
+
+<p>
+LLVM supports inline assembler expressions (as opposed to <a href="#moduleasm">
+Module-Level Inline Assembly</a>) through the use of a special value. This
+value represents the inline assembler as a string (containing the instructions
+to emit), a list of operand constraints (stored as a string), and a flag that
+indicates whether or not the inline asm expression has side effects. An example
+inline assembler expression is:
+</p>
+
+<pre>
+ int(int) asm "bswap $0", "=r,r"
+</pre>
+
+<p>
+Inline assembler expressions may <b>only</b> be used as the callee operand of
+a <a href="#i_call"><tt>call</tt> instruction</a>. Thus, typically we have:
+</p>
+
+<pre>
+ %X = call int asm "<a href="#i_bswap">bswap</a> $0", "=r,r"(int %Y)
+</pre>
+
+<p>
+Inline asms with side effects not visible in the constraint list must be marked
+as having side effects. This is done through the use of the
+'<tt>sideeffect</tt>' keyword, like so:
+</p>
+
+<pre>
+ call void asm sideeffect "eieio", ""()
+</pre>
+
+<p>TODO: The format of the asm and constraints string still need to be
+documented here. Constraints on what can be done (e.g. duplication, moving, etc
+need to be documented).
+</p>
+
+</div>
+
+<!-- *********************************************************************** -->
+<div class="doc_section"> <a name="instref">Instruction Reference</a> </div>
+<!-- *********************************************************************** -->
+
+<div class="doc_text">
+
+<p>The LLVM instruction set consists of several different
+classifications of instructions: <a href="#terminators">terminator
+instructions</a>, <a href="#binaryops">binary instructions</a>,
+<a href="#bitwiseops">bitwise binary instructions</a>, <a
+ href="#memoryops">memory instructions</a>, and <a href="#otherops">other
+instructions</a>.</p>
+
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsection"> <a name="terminators">Terminator
+Instructions</a> </div>
+
+<div class="doc_text">
+
+<p>As mentioned <a href="#functionstructure">previously</a>, every
+basic block in a program ends with a "Terminator" instruction, which
+indicates which block should be executed after the current block is
+finished. These terminator instructions typically yield a '<tt>void</tt>'
+value: they produce control flow, not values (the one exception being
+the '<a href="#i_invoke"><tt>invoke</tt></a>' instruction).</p>
+<p>There are six different terminator instructions: the '<a
+ href="#i_ret"><tt>ret</tt></a>' instruction, the '<a href="#i_br"><tt>br</tt></a>'
+instruction, the '<a href="#i_switch"><tt>switch</tt></a>' instruction,
+the '<a href="#i_invoke"><tt>invoke</tt></a>' instruction, the '<a
+ href="#i_unwind"><tt>unwind</tt></a>' instruction, and the '<a
+ href="#i_unreachable"><tt>unreachable</tt></a>' instruction.</p>
+
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="i_ret">'<tt>ret</tt>'
+Instruction</a> </div>
+<div class="doc_text">
+<h5>Syntax:</h5>
+<pre> ret <type> <value> <i>; Return a value from a non-void function</i>
+ ret void <i>; Return from void function</i>
+</pre>
+<h5>Overview:</h5>
+<p>The '<tt>ret</tt>' instruction is used to return control flow (and a
+value) from a function back to the caller.</p>
+<p>There are two forms of the '<tt>ret</tt>' instruction: one that
+returns a value and then causes control flow, and one that just causes
+control flow to occur.</p>
+<h5>Arguments:</h5>
+<p>The '<tt>ret</tt>' instruction may return any '<a
+ href="#t_firstclass">first class</a>' type. Notice that a function is
+not <a href="#wellformed">well formed</a> if there exists a '<tt>ret</tt>'
+instruction inside of the function that returns a value that does not
+match the return type of the function.</p>
+<h5>Semantics:</h5>
+<p>When the '<tt>ret</tt>' instruction is executed, control flow
+returns back to the calling function's context. If the caller is a "<a
+ href="#i_call"><tt>call</tt></a>" instruction, execution continues at
+the instruction after the call. If the caller was an "<a
+ href="#i_invoke"><tt>invoke</tt></a>" instruction, execution continues
+at the beginning of the "normal" destination block. If the instruction
+returns a value, that value shall set the call or invoke instruction's
+return value.</p>
+<h5>Example:</h5>
+<pre> ret int 5 <i>; Return an integer value of 5</i>
+ ret void <i>; Return from a void function</i>
+</pre>
+</div>
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="i_br">'<tt>br</tt>' Instruction</a> </div>
+<div class="doc_text">
+<h5>Syntax:</h5>
+<pre> br bool <cond>, label <iftrue>, label <iffalse><br> br label <dest> <i>; Unconditional branch</i>
+</pre>
+<h5>Overview:</h5>
+<p>The '<tt>br</tt>' instruction is used to cause control flow to
+transfer to a different basic block in the current function. There are
+two forms of this instruction, corresponding to a conditional branch
+and an unconditional branch.</p>
+<h5>Arguments:</h5>
+<p>The conditional branch form of the '<tt>br</tt>' instruction takes a
+single '<tt>bool</tt>' value and two '<tt>label</tt>' values. The
+unconditional form of the '<tt>br</tt>' instruction takes a single '<tt>label</tt>'
+value as a target.</p>
+<h5>Semantics:</h5>
+<p>Upon execution of a conditional '<tt>br</tt>' instruction, the '<tt>bool</tt>'
+argument is evaluated. If the value is <tt>true</tt>, control flows
+to the '<tt>iftrue</tt>' <tt>label</tt> argument. If "cond" is <tt>false</tt>,
+control flows to the '<tt>iffalse</tt>' <tt>label</tt> argument.</p>
+<h5>Example:</h5>
+<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
+ href="#i_ret">ret</a> int 1<br>IfUnequal:<br> <a href="#i_ret">ret</a> int 0<br></pre>
+</div>
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+ <a name="i_switch">'<tt>switch</tt>' Instruction</a>
+</div>
+
+<div class="doc_text">
+<h5>Syntax:</h5>
+
+<pre>
+ switch <intty> <value>, label <defaultdest> [ <intty> <val>, label <dest> ... ]
+</pre>
+
+<h5>Overview:</h5>
+
+<p>The '<tt>switch</tt>' instruction is used to transfer control flow to one of
+several different places. It is a generalization of the '<tt>br</tt>'
+instruction, allowing a branch to occur to one of many possible
+destinations.</p>
+
+
+<h5>Arguments:</h5>
+
+<p>The '<tt>switch</tt>' instruction uses three parameters: an integer
+comparison value '<tt>value</tt>', a default '<tt>label</tt>' destination, and
+an array of pairs of comparison value constants and '<tt>label</tt>'s. The
+table is not allowed to contain duplicate constant entries.</p>
+
+<h5>Semantics:</h5>
+
+<p>The <tt>switch</tt> instruction specifies a table of values and
+destinations. When the '<tt>switch</tt>' instruction is executed, this
+table is searched for the given value. If the value is found, control flow is
+transfered to the corresponding destination; otherwise, control flow is
+transfered to the default destination.</p>
+
+<h5>Implementation:</h5>
+
+<p>Depending on properties of the target machine and the particular
+<tt>switch</tt> instruction, this instruction may be code generated in different
+ways. For example, it could be generated as a series of chained conditional
+branches or with a lookup table.</p>
+
+<h5>Example:</h5>
+
+<pre>
+ <i>; Emulate a conditional br instruction</i>
+ %Val = <a href="#i_cast">cast</a> bool %value to int
+ switch int %Val, label %truedest [int 0, label %falsedest ]