[m-rev.] for review: stack slot optimization, part 3

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Mar 13 21:36:38 AEDT 2002


On 09-Mar-2002, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> Index: compiler/hlds_out.m
...
> @@ -1943,10 +2092,15 @@
>  hlds_out__write_unification(deconstruct(Var, ConsId, ArgVars, ArgModes,
>  		CanFail, CanCGC),
>  		ModuleInfo, ProgVarSet, InstVarSet, AppendVarnums, Indent) -->
> +	globals__io_lookup_string_option(dump_hlds_options, Verbose),
> +	( { string__contains_char(Verbose, 'G') } ->
>  	hlds_out__write_indent(Indent),
>  	io__write_string("% Compile time garbage collect: "),
>  	io__write(CanCGC),
> -	io__nl,
> +		io__nl
> +	;
> +		[]
> +	),

That change was not mentioned in the log message.

It should probably be committed as a separate change.

> Index: compiler/live_vars.m
...
> -:- implementation.
> -
>  % Parse tree modules
>  :- import_module prog_data.
>  
>  % HLDS modules
> -:- import_module hlds_goal, hlds_data, mode_util, instmap, code_aux.
> -:- import_module liveness.
> -
> -% Modules shared between different back-ends.
> -:- import_module code_model.
> -
> -% LLDS modules
> -:- import_module llds, arg_info, trace_params, trace.
> -
> -% Misc
> -:- import_module globals, options, graph_colour.
> -
> +:- import_module hlds_goal, hlds_pred, hlds_module, hlds_llds.
>  
>  % Standard library modules
> -:- import_module list, map, set, std_util, assoc_list, bool.
> -:- import_module int, require.
...
> +:- implementation.
> +
> +:- import_module llds, arg_info, prog_data.
> +:- import_module hlds_goal, hlds_llds, hlds_data, mode_util.
> +:- import_module code_model, liveness, code_aux, instmap.
> +:- import_module int, list, assoc_list, map, std_util, require.

You don't need to import prog_data here, since it is already
imported in the interface.

Also it would be nice if you didn't delete the comments there.

> -find_output_vars_from_arg_info(ArgVars, ArgInfo, OutVars) :-
> +find_input_output_vars_from_arg_info(ArgVars, ArgInfo, InVars, OutVars) :-
>  	assoc_list__from_corresponding_lists(ArgVars, ArgInfo, ArgPairs),
> +	set__init(InVars0),
>  	set__init(OutVars0),
> -	find_output_vars_2(ArgPairs, OutVars0, OutVars).
> +	find_input_output_vars_2(ArgPairs, InVars0, InVars, OutVars0, OutVars).
>  
> -:- pred find_output_vars_2(assoc_list(prog_var, arg_info)::in,
> +:- pred find_input_output_vars_2(assoc_list(prog_var, arg_info)::in,
> +	set(prog_var)::in, set(prog_var)::out,
>  	set(prog_var)::in, set(prog_var)::out) is det.
>  
> -find_output_vars_2([], OutVars, OutVars).
> -find_output_vars_2([Var - arg_info(_, Mode) | Rest], OutVars0, OutVars) :-
> -	( Mode = top_out ->
> +find_input_output_vars_2([], InVars, InVars, OutVars, OutVars).
> +find_input_output_vars_2([Var - arg_info(_, Mode) | Rest],
> +		InVars0, InVars, OutVars0, OutVars) :-
> +	(
> +		Mode = top_out,
> +		InVars1 = InVars0,
>  		set__insert(OutVars0, Var, OutVars1)
>  	;
> +		Mode = top_in,
> +		set__insert(InVars0, Var, InVars1),
> +		OutVars1 = OutVars0
> +	;
> +		Mode = top_unused,
> +		InVars1 = InVars0,
>  		OutVars1 = OutVars0
>  	),
> -	find_output_vars_2(Rest, OutVars1, OutVars).
> +	find_input_output_vars_2(Rest, InVars1, InVars, OutVars1, OutVars).

Shouldn't this code use the new stuff you added to arg_info.m?

Otherwise this part looks fine.
I didn't review the changes to live_vars.m very closely.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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