[m-dev.] for review: added new option `--mark-tailcalls'

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Feb 2 18:25:05 AEDT 2001


On 02-Feb-2001, Julien Fischer <juliensf at students.cs.mu.oz.au> wrote:
> Added an option `--mark-tailcalls' which makes detection of tailcalls
> in the MLDS backend optional.  If this is not turned on then the 
> tailcalls will not be optimized later on.

The fact that we optimize tail calls by first marking them and then
later transforming them is an implementation detail of the MLDS back-end.
The user shouldn't need to know about such implementation details.
So I think the optimization should be named `--optimize-tailcalls'.

> This is turned off in
> optimization level 0 and when the Java grade is being used; for other
> optimization levels it is on.

The log message is slightly misleading about what happens at
optimization level -1.

> +++ compiler/handle_options.m	2001/02/02 04:03:59
> @@ -297,7 +297,7 @@
>  	),
>  	% Generating Java implies high-level code, turning off nested functions,
>  	% using copy-out for both det and nondet output arguments,
> -	% using no tags and no static ground terms.
> +	% using no tags, not marking tailcalls and no static ground terms.
>  	% XXX no static ground terms should be eliminated in a later
>  	%     version.
>  	( { Target = java } ->

There should be an XXX comment here for tailcalls too,
like there is for static ground terms.

> @@ -2527,7 +2532,9 @@
>  	io__write_string("\n    MLDS -> MLDS optimizations:\n"),
>  	write_tabbed_lines([
>  		"--no-mlds-optimize",
> -		"\tDisable the MLDS->MLDS optimization passes."
> +		"\tDisable the MLDS->MLDS optimization passes.",
> +		"--mark-tailcalls",
> +		"\tMark tailcalls that can be optimized."
>  	]).

The `--no-mlds-optimize' option should imply `--no-mark-tailcalls'.

The option should be documented in user_guide.texi too.

The documentation could be a lot better.

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