summaryrefslogtreecommitdiffstats
path: root/llvm/docs/LangRef.rst
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2019-10-07 22:28:58 +0000
committerReid Kleckner <rnk@google.com>2019-10-07 22:28:58 +0000
commitf9b67b810e2d413606b0d5891ed9477d819bcab9 (patch)
treef5bc8a674f930c49b92f653ea7e46be53f13c084 /llvm/docs/LangRef.rst
parentdaeead4b02f062bf5a21e154ab7726b3e1dd41bd (diff)
downloadbcm5719-llvm-f9b67b810e2d413606b0d5891ed9477d819bcab9.tar.gz
bcm5719-llvm-f9b67b810e2d413606b0d5891ed9477d819bcab9.zip
[X86] Add new calling convention that guarantees tail call optimization
When the target option GuaranteedTailCallOpt is specified, calls with the fastcc calling convention will be transformed into tail calls if they are in tail position. This diff adds a new calling convention, tailcc, currently supported only on X86, which behaves the same way as fastcc, except that the GuaranteedTailCallOpt flag does not need to enabled in order to enable tail call optimization. Patch by Dwight Guth <dwight.guth@runtimeverification.com>! Reviewed By: lebedev.ri, paquette, rnk Differential Revision: https://reviews.llvm.org/D67855 llvm-svn: 373976
Diffstat (limited to 'llvm/docs/LangRef.rst')
-rw-r--r--llvm/docs/LangRef.rst17
1 files changed, 13 insertions, 4 deletions
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index d9a38907c92..e797b1f9a15 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -299,7 +299,7 @@ added in the future:
allows the target to use whatever tricks it wants to produce fast
code for the target, without having to conform to an externally
specified ABI (Application Binary Interface). `Tail calls can only
- be optimized when this, the GHC or the HiPE convention is
+ be optimized when this, the tailcc, the GHC or the HiPE convention is
used. <CodeGenerator.html#id80>`_ This calling convention does not
support varargs and requires the prototype of all callees to exactly
match the prototype of the function definition.
@@ -436,6 +436,14 @@ added in the future:
- On X86-64 RCX and R8 are available for additional integer returns, and
XMM2 and XMM3 are available for additional FP/vector returns.
- On iOS platforms, we use AAPCS-VFP calling convention.
+"``tailcc``" - Tail callable calling convention
+ This calling convention ensures that calls in tail position will always be
+ tail call optimized. This calling convention is equivalent to fastcc,
+ except for an additional guarantee that tail calls will be produced
+ whenever possible. `Tail calls can only be optimized when this, the fastcc,
+ the GHC or the HiPE convention is used. <CodeGenerator.html#id80>`_ This
+ calling convention does not support varargs and requires the prototype of
+ all callees to exactly match the prototype of the function definition.
"``cc <n>``" - Numbered convention
Any calling convention may be specified by number, allowing
target-specific calling conventions to be used. Target specific
@@ -10232,11 +10240,12 @@ This instruction requires several arguments:
Tail call optimization for calls marked ``tail`` is guaranteed to occur if
the following conditions are met:
- - Caller and callee both have the calling convention ``fastcc``.
+ - Caller and callee both have the calling convention ``fastcc`` or ``tailcc``.
- The call is in tail position (ret immediately follows call and ret
uses value of call or is void).
- - Option ``-tailcallopt`` is enabled, or
- ``llvm::GuaranteedTailCallOpt`` is ``true``.
+ - Option ``-tailcallopt`` is enabled,
+ ``llvm::GuaranteedTailCallOpt`` is ``true``, or the calling convention
+ is ``tailcc``
- `Platform-specific constraints are
met. <CodeGenerator.html#tailcallopt>`_
OpenPOWER on IntegriCloud