This is an archive of the discontinued LLVM Phabricator instance.

X86: support Swift Async context
ClosedPublic

Authored by t.p.northover on May 14 2021, 3:51 AM.

Details

Reviewers
jroelofs
paquette
Summary

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).

Diff Detail

Event Timeline

t.p.northover created this revision.May 14 2021, 3:51 AM
t.p.northover requested review of this revision.May 14 2021, 3:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 14 2021, 3:51 AM
jroelofs accepted this revision.May 14 2021, 10:24 AM

LGTM

llvm/lib/Target/X86/X86MachineFunctionInfo.h
116

I found the naming of these two a bit confusing... bit of a semantic uncanny valley, since they're almost but not quite referring to the same thing. I don't have a better suggestion though :(

This revision is now accepted and ready to land.May 14 2021, 10:24 AM
t.p.northover closed this revision.May 17 2021, 2:49 AM

Thanks, committed as ea0eec69

llvm/lib/Target/X86/X86MachineFunctionInfo.h
116

Yes, it's a bit messy.

Actually, 747e5cfb9f5d. I got my reviews a bit mixed up.