[cfe-dev] SSA form in Clang
mats at planetcatfish.com
Fri May 1 03:27:22 PDT 2015
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).
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).
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.
On 1 May 2015 at 10:58, Hayden Livingston <halivingston at gmail.com> wrote:
> For my project (a subset of C) I'm trying to do optimizations at the
> source level language and wondering why Clang doesn't have an SSA form
> Is it not useful, since LLVM does almost all the optimizations?
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev