Parsing LLVM bitcode from Java
Is there a way to parse LLVM bitcode in my Java application? In other words, is there any library that has Java binding and can p开发者_开发百科arse LLVM bitcode, which I could then access using some DOM or any other way?
Note that I'm not trying to convert LLVM bitcode to Java bytecode, just trying to parse LLVM bitcode into some workable representation for Java.
Using the LLVM C bindings via something like JNI is probably the most straightforward approach. However, since this question was asked, I was able to find a few projects that may be of help, as well as produce one of my own:
- LLVM-J, which is Java bindings for LLVM - could be more convenient than directly using the c bindings with JNI.
- JLLVM, which is a Java port of the LLVM Core package, and includes an ANTLR LLVM IR parser.
- My own LLVM IR SDK, which parses LLVM IR to build an EMF Core (ECore) module via XText and can be easily used within Eclipse.
You could emit JNI calls to the llvm C bindings.
精彩评论