diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index cf052513c5ef8..25e09c7bfa2f7 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -14535,6 +14535,9 @@ does not define what this type is, so all transformations should be prepared to handle these functions regardless of the type used. The intrinsics are overloaded, and can be used for pointers to different address spaces. +The underlying argument list is destroyed when a function returns, so +a ``va_list`` must not outlive the function that created it. + This example shows how the :ref:`va_arg ` instruction and the variable argument handling intrinsic functions are used. @@ -14631,10 +14634,13 @@ Semantics: The '``llvm.va_end``' intrinsic works just like the ``va_end`` macro available in C. In a target-dependent way, it destroys the ``va_list`` -element to which the argument points. Calls to +element to which the argument points. Calls to ``llvm.va_end`` can be +omitted when they are a no-op for the given target. ``llvm.va_end`` +is a no-op for all currently supported targets. + +When used, calls to ``llvm.va_end`` must be matched exactly with calls to :ref:`llvm.va_start ` and -:ref:`llvm.va_copy ` must be matched exactly with calls to -``llvm.va_end``. +:ref:`llvm.va_copy `. .. _int_va_copy: @@ -14671,6 +14677,10 @@ available in C. In a target-dependent way, it copies the source intrinsic is necessary because the ``llvm.va_start`` intrinsic may be arbitrarily complex and require, for example, memory allocation. +On targets where ``llvm.va_copy`` is equivalent to ``memcpy``, ``memcpy`` +can be used instead to duplicate a ``va_list``. ``llvm.va_copy`` is +equivalent to ``memcpy`` on all currently supported targets. + Accurate Garbage Collection Intrinsics --------------------------------------