[LLVMdev] Generating C code using LLVM

Eli Bendersky eliben at google.com
Thu May 14 14:57:50 PDT 2015


On Thu, May 14, 2015 at 2:49 PM, Aditya Avinash <adityaavinash1 at gmail.com>
wrote:

> Hi,
> Thanks for the response.
>
>
> On Thu, May 14, 2015 at 5:06 PM, mats petersson <mats at planetcatfish.com>
> wrote:
>
>> From what input? Usually Clang is the tool for "rewriting C" (making
>> source to source conversions), but it's not clear if that's what you are
>> trying to achieve, so some more information would be useful.
>>
>
> I have successfully generated AST from my  "hypothetical language" which
> can be translated to C. I want to use LLVM instead of building my own
> compiler. Rewriting "C" may work (I may have to try). I don't want to
> generate IR as it is hard to read whether the C output is exactly what I
> meant to write.
>
>>
>> Afaict, LLVM won't generate C source code tho'.
>>
>
> Oh. No chance?
> Thank you! :)
>
>

LLVM used to have a C backend in-tree. It was removed a few releases ago
due to disuse and code rot.

Someone maintains a fork where the C backend is alive:
https://github.com/draperlaboratory/llvm-cbe -- so you may want to check
that.

I'm curious why you need this though. Are you planning to go through LLVM
just for the sake of its IR-level optimizations?

Eli




>
>> ---
>> Mats
>>
>> On 14 May 2015 at 20:44, Aditya Avinash <adityaavinash1 at gmail.com> wrote:
>>
>>> Hi,
>>> I am trying to use LLVM to generate C (partly, Intel AVX) code to test
>>> some abstractions. Apparently, most of the documentation is related to
>>> generating LLVM-IR. Are there any tools to do this? (I have generated AST
>>> from these abstractions. I want to generate C code from it).
>>> Thank you! :)
>>>
>>> PS: If this is a wrong mailinglist, help me with the right one.
>>>
>>> --
>>> Regards,
>>>
>>> *Aditya Atluri,*
>>>
>>> *USA.*
>>>
>>>
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>>
>>
>
>
> --
> Regards,
>
> *Aditya Atluri,*
>
> *USA.*
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150514/908ba4cb/attachment.html>


More information about the llvm-dev mailing list