[LLVMdev] What can llvm provide when writing a new compiler?
Nick Lewycky
nicholas at mxc.ca
Wed Sep 24 00:44:33 PDT 2008
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?
Optimizer and target codegen. We also provide an IR file format (both
binary and textual). You provide the lexer and parser, and you write the
code that turns your language into LLVM IR.
Note that the codegen is capable of generating both assembly files on
disk and of JITting. The optimizations are capable of doing
interprocedural optimizations. Someone might want to put these pieces
together in a program that ships some IR, generates some IR on the fly,
and then link-time-optimizes them and JITs the result.
> 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.
At some point your language has to become a sequence of operations
executed in order, which can in turn be expressed in LLVM IR. Leave it
to LLVM to perform your optimization and codegen.
I don't know what document you're referring to, but the LLVM IR is
really quite compact. Do read it: http://llvm.org/docs/LangRef.html .
Nick
> If anyone knows the answer, would you please give me a reply or
> recommend the chapters which can answer my questions? Thank you very
> much for any help or any advise.
>
>
>
> --
> Best regards.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list