[cfe-dev] distributed clang patch

Ted Kremenek kremenek at apple.com
Thu Jul 10 15:45:03 PDT 2008

On Jul 10, 2008, at 10:56 AM, Csaba Hruska wrote:

> About supporting other compilers by distributed clang: Ted, please  
> describe you ideas, because i have no idea what's the point of this  
> thing.

Suppose (for whatever reason) that a user wants to use icc/gcc to  
compile their sources instead of Clang.  They can still benefit from  
the clang-distcc because of the performance advantage of Clang's  
preprocessor over using the preprocessor typically used by those  
compilers.  Right now, distcc has to fork off a process just to  
preprocess a file, which also involves writing preprocessed files out  
to disk.  A clang-distcc can have an integrated preprocessor that can  
be much faster, as it can be linked directly into the same executable  
(no fork and exec).  Much of the scalability of distcc comes with how  
quickly you can send source code to the slave machines, so even if the  
end compiler is not Clang there is still a benefit to using clang- 
distcc over vanilla distcc.

Another advantage of allowing other compilers to work with clang- 
distcc is that you get a *staged* implementation.  Instead of  
requiring Clang to preprocess, parse, and compile in order to get  
clang-distcc working, you only need the preprocessing to work to get  
the core distcc functionality in place.  This also allows clang-distcc  
to be used to compile code that Clang cannot: e.g., the full richness  
of C++.  It also allows one to play with the distributed computed core  
of of clang-distcc without waiting for end-to-end compilation  
functionality in Clang to be completed.

Incorporating more than just preprocessing into clang-distcc simply  
allows more optimizations, but the end-to-end functionality is already  
all there.  For example, if you also parse the ASTs in clang-distcc ,  
we can parse ASTs and serialize those over the wire (much more compact  
than preprocessed text).  Those serialized ASTs could be compiled  
using Clang on the remote machine, or pretty-printed out and sent  
through the other compilers.

More information about the cfe-dev mailing list