[LLVMdev] What can llvm provide when writing a new compiler?
David Greene
dag at cray.com
Wed Sep 24 09:19:25 PDT 2008
On Wednesday 24 September 2008 02:27, Cloud Strife wrote:
> Hi everyone.
> Because there is still a little confusion about the huge document, I want
> to know what llvm can provide when we customize our new compiler?
> For example, a normal compiler includes lexer, parser, intermediate code
> generator , optimizer and target code generator. According to llvm
> documents, it seems that llvm can provide a better intermediate code
> presentation. And what else can it provide?
Codegen, codegen, codegen.
Oh, and optimizations too. :)
> Assuming my new lanuage is very unusual, should I write all the parts(
> lexer, parser, intermediate code generator , optimizer and target code
> generator) by myself? If so, is there any convenient method / scheme to do
> so? Because I heard that the biggest advantage of llvm is its flexible and
> quick-development for new language.
If you're targeting x86, for example, you do NOT want to write your own
codegen! If you do, good luck digesting five volumes of ISA material. :)
This is generally true for other architectures as well. Reuse, reuse, reuse.
LLVM is well-designed to allow you to do that. Take advantage of it.
Does LLVM have its shortcomings? Sure. But I can guarantee it has fewer
shortcomings than a custom codegen would have down the road. Because there's
a community working on it, itr's been forced to be designed in a flexible and
reuseable way. Development process is a significant advantage of LLVM and
open source in general, one that I think is greatly undervalued.
-Dave
More information about the llvm-dev
mailing list