[m-dev.] for review:

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon Sep 18 15:20:10 AEDT 2000


For review by anyone.

Unify the code that performs the three kinds of data movements
required for calls:

(1) putting forward live variables to be saved across the call
    into their stack slots
(2) putting variables protected by enclosing resumption points
    into their stack slots
(3) putting input arguments into their registers

By using the same code (code_info__setup_call) for all three, we gain
two benefits:

(1) This code can also compute the live lval set we must put into
    a livevals LLDS instruction before the call to describe the
    locations that must be preserved by value numbering. Previously,
    this set was computed by other algorithms, raising the possibility
    of a discrepancy. Such discrepancies would cause value numbering
    to generate incorrect code.

(2) The eager back end is more efficient when given a single list
    of data placements to perform instead of three lists, because
    it can reorder operations more freely when required.

compiler/call_gen.m:
	Make the change described above.

	Factor out more code that is common between ordinary and generic calls.

compiler/code_info.m:
	Provide the infrastructure for the change above.

compiler/arg_info.m:
	Concentrate predicates dealing with arg_infos and parameter passing
	conventions in general in this module. Previously, call_gen.m and
	code_util.m also contained such code.

compiler/bytecode_gen.m:
compiler/pragma_c_gen.m:
compiler/disj_gen.m:
compiler/follow_vars.m:
compiler/middle_rec.m:
	Small changes to conform to changes in interfaces of the modules above.

compiler/code_util.m:
	Remove a now redundant predicate.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/arg_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/arg_info.m,v
retrieving revision 1.33
diff -u -r1.33 arg_info.m
--- compiler/arg_info.m	2000/09/04 22:33:23	1.33
+++ compiler/arg_info.m	2000/09/06 11:34:03
@@ -20,22 +20,45 @@
 :- import_module hlds_module, hlds_pred, llds, prog_data.
 :- import_module list, assoc_list.
 
-:- pred generate_arg_info(module_info, module_info).
-:- mode generate_arg_info(in, out) is det.
+	% Annotate every non-aditi procedure in the module with information
+	% about its argument passing interface.
+:- pred generate_arg_info(module_info::in, module_info::out) is det.
+
+	% Given the list of types and modes of the arguments of a procedure
+	% and its code model, return its argument passing interface.
+:- pred make_arg_infos(list(type)::in, list(mode)::in, code_model::in,
+	module_info::in, list(arg_info)::out) is det.
 
-:- pred arg_info__unify_arg_info(code_model, list(arg_info)).
-:- mode arg_info__unify_arg_info(in, out) is det.
-
-:- pred make_arg_infos(list(type), list(mode), code_model, module_info,
-	list(arg_info)).
-:- mode make_arg_infos(in, in, in, in, out) is det.
-
 	% Given a list of the head variables and their argument information,
 	% return a list giving the input variables and their initial locations.
-:- pred arg_info__build_input_arg_list(assoc_list(prog_var, arg_info),
-	assoc_list(prog_var, lval)).
-:- mode arg_info__build_input_arg_list(in, out) is det.
+:- pred arg_info__build_input_arg_list(assoc_list(prog_var, arg_info)::in,
+	assoc_list(prog_var, lval)::out) is det.
 
+	% Divide the given list of arguments into those treated as inputs
+	% by the calling convention and those treated as outputs.
+:- pred arg_info__compute_in_and_out_vars(module_info::in,
+	list(prog_var)::in, list(mode)::in, list(type)::in,
+	list(prog_var)::out, list(prog_var)::out) is det.
+
+	% Return the arg_infos for the two input arguments of a unification
+	% of the specified code model.
+:- pred arg_info__unify_arg_info(code_model::in, list(arg_info)::out) is det.
+
+	% Divide the given list of arguments and the arg_infos into three
+	% lists: the inputs, the outputs, and the unused arguments, in that
+	% order.
+:- pred arg_info__partition_args(assoc_list(prog_var, arg_info)::in,
+	assoc_list(prog_var, arg_info)::out,
+	assoc_list(prog_var, arg_info)::out,
+	assoc_list(prog_var, arg_info)::out) is det.
+
+	% Divide the given list of arguments and the arg_infos into two
+	% lists: those which are treated as inputs by the calling convention
+	% and those which are treated as outputs by the calling convention.
+:- pred arg_info__partition_args(assoc_list(prog_var, arg_info)::in,
+	assoc_list(prog_var, arg_info)::out,
+	assoc_list(prog_var, arg_info)::out) is det.
+
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
@@ -53,8 +76,8 @@
 	map__keys(Preds, PredIds),
 	generate_pred_arg_info(PredIds, ModuleInfo0, ModuleInfo).
 
-:- pred generate_pred_arg_info(list(pred_id), module_info, module_info).
-:- mode generate_pred_arg_info(in, in, out) is det.
+:- pred generate_pred_arg_info(list(pred_id)::in,
+	module_info::in, module_info::out) is det.
 
 generate_pred_arg_info([], ModuleInfo, ModuleInfo).
 generate_pred_arg_info([PredId | PredIds], ModuleInfo0, ModuleInfo) :-
@@ -64,9 +87,8 @@
 	generate_proc_list_arg_info(PredId, ProcIds, ModuleInfo0, ModuleInfo1),
 	generate_pred_arg_info(PredIds, ModuleInfo1, ModuleInfo).
 
-:- pred generate_proc_list_arg_info(pred_id, list(proc_id),
-	module_info, module_info).
-:- mode generate_proc_list_arg_info(in, in, in, out) is det.
+:- pred generate_proc_list_arg_info(pred_id::in, list(proc_id)::in,
+	module_info::in, module_info::out) is det.
 
 generate_proc_list_arg_info(_PredId, [], ModuleInfo, ModuleInfo).
 generate_proc_list_arg_info(PredId, [ProcId | ProcIds], 
@@ -90,8 +112,8 @@
 	),
 	generate_proc_list_arg_info(PredId, ProcIds, ModuleInfo1, ModuleInfo).
 
-:- pred generate_proc_arg_info(proc_info, list(type), module_info, proc_info).
-:- mode generate_proc_arg_info(in, in, in, out) is det.
+:- pred generate_proc_arg_info(proc_info::in, list(type)::in, module_info::in,
+	proc_info::out) is det.
 
 generate_proc_arg_info(ProcInfo0, ArgTypes, ModuleInfo, ProcInfo) :-
 	proc_info_argmodes(ProcInfo0, ArgModes),
@@ -116,6 +138,13 @@
 	% where the first register is reserved for the result and hence
 	% the output arguments start at register number 2.
 
