[LLVMdev] LLVM based Virtual Machine "Environment" idea sanity check.

Chris Lattner sabre at nondot.org
Wed Sep 6 00:22:14 PDT 2006

On Wed, 6 Sep 2006, Shawn Boles wrote:
> This is where I'm stumped... how can I use LLVM inside my "simplified
> processing node," allowing it only access to my "virtual devices,"
> getting it to run "as fast as possible" with as little possibility of it
> clobbering the host computer should something untoward happen to the
> LLVM code?  I'm still sifting through the documentation and feel like
> I'm 90% there to understanding out LLVM works as a Virtual Machine, and
> not a Compiler backend or Intermediate Language.  Or, if LLVM isn't my
> "perfect match," where should I look?

LLVM isn't a perfect match today.  It does provide the ability to 
transport code around in a portable way and execute it, but lacks these 

1. Given C input code, the output isn't guaranteed to be portable.  This
    is a C limitation, not an LLVM limitation.  In practice, if you avoid a
    few constructs, and stay away for complex system interfaces, the code
    you write will be mostly portable.
2. LLVM doesn't provide safety (it doesn't prevent the program from
    clobbering the machine).

#1 is a limitation of C, not LLVM.  If you use a portable source language, 
you'll get portable LLVM Code.  Several people are interested in #2 and 
have solutions with various tradeoffs, if you ask here I'm sure they'll 
tell you about them.

In practice, the hard part, and the value add, of your project seems to be 
the higher-level design issues (what APIs / interfaces do you provide, how 
to pull it together into a useful system, how to set up the middleware, 
etc).  Building the initial system on top of LLVM without worrying about 
#1/#2 seems like a good way to get a prototype up and running, and you 
might find out that #1/#2 might get solved for you by other community 



More information about the llvm-dev mailing list