mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[Clang] Introduce Swift async calling convention.
This change is intended as initial setup. The plan is to add more semantic checks later. I plan to update the documentation as more semantic checks are added (instead of documenting the details up front). Most of the code closely mirrors that for the Swift calling convention. Three places are marked as [FIXME: swiftasynccc]; those will be addressed once the corresponding convention is introduced in LLVM. Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D95561
This commit is contained in:
parent
aff94971f7
commit
d697536ac9
@ -68,6 +68,7 @@ enum class CallingConv : uint8_t {
|
||||
Vectorcall,
|
||||
Regcall,
|
||||
Swift, // Clang-only
|
||||
SwiftAsync, // Clang-only
|
||||
};
|
||||
|
||||
enum class ReferenceKind : uint8_t { None, LValueRef, RValueRef };
|
||||
|
@ -1713,6 +1713,8 @@ CallingConv Demangler::demangleCallingConvention(StringView &MangledName) {
|
||||
return CallingConv::Vectorcall;
|
||||
case 'S':
|
||||
return CallingConv::Swift;
|
||||
case 'T':
|
||||
return CallingConv::SwiftAsync;
|
||||
}
|
||||
|
||||
return CallingConv::None;
|
||||
|
@ -110,6 +110,9 @@ static void outputCallingConvention(OutputStream &OS, CallingConv CC) {
|
||||
case CallingConv::Swift:
|
||||
OS << "__attribute__((__swiftcall__)) ";
|
||||
break;
|
||||
case CallingConv::SwiftAsync:
|
||||
OS << "__attribute__((__swiftasynccall__)) ";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -709,7 +709,10 @@ void MergeFunctions::writeThunk(Function *F, Function *G) {
|
||||
|
||||
CallInst *CI = Builder.CreateCall(F, Args);
|
||||
ReturnInst *RI = nullptr;
|
||||
CI->setTailCall();
|
||||
bool isSwiftTailCall = F->getCallingConv() == CallingConv::SwiftTail &&
|
||||
G->getCallingConv() == CallingConv::SwiftTail;
|
||||
CI->setTailCallKind(isSwiftTailCall ? llvm::CallInst::TCK_MustTail
|
||||
: llvm::CallInst::TCK_Tail);
|
||||
CI->setCallingConv(F->getCallingConv());
|
||||
CI->setAttributes(F->getAttributes());
|
||||
if (H->getReturnType()->isVoidTy()) {
|
||||
|
@ -341,6 +341,9 @@
|
||||
?swift_func@@YSXXZ
|
||||
; CHECK: void __attribute__((__swiftcall__)) swift_func(void)
|
||||
|
||||
?swift_async_func@@YTXXZ
|
||||
; CHECK: void __attribute__((__swiftasynccall__)) swift_async_func(void)
|
||||
|
||||
??$fn_tmpl@$1?extern_c_func@@YAXXZ@@YAXXZ
|
||||
; CHECK: void __cdecl fn_tmpl<&void __cdecl extern_c_func(void)>(void)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user