[cfe-dev] Does Clang lower C++ to C at a single point in the lowering phase?

Daniel Dilts via cfe-dev cfe-dev at lists.llvm.org
Tue Sep 8 18:02:05 PDT 2015


You may be thinking of the old C backend.  It could generate C code from
the LLVM intermediate code.

On Tue, Sep 8, 2015 at 5:43 PM, John Sully via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Very early C++ compilers used to do this (circa early 1990s).  AFAIK No
> modern compiler has done this for decades.
>
> On Tue, Sep 8, 2015 at 5:09 PM, Hayden Livingston via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Ok, but it used to be that it lowered to C for quite a bit of the code
>> (not all), unless I've got my information wrong. Any body know?
>>
>> On Tue, Sep 8, 2015 at 3:09 PM, mats petersson <mats at planetcatfish.com>
>> wrote:
>> > I'm not a Clang expert, but I'm 99% sure that Clang does not convert C++
>> > into C (or something resembling C), but converts C++ code directly to
>> LLVM
>> > IR, which is then further "worked on" by LLVM to improve on the code
>> quality
>> > via various optimization passes, and then converted to machine code (or
>> > output as .bc or .ll from the compiler).
>> >
>> > --
>> > Mats
>> >
>> > On 8 September 2015 at 23:03, Hayden Livingston via cfe-dev
>> > <cfe-dev at lists.llvm.org> wrote:
>> >>
>> >> Is there a single well-defined point beyond which the AST has been
>> >> lowered ( / desugared?) to essentially C, including expanding template
>> >> information as different types?
>> >>
>> >> Or is it pretty much adhoc all over as we proceed to LLVM IR?
>> >>
>> >> I don't have complicated C++ code, so writing a ClangTool is not out
>> >> of the realm of possibility for me, but I'm inquiring here if it's
>> >> already part of the compiler
>> >> _______________________________________________
>> >> cfe-dev mailing list
>> >> cfe-dev at lists.llvm.org
>> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>> >
>> >
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150908/4322cf6d/attachment.html>


More information about the cfe-dev mailing list