+	% We allocate unused args as if they were outputs. The calling
+	% convention requires that we allocate them a register, and the choice
+	% should not matter since unused args should be rare. However, we
+	% do have to make sure that all the predicates in this module
+	% implement this decision consistently. (No code outside this module
+	% should know about the outcome of this decision.)
+
 make_arg_infos(ArgTypes, ArgModes, CodeModel, ModuleInfo, ArgInfo) :-
 	( CodeModel = model_semi ->
 		StartReg = 2
@@ -125,32 +154,21 @@
 	make_arg_infos_list(ArgModes, ArgTypes, 1, StartReg,
 		ModuleInfo, ArgInfo).
 
-:- pred make_arg_infos_list(list(mode), list(type), int, int,
-	module_info, list(arg_info)).
-:- mode make_arg_infos_list(in, in, in, in, in, out) is det.
+:- pred make_arg_infos_list(list(mode)::in, list(type)::in, int::in, int::in,
+	module_info::in, list(arg_info)::out) is det.
 
 make_arg_infos_list([], [], _, _, _, []).
 make_arg_infos_list([Mode | Modes], [Type | Types], InReg0, OutReg0,
 		ModuleInfo, [ArgInfo | ArgInfos]) :-
 	mode_to_arg_mode(ModuleInfo, Mode, Type, ArgMode),
-	(
-		ArgMode = top_in,
+	( ArgMode = top_in ->
 		ArgReg = InReg0,
-		InReg1 is InReg0 + 1,
+		InReg1 = InReg0 + 1,
 		OutReg1 = OutReg0
 	;
-		ArgMode = top_out,
 		ArgReg = OutReg0,
 		InReg1 = InReg0,
-		OutReg1 is OutReg0 + 1
-	;
-		% Allocate unused args as if they were outputs.
-		% We must allocate them a register, and the choice
-		% should not matter since unused args should be rare.
-		ArgMode = top_unused,
-		ArgReg = OutReg0,
-		InReg1 = InReg0,
-		OutReg1 is OutReg0 + 1
+		OutReg1 = OutReg0 + 1
 	),
 	ArgInfo = arg_info(ArgReg, ArgMode),
 	make_arg_infos_list(Modes, Types, InReg1, OutReg1,
@@ -162,15 +180,6 @@
 
 %---------------------------------------------------------------------------%
 
-arg_info__unify_arg_info(model_det,
-	[arg_info(1, top_in), arg_info(2, top_in)]).
-arg_info__unify_arg_info(model_semi,
-	[arg_info(1, top_in), arg_info(2, top_in)]).
-arg_info__unify_arg_info(model_non, _) :-
-	error("arg_info: nondet unify!").
-
-%---------------------------------------------------------------------------%
-
 arg_info__build_input_arg_list([], []).
 arg_info__build_input_arg_list([V - Arg | Rest0], VarArgs) :-
 	Arg = arg_info(Loc, Mode),
@@ -183,4 +192,86 @@
 	arg_info__build_input_arg_list(Rest0, VarArgs0).
 
 %---------------------------------------------------------------------------%
+
+arg_info__compute_in_and_out_vars(ModuleInfo, Vars, Modes, Types,
+		InVars, OutVars) :-
+	(
+		arg_info__compute_in_and_out_vars_2(ModuleInfo,
+			Vars, Modes, Types, InVars1, OutVars1)
+	->
+		InVars = InVars1,
+		OutVars = OutVars1
+	;
+		error("arg_info__compute_in_and_out_vars: length mismatch")
+	).
+
+:- pred arg_info__compute_in_and_out_vars_2(module_info::in,
+	list(prog_var)::in, list(mode)::in, list(type)::in,
+	list(prog_var)::out, list(prog_var)::out) is semidet.
+
+arg_info__compute_in_and_out_vars_2(_ModuleInfo, [], [], [], [], []).
+arg_info__compute_in_and_out_vars_2(ModuleInfo, [Var | Vars],
+		[Mode | Modes], [Type | Types], InVars, OutVars) :-
+	arg_info__compute_in_and_out_vars_2(ModuleInfo, Vars,
+		Modes, Types, InVars1, OutVars1),
+	mode_to_arg_mode(ModuleInfo, Mode, Type, ArgMode),
+	( ArgMode = top_in ->
+		InVars = [Var | InVars1],
+		OutVars = OutVars1
+	;
+		InVars = InVars1,
+		OutVars = [Var | OutVars1]
+	).
+
+%---------------------------------------------------------------------------%
+
+arg_info__unify_arg_info(model_det,
+	[arg_info(1, top_in), arg_info(2, top_in)]).
+arg_info__unify_arg_info(model_semi,
+	[arg_info(1, top_in), arg_info(2, top_in)]).
+arg_info__unify_arg_info(model_non, _) :-
+	error("arg_info: nondet unify!").
+
+%---------------------------------------------------------------------------%
+
+arg_info__partition_args(Args, Ins, Outs) :-
+	arg_info__partition_args(Args, Ins, Outs0, Unuseds),
+	list__append(Outs0, Unuseds, Outs).
+
+arg_info__partition_args([], [], [], []).
+arg_info__partition_args([Var - ArgInfo | Rest], Ins, Outs, Unuseds) :-
+	arg_info__partition_args(Rest, Ins0, Outs0, Unuseds0),
+	ArgInfo = arg_info(_, ArgMode),
+	(
+		ArgMode = top_in,
+		Ins = [Var - ArgInfo | Ins0],
+		Outs = Outs0,
+		Unuseds = Unuseds0
+	;
+		ArgMode = top_out,
+		Ins = Ins0,
+		Outs = [Var - ArgInfo | Outs0],
+		Unuseds = Unuseds0
+	;
+		ArgMode = top_unused,
+		Ins = Ins0,
+		Outs = Outs0,
+		Unuseds = [Var - ArgInfo | Unuseds0]
+	).
+
+%---------------------------------------------------------------------------%
+
+% XXX END
+
+:- pred arg_info__input_args(list(arg_info)::in, list(arg_loc)::out) is det.
+
+arg_info__input_args([], []).
+arg_info__input_args([arg_info(Loc, Mode) | Args], Vs) :-
+	arg_info__input_args(Args, Vs0),
+	( Mode = top_in ->
+		Vs = [Loc | Vs0]
+	;
+		Vs = Vs0
+	).
+
 %---------------------------------------------------------------------------%
Index: compiler/bytecode_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode_gen.m,v
retrieving revision 1.48
diff -u -r1.48 bytecode_gen.m
--- compiler/bytecode_gen.m	2000/08/09 07:46:17	1.48
+++ compiler/bytecode_gen.m	2000/09/05 12:12:12
@@ -310,7 +310,7 @@
 	make_arg_infos(ArgTypes, ArgModes, CodeModel, ModuleInfo, ArgInfo),
 	assoc_list__from_corresponding_lists(ArgVars, ArgInfo, ArgVarsInfos),
 
-	call_gen__partition_args(ArgVarsInfos, InVars, OutVars),
+	arg_info__partition_args(ArgVarsInfos, InVars, OutVars),
 	list__length(InVars, NInVars),
 	list__length(OutVars, NOutVars),
 
Index: compiler/call_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/call_gen.m,v
retrieving revision 1.143
diff -u -r1.143 call_gen.m
--- compiler/call_gen.m	2000/09/04 22:33:24	1.143
+++ compiler/call_gen.m	2000/09/05 12:00:07
@@ -4,9 +4,9 @@
 % Public License - see the file COPYING in the Mercury distribution.
 %---------------------------------------------------------------------------%
 %
-% file: call_gen.m
+% File: call_gen.m
 %
-% main author: conway.
+% Authors: conway, zs.
 %
 % This module provides predicates for generating procedure calls,
 % including calls to higher-order pred variables.
@@ -43,9 +43,6 @@
 :- pred call_gen__generic_call_info(code_model::in, generic_call::in,
 	code_addr::out, assoc_list(prog_var, arg_info)::out, int::out) is det.
 
-:- pred call_gen__partition_args(assoc_list(prog_var, arg_info)::in,
-	list(prog_var)::out, list(prog_var)::out) is det.
-
 :- pred call_gen__input_arg_locs(assoc_list(prog_var, arg_info)::in,
 	assoc_list(prog_var, arg_loc)::out) is det.
 
@@ -64,33 +61,18 @@
 
 %---------------------------------------------------------------------------%
 
-call_gen__generate_call(CodeModel, PredId, ProcId, Arguments, GoalInfo, Code)
-		-->
+call_gen__generate_call(CodeModel, PredId, ProcId, ArgVars, GoalInfo, Code) -->
 
 		% Find out which arguments are input and which are output.
 	code_info__get_pred_proc_arginfo(PredId, ProcId, ArgInfo),
-	{ assoc_list__from_corresponding_lists(Arguments, ArgInfo, ArgsInfos) },
+	{ assoc_list__from_corresponding_lists(ArgVars, ArgInfo, ArgsInfos) },
+
+		% Save the necessary vars on the stack and move the input args
+		% to their registers.
+	code_info__setup_call(GoalInfo, ArgsInfos, LiveVals, SetupCode),
 
-		% Save the known variables on the stack, except those
-		% generated by this call.
-	{ call_gen__select_out_args(ArgsInfos, OutArgs) },
-	code_info__save_variables(OutArgs, SaveCode),
-
-		% Save possibly unknown variables on the stack as well
-		% if they may be needed on backtracking, and figure out the
-		% call model.
-	call_gen__prepare_for_call(CodeModel, FlushCode, CallModel),
-
-		% Move the input arguments to their registers.
-	code_info__setup_call(ArgsInfos, caller, SetupCode),
-
-	trace__prepare_for_call(TraceCode),
-
-		% Figure out what locations are live at the call point,
-		% for use by the value numbering optimization.
-	{ call_gen__input_args(ArgInfo, InputArguments) },
-	call_gen__generate_call_vn_livevals(InputArguments, OutArgs,
-		LiveCode),
+		% Figure out what the call model is.
+	call_gen__prepare_for_call(CodeModel, CallModel, TraceCode),
 
 		% Make the call.
 	code_info__get_module_info(ModuleInfo),
@@ -99,6 +81,8 @@
 	{ call_gen__call_comment(CodeModel, CallComment) },
 	{ goal_info_get_context(GoalInfo, Context) },
 	{ CallCode = node([
+		livevals(LiveVals)
+			- "",
 		call(Address, label(ReturnLabel), ReturnLiveLvalues, Context,
 			CallModel)
 			- CallComment,
@@ -122,13 +106,10 @@
 	call_gen__handle_failure(CodeModel, FailHandlingCode),
 
 	{ Code =
-		tree(SaveCode,
-		tree(FlushCode,
 		tree(SetupCode,
 		tree(TraceCode,
-		tree(LiveCode,
 		tree(CallCode,
-		     FailHandlingCode))))))
+		     FailHandlingCode)))
 	}.
 
 %---------------------------------------------------------------------------%
@@ -149,51 +130,39 @@
 		Args0, Types0, Modes0, Args, Types, Modes) },
 
 	{ determinism_to_code_model(Det, CodeModel) },
-	code_info__get_module_info(ModuleInfo),
-	{ make_arg_infos(Types, Modes, CodeModel, ModuleInfo, ArgInfos) },
-	{ assoc_list__from_corresponding_lists(Args, ArgInfos, ArgsInfos) },
-	{ call_gen__partition_args(ArgsInfos, InVars, OutVars) },
-	{ set__list_to_set(OutVars, OutArgs) },
-	code_info__save_variables(OutArgs, SaveCode),
-
-	call_gen__prepare_for_call(CodeModel, FlushCode, CallModel),
-
 	{ call_gen__generic_call_info(CodeModel, GenericCall,
 		CodeAddr, SpecifierArgInfos, FirstImmInput) },
-
-		% Place the immediate input arguments and the part of the
-		% called-code-specifier determined by variables in their
-		% registers.
-	{ call_gen__give_vars_consecutive_regs(InVars, FirstImmInput, InLocs) },
-	{ call_gen__give_vars_consecutive_arg_infos(InVars, FirstImmInput,
-		top_in, InVarArgInfos) },
-	{ list__append(SpecifierArgInfos, InVarArgInfos, InArgInfos) },
-	code_info__setup_call(InArgInfos, caller, ImmediateCode),
-
-	code_info__generate_call_stack_vn_livevals(OutArgs, LiveVals0),
-	{ call_gen__extra_livevals(FirstImmInput, ExtraLiveVals) },
-	{ set__insert_list(LiveVals0, ExtraLiveVals, LiveVals1) },
-	{ set__insert_list(LiveVals1, InLocs, LiveVals) },
-
 	{ CodeModel = model_semi ->
 		FirstOutput = 2
 	;
 		FirstOutput = 1
 	},
+
+	code_info__get_module_info(ModuleInfo),
+	{ arg_info__compute_in_and_out_vars(ModuleInfo, Args, Modes, Types,
+		InVars, OutVars) },
+	{ call_gen__give_vars_consecutive_arg_infos(InVars, FirstImmInput,
+		top_in, InVarArgInfos) },
 	{ call_gen__give_vars_consecutive_arg_infos(OutVars, FirstOutput,
 		top_out, OutArgsInfos) },
-
-	code_info__get_instmap(InstMap),
-	{ goal_info_get_instmap_delta(GoalInfo, InstMapDelta) },
-	{ instmap__apply_instmap_delta(InstMap, InstMapDelta, ReturnInstMap) },
+	{ list__append(SpecifierArgInfos, InVarArgInfos, InArgInfos) },
+	{ list__append(InArgInfos, OutArgsInfos, ArgInfos) },
 
-		% Doing this after generating the immediate input arguments,
-		% results in slightly more efficient code by not moving
-		% the immediate arguments twice.
+		% Save the necessary vars on the stack and move the input args
+		% defined by variables to their registers.
+	code_info__setup_call(GoalInfo, ArgInfos, LiveVals0, SetupCode),
+
+		% Move the input args not defined by variables to their
+		% registers. Setting up these arguments last results in
+		% slightly more efficient code, since we can use their
+		% registers when placing the variables.
 	call_gen__generic_call_nonvar_setup(GenericCall, InVars, OutVars,
-		SetupCode),
+		NonVarCode),
+
+	{ call_gen__extra_livevals(FirstImmInput, ExtraLiveVals) },
+	{ set__insert_list(LiveVals0, ExtraLiveVals, LiveVals) },
 
