[m-dev.] for review: make tailcall loops an MLDS transformation
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Aug 24 15:36:08 AEST 2000
On 22-Aug-2000, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> +++ compiler/ml_tailcall.m 2000/08/14 01:37:38
> @@ -57,6 +57,7 @@
>
> :- implementation.
> :- import_module list, std_util.
> +:- import_module ml_util.
>
> ml_mark_tailcalls(MLDS0, MLDS) -->
> { MLDS0 = mlds(ModuleName, ForeignCode, Imports, Defns0) },
1. I don't understand why that import is needed.
2. I think it would be a good idea to add a comment in ml_tailcall.m
mentioning that optimization of self-tailcalls is done in ml_optimize.m.
> +:- func optimize_in_maybe_statement(opt_info,
> + maybe(mlds__statement)) = maybe(mlds__statement).
> +
> +optimize_in_maybe_statement(_, no) = no.
> +optimize_in_maybe_statement(OptInfo, yes(Statement0)) = yes(Statement) :-
> + Statement = optimize_in_statement(OptInfo, Statement0).
> +
> +:- func optimize_in_statements(opt_info, list(mlds__statement)) =
> + (list(mlds__statement)).
The parentheses around the return value are not needed, and for consistency
with other code in this module (and elsewhere) they should be omitted.
> +:- func optimize_in_statement(opt_info, mlds__statement) =
> + (mlds__statement).
Likewise here, and in a few other places in this module.
> +optimize_in_statement(OptInfo, statement(Stmt, Context)) =
> + statement(optimize_in_stmt(OptInfo ^ context := Context, Stmt),
> + Context).
For consistency with code elsewhere in the Mercury compiler, s/ ^ /^/
Likewise in many other spots in this module.
Apart from that, this change looks fine.
--
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