2

Does anyone know if I can execute LLVM IR which is generated from Python code?

Using numba, llvm-lite we can have LLVM IR, but I am not sure if it is executable using clang or not?

Stanislav Pankevich
  • 11,044
  • 8
  • 69
  • 129
user3126804
  • 119
  • 3
  • 10
  • I'm guessing that you'll get a better response on the numba mailing list (https://groups.google.com/a/continuum.io/forum/#!forum/numba-users) for this type of question. – JoshAdel Jun 07 '17 at 20:22

2 Answers2

2

You can compile it with clang, just make sure your IR have .bc or .ll extensions.

But the proper way is to use llc or LLVM API to compile down to native code, and then link it using system linker or LLD.

On linking stage you'd probably need to link some "runtime" libraries, numba ones in this case.

arrowd
  • 33,231
  • 8
  • 79
  • 110
0

You can use lli tool which can be found in LLVM's bin folder.

Just do lli file.ll or lli file.bc.

Also see this question: Execute LLVM IR code generated from Rust/Python source code and this question: How to run LLVM interpreter with a shared library?.

Stanislav Pankevich
  • 11,044
  • 8
  • 69
  • 129