[LLVMdev] request for help on getting started

David Tweed david.tweed at gmail.com
Sat Sep 21 06:03:44 PDT 2013


I'll make a start an answering, but the most important thing is that you
don't really say what kind of optimization you're planning: is it something
that only needs LLVM IR, does it need additional semantic information only
available at the level of C source? If the latter it will probably require
ensuring that at least the source level info gets encoded into the LLVM IR

On Sat, Sep 21, 2013 at 5:31 AM, Rekha R <rekharamapai at nitc.ac.in> wrote:

> Hi,
> I intend to write an optimization using LLVM. But before doing that I felt
> like understanding the tools. I wrote a hello world program to be compiled
> and executed. But then one of the tutorials suggested using Clang, an other
> said dragonegg, a third suggested using llvm-gcc. I am confused as to which
> one to use. Can some one help me in
> 1. What are the differences between these three?

llvm-gcc is considered obsolete and hasn't been supported fro several LLVM
releases. Clang is the main C-family front-end for LLVM. dragonegg is a
system which combines the GCC-front and mid-ends and then converts from GCC
internal repesentation to LLVM to continue compilation. It's major goal is
to bring language frontends for which there isn't a native LLVM equivalent
so far (Fortran, Ada, etc) into the LLVM system, although you can use it
with the GCC C-family compilers.

2. Which one best serves my ultimate purpose of developing an machine
> independent optimizer using LLVM?

See above: it's tricky to answer this without a better idea of what kind of
things are involved in your optimization. Since you've mentioned C I assume
it is something tailored for a C-family language. If not then you may need
to use dragonegg.

Otherwise, as a pragmatic point, if you use clang you'll probably get more
feedback on what you're doing and the problems you hit. (Arguably the clang
front-end is also one of the clearer ones around.)

> 3. Can someone give me step-by-step instructions to compile and execute
> this simple hello world C program?
> If you've got a clang binary (either precompiled or built yourself from
source), it will work like a standard C compiler. The manpages list the
relevant switches. (The trickier bits will arise when you want to examine
the internals of the compiler as it compiles a program.)


cheers, dave tweed__________________________
high-performance computing and machine vision expert: david.tweed at gmail.com
"while having code so boring anyone can maintain it, use Python." --
attempted insult seen on slashdot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130921/9b47b3c7/attachment.html>

More information about the llvm-dev mailing list