[m-dev.] for review: MLDS switch optimization

Tyson Dowd trd at cs.mu.OZ.AU
Thu Nov 9 12:25:12 AEDT 2000


On 09-Nov-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> 
> > > +mlds_output_case_cond(Indent, Context, match_range(Low, High)) -->
> > > +	% This uses the GNU C extension `case <Low> ... <High>:'.
> > > +	mlds_indent(Context, Indent),
> > > +	io__write_string("case "),
> > > +	mlds_output_rval(Low),
> > > +	io__write_string(" ... "),
> > > +	mlds_output_rval(High),
> > > +	io__write_string(":\n").
> > 
> > Isn't this going to cause Pete Ross to thump you when it breaks the
> > VC++ backend?  
> > 
> > Have I missed the bit where you avoid generating this for non GNU C
> > compilers?  Or is it not used yet?
> 
> Currently this is not used, since the MLDS code generator doesn't
> generate switches with `match_range' cases.  I just put it in to
> keep the MLDS data structure as general as possible.
> (Perhaps I'm overdoing the generality here...)

Probably, but I don't have a big problem with that, just that the output
code doesn't check for GNU C before it spits out unportable code.
Since we don't test the VC++ backend very often here, it would be a good
idea to write the alternate code now, rather than wait until it is used.
By the time we use this code, we may not even have someone regularly
building with VC++.

> For the IL back-end, feel free to handle match_range by just calling
> error/1.

I should be able to handle it easily using fall-through.

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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