-	trace__prepare_for_call(TraceCode),
+	call_gen__prepare_for_call(CodeModel, CallModel, TraceCode),
 
 		% Make the call.
 	code_info__get_next_label(ReturnLabel),
@@ -208,6 +177,13 @@
 			- "Continuation label"
 	]) },
 
+		% Figure out what variables will be live at the return point,
+		% and where, for use in the accurate garbage collector, and
+		% in the debugger.
+	code_info__get_instmap(InstMap),
+	{ goal_info_get_instmap_delta(GoalInfo, InstMapDelta) },
+	{ instmap__apply_instmap_delta(InstMap, InstMapDelta, ReturnInstMap) },
+
 		% Update the code generator state to reflect the situation
 		% after the call.
 	call_gen__handle_return(OutArgsInfos, ReturnInstMap,
@@ -218,13 +194,11 @@
 	call_gen__handle_failure(CodeModel, FailHandlingCode),
 
 	{ Code =
-		tree(SaveCode,
-		tree(FlushCode,
-		tree(ImmediateCode,
 		tree(SetupCode,
+		tree(NonVarCode,
 		tree(TraceCode,
 		tree(CallCode,
-		     FailHandlingCode))))))
+		     FailHandlingCode))))
 	}.
 
 call_gen__maybe_remove_aditi_state_args(GenericCall, Args0, Types0, Modes0,
@@ -266,6 +240,8 @@
 	assoc_list__values(TypesAndArgs, OtherArgs),
 	list__append(OtherArgs, [State0Arg, StateArg], Args).
 
+%---------------------------------------------------------------------------%
+
 	% The registers before the first input argument are all live.
 :- pred call_gen__extra_livevals(int::in, list(lval)::out) is det.
 
@@ -516,26 +492,24 @@
 
 %---------------------------------------------------------------------------%
 
-:- pred call_gen__prepare_for_call(code_model::in, code_tree::out,
-	call_model::out, code_info::in, code_info::out) is det.
+:- pred call_gen__prepare_for_call(code_model::in, call_model::out,
+	code_tree::out, code_info::in, code_info::out) is det.
 
-call_gen__prepare_for_call(CodeModel, FlushCode, CallModel) -->
+call_gen__prepare_for_call(CodeModel, CallModel, TraceCode) -->
 	code_info__succip_is_used,
 	(
 		{ CodeModel = model_det },
-		{ CallModel = det },
-		{ FlushCode = empty }
+		{ CallModel = det }
 	;
 		{ CodeModel = model_semi },
-		{ CallModel = semidet },
-		{ FlushCode = empty }
+		{ CallModel = semidet }
 	;
 		{ CodeModel = model_non },
 		code_info__may_use_nondet_tailcall(TailCallStatus),
 		{ CallModel = nondet(TailCallStatus) },
-		code_info__flush_resume_vars_to_stack(FlushCode),
 		code_info__set_resume_point_and_frame_to_unknown
-	).
+	),
+	trace__prepare_for_call(TraceCode).
 
 :- pred call_gen__handle_failure(code_model::in, code_tree::out,
 	code_info::in, code_info::out) is det.
