Move builtins from the x86 specific scope into the global scope. Their use is still limited to x86_64 and aarch64 though.
This allows wine on aarch64 to properly handle variadic functions.
This depends on D34474 for llvm.
Paths
| Differential D34475
[AArch64] Add support for __builtin_ms_va_list on aarch64 ClosedPublic Authored by mstorsjo on Jun 21 2017, 1:27 PM.
Details Summary Move builtins from the x86 specific scope into the global scope. Their use is still limited to x86_64 and aarch64 though. This allows wine on aarch64 to properly handle variadic functions. This depends on D34474 for llvm.
Diff Detail Event TimelineHerald added subscribers: kristof.beyls, javed.absar, rengolin, aemerson. · View Herald TranscriptJun 21 2017, 1:27 PM Comment Actions Did a minor adjustment, to make sure a plain va_arg produces the right kind of output, when targeting windows directly (while the rest of the patch mostly is about supporting the MS ABI while targeting a different OS). Comment Actions Split the patch into two; one for generic handling of va_arg for win/arm64, and one for using the same functionality while targeting other OSes (i.e. for wine) via the __builtin_ms_* intrinsics. mstorsjo retitled this revision from [RFC] [AArch64] Add support for __builtin_ms_va_list on aarch64 to [AArch64] Add support for __builtin_ms_va_list on aarch64. Comment ActionsAdded test cases, a minor tweak to semantic error handling, removed the RFC tag, removed the reference to the clang prerequisite that now is committed.
Comment Actions Initial attempt at unifying the use of __builtin_ms_va_list and calling conventions between x86_64 and aarch64. This goes with the current (un-unified) version of D34474. I only hooked up attribute((ms_abi)) on aarch64, I didn't hook up sysv_abi yet, because it's not obvious what it should map to, since aarch64 has got two other calling conventions in addition to the win64 one; standard AAPCS (for ELF systems) and the darwin modification of AAPCS. Since that's not directly needed for the wine usecase, I'm omitting that for now. This revision is now accepted and ready to land.Jul 17 2017, 12:53 PM Closed by commit rL308218: [AArch64] Add support for __builtin_ms_va_list on aarch64 (authored by mstorsjo). · Explain WhyJul 17 2017, 1:50 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 103451 include/clang/Basic/BuiltinsAArch64.def
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Basic/Specifiers.h
lib/AST/ItaniumMangle.cpp
lib/AST/MicrosoftMangle.cpp
lib/AST/Type.cpp
lib/AST/TypePrinter.cpp
lib/Basic/Targets.cpp
lib/CodeGen/CGBuiltin.cpp
lib/CodeGen/CGCall.cpp
lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/TargetInfo.cpp
lib/Sema/SemaChecking.cpp
lib/Sema/SemaDeclAttr.cpp
|
I strongly suspect that Microsoft will never adopt a varargs calling convention that uses a complex, non-char* va_list.
I'm starting to think we should move this to the generic builtin list and make it available everywhere. The semantics are that you can only use __builtin_ms_va_start in ms_abi functions. It always produces a char*-style va_list.