[LLVMdev] A non-JIT tutorial?

Talin viridia at gmail.com
Sat May 17 11:06:31 PDT 2008


Although I have been using LLVM in non-JIT mode for a while, there are 
still a lot of holes in my knowledge. At lot of what I do know has been 
learned either through trial and error or through inspection of the LLVM 
source code. The downside of this approach is that while you might learn 
*one* way to get things working, it isn't necessarily the right or best way.

Looking at the traffic on this list, I think that I am not the only 
person in this position.

I think a tutorial for running and debugging LLVM programs in non-JIT 
mode would be very useful. The Kaleidoscope tutorial was immensely 
useful, but for folks like me who want to produce native binaries, it 
kind of tapers off right before the really interesting part. Of course, 
I recognize why this is: Any tutorial dealing with native binaries is 
going to have to deal with issues of different platforms and toolsets.

My suggestion/request is this: Start with a basic LLVM "hello world" 
sample written in IR, one that calls some c stdio functions. Next show 
how to run it in lli, both with and without -force-interpreter. 
Introduce a crash bug and show how to diagnose it. Then move on to 
generating native assembly, on both Linux (or OS X) and Windows, using 
whatever tool chain is most convenient (assume the reader is smart 
enough to generalize from those two sample points to other platforms.) 
Show how to call functions in foreign libraries. Again, introduce a 
problem and show how to diagnose it. Maybe add some sample debugging 
intrinsics and then show how to single-step in gdb.

I'm pretty certain that for me, at least, that I would learn a lot from 
such a tutorial, even after several months of testing my code using lli.

-- Talin




More information about the llvm-dev mailing list