[m-dev.] for review: make tailcall loops an MLDS transformation

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Aug 22 23:43:14 AEST 2000


On 22-Aug-2000, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> Do the transformation of self-tailcalls into loops as an MLDS->MLDS
> transformation (instead of during mlds_to_c.m).  Both the IL and C
> backends for MLDS use this transformation.

This is a good idea...

> Also, we transform into label/goto instead of for/continue.  This is
> because IL doesn't have a for/continue construct.  It may be worth
> revisiting this decision in future and performing benchmarks.

I think this one is not such a good idea, since Java, which is definitely
an important target language, supports for/continue but not label/goto.

> +++ compiler/mercury_compile.m	2000/08/21 01:50:42
> @@ -2376,7 +2377,13 @@
>  	maybe_report_stats(Stats),
>  	mercury_compile__maybe_dump_mlds(MLDS30, "30", "nested_funcs"),
>  
> -	{ MLDS = MLDS30 },
> +	maybe_write_string(Verbose, "% Optimizing MLDS...\n"),
> +	ml_optimize__optimize(MLDS30, MLDS40),
> +	maybe_write_string(Verbose, "% done.\n"),
> +	maybe_report_stats(Stats),
> +	mercury_compile__maybe_dump_mlds(MLDS40, "40", "optimize"),

That pass should be disable-able.

> +	% The label name we use for the top of the loop introduced by
> +	% tailcall optimization.
> +:- func tailcall_loop_label_name = string.
> +tailcall_loop_label_name = "looptop".

I suggest s/looptop/loop_top/

[... to be continued ...]

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