Update the documentation for first-class aggregates changes,

and remove getresult and references thereto.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57064 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2008-10-04 19:00:07 +00:00
parent 4f993352ea
commit b1e6b969fe

View File

@ -153,7 +153,6 @@
<li><a href="#i_select">'<tt>select</tt>' Instruction</a></li>
<li><a href="#i_call">'<tt>call</tt>' Instruction</a></li>
<li><a href="#i_va_arg">'<tt>va_arg</tt>' Instruction</a></li>
<li><a href="#i_getresult">'<tt>getresult</tt>' Instruction</a></li>
</ol>
</li>
</ol>
@ -1899,27 +1898,30 @@ the '<a href="#i_invoke"><tt>invoke</tt></a>' instruction, the '<a
Instruction</a> </div>
<div class="doc_text">
<h5>Syntax:</h5>
<pre> ret &lt;type&gt; &lt;value&gt; <i>; Return a value from a non-void function</i>
<pre>
ret &lt;type&gt; &lt;value&gt; <i>; Return a value from a non-void function</i>
ret void <i>; Return from void function</i>
ret &lt;type&gt; &lt;value&gt;, &lt;type&gt; &lt;value&gt; <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>The '<tt>ret</tt>' instruction is used to return control flow (and
optionally a value) from a function back to the caller.</p>
<p>There are two forms of the '<tt>ret</tt>' instruction: one that
returns value(s) and then causes control flow, and one that just causes
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 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>
<p>The '<tt>ret</tt>' instruction optionally accepts a single argument,
the return value. The type of the return value must be a
'<a href="#t_firstclass">first class</a>' type.</p>
<p>A function is not <a href="#wellformed">well formed</a> if
it it has a non-void return type and contains a '<tt>ret</tt>'
instruction with no return value or a return value with a type that
does not match its type, or if it has a void return type and contains
a '<tt>ret</tt>' instruction with a return value.</p>
<h5>Semantics:</h5>
@ -1930,16 +1932,14 @@ 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. 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>
return value.
<h5>Example:</h5>
<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>
ret { i32, i8 } { i32 4, i8 2 } <i>; Return an aggregate of values 4 and 2</i>
</pre>
</div>
<!-- _______________________________________________________________________ -->
@ -2049,9 +2049,7 @@ function, with the possibility of control flow transfer to either the
"<tt><a href="#i_ret">ret</a></tt>" instruction, control flow will return to the
"normal" label. If the callee (or any indirect callees) returns with the "<a
href="#i_unwind"><tt>unwind</tt></a>" instruction, control is interrupted and
continued at the dynamically nearest "exception" label. If the callee function
returns multiple values then individual return values are only accessible through
a '<tt><a href="#i_getresult">getresult</a></tt>' instruction.</p>
continued at the dynamically nearest "exception" label.
<h5>Arguments:</h5>
@ -4289,9 +4287,7 @@ transfer to a specified function, with its incoming arguments bound to
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 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>
function is bound to the result argument.
<h5>Example:</h5>
@ -4304,8 +4300,8 @@ the '<tt><a href="#i_getresult">getresult</a></tt>' instruction.</p>
%struct.A = type { i32, i8 }
%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>
%gr = extractvalue %struct.A %r, 0 <i>; yields i32</i>
%gr1 = extractvalue %struct.A %r, 1 <i>; yields i8</i>
</pre>
</div>
@ -4358,52 +4354,6 @@ argument.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="i_getresult">'<tt>getresult</tt>' Instruction</a>
</div>
<div class="doc_text">
<h5>Syntax:</h5>
<pre>
&lt;resultval&gt; = getresult &lt;type&gt; &lt;retval&gt;, &lt;index&gt;
</pre>
<h5>Overview:</h5>
<p> The '<tt>getresult</tt>' instruction is used to extract individual values
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>
<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>
<p>The '<tt>getresult</tt>' instruction extracts the element identified by
'<tt>index</tt>' from the aggregate value.</p>
<h5>Example:</h5>
<pre>
%struct.A = type { i32, i8 }
%r = call %struct.A @foo()
%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>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"> <a name="intrinsics">Intrinsic Functions</a> </div>
<!-- *********************************************************************** -->