Skip to content

Commit 2ac62c5

Browse files
committed
Edit call section on LangRef
1 parent 4751f47 commit 2ac62c5

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

llvm/docs/LangRef.rst

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12759,11 +12759,11 @@ This instruction requires several arguments:
1275912759
attributes like "disable-tail-calls". The ``musttail`` marker provides these
1276012760
guarantees:
1276112761

12762-
#. The call will not cause unbounded stack growth if it is part of a
12762+
- The call will not cause unbounded stack growth if it is part of a
1276312763
recursive cycle in the call graph.
12764-
#. Arguments with the :ref:`inalloca <attr_inalloca>` or
12764+
- Arguments with the :ref:`inalloca <attr_inalloca>` or
1276512765
:ref:`preallocated <attr_preallocated>` attribute are forwarded in place.
12766-
#. If the musttail call appears in a function with the ``"thunk"`` attribute
12766+
- If the musttail call appears in a function with the ``"thunk"`` attribute
1276712767
and the caller and callee both have varargs, then any unprototyped
1276812768
arguments in register or memory are forwarded to the callee. Similarly,
1276912769
the return value of the callee is returned to the caller's caller, even
@@ -12774,7 +12774,7 @@ This instruction requires several arguments:
1277412774
argument may be passed to the callee as a byval argument, which can be
1277512775
dereferenced inside the callee. For example:
1277612776

12777-
.. code-block:: llvm
12777+
.. code-block:: llvm
1277812778

1277912779
declare void @take_byval(ptr byval(i64))
1278012780
declare void @take_ptr(ptr)
@@ -12828,43 +12828,41 @@ This instruction requires several arguments:
1282812828
ret void
1282912829
}
1283012830

12831-
1283212831
Calls marked ``musttail`` must obey the following additional rules:
1283312832

12834-
- The call must immediately precede a :ref:`ret <i_ret>` instruction,
12835-
or a pointer bitcast followed by a ret instruction.
12836-
- The ret instruction must return the (possibly bitcasted) value
12837-
produced by the call, undef, or void.
12838-
- The calling conventions of the caller and callee must match.
12839-
- The callee must be varargs iff the caller is varargs. Bitcasting a
12840-
non-varargs function to the appropriate varargs type is legal so
12841-
long as the non-varargs prefixes obey the other rules.
12842-
- The return type must not undergo automatic conversion to an `sret` pointer.
12833+
- The call must immediately precede a :ref:`ret <i_ret>` instruction,
12834+
or a pointer bitcast followed by a ret instruction.
12835+
- The ret instruction must return the (possibly bitcasted) value
12836+
produced by the call, undef, or void.
12837+
- The calling conventions of the caller and callee must match.
12838+
- The callee must be varargs iff the caller is varargs. Bitcasting a
12839+
non-varargs function to the appropriate varargs type is legal so
12840+
long as the non-varargs prefixes obey the other rules.
12841+
- The return type must not undergo automatic conversion to an `sret` pointer.
1284312842

12844-
In addition, if the calling convention is not `swifttailcc` or `tailcc`:
12843+
In addition, if the calling convention is not `swifttailcc` or `tailcc`:
1284512844

12846-
- All ABI-impacting function attributes, such as sret, byval, inreg,
12847-
returned, and inalloca, must match.
12848-
- The caller and callee prototypes must match. Pointer types of parameters
12849-
or return types may differ in pointee type, but not in address space.
12845+
- All ABI-impacting function attributes, such as sret, byval, inreg,
12846+
returned, and inalloca, must match.
12847+
- The caller and callee prototypes must match. Pointer types of parameters
12848+
or return types may differ in pointee type, but not in address space.
1285012849

12851-
On the other hand, if the calling convention is `swifttailcc` or `tailcc`:
12850+
On the other hand, if the calling convention is `swifttailcc` or `tailcc`:
1285212851

12853-
- Only these ABI-impacting attributes attributes are allowed: sret, byval,
12854-
swiftself, and swiftasync.
12855-
- Prototypes are not required to match.
12852+
- Only these ABI-impacting attributes attributes are allowed: sret, byval,
12853+
swiftself, and swiftasync.
12854+
- Prototypes are not required to match.
1285612855

1285712856
Tail call optimization for calls marked ``tail`` is guaranteed to occur if
1285812857
the following conditions are met:
1285912858

1286012859
- Caller and callee both have the calling convention ``fastcc`` or ``tailcc``.
1286112860
- The call is in tail position (ret immediately follows call and ret
1286212861
uses value of call or is void).
12863-
- Option ``-tailcallopt`` is enabled,
12864-
``llvm::GuaranteedTailCallOpt`` is ``true``, or the calling convention
12865-
is ``tailcc``
12866-
- `Platform-specific constraints are
12867-
met. <CodeGenerator.html#tail-call-optimization>`_
12862+
- Option ``-tailcallopt`` is enabled, ``llvm::GuaranteedTailCallOpt`` is
12863+
``true``, or the calling convention is ``tailcc``
12864+
- `Platform-specific constraints are met.
12865+
<CodeGenerator.html#tail-call-optimization>`_
1286812866

1286912867
#. The optional ``notail`` marker indicates that the optimizers should not add
1287012868
``tail`` or ``musttail`` markers to the call. It is used to prevent tail

0 commit comments

Comments
 (0)