[LLVMdev] Seeking Tutorial Based on Generation of LLVM IR and static compilation

Scott McLoughlin scottmcl66 at gmail.com
Fri Aug 20 04:42:09 PDT 2010


  I'm writing a compiler (originally targeting x86 asm, but now) 
targeting the
LLVM IR. I am seeking some tutorial style information focused on:

1) Hand writing LLVM IR and/or compiler generated TEXT LLVM IR
text source modules by my compiler

2) Purely static compilation and linking of modules written in LLVM IR
(or compiler generated, clearly)

3) In sum, I'm only interested in using LLVM as a "high level assembler."

4) My RTS is written 90% in assembler (garbage collection, real coroutines,
dynamic control stack for exceptions, unwind-protect, fluid-variables,
lexically scoped non-local exits, etc.) - so an example of integrating 
(linking)
RTS code into such an "LLVM IR is a generic assembly language" type
project would be a god send.

To clarify further:

1) I have no interest whatsoever in all of LLVM's "JIT" oriented features

2) I have no interest in using a LLVM's C api to generate LLVM IR. My
compiler will generate TEXT files of LLVM IR source directly that will
then be "assembled and linked" statically by LLVM utilities.

I suppose ideally, I seek ONLY a tutorial on using LLVM IR as a source
language and then getting from there to a bunch of LLVM IR source
modules and from there to assembler/link.

LLVM is big, and I'd like to be able to learn just this "IR as generic 
assembler
language" aspect of LLVM in a tutorial context.

I really, really, don't want to pay attention to all of LLVM's dynamic
compilation and C API  features - which I don't need - if I can possibly
avoid it.

Any and all pointers to resources greatly appreciated.

Thanks in advance !!!

Scott.



More information about the llvm-dev mailing list