Related articles |
---|
How to Write Your Own Compiler with LLVM alberto.fabiano@gmail.com (A.F.) (2010-02-09) |
Re: How to Write Your Own Compiler with LLVM sh006d3592@blueyonder.co.uk (Stephen Horne) (2010-02-10) |
Re: How to Write Your Own Compiler with LLVM jon@ffconsultancy.com (Jon Harrop) (2010-02-11) |
From: | Stephen Horne <sh006d3592@blueyonder.co.uk> |
Newsgroups: | comp.compilers |
Date: | Wed, 10 Feb 2010 18:33:25 +0000 |
Organization: | virginmedia.com |
References: | 10-02-040 |
Keywords: | LLVM, tools |
Posted-Date: | 10 Feb 2010 15:53:48 EST |
On Tue, 9 Feb 2010 19:56:03 -0800 (PST), "A.F."
<alberto.fabiano@gmail.com> wrote:
>Hi,
>
> 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
>http://llvm.org/ProjectsWithLLVM/>ompilerwrite
>
> 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...
http://llvm.org/docs/tutorial/LangImpl1.html
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
programmers reference.
http://llvm.org/docs/LangRef.html
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...
http://stackoverflow.com/questions/2129263/how-to-build-llvm-using-gcc-4-on-windows
Return to the
comp.compilers page.
Search the
comp.compilers archives again.