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 106701 include/clang-c/Index.h
include/clang/Basic/Builtins.def
include/clang/Basic/BuiltinsX86.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/Sema/SemaChecking.cpp
lib/Sema/SemaDeclAttr.cpp
test/CodeGen/ms_abi.c
test/CodeGen/ms_abi_aarch64.c
test/CodeGenObjC/attr-callconv.m
test/Sema/varargs-aarch64.c
test/Sema/varargs-x86-32.c
tools/libclang/CXType.cpp
|
I think we might prefer to make this non-x86_64 specific. I suspect that this pattern will arise again on ARM32 if anyone goes back there in seriousness. We'll probably want sysv_abi as well as ms_abi, and all the logic should be independent of the ISA: ms_abi is a no-op when the target OS is already Windows, and sysv_abi is a no-op when the target OS isn't Windows.