<div dir="ltr"><div>I got the impression that the AST was more like the AST of Kaleidoscope than the AST of Clang - reading between the lines in the posts above.<br><br></div><div>But yes, Clang has much better tools for generating C code out of AST than LLVM-IR will ever have. For example differnet types of loops [even when they are "strange forms"] will be retained in their original form - so loops using for(;;) as a forever loop will not turn into a while(true) or a goto loop. In LLVM-IR, this sort of construction would become lost, since the IR for any "endless loop" is identical.<br></div><div><br>--<br></div><div>Mats<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 15 May 2015 at 11:43, James Courtier-Dutton <span dir="ltr"><<a href="mailto:james.dutton@gmail.com" target="_blank">james.dutton@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 14 May 2015 at 20:44, Aditya Avinash <<a href="mailto:adityaavinash1@gmail.com">adityaavinash1@gmail.com</a>> wrote:<br>
</span><div><div class="h5">> Hi,<br>
> I am trying to use LLVM to generate C (partly, Intel AVX) code to test some<br>
> abstractions. Apparently, most of the documentation is related to generating<br>
> LLVM-IR. Are there any tools to do this? (I have generated AST from these<br>
> abstractions. I want to generate C code from it).<br>
> Thank you! :)<br>
><br>
> PS: If this is a wrong mailinglist, help me with the right one.<br>
><br>
<br>
</div></div>If you have your code at the AST level, you might as well use CLANG to<br>
work at the AST level and create C code as output.<br>
CLANG is closely linked to LLVM.<br>
There seems very little point in lowering the AST to LLVM-IR then<br>
output to C. You will loose useful structural information.<br>
E.g. By using something like this with CLANG would be better:<br>
<a href="http://eli.thegreenplace.net/2012/06/08/basic-source-to-source-transformation-with-clang" target="_blank">http://eli.thegreenplace.net/2012/06/08/basic-source-to-source-transformation-with-clang</a><br>
<br>
Also, if you can create AST in a format CLANG understands, it can then<br>
automatically lower it to LLVM-IR, and you will have your completed<br>
compiler for your own language.<br>
<br>
The mailing list for CLANG is<br>
mailto: <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<br>
Kind Regards<br>
<span class="HOEnZb"><font color="#888888"><br>
James<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br></div>