[m-dev.] for review: deforestation [2/3]

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Apr 22 11:38:16 AEST 1998


On 01-Apr-1998, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> +++ options.m	1998/03/19 04:08:05
> @@ -71,6 +71,7 @@
>  		;	debug_det
>  		;	debug_opt
>  		;	debug_vn
> +		;	debug_pd

A comment saying that `pd' stands for "partial deduction",
i.e. deforestation, might be helpful here.

(Ditto for `vn' = "value numbering".)

> +simplify__find_simplifications(WarnThisPass, Globals, S) :-
> +	( WarnThisPass = yes ->
> +		simplify__lookup_option(Globals, warn_duplicate_calls,
> +			warn_duplicate_calls, [], S1),
> +		simplify__lookup_option(Globals, warn_simple_code,
> +			warn_simple_code, S1, S2)
> +	;
> +		S2 = []
> +	),
> +	simplify__lookup_option(Globals, excess_assign, excess_assigns, S2, S3),
> +	simplify__lookup_option(Globals, common_struct, common_struct, S3, S4),
> +	simplify__lookup_option(Globals, optimize_duplicate_calls,
> +		duplicate_calls, S4, S5),
> +	simplify__lookup_option(Globals, constant_propagation,
> +		constant_prop, S5, S).

It would probably be clearer and more maintainable to write this as a DCG.

simplify__find_simplifications(WarnThisPass, Globals, S) :-
	simplify__find_simplifications_2(WarnThisPass, Globals, [], S).

simplify__find_simplifications_2(WarnThisPass, Globals) -->
	( { WarnThisPass = yes } ->
		simplify__lookup_option(Globals, warn_duplicate_calls,
			warn_duplicate_calls),
		simplify__lookup_option(Globals, warn_simple_code,
			warn_simple_code)
	;
		[]
	),
	simplify__lookup_option(Globals, excess_assign, excess_assigns),
	simplify__lookup_option(Globals, common_struct, common_struct),
	simplify__lookup_option(Globals, optimize_duplicate_calls,
		duplicate_calls),
	simplify__lookup_option(Globals, constant_propagation, constant_prop).

> Index: tests/misc_tests/mdemangle_test.exp
> Index: tests/misc_tests/mdemangle_test.inp
> Index: util/mdemangle.c

These changes aren't in the log message.

Also you need to modify profiler/demangle.m to match the changes to
util/mdemangle.c.

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



More information about the developers mailing list