Building machine functions from outside llvm?


I had a request earlier for a means of building machine functions from an application linked to LLVM. The application currently composes strings containing assembly and then calls LLVM in order to parse them and emit object files.

An alternative would be to construct the MachineInstrs using an API like BuildMI directly. I’d be interested to hear if anyone is doing this already - essentially using the interfaces I previously considered internal as an alternative to formatted strings of assembly. Any serious pitfalls here?