The general rule here is that something needs to be SWIFT_CC(swift)
if it's just declared in Swift code using _silgen_name, as opposed to
importing something via a header.
Of course, SWIFT_CC(swift) expands to nothing by default for now, and
I haven't made an effort yet to add the indirect-result / context
parameter ABI attributes. This is just a best-effort first pass.
I also took the opportunity to shift a few files to just implement
their shims header and to demote a few things to be private stdlib
interfaces.
Ensure that the functions which are declared with @_silgen_name for importing
from external libraries are described with the correct linkage. If the declared
functions are marked with internal or no linkage, the declaration for the import
will be given internal linkage. However, this is incorrect if the definition is
not part of the image.
The remaining uses were filtered on the assumption that the swift standard
library is statically linked and provides the definitions for those symbols and
thus will be part of the image.
This was noticed by manual inspection of the IR generated. Thanks to Dmitri
Gribenko for the hint about the trampoline construction.