Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to embed LLVM?

The LLVM Core project consists of:

  • Compiler - converts source code to LLVM IR
  • VM - executes compiled IR code

How can I embed the VM to a C++ application?

like image 247
Alon Gubkin Avatar asked Aug 20 '10 00:08

Alon Gubkin


People also ask

Where do I put LLVM?

The binaries for LLVM tools are placed in ~/llvm/build/bin . These tools are used to run the LLVM passes. To make it easy to run the tools, it is a good idea to add the path to the binaries to the bash PATH variable so that you can invoke the tools from any directory.


1 Answers

The LLVM is really a collection of libraries that you can link to, so it's pretty easy to embed. More often the LLVM takes IR that you generate and compiles it directly to machine code. There is also a library available to interpret and execute IR for platforms that do not support JIT compilation.

There's a pretty good tutorial available on the LLVM website here: http://llvm.org/docs/tutorial/. I suggest that you go through that and then ask more specific questions if you have them.

like image 169
Evan Shaw Avatar answered Sep 19 '22 07:09

Evan Shaw