[LLVMdev] LLVM bytecode simulator/emulator?
Chris Lattner
sabre at nondot.org
Wed Jul 12 21:39:52 PDT 2006
On Wed, 12 Jul 2006, Kenneth Hoste wrote:
> Just today, I heard of the existence of the LLVM project. Because of its high
> activity and projects, I'm quite interested in it for using it in my
> research.
> Currently, we are comparing applications/programs/benchmarks by collecting
> characteristics of their dynamic behavior. This is done by instrumenting the
> program (using ATOM on Alpha), and subsequently running the program. During
> the instrumented run, anything we would like to know about the dynamic
> behavior of the program is captured, and spit out into log files.
ok.
> The only drawback is that we are currently stuck to the Alpha architecture,
> which means we are limited in our abilities... LLVM could provide a solution
> to this, because the intermediar LLVM bytecode is not biased towards a
> particular architecture.
Right.
> The question is if there are tools to support the
> profilation of the benchmarks I'm running (i.e. SPEC CPU2000, among others).
Yes. :)
> Are there any freely available instrumentator/simulator tools available for
> the LLVM bytecode, which, if possible, are also properly maintained? Or is
> there some kind of profilation already possbile, where I can start from?
There are two ways to do this. The first is to instrument the LLVM
interpreter. This is a matter of hacking on the functions in
lib/ExecutionEngine/Interpreter/Execution.cpp, and is very easy.
The other approach is to write an llvm-to-llvm instrumentation pass that
inserts code which dynamically computes (and logs) the properties you're
interested in. This is how our profile information works, for example.
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.
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.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list