6

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.

1

2 Answers 2

2

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.
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, @Oak! Your Xtext parser was exactly what I was looking for!
0

You could emit JNI calls to the llvm C bindings.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.