<div>Rafael,</div><div><br></div><div>This could be implemented at a higher level.</div><div><br></div><div>Rewriting the va_arg instruction at the bitcode level would be the most powerful method, especially if you could apply opt to the target-specific bitcode after the rewrite. </div>
<div><br></div><div>Another way would be to emit a custom va_arg implementation as the initial SelectionDAG is being built. This would not be subject to opt, but it would be subject to better optimization in the backend.</div>
<div><br></div><div>Perhaps I jumped the gun by implementing EmitVAArg at a low level, but I'm not sure which of the other possible solutions are practical (or preferable).</div><div><br></div><div>- David M</div><div>
<br></div>