|How to Write Your Own Compiler with LLVM firstname.lastname@example.org (A.F.) (2010-02-09)|
|Re: How to Write Your Own Compiler with LLVM email@example.com (Stephen Horne) (2010-02-10)|
|Re: How to Write Your Own Compiler with LLVM firstname.lastname@example.org (Jon Harrop) (2010-02-11)|
|From:||Stephen Horne <email@example.com>|
|Date:||Wed, 10 Feb 2010 18:33:25 +0000|
|Posted-Date:||10 Feb 2010 15:53:48 EST|
On Tue, 9 Feb 2010 19:56:03 -0800 (PST), "A.F."
> So sorry if the question seems basic, but would like an paper or
>another document equivalent to the tutorial below:
>How to Write Your Own Compiler
> But more focused and a little more advanced.
> And by the way, my goal is to use the LLVM.
I found the Kaleidoscope tutorial to be easier...
You can probably skip chapters 1 and 2 if you're OK with scanning,
parsing and AST handling. LLVM itself is only introduced in chapter 3.
Once you complete the tutorial, I recommend the LLVM assembler
Transferring the ideas from this form to LLVM library calls (e.g.
builder calls to generate particular instructions) is fairly easy. The
important thing is to understand how LLVM intermediate code works. If
you've used a non-virtual assembler before, probably the biggest
surprise is the phi instruction needed for SSA, and this is explained
in the Kaleidoscope tutorial.
The Doxygen documentation for the library isn't too bad, but you do
need to have some idea where to look before you dive in. Good starting
points are the main classes mentioned in the Kaleidoscope tutorial.
Also, it may be better to build the Doxygen with GraphViz *not*
installed. The diagrams it generates tend to be far too large to be
useful on screen, no matter how big your monitor, and you'd need a
large wall to display even a selection of them as posters.
One of the biggest challenges with LLVM, if you're running Windows,
may be getting the thing to build - though on Linux (and with some
compilers, on Windows) this is very easy. If you're building using
MinGW GCC 4.4.0, for instance, look here...
Return to the
Search the comp.compilers archives again.