Scott McLoughlin
2010-Aug-20 11:42 UTC
[LLVMdev] Seeking Tutorial Based on Generation of LLVM IR and static compilation
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.
Devang Patel
2010-Aug-24 01:10 UTC
[LLVMdev] Seeking Tutorial Based on Generation of LLVM IR and static compilation
Scott,> 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. > >In that case, I guess just follow one of the llvm tool named 'llc' in debugger. It will read llvm IR text file and generate assembly output. If you need and overview of llvm components then lib/AsmParser reads llvm IR text file. lib/Transforms optimizes the llvm IR. lib/CodeGen (along with lib/Target) generates code from llvm IR which can be assembled and linked using traditional assembler and linker respectively. Browsing through various docs from http://llvm.org/docs/ will give definitely help you in general. - Devang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100823/17b84457/attachment.html>