Hello All
LiangKun 梁堃 wrote:
Hello, everyone :
I am learning compiler techniques. I want a live example. I also want to do my
contributions to open source. So I turn to gcc.
Last year I have added some instruction templates to one specific gcc
backend as a task in work.
I have read a little of "Using and Porting GCC".
But still, I cannot manage the source code of gcc.
I don't know how to start reading it.
Actually you ask an interesting & difficult question. Some thoughts from
somebody who works on GCC for more than a year but still considers
himself a newbie:
* the biggest issue with GCC is probably not being a compiler, but it is
being a huge (more than three million lines of source code), constantly
evolving (perhaps several hundred of lines changed or added each week to
the trunk!), software (open source = GPLv3). I imagine that other big
open source projects (like the Linux kernel, or Xorg, or MySQL, or
OpenOffice or even Qt or GTK etc) have similar issues [but I think
almost nobody could invest himself deeply in more than one such a big
project] And I am quite sure that even big coorporate proprietary
projects have similar partial mis-understanding; for instance, I would
believe that nobody at Microsoft understands all of Windows, or their
Word processor, same for SAP, etc.. To make it short: human brains are
not fully compatible with million source line sized sofware!
* my impression is that nobody understands fully the GCC compiler. Maybe
there are some few exceptions, but I tend to believe that most of GCC
contributors (in particular myself) do not understand all of it, and had
to give up the idea of grasping it all! As usual, the way to go into it
is abstraction: you agree to not understand fully some stuff, and you
abstract it.
* on the positive side, GCC is still doing well and alive, has an active
community; when you ask questions on this gcc@gcc.gnu.org mailing list,
you get some answers, provided your question is precise enough, and you
did look into code and existing documentation.
* more concretely, there are lot of material on GCC. Of course, the
"official" documentation http://gcc.gnu.org/onlinedocs/ the source code
(usually well commented), the mailing lists (including
[EMAIL PROTECTED]), the Wiki (feel free to contribute)
http://gcc.gnu.org/wiki and many others (which you can find by STFW). In
particular http://gcc.gnu.org/wiki/GettingStarted points to
http://www.airs.com/dnovillo/200711-GCC-Internals/ and
http://www.hipeac.net/node/746
http://gcc.gnu.org/wiki/OptimizationCourse where you can find
interesting slides & tutorial.
* an efficient way to learn GCC is by interacting with real persons (who
would be your mentors). Sebastian Pop taught me a lot of stuff on GCC,
and this was face to face. Still a big thanks to him!
I hope this will help you. I also hope you would contribute some hints
on how did you learn GCC stuff.
Regards.
--
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 mines, sont seulement les miennes} ***