[llvm-dev] Why the platform dependent "va_list" variable is lowered by the frontend?

James Y Knight via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 27 06:10:17 PST 2016


Yes, it does seem more logical.

Unfortunately, this is not possible, at least with the current state of
LLVM. Note in particular that *function calls* are also handled specially
by the clang frontend for many architectures. On the LLVM side, there's not
enough information to properly represent the function call convention for
many architectures, as the calling conventions depend on C type
information, and after converting the C types into LLVM types, some of the
necessary information has been lost.

I think it would be great to move more of the calling convention logic down
to LLVM -- and I have some half-baked ideas on how it could be done without
pushing the entire C type system down. But, it's certainly not trivial.

On Wed, Jan 27, 2016 at 8:11 AM, Gaël Jobin via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi all,
>
> I was playing with varargs and was wondering why the va_list variable
> in C is lowered by the frontend to a *i8 (x86) or a struct (x86_64)? I
> mean, if it depends on the architecture, it is more logical to have an
> IR intrinsic for va_list and let the backend lowering it to the right
> type.
>
> Regards,
> Gaël
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160127/89477028/attachment.html>


More information about the llvm-dev mailing list