Support for monomorphization


I am building a LLVM based compiler for a custom language , but would like to know if there is any support for Monomorphization in LLVM.

But the fact that llvm::Type cannot be mutated , makes it harder to implement this.

( Looking at the API , I see some member functions in the llvm::Value class documentation but they were not necessarily helpful ).



llvm IR provides capabilities somewhere between C and an idealised assembly language for mainstream CPUs but with things such as an infinite number of registers.

If you are writing a compiler for a language very different to C then it’s your job to figure out how to map your language features onto C/generalised ASM.