[llvm-dev] va_arg on Windows 64
Tim Northover via llvm-dev
llvm-dev at lists.llvm.org
Wed Apr 20 13:56:24 PDT 2016
Hi Gaël,
On 20 April 2016 at 13:23, Gaël Jobin via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Is there some kind of attributes to force function parameters to be
> aligned contiguously? Or could it be that va_arg alignment is wrongly
> made using DL.getABITypeAlignment?
It looks like support for the Windows ABI hasn't really been added to
LLVM's va_arg instruction at all, so it's falling back to the generic
implementation in SelectionDAG. To change that, you'll probably want
to hook into X86TargetLowering::LowerVAARG. You ought to be able to
override the alignment of 32-bit types there. (Beware, it'll never be
able to handle the full breadth of C/C++ use-cases, there's a reason
Clang implements it directly and it's not purely for efficiency).
Alternatively, you might be able to get away with always doing an i64
va_arg and truncating the result if you control the front-end and
don't want to fully expand va_arg.
Cheers.
Tim.
More information about the llvm-dev
mailing list