Contructing a GCC front end
Developing a GCC front end is something surrounded with black magic. GCC's size and age make it very complex, old APIs mix with new ones and most documentation is old and doesn't cover its current state. Nonetheless, the advantages surely compensate the costs. Once the front end is written, it is able to generate code for ARMs, x86s, s390 and many others. Besides this, the generated code has a superior quality due the optimizations that GCC implements. In this tutorial we will show how to build a simple GCC front end. The presentation will be divided in 1) The general organization of GCC: What are the responsibilities of the front end, middle end and back end? How does the front-end communicates to the middle end? What data structure does it use? 2) The GCC build system from a front end point of view: How to add a front end to the GCC build process? Which options must be passed to GCC? Which files should be supplied? Which programs should be created by the build? 3) The compilation process: How does the driver (gcc) talks to the compiler (cc1). What callbacks must be supplied by the front end. 4) The GCC internals: GCC uses a garbage collector. How to avoid being trashed by it. The front end must translate its input to the GENERIC representation. What does it look like? How to create it? 5) Sending data to the middle end: What is the call graph module? What should be passed to it? How to tell it to finish the compilation? 6) Putting it all together: The hello world compiler (a compiler that always creates a hello world program) and a overview of the GCC scheme compiler (https://gna.org/projects/gsc) *** If you are attending this tutorial you should download this file *** (http://tux05.ltc.ic.unicamp.br/~rafael/snapshot-gcc.tar.bz2)
Computer engineer student at the State University of Campinas Main developer of the GCC Scheme Compiler (http://gna.org/projects/gsc) ported the support for the emc6d102 temperature sensor to the 2.6 linux kernel. from march 2004 to march 2005 had a part time job at the Linux Technology Center (LTC), IBM. did some preliminary work on porting debian to the powerpc64 architecture (http://lists.debian.org/debian-pnowerpc/2004/09/msg00418.html)
Computer engineer student at the State University of Campinas. Core developer of the LinModem general layer (http://gna.org/projects/linmodem). Co-author of the GCC Scheme Compiler (http://gna.org/projects/gsc). Free Software contributor since 1999, with patches to FFMpeg, MPlayer, MAS, KDE, Discover, Freevo, ArchC and a few others. Work part time at Linux Technology Center (LTC), IBM, since March 2004.