[LLVMdev] Var Args on X86-64

Duncan Sands baldrick at free.fr
Wed Jun 23 00:53:48 PDT 2010


Hi David,

> I wish to get the va_arg instruction working on X86-64 Linux.  This
> requires implementing VAARG lowering for X86-64.
>
> I am fine with implementing it, but I am unsure of what approach I
> should take. The straightforward option is to add the DAG nodes required
> to perform the operation during lowering.
> (in X86TargetLowering::LowerVAARG()).  However, the resulting code will
> be relatively long to accommodate the complexity of what va_arg must
> do. It would be easier to operate on a higher level, for example, by
> implementing va_arg in LLVM assembly. Is it possible (or preferable) to
> implement an intrinsic (va_arg) using target-specific llvm assembly?

I think currently llvm-gcc lowers va-arg to LLVM IR in the front-end, so you
may want to take a look at how it does that.

Ciao,

Duncan.



More information about the llvm-dev mailing list