Emit va_arg intrinsic in llvm-gcc?

Dear all,

Is there a way to have llvm-gcc output the llvm va_arg intrinsic? As
far as I understand, llvm-gcc directly lowers va_arg in the frontend
using the TARGET_GIMPLIFY_VA_ARG target hook.

I am aware that va_arg segfaults on x86-64
(http://llvm.org/bugs/show_bug.cgi?id=1740) and that llvm-gcc avoids
this issue by always lowering calls to va_arg

However, I am developing an llvm backend (similar to the CBackend)
that would like to handle va_arg as intrinsic from llvm-gcc. How can I
modify llvm-gcc to generate the llvm va_arg instrinsic?

With my little understanding of llvmg/gcc, I can try to modify the
TARGET_GIMPLIFY_VA_ARG hook to create a new gcc builtin for va_arg and
convert the tree code somehow to llvm in llvm-convert.c,
EmitBuiltinCall(), but would really appreciate any advice on how to
tackle the problem.

   Martijn Rutten