<div>Duncan,</div><div><br></div><div><div>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)</div>
</div><div><br></div><div>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).</div>
<meta charset="utf-8"><div><br></div><div><div>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).</div>
</div><div><br></div><div>- David M</div><div><br></div><div><br></div>