Adding a new function attribute


I’m adding a new function attribute in clang and llvm for a backend I’m writing that treats prolog and epilogue code in a special way inside interrupt handlers, similar to what naked does. One way I’ve seen to do this is to add a new attribute type in Attributes.h, however to me it feels bad to add a target dependent attribute into this place which is very target independent. So what’s the best way to do this or is there an api to handle this kind of issues?

Thanks for the help.

FWIW, GCC has something similar.

In LLVM IR, interrupt handlers could be considered either a function
attribute or a calling convention. I don't have a particular
preference. If using a CC, I'd suggest making it be target neutral
like fastcc.