[LLVMdev] Declaration of a va_list should be an intrinsic?

Andrew Lenharth andrewl at lenharth.org
Mon Apr 2 07:29:59 PDT 2007


On 4/2/07, Nicolas Geoffray <nicolas.geoffray at lip6.fr> wrote:
> Hi everyone,
>
> Currently, when declaring a va_list in llvm, one only needs to do:
>
> %ap = alloca i8 * (Reference : llvm/docs/LangRef.html#int_varargs)

This example is x86 specific.  alpha allocas an {sbyte*, int} (and
does so in llvm-gcc).  What the type of the alloca to use is requires
the frontend to know the abi of the backend.  Even with an intrinsic
for allocating a va_list, you have the problem of what type should be
returned.

> Therefore, I think there should be a special intrinsic for declaring a va_list. This
> unfortunately requires changes to all
> backends, but i do not see how this can be handled differently. If an other backend already handles this correctly, please
> tell me which one.

No, the problem is just updating all the frontends.  Right now, vaarg
handling is not target independent at the llvm level.  I agree that a
va_list alloc intrinsic would go a long way towards abstracting the
target ABI from a vaarg function.

Andrew



More information about the llvm-dev mailing list