Questions on using LLVM to build a VM

Good day,

Firstly, I am very new to this project. I have dug through some of the documentation, but cannot find a satisfying answer to some questions I have. I hope somebody here can edify me.

I am interested in embedded a LLVM ‘VM’ inside an embedded ARM-based device. That is, I want to be able to load and execute .bc files directly in an embedded system.

The questions:

  • Are there any more direct examples of doing the above?

  • I am unclear on how the .bc is ‘linked’ to the external functions it calls. For example, if I have a ‘print’ or ‘playSound’ function implemented in my firmware environment, and have properly exposed it to the LLVM front-end language, how does the connection and actual function call occur at run-time?

If I can get answers or pointers to answers, that should get me started.

Thank you,



I think you might be looking for a JIT in ARM architecture. It seems that it has been “out of box” in LLVM distribution already, probably you might need some work to fit them into your system.

I suggest you have a look at the Kaleidoscope example. It uses a trick to make standard functions, like abs / cot available to Kaleidoscope. You might implement your system in similar way.

– Haohui