[LLVMdev] Newbie Enquiry

Reid Spencer reid at x10sys.com
Fri Aug 20 08:47:23 PDT 2004


On Fri, 2004-08-20 at 05:37, Ed Cogburn wrote:
> Reid Spencer wrote:
> > Yes, that's right!
> > 
> > In fact, shortly the process of doing that will get easier with the
> > llvmc (compiler driver) tool that I'm working on.

> [another newbie delurks]

heh. Hi!

> Hi, Reid.  Been tinkering with LLVM about 2 weeks now.  I've been using the 
> Stacker Compiler as an example so far for my own little project.  Is this tool 
> you mentioned coming "Real Soon Now(tm)", or is it months away?  

You can look at llvmc today in llvm/tools/llvmc. It won't build
automatically because its not in llvm/tools/Makefile yet, but that will
happen this week. It does everything except linking right now. I hope to
finish it by month's end.

> If its coming 
> soon, should I avoid using the Stacker example as a template?  In other words, 
> how much is this tool going to change the way one builds a frontend to LLVM? 
> Sorry in advance if this is a stupid question, LLVM is still a new beast to me.

The Stacker example is still a reasonable way to *start* your compiler.
You can get an optimizing back end that generates native or bytecode
output up and running by merely writing a simple translator (like
Stacker) and a configuration file (for which there is a stacker example
as well). Furthermore it will allow you to automagically link with other
LLVM compiled language (e.g. C/C++/LLVM Assembly). You have two choices
initially: write a front end that produces LLVM Assembly text files
(like the scheme front end) or write one that uses the C++ IR and
produces bytecode files (like  Stacker). The rest is handled by llvmc.

As your compiler mature and if you write it in C++, you can make it do
optimizations and configure llvmc not to run "opt". This will give you
better control over the optimizations passes, allow you to write your
own language specific passes, and also do the bulk of compilation more
quickly (fewer execs, less file I/O, etc.). Linking will still be
handled automatically by llvmc.

> 
> Thanks folks for your effort here, after looking at GCC sources to see what 
> writing a frontend would be like, LLVM looks like manna from heaven.  

Yeah, my sentiments exactly. I faced the same "need a backend" problem
last November. When I found I could invent a language (Stacker) and
implement something that worked in 4 days, I was thrilled. I had spent 4
MONTHS just trying to grok the GCC mailing list, never mind the code!

As for "manna from heaven", I think you just made Misha's quote book :)

Welcome Aboard!

Reid.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040820/7410620c/attachment.sig>


More information about the llvm-dev mailing list