[LLVMdev] a very beginning question

Chris Lattner sabre at nondot.org
Mon Sep 5 21:05:16 PDT 2005

On Mon, 5 Sep 2005 shding at mtu.edu wrote:
>   Thank you.
>   I'm only consider about how the compiler comiles c program to LLVM IR.
> I know there should be a scanner, parser, and IR generator. But where
> is the main entrance and  how about the flow of the process, especially
> about the IR generator?

This all exists in the llvm-gcc project, which you can check out per 
Reid's instructions.  We use a mostly unmodified GCC lexer and parser (see 
the gcc internals manual for details).  The LLVM specific parts are in the 
gcc/llvm-* files, most notably llvm-expand.c which converts the GCC AST to 
LLVM code.


>> shding at mtu.edu wrote:
>>> Hi,
>>>   Where can I find the main function of llvm compiler in the source
>>> file?
>>>   Thanks!
>> Well, there's a loaded question. :)
>> It depends on "which" compiler you mean. If you're talking about the
>> llvm-gcc
>> and llvm-g++ compilers (C/C++ to LLVM) then they are in the downloadable
>> tarballs available here: http://llvm.cs.uiuc.edu/releases/. You can also
>> get
>> them via CVS using the llvm-gcc repository name.
>> If you're talking about the llc compiler (LLVM to machine code), it is in
>> the
>> llvm repository under tools/llc, however most of the code consists of the
>> various libraries that make up LLVM (viewable at
>> http://illuvium.com/cgi-bin/cvsweb.cgi/llvm/lib/), in particular the
>> assembler
>> (lib/AsmParser), Bytecode facilities (lib/Bytecode), code generation code
>> (lib/Codegen), and target-specific translators (lib/Target).
>> If you're talking about the generic compiler, llvmc, you can find it at
>> the
>> tools/llvmc directory.
>> If you're talking about the (partially complete) Java interface, you can
>> find
>> it in the llvm-java repository.
>> If you're talking about the Stacker compiler, you can find it in the llvm
>> repository at projects/Stacker/lib/compiler.
>> Hope this helps.
>> Reid
>> _______________________________________________
>> 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