[m-rev.] for review: flatten nested blocks in the mlds
Ralph Becket
rafe at cs.mu.OZ.AU
Sat Feb 28 09:05:27 AEDT 2004
Peter Ross, Friday, 27 February 2004:
> Index: compiler/ml_optimize.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/ml_optimize.m,v
> retrieving revision 1.24
> diff -u -r1.24 ml_optimize.m
> --- compiler/ml_optimize.m 20 Feb 2004 02:39:57 -0000 1.24
> +++ compiler/ml_optimize.m 27 Feb 2004 12:46:21 -0000
> @@ -461,6 +462,27 @@
> target_supports_break_and_continue_2(il) = no.
> target_supports_break_and_continue_2(java) = yes.
> % target_supports_break_and_continue_2(c_sharp) = yes.
> +
> +%-----------------------------------------------------------------------------%
> +
> +%
> +% If the list of statements contains a block with no local variables,
> +% then bring the block up one level. This optimization is needed to avoid
> +% a compiler limit in the Microsoft C compiler for too deeply nested blocks.
> +%
> +:- pred maybe_flatten_block(mlds__statements::in, mlds__statements::out) is det.
I'd write maybe_flatten_block as a function.
> +
> +maybe_flatten_block(!Stmts) :-
> + !:Stmts = list__condense(list__map(flatten_block, !.Stmts)).
I'm not sure that it's good style to use state variable notation for
such a small case, unless, perhaps, the broad surrounding context is
covered in state variables.
-- Ralph
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list