[LLVMdev] LLVM bytecode simulator/emulator?

Chris Lattner sabre at nondot.org
Thu Jul 13 12:15:42 PDT 2006


On Thu, 13 Jul 2006, Kenneth Hoste wrote:
> Chris Lattner wrote:
>> Hacking on the interpreter is easy, but has several drawbacks.  In 
>> particular, the interpreter is very slow (even compared to other 
>> interpreters) and it is missing functionality: you cannot call arbitrary 
>> external functions, which causes many programs to fail in it.
>
> What do you mean by external functions? I only need to print stuff to file, 
> the measuring of the characteristics should be pretty easy I think.

I mean things like printf, exit, write, etc.  Take a look at 
lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp

If there is a small set of things you need to support, this shouldn't be a 
problem.  Adding functions is easy.

>> OTOH, writing an llvm-to-llvm transformation has many advantages: we have 
>> plenty of robust infrastructure for doing such a thing, many people use 
>> this, you can use any code generator you like with it (JIT, static 
>> compiler, or C backend), and you can even use LLVM optimizations to reduce 
>> the cost of your instrumentation.
>
> Is there some kind of tutorial on this? Or an example program or something? 
> This sounds quite interesting...

There is extensive documentation at http://llvm.org/docs/

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list