[llvm-dev] varargs, the x86, and clang

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 29 10:02:32 PDT 2015


On 29 September 2015 at 09:31, Preston Briggs via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Is there a way I can suppress that expansion? I'd really like to get hold of
> the IR with the va_args intact.

No, as Joerg said LLVM's va_arg instruction can't handle the ABI
requirements in all cases. The va_arg's are never created by Clang in
those cases.

If you don't care about following any particular ABI (i.e. have no
existing libraries to be compatible with), you might try "-target
le32-nacl" or "-target le64-nacl" which are designed to be generic
"little-endian" targets and do always emit a va_arg instruction.
Whether any given backend can handle what gets emitted is also another
matter entirely, of course.

Cheers.

Tim.


More information about the llvm-dev mailing list