@@ -714,48 +688,6 @@
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
 
-call_gen__partition_args([], [], []).
-call_gen__partition_args([V - arg_info(_Loc, Mode) | Rest], Ins, Outs) :-
-	(
-		Mode = top_in
-	->
-		call_gen__partition_args(Rest, Ins0, Outs),
-		Ins = [V | Ins0]
-	;
-		call_gen__partition_args(Rest, Ins, Outs0),
-		Outs = [V | Outs0]
-	).
-
-%---------------------------------------------------------------------------%
-
-:- pred call_gen__select_out_args(assoc_list(prog_var, arg_info)::in,
-	set(prog_var)::out) is det.
-
-call_gen__select_out_args([], Out) :-
-	set__init(Out).
-call_gen__select_out_args([V - arg_info(_Loc, Mode) | Rest], Out) :-
-	call_gen__select_out_args(Rest, Out0),
-	( Mode = top_out ->
-		set__insert(Out0, V, Out)
-	;
-		Out = Out0
-	).
-
-%---------------------------------------------------------------------------%
-
-:- pred call_gen__input_args(list(arg_info)::in, list(arg_loc)::out) is det.
-
-call_gen__input_args([], []).
-call_gen__input_args([arg_info(Loc, Mode) | Args], Vs) :-
-	call_gen__input_args(Args, Vs0),
-	( Mode = top_in ->
-		Vs = [Loc | Vs0]
-	;
-		Vs = Vs0
-	).
-
-%---------------------------------------------------------------------------%
-
 call_gen__input_arg_locs([], []).
 call_gen__input_arg_locs([Var - arg_info(Loc, Mode) | Args], Vs) :-
 	call_gen__input_arg_locs(Args, Vs0),
@@ -789,17 +721,6 @@
 
 %---------------------------------------------------------------------------%
 
-:- pred call_gen__give_vars_consecutive_regs(list(prog_var)::in, int::in,	
-	list(lval)::out) is det.
-
-call_gen__give_vars_consecutive_regs([], _N, []).
-call_gen__give_vars_consecutive_regs([_Var | Vars], N0, [Lval | Lvals]) :-
-	Lval = reg(r, N0),
-	N1 is N0 + 1,
-	call_gen__give_vars_consecutive_regs(Vars, N1, Lvals).
-
-%---------------------------------------------------------------------------%
-
 :- pred call_gen__give_vars_consecutive_arg_infos(list(prog_var)::in, int::in,
 	arg_mode::in, assoc_list(prog_var, arg_info)::out) is det.
 
