aboutsummaryrefslogtreecommitdiffstats
path: root/docs/CodeGenerator.html
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-03-08 21:05:02 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-03-08 21:05:02 +0000
commitdc444e9a236c9e5a9a3a5e6da75f29f7000208d3 (patch)
tree7a3f1a198128fbf921c1e219fd8186c0a0ac00db /docs/CodeGenerator.html
parent9dcd6f14f8c559601fa2ad1ff168dcc236f7ce05 (diff)
downloadexternal_llvm-dc444e9a236c9e5a9a3a5e6da75f29f7000208d3.zip
external_llvm-dc444e9a236c9e5a9a3a5e6da75f29f7000208d3.tar.gz
external_llvm-dc444e9a236c9e5a9a3a5e6da75f29f7000208d3.tar.bz2
Add documentation on sibling call optimization. Rename tailcall2.ll test to sibcall.ll.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97980 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/CodeGenerator.html')
-rw-r--r--docs/CodeGenerator.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/docs/CodeGenerator.html b/docs/CodeGenerator.html
index 2be3185..f26d0ab 100644
--- a/docs/CodeGenerator.html
+++ b/docs/CodeGenerator.html
@@ -86,6 +86,7 @@
<li><a href="#targetimpls">Target-specific Implementation Notes</a>
<ul>
<li><a href="#tailcallopt">Tail call optimization</a></li>
+ <li><a href="#sibcallopt">Sibling call optimization</a></li>
<li><a href="#x86">The X86 backend</a></li>
<li><a href="#ppc">The PowerPC backend</a>
<ul>
@@ -1734,6 +1735,50 @@ define fastcc i32 @tailcaller(i32 %in1, i32 %in2) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
+ <a name="sibcallopt">Sibling call optimization</a>
+</div>
+
+<div class="doc_text">
+
+<p>Sibling call optimization is a restricted form of tail call optimization.
+ Unlike tail call optimization described in the previous section, it can be
+ performed automatically on any tail calls when <tt>-tailcallopt</tt> option
+ is not specified.</p>
+
+<p>Sibling call optimization is currently performed on x86/x86-64 when the
+ following constraints are met:</p>
+
+<ul>
+ <li>Caller and callee have the same calling convention. It can be either
+ <tt>c</tt> or <tt>fastcc</tt>.
+
+ <li>The call is a tail call - in tail position (ret immediately follows call
+ and ret uses value of call or is void).</li>
+
+ <li>Caller and callee have matching return type or the callee result is not
+ used.
+
+ <li>If any of the callee arguments are being passed in stack, they must be
+ available in caller's own incoming argument stack and the frame offsets
+ must be the same.
+</ul>
+
+<p>Example:</p>
+<div class="doc_code">
+<pre>
+declare i32 @bar(i32, i32)
+
+define i32 @foo(i32 %a, i32 %b, i32 %c) {
+entry:
+ %0 = tail call i32 @bar(i32 %a, i32 %b)
+ ret i32 %0
+}
+</pre>
+</div>
+
+</div>
+<!-- ======================================================================= -->
+<div class="doc_subsection">
<a name="x86">The X86 backend</a>
</div>