aboutsummaryrefslogtreecommitdiffstats
path: root/docs/LangRef.html
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-05-06 05:47:36 +0000
committerChris Lattner <sabre@nondot.org>2005-05-06 05:47:36 +0000
commit2bff524501f3438480541ba48edd8e76908e0bc4 (patch)
treed93f5cfdc25745ed81e548f2f37332043c563346 /docs/LangRef.html
parent19bdc03adcc2961248068e3dfbbb54edbe0430e0 (diff)
downloadexternal_llvm-2bff524501f3438480541ba48edd8e76908e0bc4.zip
external_llvm-2bff524501f3438480541ba48edd8e76908e0bc4.tar.gz
external_llvm-2bff524501f3438480541ba48edd8e76908e0bc4.tar.bz2
Add info on new 'tail' marker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21721 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/LangRef.html')
-rw-r--r--docs/LangRef.html48
1 files changed, 37 insertions, 11 deletions
diff --git a/docs/LangRef.html b/docs/LangRef.html
index fc586ed..df5cd9f 100644
--- a/docs/LangRef.html
+++ b/docs/LangRef.html
@@ -2041,26 +2041,43 @@ value argument, otherwise it returns the second value argument.
<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_call">'<tt>call</tt>'
-Instruction</a> </div>
+<div class="doc_subsubsection">
+ <a name="i_call">'<tt>call</tt>' Instruction</a>
+</div>
+
<div class="doc_text">
+
<h5>Syntax:</h5>
-<pre> &lt;result&gt; = call &lt;ty&gt;* &lt;fnptrval&gt;(&lt;param list&gt;)<br></pre>
+<pre>
+ &lt;result&gt; = [tail] call &lt;ty&gt;* &lt;fnptrval&gt;(&lt;param list&gt;)
+</pre>
+
<h5>Overview:</h5>
+
<p>The '<tt>call</tt>' instruction represents a simple function call.</p>
+
<h5>Arguments:</h5>
+
<p>This instruction requires several arguments:</p>
+
<ol>
<li>
- <p>'<tt>ty</tt>': shall be the signature of the pointer to function
-value being invoked. The argument types must match the types implied
-by this signature.</p>
+ <p>The "tail" marker indicates whether the callee function accesses any
+ allocas or varargs in the caller. If the "tail" marker is present, the
+ function call is eligible for tail call optimization. Note that calls may
+ be marked "tail" even if they do not occur before a <a
+ href="#i_ret"><tt>ret</tt></a> instruction.
+ </li>
+ <li>
+ <p>'<tt>ty</tt>': shall be the signature of the pointer to function value
+ being invoked. The argument types must match the types implied by this
+ signature.</p>
</li>
<li>
- <p>'<tt>fnptrval</tt>': An LLVM value containing a pointer to a
-function to be invoked. In most cases, this is a direct function
-invocation, but indirect <tt>call</tt>s are just as possible,
-calling an arbitrary pointer to function values.</p>
+ <p>'<tt>fnptrval</tt>': An LLVM value containing a pointer to a function to
+ be invoked. In most cases, this is a direct function invocation, but
+ indirect <tt>call</tt>s are just as possible, calling an arbitrary pointer
+ to function values.</p>
</li>
<li>
<p>'<tt>function args</tt>': argument list whose types match the
@@ -2070,7 +2087,9 @@ calling an arbitrary pointer to function values.</p>
arguments can be specified.</p>
</li>
</ol>
+
<h5>Semantics:</h5>
+
<p>The '<tt>call</tt>' instruction is used to cause control flow to
transfer to a specified function, with its incoming arguments bound to
the specified values. Upon a '<tt><a href="#i_ret">ret</a></tt>'
@@ -2078,8 +2097,15 @@ 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. This is a simpler case of
the <a href="#i_invoke">invoke</a> instruction.</p>
+
<h5>Example:</h5>
-<pre> %retval = call int %test(int %argc)<br> call int(sbyte*, ...) *%printf(sbyte* %msg, int 12, sbyte 42);<br></pre>
+
+<pre>
+ %retval = call int %test(int %argc)
+ call int(sbyte*, ...) *%printf(sbyte* %msg, int 12, sbyte 42);
+ %X = tail call int %foo()
+</pre>
+
</div>
<!-- _______________________________________________________________________ -->