<div dir="ltr"><div>Hi,<br><br></div>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 produced.<br>
<div><div><br>On Sat, Sep 21, 2013 at 5:31 AM, Rekha R <span dir="ltr"><<a href="mailto:rekharamapai@nitc.ac.in" target="_blank">rekharamapai@nitc.ac.in</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>Hi,<br></div>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<br>
<br></div><div>1. What are the differences between these three?<br></div><div></div></div></div></blockquote><div><br></div><div>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.<br>
<br></div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>2. Which one best serves my ultimate purpose of developing an machine independent optimizer using LLVM?<br>
</div></div></div></blockquote><div><br></div><div>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.<br>
</div><div><br><div>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.)<br>
</div><div> </div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div></div>3. Can someone give me step-by-step instructions to compile and execute this simple hello world C program?<br>
<br></div></div></blockquote><div>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.)<br>
<br></div><div>Cheers,<br></div><div>Dave <br></div></div><br>-- <br><div>cheers, dave tweed__________________________</div><div>high-performance computing and machine vision expert: <a href="mailto:david.tweed@gmail.com" target="_blank">david.tweed@gmail.com</a></div>
<div>"while having code so boring anyone can maintain it, use Python." -- attempted insult seen on slashdot</div><div> </div>
</div></div></div></div>