@@ -807,7 +728,7 @@
 call_gen__give_vars_consecutive_arg_infos([Var | Vars], N0, ArgMode,
 		[Var - ArgInfo | ArgInfos]) :-
 	ArgInfo = arg_info(N0, ArgMode),
-	N1 is N0 + 1,
+	N1 = N0 + 1,
 	call_gen__give_vars_consecutive_arg_infos(Vars, N1, ArgMode, ArgInfos).
 
 %---------------------------------------------------------------------------%
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.80
diff -u -r1.80 code_gen.m
--- compiler/code_gen.m	2000/09/04 22:33:26	1.80
+++ compiler/code_gen.m	2000/09/05 12:20:35
@@ -737,9 +737,10 @@
 		(
 			{ instmap__is_unreachable(Instmap) }
 		->
+			{ OutLvals = set__init },
 			{ FlushCode = empty }
 		;
-			code_info__setup_call(Args, callee, FlushCode)
+			code_info__setup_return(Args, OutLvals, FlushCode)
 		),
 		{
 			MaybeSuccipSlot = yes(SuccipSlot)
@@ -794,24 +795,18 @@
 					Locn = indirect(Lval, _)
 				)
 			)) },
-			{ solutions(FindBaseLvals, TypeInfoLvals) }
+			{ solutions(FindBaseLvals, TypeInfoLvals) },
+			{ set__insert_list(OutLvals, TypeInfoLvals,
+				LiveLvals) }
 		;
 			{ TraceExitCode = empty },
-			{ TypeInfoLvals = [] }
+			{ LiveLvals = OutLvals }
 		),
 
-			% Find out which locations should be mentioned
-			% in the success path livevals(...) annotation,
-			% so that value numbering doesn't optimize them away.
-		{ code_gen__select_args_with_mode(Args, top_out, _OutVars,
-			OutLvals) },
-		{ list__append(TypeInfoLvals, OutLvals, LiveArgLvals) },
-		{ set__list_to_set(LiveArgLvals, LiveArgs) },
-
 		(
 			{ CodeModel = model_det },
 			{ SuccessCode = node([
-				livevals(LiveArgs) - "",
+				livevals(LiveLvals) - "",
 				goto(succip) - "Return from procedure call"
 			]) },
 			{ AllSuccessCode =
@@ -821,7 +816,7 @@
 			}
 		;
 			{ CodeModel = model_semi },
-			{ set__insert(LiveArgs, reg(r, 1), SuccessLiveRegs) },
+			{ set__insert(LiveLvals, reg(r, 1), SuccessLiveRegs) },
 			{ SuccessCode = node([
 				assign(reg(r, 1), const(true)) - "Succeed",
 				livevals(SuccessLiveRegs) - "",
@@ -841,7 +836,7 @@
 				SetupRedoCode = empty
 			},
 			{ SuccessCode = node([
-				livevals(LiveArgs) - "",
+				livevals(LiveLvals) - "",
 				goto(do_succeed(no))
 					- "Return from procedure call"
 			]) },
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.252
diff -u -r1.252 code_info.m
--- compiler/code_info.m	2000/09/11 02:48:07	1.252
+++ compiler/code_info.m	2000/09/11 03:18:24
@@ -2036,7 +2036,8 @@
 				Map, FailureAddress) },
 			{ map__to_assoc_list(Map, AssocList) },
 			code_info__remember_position(CurPos),
-			code_info__pick_and_place_vars(AssocList, PlaceCode),
+			code_info__pick_and_place_vars(AssocList, _,
+				PlaceCode),
 			code_info__reset_to_position(CurPos)
 		),
 		{ BranchCode = node([goto(FailureAddress) - "fail"]) },
@@ -2068,7 +2069,8 @@
 			{ map__to_assoc_list(Map, AssocList) },
 			code_info__get_next_label(SuccessLabel),
 			code_info__remember_position(CurPos),
-			code_info__pick_and_place_vars(AssocList, PlaceCode),
+			code_info__pick_and_place_vars(AssocList, _,
+				PlaceCode),
 			code_info__reset_to_position(CurPos),
 			{ SuccessAddress = label(SuccessLabel) },
 				% We branch away if the test *fails*,
@@ -2233,12 +2235,19 @@
 	{ Code = tree(Code0, Code1) }.
 
 code_info__flush_resume_vars_to_stack(Code) -->
+	code_info__compute_resume_var_stack_locs(VarLocs),
+	code_info__place_vars(VarLocs, Code).
+
+:- pred compute_resume_var_stack_locs(assoc_list(prog_var, lval)::out,
+	code_info::in, code_info::out) is det.
+
+code_info__compute_resume_var_stack_locs(VarLocs) -->
 	code_info__get_fail_info(FailInfo),
 	{ FailInfo = fail_info(ResumePointStack, _, _, _, _) },
 	{ stack__top_det(ResumePointStack, ResumePoint) },
 	{ code_info__pick_stack_resume_point(ResumePoint, StackMap, _) },
-	{ map__to_assoc_list(StackMap, StackLocs) },
-	code_info__pick_and_place_vars(StackLocs, Code).
+	{ map__to_assoc_list(StackMap, VarLocSets) },
+	{ code_info__pick_var_places(VarLocSets, VarLocs) }.
 
 %---------------------------------------------------------------------------%
 
@@ -3060,14 +3069,24 @@
 
 :- type call_direction ---> caller ; callee.
 
-	% Generate code to either setup the input arguments for a call
-	% (i.e. in the caller), or to setup the output arguments in the
-	% predicate epilog (i.e. in the callee).
+	% Move variables to where they need to be at the time of the call:
+	%
+	% - The variables that need to be saved across the call (either because
+	%   they are forward live after the call or because they are protected
+	%   by an enclosing resumption point) will be saved on the stack.
+	%
+	% - The input arguments will be moved to their registers.
 
