As part of my patch to add interrupt handlers to embedded swift on AVR, I want to add the
llvm::CallingConv::AVR_SIGNAL calling conventions to the generated function declarations when in embedded mode for AVR target triples, perhaps if a specific attribute is added to a function declaration in the Swift AST, such as
@interruptHandler but we can get into the details like that when I raise a PR for upstreaming.
For now I'm just trying to get an idea what might fit in with the "general flow" of the swift compiler design for something like this.
I'm trying to work out the best place to set or override calling conventions for function declarations. It's rather a maze to see where things like this should go. Obvious places might be somewhere in
Or should it really be done at SIL level, in something like
Or in some specialised pass, such as an LLVM pass??
Any clues would be useful, it's a bit hard to navigate the forest of things happening in function generation and I couldn't find obvious documentation to tell me how all these parts fit together.
Thanks for any help or advice.