[m-dev.] for review: --no-special-preds

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Apr 2 00:04:06 AEST 2000


On 31-Mar-2000, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> On 01-Apr-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > > 	enumerations, we were only specializing compare in mode 0, when modes
> > > 	0 through 3 have identical code (they differ only in uniqueness
> > > 	requirements on the arguments).
> > 
> > I'm not sure that this specialization is safe, because the resulting code is
> > not be well-moded.
> 
> The transformation I made should only ever be casting away the uniqueness
> information from (a) builtins and (b) enum types without user-defined equality.
> I don't believe that any part of the compiler after unique mode checking
> is as yet interested in the uniqueness of values of such types.

Some parts of the compiler, for example deforestation, redo mode analysis.
Currently the deforestation pass simply skips the deforestation optimization
if the optimized code fails to pass mode checking.  But in general it would
be easier if the various optimization phases preserved properties like
unique mode correctness.  The few places where the compiler fails to
preserve type correctness have often come back to bite us later.

> However, the problem can in any case be avoided reasonably simply, by adding
> three new modes (out,ui,in), (out,in,ui) and (out,ui,ui) for the comparison
> preds of the builtin types

That would be great if it works, but doing that may not be trivial,
since I think the compiler currently doesn't support `ui' modes.

-- 
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