<ol>
<li><a href="#i_icmp">'<tt>icmp</tt>' Instruction</a></li>
<li><a href="#i_fcmp">'<tt>fcmp</tt>' Instruction</a></li>
+ <li><a href="#i_vicmp">'<tt>vicmp</tt>' Instruction</a></li>
+ <li><a href="#i_vfcmp">'<tt>vfcmp</tt>' Instruction</a></li>
<li><a href="#i_phi">'<tt>phi</tt>' Instruction</a></li>
<li><a href="#i_select">'<tt>select</tt>' Instruction</a></li>
<li><a href="#i_call">'<tt>call</tt>' Instruction</a></li>
</div>
<div class="doc_text">
<p>Aliases act as "second name" for the aliasee value (which can be either
- function or global variable or bitcast of global value). Aliases may have an
- optional <a href="#linkage">linkage type</a>, and an
+ function, global variable, another alias or bitcast of global value). Aliases
+ may have an optional <a href="#linkage">linkage type</a>, and an
optional <a href="#visibility">visibility style</a>.</p>
<h5>Syntax:</h5>
<dt><tt>sret</tt></dt>
<dd>This indicates that the pointer parameter specifies the address of a
structure that is the return value of the function in the source program.
+ Loads and stores to the structure are assumed not to trap.
May only be applied to the first parameter.</dd>
<dt><tt>noalias</tt></dt>
an <tt>unreachable</tt> instruction immediately followed the call.</dd>
<dt><tt>nounwind</tt></dt>
- <dd>This function attribute indicates that the function type does not use
- the unwind instruction and does not allow stack unwinding to propagate
- through it.</dd>
-
+ <dd>This function attribute indicates that no exceptions unwind out of the
+ function. Usually this is because the function makes no use of exceptions,
+ but it may also be that the function catches any exceptions thrown when
+ executing it.</dd>
+
<dt><tt>nest</tt></dt>
<dd>This indicates that the parameter can be excised using the
<a href="#int_trampoline">trampoline intrinsics</a>.</dd>
<!-- _______________________________________________________________________ -->
<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>
+consists of a return type and a list of formal parameter types. The
+return type of a function type is a scalar type, a void type, or a struct type.
+If the return type is a struct type then all struct elements must be of first
+class types, and the struct must have at least one element.</p>
<h5>Syntax:</h5>
-<pre> <returntype list> (<parameter list>)<br></pre>
+
+<pre>
+ <returntype list> (<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>,
which indicates that the function takes a variable number of arguments.
href="#int_varargs">variable argument handling intrinsic</a> functions.
'<tt><returntype list></tt>' is a comma-separated list of
<a href="#t_firstclass">first class</a> type specifiers.</p>
+
<h5>Examples:</h5>
<table class="layout">
<tr class="layout">
which returns an integer. This is the signature for <tt>printf</tt> in
LLVM.
</td>
+ </tr><tr class="layout">
+ <td class="left"><tt>{i32, i32} (i32)</tt></td>
+ <td class="left">A function taking an <tt>i32></tt>, returning two
+ <tt> i32 </tt> values as an aggregate of type <tt>{ i32, i32 }</tt>
+ </td>
</tr>
</table>
<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>
+ notation (see below). The assembler requires the exact decimal value of
+ a floating-point constant. For example, the assembler accepts 1.25 but
+ rejects 1.3 because 1.3 is a repeating decimal in binary. Floating point
+ constants must have a <a href="#t_floating">floating point</a> type. </dd>
<dt><b>Null pointer constants</b></dt>
<dt><b><tt>fcmp COND ( VAL1, VAL2 )</tt></b></dt>
<dd>Performs the <a href="#i_fcmp">fcmp operation</a> on constants.</dd>
+ <dt><b><tt>vicmp COND ( VAL1, VAL2 )</tt></b></dt>
+ <dd>Performs the <a href="#i_vicmp">vicmp operation</a> on constants.</dd>
+
+ <dt><b><tt>vfcmp COND ( VAL1, VAL2 )</tt></b></dt>
+ <dd>Performs the <a href="#i_vfcmp">vfcmp operation</a> on constants.</dd>
+
<dt><b><tt>extractelement ( VAL, IDX )</tt></b></dt>
<dd>Perform the <a href="#i_extractelement">extractelement
ret void <i>; Return from void function</i>
ret <type> <value>, <type> <value> <i>; Return two values from a non-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
+returns value(s) 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 one or multiple values. The
-type of each return value must be a '<a href="#t_firstclass">first class</a>'
- type. Note 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 values that do not match the return type of the function.</p>
+
+<p>The '<tt>ret</tt>' instruction may return zero, one or multiple values.
+The type of each return value must be a '<a href="#t_firstclass">first
+class</a>' type. Note 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 values that do 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
return value. If the instruction returns multiple values then these
values can only be accessed through a '<a href="#i_getresult"><tt>getresult</tt>
</a>' instruction.</p>
+
<h5>Example:</h5>
-<pre> ret i32 5 <i>; Return an integer value of 5</i>
+
+<pre>
+ ret i32 5 <i>; Return an integer value of 5</i>
ret void <i>; Return from a void function</i>
ret i32 4, i8 2 <i>; Return two values 4 and 2 </i>
</pre>
<h5>Syntax:</h5>
<pre>
- <result> = invoke [<a href="#callingconv">cconv</a>] <ptr to function ty> %<function ptr val>(<function args>)
+ <result> = invoke [<a href="#callingconv">cconv</a>] <ptr to function ty> <function ptr val>(<function args>)
to label <normal label> unwind label <exception label>
</pre>
<h5>Example:</h5>
<pre>
- %retval = invoke i32 %Test(i32 15) to label %Continue
+ %retval = invoke i32 @Test(i32 15) to label %Continue
unwind label %TestCleanup <i>; {i32}:retval set</i>
- %retval = invoke <a href="#callingconv">coldcc</a> i32 %Test(i32 15) to label %Continue
+ %retval = invoke <a href="#callingconv">coldcc</a> i32 %Testfnptr(i32 15) to label %Continue
unwind label %TestCleanup <i>; {i32}:retval set</i>
</pre>
</div>
<h5>Semantics:</h5>
-<p>The '<tt>unwind</tt>' intrinsic causes execution of the current function to
+<p>The '<tt>unwind</tt>' instruction causes execution of the current function to
immediately halt. The dynamic call stack is then searched for the first <a
href="#i_invoke"><tt>invoke</tt></a> instruction on the call stack. Once found,
execution continues at the "exceptional" destination block specified by the
<div class="doc_subsection"> <a name="binaryops">Binary Operations</a> </div>
<div class="doc_text">
<p>Binary operators are used to do most of the computation in a
-program. They require two operands, execute an operation on them, and
+program. They require two operands of the same type, execute an operation on them, and
produce a single value. The operands might represent
multiple data, as is the case with the <a href="#t_vector">vector</a> data type.
-The result value of a binary operator is not
-necessarily the same type as its operands.</p>
+The result value has the same type as its operands.</p>
<p>There are several different binary operators:</p>
</div>
<!-- _______________________________________________________________________ -->
types. This instruction can also take <a href="#t_vector">vector</a> versions
of the values in which case the elements must be integers.</p>
<h5>Semantics:</h5>
-<p>The value produced is the signed integer quotient of the two operands.</p>
+<p>The value produced is the signed integer quotient of the two operands rounded towards zero.</p>
<p>Note that signed integer division and unsigned integer division are distinct
operations; for unsigned integer division, use '<tt>udiv</tt>'.</p>
<p>Division by zero leads to undefined behavior. Overflow also leads to
of the values in which case the elements must be integers.</p>
<h5>Semantics:</h5>
<p>This instruction returns the unsigned integer <i>remainder</i> of a division.
-This instruction always performs an unsigned division to get the remainder,
-regardless of whether the arguments are unsigned or not.</p>
+This instruction always performs an unsigned division to get the remainder.</p>
<p>Note that unsigned integer remainder and signed integer remainder are
distinct operations; for signed integer remainder, use '<tt>srem</tt>'.</p>
<p>Taking the remainder of a division by zero leads to undefined behavior.</p>
identical types. This instruction can also take <a href="#t_vector">vector</a>
versions of floating point values.</p>
<h5>Semantics:</h5>
-<p>This instruction returns the <i>remainder</i> of a division.</p>
+<p>This instruction returns the <i>remainder</i> of a division.
+The remainder has the same sign as the dividend.</p>
<h5>Example:</h5>
<pre> <result> = frem float 4.0, %var <i>; yields {float}:result = 4.0 % %var</i>
</pre>
<p>Bitwise binary operators are used to do various forms of
bit-twiddling in a program. They are generally very efficient
instructions and can commonly be strength reduced from other
-instructions. They require two operands, execute an operation on them,
-and produce a single value. The resulting value of the bitwise binary
-operators is always the same type as its first operand.</p>
+instructions. They require two operands of the same type, execute an operation on them,
+and produce a single value. The resulting value is the same type as its operands.</p>
</div>
<!-- _______________________________________________________________________ -->
<h5>Arguments:</h5>
<p>Both arguments to the '<tt>shl</tt>' instruction must be the same <a
- href="#t_integer">integer</a> type.</p>
+ href="#t_integer">integer</a> type. '<tt>var2</tt>' is treated as an
+unsigned value.</p>
<h5>Semantics:</h5>
-<p>The value produced is <tt>var1</tt> * 2<sup><tt>var2</tt></sup>. If
-<tt>var2</tt> is (statically or dynamically) equal to or larger than the number
-of bits in <tt>var1</tt>, the result is undefined.</p>
+<p>The value produced is <tt>var1</tt> * 2<sup><tt>var2</tt></sup> mod 2<sup>n</sup>,
+where n is the width of the result. If <tt>var2</tt> is (statically or dynamically) negative or
+equal to or larger than the number of bits in <tt>var1</tt>, the result is undefined.</p>
<h5>Example:</h5><pre>
<result> = shl i32 4, %var <i>; yields {i32}: 4 << %var</i>
<h5>Arguments:</h5>
<p>Both arguments to the '<tt>lshr</tt>' instruction must be the same
-<a href="#t_integer">integer</a> type.</p>
+<a href="#t_integer">integer</a> type. '<tt>var2</tt>' is treated as an
+unsigned value.</p>
<h5>Semantics:</h5>
<h5>Arguments:</h5>
<p>Both arguments to the '<tt>ashr</tt>' instruction must be the same
-<a href="#t_integer">integer</a> type.</p>
+<a href="#t_integer">integer</a> type. '<tt>var2</tt>' is treated as an
+unsigned value.</p>
<h5>Semantics:</h5>
<p>This instruction always performs an arithmetic shift right operation,
bytes of memory from the operating system and returns a pointer of the
appropriate type to the program. If "NumElements" is specified, it is the
number of elements allocated, otherwise "NumElements" is defaulted to be one.
-If an alignment is specified, the value result of the allocation is guaranteed to
+If a constant alignment is specified, the value result of the allocation is guaranteed to
be aligned to at least that boundary. If not specified, or if zero, the target can
choose to align the allocation on any convenient boundary.</p>
<h5>Semantics:</h5>
<p>Memory is allocated using the system "<tt>malloc</tt>" function, and
-a pointer is returned.</p>
+a pointer is returned. The result of a zero byte allocattion is undefined. The
+result is null if there is insufficient memory available.</p>
<h5>Example:</h5>
<h5>Semantics:</h5>
<p>Access to the memory pointed to by the pointer is no longer defined
-after this instruction executes.</p>
+after this instruction executes. If the pointer is null, the operation
+is a noop.</p>
<h5>Example:</h5>
bytes of memory on the runtime stack, returning a pointer of the
appropriate type to the program. If "NumElements" is specified, it is the
number of elements allocated, otherwise "NumElements" is defaulted to be one.
-If an alignment is specified, the value result of the allocation is guaranteed
+If a constant alignment is specified, the value result of the allocation is guaranteed
to be aligned to at least that boundary. If not specified, or if zero, the target
can choose to align the allocation on any convenient boundary.</p>
<h5>Semantics:</h5>
-<p>Memory is allocated; a pointer is returned. '<tt>alloca</tt>'d
+<p>Memory is allocated; a pointer is returned. The operation is undefiend if
+there is insufficient stack space for the allocation. '<tt>alloca</tt>'d
memory is automatically released when the function returns. The '<tt>alloca</tt>'
instruction is commonly used to represent automatic variables that must
have an address available. When the function returns (either with the <tt><a
href="#i_ret">ret</a></tt> or <tt><a href="#i_unwind">unwind</a></tt>
-instructions), the memory is reclaimed.</p>
+instructions), the memory is reclaimed. Allocating zero bytes
+is legal, but the result is undefined.</p>
<h5>Example:</h5>
volatile <tt>load</tt> and <tt><a href="#i_store">store</a></tt>
instructions. </p>
<p>
-The optional "align" argument specifies the alignment of the operation
+The optional constant "align" argument specifies the alignment of the operation
(that is, the alignment of the memory address). A value of 0 or an
omitted "align" argument means that the operation has the preferential
alignment for the target. It is the responsibility of the code emitter
<h5>Arguments:</h5>
<p>There are two arguments to the '<tt>store</tt>' instruction: a value
to store and an address at which to store it. The type of the '<tt><pointer></tt>'
-operand must be a pointer to the type of the '<tt><value></tt>'
+operand must be a pointer to the <a href="#t_firstclass">first class</a> type
+of the '<tt><value></tt>'
operand. If the <tt>store</tt> is marked as <tt>volatile</tt>, then the
optimizer is not allowed to modify the number or order of execution of
this <tt>store</tt> with other volatile <tt>load</tt> and <tt><a
href="#i_store">store</a></tt> instructions.</p>
<p>
-The optional "align" argument specifies the alignment of the operation
+The optional constant "align" argument specifies the alignment of the operation
(that is, the alignment of the memory address). A value of 0 or an
omitted "align" argument means that the operation has the preferential
alignment for the target. It is the responsibility of the code emitter
'<tt>getelementptr</tt>' instruction is used to index down through the type
levels of a structure or to a specific index in an array. When indexing into a
structure, only <tt>i32</tt> integer constants are allowed. When indexing
-into an array or pointer, only integers of 32 or 64 bits are allowed, and will
-be sign extended to 64-bit values.</p>
+into an array or pointer, only integers of 32 or 64 bits are allowed; 32-bit
+values will be sign extended to 64-bits if required.</p>
<p>For example, let's consider a C code fragment and how it gets
compiled to LLVM:</p>
on the pointer type that is being indexed into. <a href="#t_pointer">Pointer</a>
and <a href="#t_array">array</a> types can use a 32-bit or 64-bit
<a href="#t_integer">integer</a> type but the value will always be sign extended
-to 64-bits. <a href="#t_struct">Structure</a> types require <tt>i32</tt>
-<b>constants</b>.</p>
+to 64-bits. <a href="#t_struct">Structure</a> and <a href="#t_pstruct">packed
+structure</a> types require <tt>i32</tt> <b>constants</b>.</p>
<p>In the example above, the first index is indexing into the '<tt>%ST*</tt>'
type, which is a pointer, yielding a '<tt>%ST</tt>' = '<tt>{ i32, double, %RT
<p>Note that it is undefined to access an array out of bounds: array and
pointer indexes must always be within the defined bounds of the array type.
-The one exception for this rules is zero length arrays. These arrays are
+The one exception for this rule is zero length arrays. These arrays are
defined to be accessible as variable length arrays, which requires access
beyond the zero'th element.</p>
</pre>
<h5>Overview:</h5>
<p>The '<tt>icmp</tt>' instruction returns a boolean value based on comparison
-of its two integer operands.</p>
+of its two integer or pointer operands.</p>
<h5>Arguments:</h5>
<p>The '<tt>icmp</tt>' instruction takes three operands. The first operand is
the condition code indicating the kind of comparison to perform. It is not
<a href="#t_floating">floating point</a> typed. They must have identical
types.</p>
<h5>Semantics:</h5>
-<p>The '<tt>fcmp</tt>' compares <tt>var1</tt> and <tt>var2</tt> according to
-the condition code given as <tt>cond</tt>. The comparison performed always
-yields a <a href="#t_primitive">i1</a> result, as follows:
+<p>The '<tt>fcmp</tt>' instruction compares <tt>var1</tt> and <tt>var2</tt>
+according to the condition code given as <tt>cond</tt>. The comparison performed
+always yields a <a href="#t_primitive">i1</a> result, as follows:
<ol>
<li><tt>false</tt>: always yields <tt>false</tt>, regardless of operands.</li>
<li><tt>oeq</tt>: yields <tt>true</tt> if both operands are not a QNAN and
</pre>
</div>
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+ <a name="i_vicmp">'<tt>vicmp</tt>' Instruction</a>
+</div>
+<div class="doc_text">
+<h5>Syntax:</h5>
+<pre> <result> = vicmp <cond> <ty> <var1>, <var2> <i>; yields {ty}:result</i>
+</pre>
+<h5>Overview:</h5>
+<p>The '<tt>vicmp</tt>' instruction returns an integer vector value based on
+element-wise comparison of its two integer vector operands.</p>
+<h5>Arguments:</h5>
+<p>The '<tt>vicmp</tt>' instruction takes three operands. The first operand is
+the condition code indicating the kind of comparison to perform. It is not
+a value, just a keyword. The possible condition code are:
+<ol>
+ <li><tt>eq</tt>: equal</li>
+ <li><tt>ne</tt>: not equal </li>
+ <li><tt>ugt</tt>: unsigned greater than</li>
+ <li><tt>uge</tt>: unsigned greater or equal</li>
+ <li><tt>ult</tt>: unsigned less than</li>
+ <li><tt>ule</tt>: unsigned less or equal</li>
+ <li><tt>sgt</tt>: signed greater than</li>
+ <li><tt>sge</tt>: signed greater or equal</li>
+ <li><tt>slt</tt>: signed less than</li>
+ <li><tt>sle</tt>: signed less or equal</li>
+</ol>
+<p>The remaining two arguments must be <a href="#t_vector">vector</a> of
+<a href="#t_integer">integer</a> typed. They must also be identical types.</p>
+<h5>Semantics:</h5>
+<p>The '<tt>vicmp</tt>' instruction compares <tt>var1</tt> and <tt>var2</tt>
+according to the condition code given as <tt>cond</tt>. The comparison yields a
+<a href="#t_vector">vector</a> of <a href="#t_integer">integer</a> result, of
+identical type as the values being compared. The most significant bit in each
+element is 1 if the element-wise comparison evaluates to true, and is 0
+otherwise. All other bits of the result are undefined. The condition codes
+are evaluated identically to the <a href="#i_icmp">'<tt>icmp</tt>'
+instruction</a>.
+
+<h5>Example:</h5>
+<pre>
+ <result> = vicmp eq <2 x i32> < i32 4, i32 0 >, < i32 5, i32 0 > <i>; yields: result=<2 x i32> < i32 0, i32 -1 ></i>
+ <result> = vicmp ult <2 x i8> < i8 1, i8 2 >, < i8 2, i8 2> <i>; yields: result=<2 x i8> < i8 -1, i8 0 ></i>
+</pre>
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+ <a name="i_vfcmp">'<tt>vfcmp</tt>' Instruction</a>
+</div>
+<div class="doc_text">
+<h5>Syntax:</h5>
+<pre> <result> = vfcmp <cond> <ty> <var1>, <var2></pre>
+<h5>Overview:</h5>
+<p>The '<tt>vfcmp</tt>' instruction returns an integer vector value based on
+element-wise comparison of its two floating point vector operands. The output
+elements have the same width as the input elements.</p>
+<h5>Arguments:</h5>
+<p>The '<tt>vfcmp</tt>' instruction takes three operands. The first operand is
+the condition code indicating the kind of comparison to perform. It is not
+a value, just a keyword. The possible condition code are:
+<ol>
+ <li><tt>false</tt>: no comparison, always returns false</li>
+ <li><tt>oeq</tt>: ordered and equal</li>
+ <li><tt>ogt</tt>: ordered and greater than </li>
+ <li><tt>oge</tt>: ordered and greater than or equal</li>
+ <li><tt>olt</tt>: ordered and less than </li>
+ <li><tt>ole</tt>: ordered and less than or equal</li>
+ <li><tt>one</tt>: ordered and not equal</li>
+ <li><tt>ord</tt>: ordered (no nans)</li>
+ <li><tt>ueq</tt>: unordered or equal</li>
+ <li><tt>ugt</tt>: unordered or greater than </li>
+ <li><tt>uge</tt>: unordered or greater than or equal</li>
+ <li><tt>ult</tt>: unordered or less than </li>
+ <li><tt>ule</tt>: unordered or less than or equal</li>
+ <li><tt>une</tt>: unordered or not equal</li>
+ <li><tt>uno</tt>: unordered (either nans)</li>
+ <li><tt>true</tt>: no comparison, always returns true</li>
+</ol>
+<p>The remaining two arguments must be <a href="#t_vector">vector</a> of
+<a href="#t_floating">floating point</a> typed. They must also be identical
+types.</p>
+<h5>Semantics:</h5>
+<p>The '<tt>vfcmp</tt>' instruction compares <tt>var1</tt> and <tt>var2</tt>
+according to the condition code given as <tt>cond</tt>. The comparison yields a
+<a href="#t_vector">vector</a> of <a href="#t_integer">integer</a> result, with
+an identical number of elements as the values being compared, and each element
+having identical with to the width of the floating point elements. The most
+significant bit in each element is 1 if the element-wise comparison evaluates to
+true, and is 0 otherwise. All other bits of the result are undefined. The
+condition codes are evaluated identically to the
+<a href="#i_fcmp">'<tt>fcmp</tt>' instruction</a>.
+
+<h5>Example:</h5>
+<pre>
+ <result> = vfcmp oeq <2 x float> < float 4, float 0 >, < float 5, float 0 > <i>; yields: result=<2 x i32> < i32 0, i32 -1 ></i>
+ <result> = vfcmp ult <2 x double> < double 1, double 2 >, < double 2, double 2> <i>; yields: result=<2 x i64> < i64 -1, i64 0 ></i>
+</pre>
+</div>
+
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="i_phi">'<tt>phi</tt>'
Instruction</a> </div>
the specified values. Upon a '<tt><a href="#i_ret">ret</a></tt>'
instruction in the called function, control flow continues with the
instruction after the function call, and the return value of the
-function is bound to the result argument. If the '<tt><a href="#i_ret">ret</a>
-</tt>' instruction returns multiple values then the return values of the
-function are only accessible through a '<tt><a href="#i_getresult">getresult</a>
-</tt>' instruction. This is a simpler case of
-the <a href="#i_invoke">invoke</a> instruction.</p>
+function is bound to the result argument. If the callee returns multiple
+values then the return values of the function are only accessible through
+the '<tt><a href="#i_getresult">getresult</a></tt>' instruction.</p>
<h5>Example:</h5>
<pre>
%retval = call i32 @test(i32 %argc)
- call i32 (i8 *, ...)* @printf(i8 * %msg, i32 12, i8 42);
- %X = tail call i32 @foo()
- %Y = tail call <a href="#callingconv">fastcc</a> i32 @foo()
- %Z = call void %foo(i8 97 signext)
+ call i32 (i8 *, ...)* @printf(i8 * %msg, i32 12, i8 42) <i>; yields i32</i>
+ %X = tail call i32 @foo() <i>; yields i32</i>
+ %Y = tail call <a href="#callingconv">fastcc</a> i32 @foo() <i>; yields i32</i>
+ call void %foo(i8 97 signext)
%struct.A = type { i32, i8 }
- %r = call %struct.A @foo()
- %gr = getresult %struct.A %r, 0
- %gr1 = getresult %struct.A %r, 1
+ %r = call %struct.A @foo() <i>; yields { 32, i8 }</i>
+ %gr = getresult %struct.A %r, 0 <i>; yields i32</i>
+ %gr1 = getresult %struct.A %r, 1 <i>; yields i8</i>
</pre>
</div>
<h5>Syntax:</h5>
<pre>
- <resultval> = getresult <type> <retval>, <index>
+ <resultval> = getresult <type> <retval>, <index>
</pre>
+
<h5>Overview:</h5>
<p> The '<tt>getresult</tt>' instruction is used to extract individual values
-from multiple values returned by a '<tt><a href="#i_call">call</a></tt>'
-or '<tt><a href="#i_invoke">invoke</a></tt>' instruction.
+from a '<tt><a href="#i_call">call</a></tt>'
+or '<tt><a href="#i_invoke">invoke</a></tt>' instruction that returns multiple
+results.</p>
<h5>Arguments:</h5>
-The '<tt>getresult</tt>' instruction takes a return value as first argument.
-The value must have <a href="#t_struct">structure type</a>. The second argument
-is an unsigned index value.
+<p>The '<tt>getresult</tt>' instruction takes a call or invoke value as its
+first argument, or an undef value. The value must have <a
+href="#t_struct">structure type</a>. The second argument is a constant
+unsigned index value which must be in range for the number of values returned
+by the call.</p>
<h5>Semantics:</h5>
-The '<tt>getresult</tt>' instruction extracts the element identified by
-'<tt>index</tt>' from the aggregate value.
+<p>The '<tt>getresult</tt>' instruction extracts the element identified by
+'<tt>index</tt>' from the aggregate value.</p>
<h5>Example:</h5>
%struct.A = type { i32, i8 }
%r = call %struct.A @foo()
- %gr = getresult %struct.A %r, 0
- %gr1 = getresult %struct.A %r, 1
+ %gr = getresult %struct.A %r, 0 <i>; yields i32:%gr</i>
+ %gr1 = getresult %struct.A %r, 1 <i>; yields i8:%gr1</i>
add i32 %gr, 42
add i8 %gr1, 41
</pre>
<h5>Semantics:</h5>
-<p>At runtime, a call to this intrinsics stores a null pointer into the "ptrloc"
+<p>At runtime, a call to this intrinsic stores a null pointer into the "ptrloc"
location. At compile-time, the code generator generates information to allow
the runtime to find the pointer at GC safe points. The '<tt>llvm.gcroot</tt>'
intrinsic may only be used in a function which <a href="#gc">specifies a GC