On Saturday 17 November 2012 08:34 PM, Basile Starynkevitch wrote:
On Sat, Nov 17, 2012 at 07:03:33AM -0500, Richard Kenner wrote:
First, C or C++ is not the best language to write a compiler in,
It is my strong opinion that the best language to write a compiler in is
the language that it is compiling (or the primary language in the case
of a multi-language compiler like GCC).
I tend to half agree with that, but GCC is not exactly coded in C (or in C++).
It has a lot of C code generators (gengtype, genautomata, and all the other
gen*) and the combined amount of generated (C or C++) code in GCC is not
insignificant.
In my humble opinion, glossing over this distinction has been a gross
mistake. Even for the folks trained in compiler technology, it becomes
very hard to understand GCC in the absence of a clear statement that GCC
is not a compiler but is a compiler generation framework. Calling it a
compiler collection is also misleading because it is far more than that.
I have struggled for close to a decade to build a view of GCC which can
be explained to others without necessarily requiring them to fight with
the code for many months. I have come to a conclusion that not giving
importance to making things easier for new people wanting to contribute
to GCC has done more harm to GCC movement than anything else.
As GCC becomes more and more complex, it becomes more and more difficult
to involve students. No wonder more and more people are turning to LLVM
to do their experiments. All these people could have been GCC's testers
and experimenters, but that was not to be. And this trend from academic
has now also reached the industry because today's students are
tomorrow's professionals.
For a simple evidence, count the number of job openings involving LLVM
vs. the number of job openings involving GCC on
http://www.compilerjobs.com/db/jobs_list.php. The situation was far
different say five years ago.
In past three or four years during my tutorials and workshops, one
question that has been persistently asked is: Why not LLVM? Earlier I
used to think that this question was being raised to seek advice.
However, I realized to my utter dismay in past one year, that it was not
a question seeking advice on what they should be doing but it was a
question seeking clarification on why I still continue to work on GCC!
And this is a distinction that at least cannot gloss over. I have met a
large number of people who have tried hands at both and have given up on
GCC and have moved to LLVM.
So while we continue to improve the technology, we have to also give due
importance to making it easier for newer people to become contributors
to the technology.
GCC is not just about a code that works. It is also about building
succinct explanations of what that code is and why it has been designed
the way it is.
Uday.