[llvm-commits] PATCH: llvm-gcc option to emit "va_arg" instruction

David Meyer pdox at google.com
Sat Oct 16 07:57:03 PDT 2010


Duncan,

I don't think I'm confused. Yes, expand_expr is never called by llvm-gcc,
but the point I was making is that expand_expr does not expect to see
VA_ARG_EXPR in a GIMPLE tree. As gcc is currently written, VA_ARG_EXPR is a
legal node in the GENERIC representation but not the GIMPLE representation.
(Gimplification always eliminates VA_ARG_EXPR)

By re-packaging VA_ARG_EXPR as a call to a built-in, we automatically get a
legal GIMPLE representation for va_arg which has the right semantics and
resembles the other vararg functions. (BUILT_IN_VA_START, BUILT_IN_VA_COPY,
etc).

Of course it is possible to modify the gimplifier to keep VA_ARG_EXPR in the
tree. I suspect this approach may require additional changes. If anything
else looks at the GIMPLE tree, it would need to know how to handle
VA_ARG_EXPR. Also, as a consequence, the llvm-gcc GIMPLE representation
would no longer match mainline gcc's (but perhaps that is already the case
with some of your other modifications).

- David M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20101016/1ef55709/attachment.html>


More information about the llvm-commits mailing list