[swift-lldb-dev] Support for the Swift calling convention in lldb

Arnold Schwaighofer aschwaighofer at apple.com
Thu Oct 13 14:32:40 CDT 2016

Hi LLDB team,

as part of the ABI work for this year we would like to adopt the swift calling convention.

I am working on the swift/llvm side of this.

<rdar://problem/19978563> Adopt the new Swift calling convention

The swift calling convention “swiftcc” together with the “swifterror” and “swiftself” attribute will change how many registers this calling convention will use for passing arguments and returning values. Furthermore, the “swifterror” and “swiftself” attribute will cause llvm to put the parameter marked with this attribute into a specific register at the call side.

The swift compiler will use this convention for native swift functions. We have to be able to call native swift functions from the runtime so there is also support in clang to define/declare functions with this calling convention in C/C++.

This might have implications on the debugger.

My current plan is to finish the swift/llvm side of this work in the next couple weeks. There is a prototype at https://github.com/aschwaighofer/swift/tree/native_calling_convention_wip that can be tried out today.

There are two radars that track work related to lldb and dwarf support:

<rdar://problem/24489517> DWARF support for the new Swift calling convention
<rdar://problem/25471028> LLDB support for new Swift calling convention


More information about the swift-lldb-dev mailing list