-:- pred code_info__setup_call(assoc_list(prog_var, arg_info)::in,
-	call_direction::in, code_tree::out,
+:- pred code_info__setup_call(hlds_goal_info::in,
+	assoc_list(prog_var, arg_info)::in, set(lval)::out, code_tree::out,
 	code_info::in, code_info::out) is det.
 
+	% Move the output arguments of the current procedure to where
+	% they need to be at return.
+
+:- pred code_info__setup_return(assoc_list(prog_var, arg_info)::in,
+	set(lval)::out, code_tree::out, code_info::in, code_info::out) is det.
+
 :- pred code_info__eager_lock_regs(int::in, assoc_list(prog_var, lval)::in,
 	code_info::in, code_info::out) is det.
 
@@ -3078,12 +3097,10 @@
 :- pred code_info__clobber_regs(list(lval)::in,
 	code_info::in, code_info::out) is det.
 
-:- pred code_info__save_variables(set(prog_var)::in, code_tree::out,
+:- pred code_info__save_variables(set(prog_var)::in,
+	set(lval)::out, code_tree::out,
 	code_info::in, code_info::out) is det.
 
-:- pred code_info__save_variable_on_stack(prog_var::in, code_tree::out,
-	code_info::in, code_info::out) is det.
-
 :- pred code_info__save_variables_on_stack(list(prog_var)::in, code_tree::out,
 	code_info::in, code_info::out) is det.
 
@@ -3095,7 +3112,7 @@
 :- implementation.
 
 :- pred code_info__pick_and_place_vars(assoc_list(prog_var, set(lval))::in,
-	code_tree::out, code_info::in, code_info::out) is det.
+	set(lval)::out, code_tree::out, code_info::in, code_info::out) is det.
 
 :- pred code_info__place_vars(assoc_list(prog_var, lval)::in,
 	code_tree::out, code_info::in, code_info::out) is det.
@@ -3232,8 +3249,10 @@
 	},
 	code_info__set_var_locns_info(VarInfo).
 
-code_info__pick_and_place_vars(VarLocSets, Code) -->
+code_info__pick_and_place_vars(VarLocSets, LiveLocs, Code) -->
 	{ code_info__pick_var_places(VarLocSets, VarLocs) },
+	{ assoc_list__values(VarLocs, Locs) },
+	{ set__list_to_set(Locs, LiveLocs) },
 	code_info__place_vars(VarLocs, Code).
 
 :- pred code_info__pick_var_places(assoc_list(prog_var, set(lval))::in,
@@ -3426,28 +3445,84 @@
 	code_info__set_var_locns_info(VarInfo).
 
 %---------------------------------------------------------------------------%
+
+code_info__setup_return(VarArgInfos, OutLocs, Code) -->
+	code_info__setup_call_args(VarArgInfos, callee, OutLocs, Code).
+
+code_info__setup_call(GoalInfo, ArgInfos, LiveLocs, Code) -->
+	{ partition_args(ArgInfos, InArgInfos, OutArgInfos, _UnusedArgInfos) },
+	{ assoc_list__keys(OutArgInfos, OutVars) },
+	{ set__list_to_set(OutVars, OutVarSet) },
+	code_info__compute_forward_live_var_saves(OutVarSet, ForwardVarLocs),
+
+	{ goal_info_get_code_model(GoalInfo, CodeModel) },
+	( { CodeModel = model_non } ->
+			% Save variables protected by the nearest resumption
+			% point on the stack. XXX
+		code_info__compute_resume_var_stack_locs(ResumeVarLocs),
+		{ list__append(ResumeVarLocs, ForwardVarLocs, StackVarLocs) }
+	;
+		{ StackVarLocs = ForwardVarLocs }
+	),
+
+	code_info__get_var_locns_info(VarInfo0),
+	(
+		{ VarInfo0 = exprn_info(_) },
+
+		code_info__place_vars(StackVarLocs, StackCode),
+		{ assoc_list__values(StackVarLocs, StackLocs) },
+		{ set__list_to_set(StackLocs, StackLiveLocs) },
+
+		code_info__setup_call_args_lazy(InArgInfos, caller,
+			ArgLiveLocs, ArgCode),
+		{ set__union(StackLiveLocs, ArgLiveLocs, LiveLocs) },
+		{ Code = tree(StackCode, ArgCode) }
+	;
+		{ VarInfo0 = var_locn_info(VarLocnInfo0) },
+		{ code_info__var_arg_info_to_lval(InArgInfos, InArgLocs) },
+		{ list__append(StackVarLocs, InArgLocs, AllLocs) },
+		{ var_locn__place_vars(AllLocs, Code,
+			VarLocnInfo0, VarLocnInfo) },
+		code_info__set_var_locns_info(var_locn_info(VarLocnInfo)),
+		{ assoc_list__values(AllLocs, LiveLocList) },
+		{ set__list_to_set(LiveLocList, LiveLocs) },
+
+		{ assoc_list__keys(InArgLocs, InArgVars) },
+		{ set__init(DeadVars0) },
+		code_info__which_variables_are_forward_live(InArgVars,
+			DeadVars0, DeadVars),
+		code_info__make_vars_forward_dead(DeadVars)
+	).
+
+:- pred code_info__setup_call_args(assoc_list(prog_var, arg_info)::in,
+	call_direction::in, set(lval)::out, code_tree::out,
+	code_info::in, code_info::out) is det.
 
-code_info__setup_call(VarArgInfos, Direction, Code) -->
+code_info__setup_call_args(VarArgInfos, Direction, LiveLocs, Code) -->
 	code_info__get_var_locns_info(VarInfo0),
 	(
 		{ VarInfo0 = exprn_info(_) },
-		code_info__setup_call_lazy(VarArgInfos, Direction, Code)
+		code_info__setup_call_args_lazy(VarArgInfos, Direction,
+			LiveLocs, Code)
 	;
 		{ VarInfo0 = var_locn_info(_) },
-		code_info__setup_call_eager(VarArgInfos, Direction, Code)
+		code_info__setup_call_args_eager(VarArgInfos, Direction,
+			LiveLocs, Code)
 	).
 
-:- pred code_info__setup_call_eager(assoc_list(prog_var, arg_info)::in,
-	call_direction::in, code_tree::out, code_info::in, code_info::out)
-	is det.
+:- pred code_info__setup_call_args_eager(assoc_list(prog_var, arg_info)::in,
+	call_direction::in, set(lval)::out, code_tree::out,
+	code_info::in, code_info::out) is det.
 
-code_info__setup_call_eager(AllArgsInfos, Direction, Code) -->
+code_info__setup_call_args_eager(AllArgsInfos, Direction, LiveLocs, Code) -->
 	{ list__filter(code_info__call_arg_in_selected_dir(Direction),
 		AllArgsInfos, ArgsInfos) },
 	{ code_info__var_arg_info_to_lval(ArgsInfos, ArgsLocns) },
 	code_info__get_eager_var_locns_info(VarLocnInfo0),
 	{ var_locn__place_vars(ArgsLocns, Code, VarLocnInfo0, VarLocnInfo1) },
 	code_info__set_var_locns_info(var_locn_info(VarLocnInfo1)),
+	{ assoc_list__values(ArgsLocns, LiveLocList) },
+	{ set__list_to_set(LiveLocList, LiveLocs) },
 	{ assoc_list__keys(ArgsLocns, ArgVars) },
 	{ set__init(DeadVars0) },
 	code_info__which_variables_are_forward_live(ArgVars,
@@ -3478,12 +3553,12 @@
 	),
 	code_info__which_variables_are_forward_live(Vars, DeadVars1, DeadVars).
 
-:- pred code_info__setup_call_lazy(assoc_list(prog_var, arg_info)::in,
-	call_direction::in, code_tree::out, code_info::in, code_info::out)
-	is det.
+:- pred code_info__setup_call_args_lazy(assoc_list(prog_var, arg_info)::in,
+	call_direction::in, set(lval)::out, code_tree::out,
+	code_info::in, code_info::out) is det.
 
-code_info__setup_call_lazy([], _Direction, empty) --> [].
-code_info__setup_call_lazy([First | Rest], Direction, Code) -->
+code_info__setup_call_args_lazy([], _Direction, set__init, empty) --> [].
+code_info__setup_call_args_lazy([First | Rest], Direction, LiveLocs, Code) -->
 	( { code_info__call_arg_in_selected_dir(Direction, First) } ->
 		{ First = V - arg_info(Loc, _Mode) },
 		{ code_util__arg_loc_to_register(Loc, Reg) },
@@ -3516,7 +3591,8 @@
 		->
 			{ code_exprn__lock_reg(Reg, Exprn1, Exprn2) },
 			code_info__set_var_locns_info(exprn_info(Exprn2)),
-			code_info__setup_call_lazy(Rest, Direction, Code1),
+			code_info__setup_call_args_lazy(Rest, Direction,
+				LiveLocs1, Code1),
 			code_info__get_lazy_var_locns_info(Exprn3),
 			{ code_exprn__unlock_reg(Reg, Exprn3, Exprn) },
 			code_info__set_var_locns_info(exprn_info(Exprn)),
@@ -3526,14 +3602,17 @@
 			code_info__set_var_locns_info(exprn_info(Exprn2)),
 			{ set__singleton_set(Vset, V) },
 			code_info__make_vars_forward_dead(Vset),
-			code_info__setup_call_lazy(Rest, Direction, Code1),
+			code_info__setup_call_args_lazy(Rest, Direction,
+				LiveLocs1, Code1),
 			code_info__get_lazy_var_locns_info(Exprn4),
 			{ code_exprn__unlock_reg(Reg, Exprn4, Exprn) },
 			code_info__set_var_locns_info(exprn_info(Exprn)),
 			{ Code = tree(Code0, Code1) }
-		)
+		),
+		{ set__insert(LiveLocs1, Reg, LiveLocs) }
 	;
