[llvm-dev] Parse LLVM IR using LLVM C API

David Chisnall via llvm-dev llvm-dev at lists.llvm.org
Fri Dec 8 09:44:20 PST 2017


On 8 Dec 2017, at 15:53, Mahdi Mohammadi via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> I'm writing a compiler and I am thinking of mixing LLVM IR inside the source code I'm compiling. So user can write normal code and write some functions using LLVM IR.

Note that the text representation of LLVM IR is currently intended for debugging and is not guaranteed to be stable.  If you’re using the C API, then I’d guess that you want your compiler to work with multiple versions of LLVM, but it’s likely that any code that embeds the text form of LLVM IR will be tied to a specific compiler version (the auto-updater should work with the bitcode representation, but is best-effort when it comes to the text version).

If you have some parts of your language’s runtime library that you want to write directly in LLVM IR and don’t mind having to modify them them when you update LLVM, then this might be a good idea, but exposing it to users is likely to cause problems.

David




More information about the llvm-dev mailing list