Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parsing LLVM bitcode from Java

Tags:

java

llvm

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 parse 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.

like image 480
Oak Avatar asked Jul 11 '11 12:07

Oak


1 Answers

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:

  1. LLVM-J, which is Java bindings for LLVM - could be more convenient than directly using the c bindings with JNI.
  2. JLLVM, which is a Java port of the LLVM Core package, and includes an ANTLR LLVM IR parser.
  3. 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.
like image 131
Oak Avatar answered Oct 22 '22 18:10

Oak