Hi compiler experts,
I'm working on differentiable programming in Swift and I'd like advice on implementing robust mangling for compiler-generated derivative functions/thunks. These mangled names will eventually be used in SIL differentiability witness tables.
There are a few components to mangle:
- Name of the original SIL function: a
- Derivative function kind:
- Differentiable parameter indices: a bit vector. (e.g.
- Differentiation result indices: a bit vector. (e.g.
- Generic requirements (optional):
Currently, we've been using a hacky scheme, but we'd like to make the scheme robust and implement it in the mangler/demangler.
I took a look at Mangling.rst and
ASTMangler but I'm not sure how to start. Could anyone please help me get started or point to related existing code? Any advice would be appreciated!