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

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue Apr 3 06:35:25 PDT 2007


Hi Andrew,

Andrew Lenharth wrote:
> 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.
>   

We can set the type of the va_list to be i8* or i8**. Even if internally
it's something else.

> Right now, vaarg
> handling is not target independent at the llvm level.  

Isn't this an error at the conception level? llvm bytecode should be
target independent.

> I agree that a
> va_list alloc intrinsic would go a long way towards abstracting the
> target ABI from a vaarg function.
>
>   

So you agree that it's the correct way to implement this target-dependant
feature? Updating all backends shouldn't be too hard.

Cheers,
Nicolas



More information about the llvm-dev mailing list