So I've confirmed that if I don't add my patch to llvm before compiling our swift compiler, the compiler is unable to emit IR. The compiler builds, but when I run it on my standard library it traps due to the lack of SwiftABIInfo...
5 libsystem_c.dylib 0x00007ff808da7a49 abort + 126
6 libsystem_c.dylib 0x00007ff808da6d30 err + 0
7 swift-frontend 0x0000000109507881 clang::CodeGen::swiftcall::SwiftAggLowering::shouldPassIndirectly(bool) const (.cold.2) + 33
8 swift-frontend 0x00000001052eda83 clang::CodeGen::swiftcall::SwiftAggLowering::shouldPassIndirectly(bool) const + 387
9 swift-frontend 0x0000000102eaaf53 swift::irgen::NativeConventionSchema::NativeConventionSchema(swift::irgen::IRGenModule&, swift::irgen::TypeInfo const*, bool) + 115
10 swift-frontend 0x0000000103011ab6 swift::irgen::TypeInfo::nativeParameterValueSchema(swift::irgen::IRGenModule&) const + 54
11 swift-frontend 0x00000001030e769c isLargeLoadableType(swift::GenericEnvironment*, swift::SILType, swift::irgen::IRGenModule&) + 300
12 swift-frontend 0x00000001030fa77d (anonymous namespace)::LoadableStorageAllocation::allocateLoadableStorage() + 237
13 swift-frontend 0x00000001030e8813 (anonymous namespace)::LoadableByAddress::run() + 835
14 swift-frontend 0x00000001035b6a21 swift::SILPassManager::runModulePass(unsigned int) + 929
... I hadn't quite appreciated how Swift relies on clang here.
Clang and llvm don't support swiftcall for this target (AVR) though so it feels a bit tricky what to do. I wouldn't expect any swiftcall structured call sites to get emitted in normal clang usage when targeting the AVR platform at this time.
But it seems like Swift needs to activate this part of clang to "get an opinion" from it for ABI questions like "should this type be passed indirectly or directly?". Which seems a bit of a grey area unless I'm misunderstanding how it all works?
I don't think we (the AVR llvm community) are likely to add "full support" for the swiftcall calling convention to pure clang/llvm any time soon. AVR is pretty simple and as far as I know the AVR-GCC calling convention has remained universal. AFAIK our sister languages AVR-Rust and TinyGo for AVR also just use the same old GCC based calling convention, and I don't think there'd be much support from the wider AVR community for changing calling conventions that might change the register/stack behaviour that we all know.
Which might leave Swift feeling a bit unloved. 
Would it be possible/OK to just support the "high level" part of the swift calling convention for now? That is to say, allow the code in SwiftCallingConv.cpp to be used by Swift when targeting this platform, but not actually support the swiftcall lower part of the calling convention (which would involve more significant changes to clang on AVR and involve "breaking" the standard calling convention that everyone else uses)?
I don't think this would actually "close any doors" on Swift on AVR as from what I understand, we are only talking about optimisations with things like context parameters and error parameters (to help with things like avoiding "thunks" for translating thin to thick calls, with errors, default parameters functions, etc.)
I think Swift will still function without these optimisations on AVR and they can be added later in due course.
If that's acceptable/workable...
Taking a look at the SwiftABIInfo type, it seems the default for shouldPassIndirectly is "yes if the type would use more than four registers". That seems reasonable for AVR too... because more than 32 bits is really a "large" type on AVR and it would get inefficient trying to load it into and out of registers. It's relatively common to use 32 bit integers in our hardware libraries (for things like "ticks") and our llvm backend handles it well, but it's very rare to use 64 bit integers in our Swift based hardware libraries and client code for example.
So, having gone full circle, I am thinking that the default SwiftABIInfo class looks fairly reasonable to just use in a very simple implementation as my original patch did. The only thing I'm wondering, the implementation of occupiesMoreThan looks like it maybe considers integers/pointers to be the same size as registers on the platform? For AVR, registers are 8 bit and pointers are 16 bit. If need be, I can create a simple subclass AVRSwiftABIInfo in the AVR bit of clang, that takes account of this discrepancy?
Carl