-		code_info__setup_call_lazy(Rest, Direction, Code)
+		code_info__setup_call_args_lazy(Rest, Direction,
+			LiveLocs, Code)
 	).
 
 :- pred code_info__call_arg_in_selected_dir(call_direction::in,
@@ -3627,8 +3706,21 @@
 		VarInfo = var_locn_info(VarLocn)
 	},
 	code_info__set_var_locns_info(VarInfo).
+
+code_info__save_variables(OutArgs, SavedLocs, Code) -->
+	code_info__compute_forward_live_var_saves(OutArgs, VarLocs),
+	{ assoc_list__values(VarLocs, SavedLocList) },
+	{ set__list_to_set(SavedLocList, SavedLocs) },
+	code_info__place_vars(VarLocs, Code).
 
-code_info__save_variables(OutArgs, Code) -->
+code_info__save_variables_on_stack(Vars, Code) -->
+	list__map_foldl(code_info__associate_stack_slot, Vars, VarLocs),
+	code_info__place_vars(VarLocs, Code).
+
+:- pred code_info__compute_forward_live_var_saves(set(prog_var)::in,
+	assoc_list(prog_var, lval)::out, code_info::in, code_info::out) is det.
+
+code_info__compute_forward_live_var_saves(OutArgs, VarLocs) -->
 	code_info__get_known_variables(Variables0),
 	{ set__list_to_set(Variables0, Vars0) },
 	code_info__get_module_info(ModuleInfo),
@@ -3644,36 +3736,13 @@
 		VarTypes, TVarMap, Vars1) },
 	{ set__difference(Vars1, OutArgs, Vars) },
 	{ set__to_sorted_list(Vars, Variables) },
-	code_info__save_variables_2(Variables, Code).
-
-:- pred code_info__save_variables_2(list(prog_var)::in, code_tree::out,
-	code_info::in, code_info::out) is det.
+	list__map_foldl(code_info__associate_stack_slot, Variables, VarLocs).
 
-code_info__save_variables_2([], empty) --> [].
-code_info__save_variables_2([Var | Vars], Code) -->
-	code_info__save_variable_on_stack(Var, CodeA),
-	code_info__save_variables_2(Vars, CodeB),
-	{ Code = tree(CodeA, CodeB) }.
-
-code_info__save_variable_on_stack(Var, Code) -->
-	code_info__get_variable_slot(Var, Slot),
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__place_var(Var, Slot, Code, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocn0),
-		var_locn__place_var(Var, Slot, Code, VarLocn0, VarLocn),
-		VarInfo = var_locn_info(VarLocn)
-	},
-	code_info__set_var_locns_info(VarInfo).
+:- pred code_info__associate_stack_slot(prog_var::in,
+	pair(prog_var, lval)::out, code_info::in, code_info::out) is det.
 
-code_info__save_variables_on_stack([], empty) --> [].
-code_info__save_variables_on_stack([Var | Vars], Code) -->
-	code_info__save_variable_on_stack(Var, FirstCode),
-	code_info__save_variables_on_stack(Vars, RestCode),
-	{ Code = tree(FirstCode, RestCode) }.
+code_info__associate_stack_slot(Var, Var - Slot) -->
+	code_info__get_variable_slot(Var, Slot).
 
 code_info__max_reg_in_use(Max) -->
 	code_info__get_var_locns_info(VarInfo),
@@ -3697,9 +3766,6 @@
 
 :- interface.
 
-:- pred code_info__generate_call_stack_vn_livevals(set(prog_var)::in,
-	set(lval)::out, code_info::in, code_info::out) is det.
-
 :- pred code_info__generate_call_vn_livevals(list(arg_loc)::in,
 	set(prog_var)::in, set(lval)::out, code_info::in, code_info::out)
 	is det.
