tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] modern c++ compiler written in C (food for thought)


From: Basile Starynkevitch
Subject: Re: [Tinycc-devel] modern c++ compiler written in C (food for thought)
Date: Wed, 28 Oct 2015 07:11:47 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.3.0

On 10/28/2015 05:14 AM, Sergey Korshunoff wrote:
Hi Basile

A C++ compiler needs to be optimizing. The C++ language specification sort-of 
requires an > > optimizing compiler
Did you say that a usual C compiler (gcc, clang) can not optimize as a C++ does?
A tcc compiler is a compiler for a development speedup. A final stage
can be build by the usual compiler.

No, I was just saying the obvious point that practically speaking the C++11 standard is expecting any compiler implementing that standard to optimize significantly. A C++ compiler should inline lots of functions (including most member functions declared inside a class) and do a lot of optimizations (in particular constant folding, some loop unrolling or if (true) optimizations, dead code elimination, etc...). I giuess that some template expansion cannot happen without optimizations.

Hence a trivial compiler like TinyC (which don't do any serious optimization at all, this is why it compiles so fast) won't make sense in C++; you cannot code a TinyC++ compiler (which would not have serious optimization passes)!

I do know that both GCC & Clang are optimizing a common internal representation (e.g. Gimple in GCC) which is the same (or at least mostly overlapping) for C or C++ source code.

Notice that GCC even with -O0 is doing *some* optimizations.

Cheers.

--
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***




reply via email to

[Prev in Thread] Current Thread [Next in Thread]