This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Converting GCC to compilation with C++


Paolo Bonzini wrote:
> 
> It is too hard to use a different number of stages for different parts 
> of the compiler.  So if you build the C++ front-end needed to compile 
> Java in stageN, you'll need N+2 stages (N+1 compiles the Java front-end, 
> N+2 is needed to compare the object files).

Paolo, our understanding of what the bootstrap process and
its stages ought to be seems to be somewhat different.

*My understanding*, which might very well be wrong, of
the generalised bootstrap process is:

a. In stage1, build the minimal set of front-ends. This
includes the C front-end and any front-end that is not
written in C or in a language who's front-end in GCC is
not written in C (so the Ada front-end in Ada is built,
but not the Java front-end in C++, for example).

b. Use the stage1 compilers to build all front-ends that
are now build-able. So we can now build C, C++, Ada, ObjC
and Fortran, but not Java yet.

c. To guard against code/debug-info generation bugs,
repeat the above process but now with the stage2
compilers. So once again, C, C++, Ada, ObjC and Fortran
get built, but not Java.

d. Now build all front-ends that were not built in
stage2, i.e. those that are written in a non-C
language whose front-end in GCC is written in C. So
only Java (and not others) get built here.

(There is no point in having a stage5, as object
comparisons would be pointless.)

Only this, I claim, is a true "bootstrap". There are
of course shortcuts possible (as when you also want
to use the system C++ compiler for Java, for example),
but they are not "bootstraps" really.


> A 4-stage bootstrap obviously takes longer than a 3-stage bootstrap, so 
> the scheme on the left is preferrable to the one on the right:
> 
> stage1           C,C++,Ada              C,Ada
> stage2           C,C++,Java,Ada         C,C++,Ada
> stage3           C,C++,Java,Ada         C,C++,Java,Ada
> stage4                                  C,C++,Java,Ada

The corresponding column for what I outline above would be:

  stage1    C,Ada
  stage2    C,C++,Ada
  stage3    C,C++,Ada
  stage4    Java


>>This is so that we can benefit as much as possible from
>>new optimisation and/or other features in the GCC being
>>built.
> 
> 
> You always end up installing the C++ compiler built in the final stage, 
> so it makes no difference whether you first build C++ in stage1 or stage2.

It does - what if the vendor compiler (or existing GCC) does
not have the optimisations or extensions in the current GCC?
I want the C++, Java, etc. compilers built with as much
available optimisations as possible.

(I note that this process only gives me confidence in the C
and the Ada compilers, and not as much in the C++, Fortran,
ObjC and Java compilers.)


> If all you want is a GCC compiled with itself, you can use a 2-stage 
> bootstrap (even faster, but without the self test introduced by 
> bootstrap compares).  That would work even if Java used C++, as long as 
> you had a C++ compiler installed on your machine.

No, the comparison is vital in ensuring (to the extent
possible) that the newly-built compiler (or the vendor
compiler itself) does indeed generate correct code.

Ranjit.

-- 
Ranjit Mathew          Email: rmathew AT gmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]