[m-dev.] problem with MCFLAGS

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Nov 19 16:35:37 AEDT 1999


On 18-Nov-1999, Peter Ross <petdr at cs.mu.OZ.AU> wrote:
> The accumulator tests fail at -O5 because runtests puts the -O5 in
> EXTRA_MCFLAGS which come after MCFLAGS leading to calls to the compiler
> like the following:
> 
>     mmc file.m --introduce-accumulators -O5
> 
> Now while processing the -O5 the first thing it does is reset all
> the optimizations to their defaults, and you lose the fact that
> --introduce-accumulators was turned on.
> 
> Any hints on how to solve this problem?

Pete's current solution is as follows:

|       # XXX
|       # Accumulators aren't introduced for -O5
|       # this is just a temp workaround
| override EXTRA_MCFLAGS =
| MCFLAGS = -d accum --introduce-accumulators --optimize-constructor-last-call \
|                 --intermodule-optimization

A solution that avoids ignoring the command-line setting of EXTRA_MCFLAGS
would be to use

	TARGET_MCFLAGS += -d accum --introduce-accumulators \
		--optimize-constructor-last-call --intermodule-optimization

That relies on some implementation details of Mmake.
It's probably OK to do that in the Mercury test suite.

Another solution which only uses documented features of Mmake,
rather than relying on implementation details such as TARGET_MCFLAGS,
would be to use

	ACC_MCFLAGS = -d accum --introduce-accumulators \
		--optimize-constructor-last-call --intermodule-optimization

	MCFLAGS-test1 = $(ACC_MCFLAGS)
	MCFLAGS-test2 = $(ACC_MCFLAGS)
	MCFLAGS-test3 = $(ACC_MCFLAGS)
	...

The drawback of that solution is that there is a tiny bit of code duplication
for each test case.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- 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