llvm interpreter for embedded system

Has anyone looked at porting the llvm interpreter to an embedded
system? I've been looking into how to portably run bytecode on a
lightweight embedded processor and it seemed like interpreting llvm
bytecode might be a solution. We would have to write the interpreter
in c and it would have to fit in a few k of ram and a dozen or less k
of code space, but I figured I'd ask to see if people think it might
be possible.


I'm not aware of anyone working on this. There are several companies using LLVM as a static compiler for their embedded chips, but I'm not aware of anyone using the interpreter in this way. You would probably want to write a from-scratch interpreter: the currently LLVM interpreter is very heavy weight and slow (it was built rapidly to get it working fast, not as something that would be a good interpreter).

Another option is that you could write a simple backend for a pseudo target that is really easily interpretable. This would let you JIT compile LLVM to this pseudo target, then interpret the result. This would be appealing if you find LLVM too hard to interpret (I don't know why this would be the case, but just pointing out the option).


Hi chris,

I am a novice in compilers and stuff.I want to write an interpreter for AST but I haven’t found any links to how to begin :frowning: .Can u give a few pointers to where I can get some material on interpreter basics etc?


I'm sorry but this is off-topic for this list. There are lots of books that talk about interpreter basics: I'd suggest looking at some of those. If you're specifically interested in the LLVM interpreter, we can help with that of course.