[m-dev.] GCC back-end and -a / --asm ==> --target asm

Fergus Henderson fjh at cs.mu.OZ.AU
Fri May 11 02:44:18 AEST 2001


On 10-May-2001, Ralph Becket <rbeck at microsoft.com> wrote:
> > Now that I've got the GCC back-end passing all of our test suite,
> > I'm keen to see it more widely used.
> 
> Great stuff.  How much does this shorten compile times (a subjective
> estimate may be enough to motivate me!)?

I just tested the compilation speed for samples/diff.
Starting with `MCFLAGS=-O0 MGNUCFLAGS=--no-c-optimize MLFLAGS=--shared'
(which you want if your aim is to minimize for maximum compilation time)
as the baseline, I measured that adding `--target asm' cut compilation
time by 20% (i.e. increased compilation speed by 25%).

times for --target asm GRADEFLAGS=-H MLFLAGS=--shared MCFLAGS=-O0
6.380u 1.570s 0:09.85 80.7%	0+0k 0+0io 47265pf+0w
6.430u 1.480s 0:07.94 99.6%	0+0k 0+0io 47258pf+0w
6.590u 1.320s 0:07.92 99.8%	0+0k 0+0io 47258pf+0w

times for GRADEFLAGS=-H MLFLAGS=--shared MCFLAGS=-O0 MGNUCFLAGS=--no-c-optimize
7.550u 2.030s 0:10.34 92.6%	0+0k 0+0io 59538pf+0w
7.450u 2.160s 0:09.83 97.7%	0+0k 0+0io 59536pf+0w
7.580u 2.020s 0:09.63 99.6%	0+0k 0+0io 59536pf+0w

However, this is to some extent an apples-vs-oranges comparison, because
`--target asm' uses a 2001/01/29 snapshot of gcc, whereas `--target c'
uses gcc 2.95.3.  There may be a diffence in compilation speed between
those.  It would be fairer to compare using the same version of gcc.

The speedup might be higher using `mmc' directly rather than Mmake.
Unfortunately I can't test it easily right now; I need to wait until my
recent fixes get installed.

> Do you get better quality object code using it?

No.  In fact if you have intermodule optimization enabled or
you're using the C interface, you may get worse code, since it won't
inline procedures defined using `pragma c_code'.

However, I have a patch to gcc to let the front-end tell the gcc back-end
when it is safe to do tail recursion.  With this patch, you will get
better code, since it will be able to do tail recursion optimization in
more circumstances.  (Currently we do it in the Mercury front-end for
direct tail recursion, but other last calls don't get optimized most
of the time.)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list