X86: support Swift Async context
authorTim Northover <t.p.northover@gmail.com>
Tue, 12 Jan 2021 13:12:40 +0000 (13:12 +0000)
committerTim Northover <t.p.northover@gmail.com>
Mon, 17 May 2021 10:56:16 +0000 (11:56 +0100)
commit747e5cfb9f5d944b47fe014925b0d5dc2fda74d7
tree0c7b4183fad5a2ad2aa1cbc8dd9b0215a01d0210
parent769ced3d576bef1098c1e5819d4afeb9eee4d6bd
X86: support Swift Async context

This adds support to the X86 backend for the newly committed swiftasync
function parameter. If such a (pointer) parameter is present it gets stored
into an augmented frame record (populated in IR, but generally containing
enhanced backtrace for coroutines using lots of tail calls back and forth).

The context frame is identical to AArch64 (primarily so that unwinders etc
don't get extra complexity). Specfically, the new frame record is [AsyncCtx,
%rbp, ReturnAddr], and its presence is signalled by bit 60 of the stored %rbp
being set to 1. %rbp still points to the frame pointer in memory for backwards
compatibility (only partial on x86, but OTOH the weird AsyncCtx before the rest
of the record is because of x86).
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
llvm/lib/Target/X86/X86FastISel.cpp
llvm/lib/Target/X86/X86FrameLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86MachineFunctionInfo.h
llvm/test/CodeGen/X86/swift-async-reg.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/swift-async.ll [new file with mode: 0644]