[llvm-dev] A "Java Backend"

David Chisnall via llvm-dev llvm-dev at lists.llvm.org
Thu Jul 21 04:27:22 PDT 2016

On 21 Jul 2016, at 12:04, Lorenzo Laneve <lore97drk at icloud.com> wrote:
> Passing through LLVM IR would enable LLVM to apply its optimizers and, as I said, I know that creating a custom standalone backend could be easier, but enabling LLVM to translate to Bytecode would enable all of its frontends to do it.

Generally, this is a bad idea (I believe, Sanjoy is far more experienced here and can correct me if I’m wrong).  Modern JVMs benefit a lot more from Java bytecode that is easy to analyse.  The first thing that Hotspot does when it loads bytecode is undo a bunch of optimisations that javac does, because they make it harder to do the optimisations that the JIT performs.

> I know that it might be quite hard to treat Java or .NET as LLVM targets, but could this be a challenge? Let LLVM IR be compiled to Bytecode and CLI, which are higher level than our IR.

Going from a high-level language to a high-level IR via a low-level IR is certainly a challenge.  Many things are difficult, but not all of them are worthwhile.


More information about the llvm-dev mailing list