<div dir="ltr"><div><div>Someone will come along and correct me if I'm wrong, but my understanding is that Clang does indeed rely very on LLVM to produce optimised code, and very little, if any, optimisation is done in Clang. Clang produces LLVM IR directly from the AST (or at least "nearly directly", it does some transformations in Sema for example, that introduces explicit casts from implicit casts in the original source - such as converting integers to float or float to integer in arguments or assignments).<br><br></div>This is kind of the beauty of LLVM IR, and certainly helps the approach I've taken in my Pascal compiler - of course, you still need to produce "sensible" LLVM IR, as the optimisation will not remove all forms of useless/stupid code that the user could create (as I've found out at times).<br><br></div><div>I have a hard time understanding why you couldn't use LLVM IR to make the optimisations you want (by adding suitable passes to the compiler) - or was the point to output C source code that is "optimised"? If so, you may want to work at the AST level in Clang instead - there are tools for (recusively) iterating over that too.<br></div><div><br>--<br></div>Mats<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 1 May 2015 at 10:58, Hayden Livingston <span dir="ltr"><<a href="mailto:halivingston@gmail.com" target="_blank">halivingston@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For my project (a subset of C) I'm trying to do optimizations at the<br>
source level language and wondering why Clang doesn't have an SSA form<br>
representation.<br>
<br>
Is it not useful, since LLVM does almost all the optimizations?<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>