[PATCH v2] LangRef: clarify that va_arg doesn't work on x86_64

Tim Northover t.p.northover at gmail.com
Wed Oct 29 12:46:20 PDT 2014


Hi again,

I've moved this to the llvm-commits list, which is where most
discussion takes place. It's also best to keep things in a single
thread where possible, by attaching updated patches to replies rather
than new messages.

I'm actually still unconvinced by the need to call out x86_64
specifically (especially having discovered that there *is* partial
support for "va_arg"). I'd just go for something like "Note that not
all targets support the va_arg instruction".

On 29 October 2014 12:21, Ramkumar Ramachandra <artagnon at gmail.com> wrote:
> -This example shows how the :ref:`va_arg <i_va_arg>` instruction and the
> -variable argument handling intrinsic functions are used.
> +This example shows how the :ref:`va_arg <i_va_arg>` instruction and
> +the variable argument handling intrinsic functions are used. Note that
> +this is for platforms where ``va_list`` is an ``i8**``, most notably
> +not x86_64.

This isn't quite right. As far as I know (x86, ARM, AArch64) all
in-tree targets that accept va_arg use it with an i8**, but with
certain caveats (around type lowering & alignment in particular) even
the x86_64 ABI could be supported. In fact, X86 actually seems to
support certain common cases.

It's just rather easier and more efficient to do it in Clang -- the
optimisation passes can be rather useful for simplifying the special
cases.

Cheers.

Tim.



More information about the llvm-commits mailing list