From 95fa80af6f0451bb52cd2d86dea1b165c5e2675a Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Sat, 9 Jan 2010 19:44:16 +0000 Subject: [PATCH] Clarify the requirements for a "tail call" to actually be optimized into a jump. People clearly weren't finding the extra requirements in CodeGenerator.html. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93070 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/docs/LangRef.html b/docs/LangRef.html index 6315993fdf6..22a2d161548 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -678,9 +678,9 @@ define i32 @main() { ; i32()* (e.g. by passing things in registers). This calling convention 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). Implementations of this convention should - allow arbitrary tail call - optimization to be supported. This calling convention does not + (Application Binary Interface). + Tail calls can only be optimized + when this convention is used. This calling convention does not support varargs and requires the prototype of all callees to exactly match the prototype of the function definition. @@ -4993,15 +4993,31 @@ Loop: ; Infinite loop that counts from 0 on up...

This instruction requires several arguments:

    -
  1. The optional "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 ret instruction.
  2. +
  3. The optional "tail" marker indicates that the callee function does not + access any allocas or varargs in the caller. Note that calls may be + marked "tail" even if they do not occur before + a ret instruction. If the "tail" marker is + present, the function call is eligible for tail call optimization, + but might not in fact be + optimized into a jump. As of this writing, the extra requirements for + a call to actually be optimized are: +
      +
    • Caller and callee both have the calling + convention fastcc.
    • +
    • 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::PerformTailCallOpt is true.
    • +
    • Platform specific + constraints are met.
    • +
    +
  4. The optional "cconv" marker indicates which calling convention the call should use. If none is specified, the call - defaults to using C calling conventions.
  5. + defaults to using C calling conventions. The calling convention of the + call must match the calling convention of the target function, or else the + behavior is undefined.
  6. The optional Parameter Attributes list for return values. Only 'zeroext', 'signext', and -- 2.34.1