[PATCH] D34474: [RFC] [AArch64] Add a win64 specific aarch64 calling convention, for va_list handling

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 21 13:25:13 PDT 2017


mstorsjo created this revision.
Herald added subscribers: kristof.beyls, javed.absar, mehdi_amini, rengolin, aemerson.

In this calling convention, parameters and return values are passed in the same way as in normal AAPCS. However, one ABI difference between windows and AAPCS is how va_list is represented.

To allow (among other things) wine to handle va_list objects originating in the windows ABI, a __builtin_ms_va_list data type is added (on the clang level), just as on x86_64. Most of the handling of that type can be kept in clang, but the lowering of the va_start intrinsic happens within llvm.

Currently, this calling convention is only used to select the right version of the va_start intrinsic, since the distinction between default va_start and __builtin_ms_va_start isn't reflected from clang into the IR otherwise.

This at least seems to work correctly for parameters passed in GPRs - handling of float arguments in variadic functions is yet untested and/or unknown.

This allows wine on aarch64 to properly handle variadic functions, successfully running arm64 exes (from the windows 10 sdk) with a few different variations of fprintf and vsnprintf.

No llvm tests are written yet, pending feedback on whether this is the right way to go.


https://reviews.llvm.org/D34474

Files:
  include/llvm/IR/CallingConv.h
  lib/AsmParser/LLLexer.cpp
  lib/AsmParser/LLParser.cpp
  lib/AsmParser/LLToken.h
  lib/IR/AsmWriter.cpp
  lib/Target/AArch64/AArch64ISelLowering.cpp
  lib/Target/AArch64/AArch64ISelLowering.h
  lib/Target/AArch64/AArch64Subtarget.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34474.103450.patch
Type: text/x-patch
Size: 6163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170621/1c8d2e6b/attachment.bin>


More information about the llvm-commits mailing list