@@ -3712,6 +3778,14 @@
 
 :- implementation.
 
+code_info__generate_call_vn_livevals(InputArgLocs, OutputArgs, LiveVals) -->
+	code_info__generate_call_stack_vn_livevals(OutputArgs, StackLiveVals),
+	{ code_info__generate_input_var_vn(InputArgLocs, StackLiveVals,
+		LiveVals) }.
+
+:- pred code_info__generate_call_stack_vn_livevals(set(prog_var)::in,
+	set(lval)::out, code_info::in, code_info::out) is det.
+
 code_info__generate_call_stack_vn_livevals(OutputArgs, LiveVals) -->
 	code_info__get_known_variables(KnownVarList),
 	{ set__list_to_set(KnownVarList, KnownVars) },
@@ -3722,11 +3796,6 @@
 
 	code_info__get_active_temps_data(Temps),
 	{ code_info__generate_call_temp_vn(Temps, LiveVals1, LiveVals) }.
-
-code_info__generate_call_vn_livevals(InputArgLocs, OutputArgs, LiveVals) -->
-	code_info__generate_call_stack_vn_livevals(OutputArgs, StackLiveVals),
-	{ code_info__generate_input_var_vn(InputArgLocs, StackLiveVals,
-		LiveVals) }.
 
 :- pred code_info__generate_stack_var_vn(list(prog_var)::in, set(lval)::in,
 	set(lval)::out, code_info::in, code_info::out) is det.
Index: compiler/code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_util.m,v
retrieving revision 1.123
diff -u -r1.123 code_util.m
--- compiler/code_util.m	2000/09/04 22:33:31	1.123
+++ compiler/code_util.m	2000/09/05 12:17:56
@@ -20,7 +20,7 @@
 :- import_module prog_data, hlds_module, hlds_pred, hlds_goal, hlds_data.
 :- import_module rtti, llds.
 
-:- import_module bool, list, assoc_list, set, std_util.
+:- import_module bool, list, std_util.
 
 	% Create a code address which holds the address of the specified
 	% procedure.
@@ -166,11 +166,6 @@
 	int, int).
 :- mode code_util__count_recursive_calls(in, in, in, out, out) is det.
 
-	% Return the set of locations occupied by output arguments.
-
-:- pred code_util__output_args(assoc_list(prog_var, arg_info), set(lval)).
-:- mode code_util__output_args(in, out) is det.
-
 	% These predicates return the set of lvals referenced in an rval
 	% and an lval respectively. Lvals referenced indirectly through
 	% lvals of the form var(_) are not counted.
@@ -776,19 +771,6 @@
 			Min1, Max1),
 		int__min(Min0, Min1, Min),
 		int__max(Max0, Max1, Max)
-	).
-
-code_util__output_args([], LiveVals) :-
-	set__init(LiveVals).
-code_util__output_args([_V - arg_info(Loc, Mode) | Args], Vs) :-
-	code_util__output_args(Args, Vs0),
-	(
-		Mode = top_out
-	->
-		code_util__arg_loc_to_register(Loc, Reg),
-		set__insert(Vs0, Reg, Vs)
-	;
-		Vs = Vs0
 	).
 
 %-----------------------------------------------------------------------------%
Index: compiler/disj_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/disj_gen.m,v
retrieving revision 1.71
diff -u -r1.71 disj_gen.m
--- compiler/disj_gen.m	2000/09/04 22:33:34	1.71
+++ compiler/disj_gen.m	2000/09/06 12:04:11
@@ -242,8 +242,8 @@
 
 			code_info__maybe_release_hp(MaybeHpSlot),
 			% we're committing to this disjunct
-			code_info__maybe_reset_prune_and_release_ticket(MaybeTicketSlot,
-				commit, PruneTicketCode),
+			code_info__maybe_reset_prune_and_release_ticket(
+				MaybeTicketSlot, commit, PruneTicketCode),
 
 			code_info__reset_resume_known(BranchStart)
 		),
Index: compiler/follow_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/follow_vars.m,v
retrieving revision 1.57
diff -u -r1.57 follow_vars.m
--- compiler/follow_vars.m	2000/09/04 22:33:35	1.57
+++ compiler/follow_vars.m	2000/09/05 13:16:44
@@ -219,7 +219,8 @@
 	make_arg_infos(EffTypes, EffModes, CodeModel, ModuleInfo, EffArgInfo),
 	assoc_list__from_corresponding_lists(EffArgs, EffArgInfo,
 		EffArgsInfos),
-	call_gen__partition_args(EffArgsInfos, EffInVars, _),
+	arg_info__partition_args(EffArgsInfos, EffInVarInfos, _),
+	assoc_list__keys(EffInVarInfos, EffInVars),
 	call_gen__generic_call_info(CodeModel, GenericCall, _,
 		SpecifierArgInfos, FirstInput),
 	map__init(FollowVarsMap0),
Index: compiler/middle_rec.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/middle_rec.m,v
retrieving revision 1.83
diff -u -r1.83 middle_rec.m
--- compiler/middle_rec.m	2000/04/26 05:40:27	1.83
+++ compiler/middle_rec.m	2000/09/05 12:15:17
@@ -140,9 +140,7 @@
 	code_info__get_arginfo(ArgModes),
 	code_info__get_headvars(HeadVars),
 	{ assoc_list__from_corresponding_lists(HeadVars, ArgModes, Args) },
-	code_info__setup_call(Args, callee, EpilogCode),
-
-	{ code_util__output_args(Args, LiveArgs) },
+	code_info__setup_return(Args, LiveArgs, EpilogCode),
 
 	{ BaseCode = tree(BaseGoalCode, tree(BaseSaveCode, EpilogCode)) },
 	{ RecCode = tree(RecGoalCode, tree(RecSaveCode, EpilogCode)) },
Index: compiler/pragma_c_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pragma_c_gen.m,v
retrieving revision 1.37
diff -u -r1.37 pragma_c_gen.m
--- compiler/pragma_c_gen.m	2000/09/04 22:33:47	1.37
+++ compiler/pragma_c_gen.m	2000/09/05 12:06:03
@@ -368,7 +368,7 @@
 		% (other than the output args) onto the stack
 		{ get_c_arg_list_vars(OutArgs, OutArgs1) },
 		{ set__list_to_set(OutArgs1, OutArgsSet) },
-		code_info__save_variables(OutArgsSet, SaveVarsCode)
+		code_info__save_variables(OutArgsSet, _, SaveVarsCode)
 	),
 
 	( { CodeModel = model_semi } ->
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing trax
cvs diff: Diffing trial
cvs diff: Diffing util
--------------------------------------------------------------------------
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