If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Since gcc is now being written in C++ it will no longer be possible to compile it on platforms that only have a C compiler (although cross compiling may be possible). This leads to the possibility of gcc being ported to some platforms by compiling it with llvm to C, and then using that C output to bootstrap the compilation of gcc!

Comment

Since gcc is now being written in C++ it will no longer be possible to compile it on platforms that only have a C compiler (although cross compiling may be possible). This leads to the possibility of gcc being ported to some platforms by compiling it with llvm to C, and then using that C output to bootstrap the compilation of gcc!

That ... could actually work. It's simultaneously a horrid hack, rather neat, and has a historical precedent (at least one ancient C++ compiler translated to C and passed that to an existing C compiler).

I do wonder what performance one would get out of a llvm → C → gcc pipeline, too... worth testing at some later point, though I don't expect anything earth-shattering.

Comment

We know - that was sort of the point of wondering if stage one could be "use llvm to compile the relevant parts of gcc to plain C, then feed that to the system C compiler".

You may try to see the bookkeeping code size of your final code! As C describes fairly well what the final processor does, you can see if your code is really efficient or has a lot of hidden copying, conversions and stuff as such.
Another use I think is for projects like Mono: they are in need to generate C# wrappers starting from C++ ones. Maybe if the C generated code header generates C#-friendly code, it may be a way for a lot of languages that work in a VM with a C based interface: Python, Java, C# to import C++ interface of C++ libraries of physics, big frameworks like Qt, extensions for Firefox (they will likely need just C++ soon, as the new JS/GC implementations will make use of it).