incremental compiler project

Tom Tromey
Fri Jul 13 21:23:00 GMT 2007

I've started work on a project to turn GCC into an incremental
compiler.  This project is still in an investigative stage but I
thought I would post some of my plans and ideas before making a

The primary goal of this project is improving the developer user
experience by decreasing turnaround time for typical changes to a
program.  This project will focus on the C and C++ compilers.

The basic idea of the project is to run GCC as a server (similar in a
way to the old compile server branch) and try to minimize the amount
of re-compilation done when a source file changes.

This is a complicated task with several components:

* Change GCC to run as a server.

* Change the front ends to re-use the results of parsing header files.
  Currently I'm experimenting with a prototype based on "--combine";
  the results of this will help determine the final design.  One idea
  for the "incremental" part of the plan is to do nothing special
  aside from this reuse; determining whether this is practical is one
  of the goals of the prototype.  BTW the prototype already has shown
  some nice results: 1/2 to 2/3 the runtime of the ordinary compiler,
  and 1/2 the memory.

* Change GCC to avoid generating object code for objects (functions,
  variables definitions, etc) that have not changed.  My current code
  generation plan is to fork the server process and generate a
  separate object per top-level definition.  (I'm not totally sure if
  this is practical.)

  For the full benefit I expect we'll need an incremental (re-)linker
  as well, but this is a separate project.

* Ideally, make the front ends parallel safe and parse in multiple
  threads.  This will require removing most of the global variables
  from the C and C++ front ends.

I'll be sending patches to the gcc-patches list, of course, and I will
make a wiki page describing the project and its current state.

I'll be at the GCC Summit in case anybody wants to talk in person
about this.  And, of course, I'm happy to answer questions and
concerns via email as well.


More information about the Gcc mailing list