I don’t actually plan on doing this, just curious and trying to learn how various intermediate representation languages work. Similar to how the JVM and .NET compile higher level languages to an assembly-like intermediate language, which is then executed on a JIT compiler, could we do that with LLVM IR to make any LLVM-based language like Rust, Objective C or Swift “interpreted” on a level similar to the JVM? Maybe even interop them since now they’re running on the same interpreter like how Java, Kotlin and Scala can all work together; or C#, F# and Visual Basic. And since LLVM IR is cross platform, I can imagine this can be an easy way to have platform agnostic executables for languages where you’d normally have to compile separate binaries, and since LLVM doesn’t have a garbage collector, of you use a parent language that also doesn’t have a garbage collector, you could probably get more reliable latency than JVM or .NET, right?
Does such a runtime already exist? And does LLVM IR have a pure binary version that would actually make it similar to the bytecodes of other languages?
Keep in mind that the IR has optimization instructions as well (see “phi” directives)