[LLVMdev] Emit va_arg intrinsic in llvm-gcc?
Martijn
martijn at martijnrutten.com
Fri Nov 27 05:29:42 PST 2009
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
(http://old.nabble.com/va_arg-td25197836.html).
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.
Cheers,
Martijn Rutten
More information about the llvm-dev
mailing list