[m-dev.] diff: update alias branch [2/3]

Simon Taylor stayl at cs.mu.OZ.AU
Mon Jul 19 11:46:47 AEST 1999


-<<<<<<< hlds_pred.m
 proc_info_inst_table(ProcInfo, U) :-
     ProcInfo = procedure(_, _, _, _, _, _, _, _, _,
-    		_, _, _, _, _, _, _, _, _, _, _, U).
+    		_, _, _, _, _, _, _, _, _, _, _, U, _).
 
-=======
-proc_info_get_rl_exprn_id(ProcInfo, U) :-
+proc_info_get_rl_exprn_id(ProcInfo, V) :-
 	ProcInfo = procedure(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, 
-		_, _, _, _, U).
+		_, _, _, _, _, V).
 
->>>>>>> 1.62
 % :- type proc_info
 % 	--->	procedure(
 % A			maybe(determinism),
@@ -1906,131 +1907,125 @@
 %					% typeinfo liveness for them, so that
 %					% deep_copy and accurate gc have the
 %					% RTTI they need for copying closures.
-<<<<<<< hlds_pred.m
-% U			inst_table
+% U			inst_table,
 %					% the inst_table for this proc
-=======
-% U			maybe(rl_exprn_id)
+% V			maybe(rl_exprn_id)
 %					% For predicates with an
 %					% `aditi_top_down' marker, which are
 %					% executed top-down on the Aditi side
 %					% of the connection, we generate an RL
 %					% expression, for which this is an
 %					% identifier. See rl_update.m.
->>>>>>> 1.62
 %		).
 
 proc_info_set_varset(ProcInfo0, B, ProcInfo) :-
 	ProcInfo0 = procedure(A, _, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U),
+		P, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_vartypes(ProcInfo0, C, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, _, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U),
+		P, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_headvars(ProcInfo0, D, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, _, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U),
+		P, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_argmodes(ProcInfo0, E, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, _, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U),
+		P, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_maybe_arglives(ProcInfo0, F, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, _, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U),
+		P, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_goal(ProcInfo0, G, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, F, _, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U),
+		P, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_stack_slots(ProcInfo0, I, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, F, G, H, _, J, K, L, M, N, O, 
-		P, Q, R, S, T, U),
+		P, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_inferred_determinism(ProcInfo0, J, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, F, G, H, I, _, K, L, M, N, O, 
-		P, Q, R, S, T, U),
+		P, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_can_process(ProcInfo0, K, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, F, G, H, I, J, _, L, M, N, O, 
-		P, Q, R, S, T, U),
+		P, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_arg_info(ProcInfo0, L, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, F, G, H, I, J, K, _, M, N, O, 
-		P, Q, R, S, T, U),
+		P, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_liveness_info(ProcInfo0, M, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, F, G, H, I, J, K, L, _, N, O, 
-		P, Q, R, S, T, U),
+		P, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_typeinfo_varmap(ProcInfo0, N, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, _, O, 
-		P, Q, R, S, T, U),
+		P, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_typeclass_info_varmap(ProcInfo0, O, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, _, 
-		P, Q, R, S, T, U),
+		P, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_eval_method(ProcInfo0, P, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O,
-		_, Q, R, S, T, U),
+		_, Q, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O,
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_maybe_arg_size_info(ProcInfo0, Q, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, _, R, S, T, U),
+		P, _, R, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
 proc_info_set_maybe_termination_info(ProcInfo0, R, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, _, S, T, U),
+		P, Q, _, S, T, U, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
-<<<<<<< hlds_pred.m
 proc_info_set_inst_table(ProcInfo0, U, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O,
-		P, Q, R, S, T, _),
+		P, Q, R, S, T, _, V),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O,
-		P, Q, R, S, T, U).
+		P, Q, R, S, T, U, V).
 
-=======
-proc_info_set_rl_exprn_id(ProcInfo0, U, ProcInfo) :-
+proc_info_set_rl_exprn_id(ProcInfo0, V, ProcInfo) :-
 	ProcInfo0 = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, _),
+		P, Q, R, S, T, U, _),
 	ProcInfo  = procedure(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 
-		P, Q, R, S, T, yes(U)).
+		P, Q, R, S, T, U, yes(V)).
 
->>>>>>> 1.62
 proc_info_get_typeinfo_vars_setwise(ProcInfo, Vars, TypeInfoVars) :-
 	set__to_sorted_list(Vars, VarList),
 	proc_info_get_typeinfo_vars_2(ProcInfo, VarList, TypeInfoVarList),
--- inlining.m	1999/07/14 00:26:57	1.2
+++ inlining.m	1999/07/16 05:22:20
@@ -540,16 +540,8 @@
 		VarSet, VarTypes, TypeVarSet, TypeInfoVarMap, DidInlining,
 		DetChanged).
 
-inlining__inlining_in_goal(higher_order_call(A, B, C, D, E, F) - GoalInfo,
-		higher_order_call(A, B, C, D, E, F) - GoalInfo) --> [].
-
-<<<<<<< inlining.m
-inlining__inlining_in_goal(class_method_call(A, B, C, D, E, F) - GoalInfo,
-		class_method_call(A, B, C, D, E, F) - GoalInfo) --> [].
-=======
 inlining__inlining_in_goal(generic_call(A, B, C, D) - GoalInfo,
 		generic_call(A, B, C, D) - GoalInfo) --> [].
->>>>>>> 1.82
 
 inlining__inlining_in_goal(unify(A, B, C, D, E) - GoalInfo,
 		unify(A, B, C, D, E) - GoalInfo) --> [].
--- intermod.m	1999/07/14 00:26:57	1.2
+++ intermod.m	1999/07/16 05:22:22
@@ -432,16 +432,8 @@
 	%
 	intermod_info_add_proc(PredId, DoWrite).
 
-intermod__traverse_goal(higher_order_call(A,B,C,D,E,F) - Info,
-			higher_order_call(A,B,C,D,E,F) - Info, yes) --> [].
-
-<<<<<<< intermod.m
-intermod__traverse_goal(class_method_call(A,B,C,D,E,F) - Info,
-			class_method_call(A,B,C,D,E,F) - Info, yes) --> [].
-=======
 intermod__traverse_goal(generic_call(A,B,C,D) - Info,
 			generic_call(A,B,C,D) - Info, yes) --> [].
->>>>>>> 1.66
 
 intermod__traverse_goal(switch(A, B, Cases0, D) - Info,
 		switch(A, B, Cases, D) - Info, DoWrite) -->
@@ -631,24 +623,10 @@
 		intermod_info::out) is det.
 
 intermod__module_qualify_unify_rhs(_, var(Var), var(Var), yes) --> [].
-<<<<<<< intermod.m
-intermod__module_qualify_unify_rhs(_LVar, lambda_goal(A,B,C,Modes,E,F,Goal0),
-		lambda_goal(A,B,C,Modes,E,F,Goal), DoWrite) -->
-	intermod__traverse_goal(Goal0, Goal, DoWrite),
-	intermod_info_get_module_info(ModuleInfo),
-	{ module_info_modes(ModuleInfo, ModeTable) },
-	{ mode_table_get_mode_defns(ModeTable, ModeDefns) },
-	{ module_info_user_insts(ModuleInfo, UserInsts) },
-	{ user_inst_table_get_inst_defns(UserInsts, UserInstDefns) },
-	{ Modes = argument_modes(_ArgIKT, ArgModes) },
-	intermod__gather_proc_modes(ModuleInfo, ModeDefns,
-				UserInstDefns, ArgModes).
-
-=======
 
 intermod__module_qualify_unify_rhs(_LVar,
-		lambda_goal(A,EvalMethod,C,D,E,Modes,G,Goal0),
-		lambda_goal(A,EvalMethod,C,D,E,Modes,G,Goal), DoWrite) -->
+		lambda_goal(A,EvalMethod,C,D,E,Modes,G,H,Goal0),
+		lambda_goal(A,EvalMethod,C,D,E,Modes,G,H,Goal), DoWrite) -->
 	( { EvalMethod = (aditi_top_down) } ->
 		% XXX Predicates which build this type of lambda expression
 		% can't be exported because the importing modules have
@@ -662,14 +640,13 @@
 		intermod_info_get_module_info(ModuleInfo),
 		{ module_info_modes(ModuleInfo, ModeTable) },
 		{ mode_table_get_mode_defns(ModeTable, ModeDefns) },
-		{ module_info_insts(ModuleInfo, Insts) },
-		{ inst_table_get_user_insts(Insts, UserInsts) },
+		{ module_info_user_insts(ModuleInfo, UserInsts) },
 		{ user_inst_table_get_inst_defns(UserInsts, UserInstDefns) },
+		{ Modes = argument_modes(_ArgIKT, ArgModes) },
 		intermod__gather_proc_modes(ModuleInfo, ModeDefns,
-					UserInstDefns, Modes)
+					UserInstDefns, ArgModes)
 	).	
 
->>>>>>> 1.66
 	% Fully module-qualify the right-hand-side of a unification.
 	% For function calls and higher-order terms, call intermod__add_proc
 	% so that the predicate or function will be exported if necessary.
--- lambda.m	1999/07/14 00:26:57	1.2
+++ lambda.m	1999/07/16 05:27:09
@@ -78,26 +78,15 @@
 :- pred lambda__process_pred(pred_id, module_info, module_info).
 :- mode lambda__process_pred(in, in, out) is det.
 
-<<<<<<< lambda.m
-:- pred lambda__transform_lambda(pred_or_func, string, list(prog_var),
-		list(mode), determinism, list(prog_var), set(prog_var),
-		hlds_goal, unification, prog_varset, map(prog_var, type),
-		class_constraints, tvarset, map(tvar, type_info_locn),
-		map(class_constraint, prog_var), pred_markers, aditi_owner,
-		inst_table, module_info, unify_rhs, unification, module_info).
-:- mode lambda__transform_lambda(in, in, in, in, in, in, in, in, in, in, in,
-		in, in, in, in, in, in, in, in, out, out, out) is det.
-=======
 :- pred lambda__transform_lambda(pred_or_func, lambda_eval_method, string,
 		list(prog_var), list(mode), determinism, list(prog_var),
 		set(prog_var), hlds_goal, unification, prog_varset,
 		map(prog_var, type), class_constraints, tvarset,
 		map(tvar, type_info_locn), map(class_constraint, prog_var),
-		pred_markers, aditi_owner, module_info, unify_rhs,
+		pred_markers, aditi_owner, inst_table, module_info, unify_rhs,
 		unification, module_info).
 :- mode lambda__transform_lambda(in, in, in, in, in, in, in, in, in, in,
-		in, in, in, in, in, in, in, in, in, out, out, out) is det.
->>>>>>> 1.52
+		in, in, in, in, in, in, in, in, in, in, out, out, out) is det.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -229,13 +218,8 @@
 
 lambda__process_goal_2(unify(XVar, Y, Mode, Unification, Context), GoalInfo,
 			Unify - GoalInfo) -->
-<<<<<<< lambda.m
-	( { Y = lambda_goal(PredOrFunc, NonLocalVars, Vars, 
-			Modes, Det, _IMDelta, LambdaGoal0) } ->
-=======
 	( { Y = lambda_goal(PredOrFunc, EvalMethod, _, NonLocalVars, Vars, 
-			Modes, Det, LambdaGoal0) } ->
->>>>>>> 1.52
+			Modes, Det, _IMDelta, LambdaGoal0) } ->
 		% first, process the lambda goal recursively, in case it
 		% contains some nested lambda expressions.
 		lambda__process_goal(LambdaGoal0, LambdaGoal1),
@@ -302,18 +286,11 @@
 	lambda__process_goal(Goal0, Goal),
 	lambda__process_cases(Cases0, Cases).
 
-<<<<<<< lambda.m
-:- pred lambda__process_lambda(pred_or_func, list(prog_var), argument_modes,
-		determinism, list(prog_var), hlds_goal, unification, unify_rhs,
-		unification, lambda_info, lambda_info).
-:- mode lambda__process_lambda(in, in, in, in, in, in, in, out, out,
-=======
 :- pred lambda__process_lambda(pred_or_func, lambda_eval_method,
-		list(prog_var), list(mode), determinism, list(prog_var),
+		list(prog_var), argument_modes, determinism, list(prog_var),
 		hlds_goal, unification, unify_rhs, unification,
 		lambda_info, lambda_info).
 :- mode lambda__process_lambda(in, in, in, in, in, in, in, in, out, out,
->>>>>>> 1.52
 		in, out) is det.
 
 lambda__process_lambda(PredOrFunc, EvalMethod, Vars, Modes, Det,
@@ -343,17 +320,12 @@
 	goal_info_get_nonlocals(LambdaGoalInfo, LambdaNonLocals),
 	goal_util__extra_nonlocal_typeinfos(TVarMap, TCVarMap, VarTypes,
 		ExistQVars, LambdaNonLocals, ExtraTypeInfos),
-<<<<<<< lambda.m
 	% YYY Bogus if ArgInstTable is non-empty.
-	lambda__transform_lambda(PredOrFunc, PredName, Vars, ArgModes, Det,
-		OrigNonLocals0, ExtraTypeInfos, LambdaGoal, Unification0,
-=======
-	lambda__transform_lambda(PredOrFunc, EvalMethod, PredName, Vars, Modes,
-		Det, OrigNonLocals0, ExtraTypeInfos, LambdaGoal, Unification0,
->>>>>>> 1.52
-		VarSet, VarTypes, Constraints, TVarSet, TVarMap, TCVarMap,
-		Markers, Owner, InstTable, ModuleInfo0, Functor, Unification,
-		ModuleInfo),
+	lambda__transform_lambda(PredOrFunc, EvalMethod, PredName, Vars,
+		ArgModes, Det, OrigNonLocals0, ExtraTypeInfos, LambdaGoal,
+		Unification0, VarSet, VarTypes, Constraints, TVarSet,
+		TVarMap, TCVarMap, Markers, Owner, InstTable,
+		ModuleInfo0, Functor, Unification, ModuleInfo),
 	LambdaInfo = lambda_info(VarSet, VarTypes, Constraints, TVarSet,
 		TVarMap, TCVarMap, Markers, POF, PredName, Owner, ModuleInfo,
 		InstTable).
@@ -371,19 +343,11 @@
 	set__list_to_set(ConstraintVars, ConstraintVarsSet),
 	set__subset(ConstraintVarsSet, LambdaVarsSet).
 
-<<<<<<< lambda.m
-lambda__transform_lambda(PredOrFunc, OrigPredName, Vars, Modes, Detism,
-		OrigVars, ExtraTypeInfos, LambdaGoal, Unification0, VarSet,
-		VarTypes, Constraints, TVarSet, TVarMap, TCVarMap, Markers,
-		Owner, InstTable, ModuleInfo0, Functor, Unification,
-		ModuleInfo) :-
-=======
 lambda__transform_lambda(PredOrFunc, EvalMethod, OrigPredName, Vars, Modes,
 		Detism, OrigVars, ExtraTypeInfos, LambdaGoal, Unification0,
 		VarSet, VarTypes, Constraints, TVarSet, TVarMap, TCVarMap,
-		Markers, Owner, ModuleInfo0, Functor,
+		Markers, Owner, InstTable, ModuleInfo0, Functor,
 		Unification, ModuleInfo) :-
->>>>>>> 1.52
 	(
 		Unification0 = construct(Var0, _, _, UniModes0, _, _, _)
 	->
@@ -575,9 +539,11 @@
 			TVarMap, TCVarMap, address_is_taken, ArgInstTable,
 			ProcInfo),
 
+		set__init(Assertions),
+
 		pred_info_create(ModuleName, PredName, TVarSet, ExistQVars,
 			ArgTypes, true, LambdaContext, local, LambdaMarkers,
-			PredOrFunc, Constraints, Owner, ProcInfo,
+			PredOrFunc, Constraints, Owner, Assertions, ProcInfo,
 			ProcId, PredInfo),
 
 		% save the new predicate in the predicate table
--- lco.m	1999/07/14 00:26:57	1.2
+++ lco.m	1999/07/16 05:22:23
@@ -132,50 +132,26 @@
 			Proc1, Proc, Changed1),
 	bool__or(Changed0, Changed1, Changed).
 
-lco_in_goal_2(PredProcId, some(Vars, Goal0), some(Vars, Goal), Module0, Module,
+lco_in_goal_2(PredProcId, some(Vars, CanRemove, Goal0),
+		some(Vars, CanRemove, Goal), Module0, Module,
 		InstMap0, Proc0, Proc, Changed) :-
 	lco_in_sub_goal(PredProcId, Goal0, Goal, Module0, Module, InstMap0,
 		Proc0, Proc, Changed).
 
 lco_in_goal_2(_, not(Goal), not(Goal), Module, Module, _, Proc, Proc, no).
 
-lco_in_goal_2(_, higher_order_call(A,B,C,D,E,F),
-		higher_order_call(A,B,C,D,E,F),
-		Module, Module, _, Proc, Proc, no).
-
-lco_in_goal_2(_, class_method_call(A,B,C,D,E,F),
-		class_method_call(A,B,C,D,E,F),
-		Module, Module, _, Proc, Proc, no).
-
-<<<<<<< lco.m
 lco_in_goal_2(_, call(A,B,C,D,E,F), call(A,B,C,D,E,F), Module, Module,
 		_, Proc, Proc, no).
-=======
-lco_in_goal_2(some(Vars, CanRemove, Goal0), ModuleInfo,
-		some(Vars, CanRemove, Goal)) :-
-	lco_in_goal(Goal0, ModuleInfo, Goal).
->>>>>>> 1.12
+
+lco_in_goal_2(_, generic_call(A,B,C,D), generic_call(A,B,C,D),
+		Module, Module, _, Proc, Proc, no).
 
 lco_in_goal_2(_, unify(A,B,C,D,E), unify(A,B,C,D,E), Module, Module,
 		_, Proc, Proc, no).
 
-<<<<<<< lco.m
 lco_in_goal_2(_, pragma_c_code(A,B,C,D,E,F,G), pragma_c_code(A,B,C,D,E,F,G), 
 		Module, Module, _, Proc, Proc, no).
-=======
-lco_in_goal_2(generic_call(A,B,C,D), _ModuleInfo, generic_call(A,B,C,D)).
->>>>>>> 1.12
 
-<<<<<<< lco.m
-=======
-lco_in_goal_2(call(A,B,C,D,E,F), _ModuleInfo, call(A,B,C,D,E,F)).
-
-lco_in_goal_2(unify(A,B,C,D,E), _ModuleInfo, unify(A,B,C,D,E)).
-
-lco_in_goal_2(pragma_c_code(A,B,C,D,E,F,G), _,
-		pragma_c_code(A,B,C,D,E,F,G)).
-
->>>>>>> 1.12
 %-----------------------------------------------------------------------------%
 
 :- pred lco_in_disj(pred_proc_id, list(hlds_goal), list(hlds_goal),
@@ -237,16 +213,12 @@
 	instmap__apply_instmap_delta(InstMap0, InstMapDelta, InstMap1),
 	(
 		GoalExpr0 = unify(_, _, _, Unif, _),
-<<<<<<< lco.m
-		Unif = construct(_, ConsId, _, _),
+		Unif = construct(_, ConsId, _, _, _, _, _),
 
 		% XXX For now, don't allow LCO on constructions of
 		% higher-order terms.  This is because we currently
 		% can't express non-ground higher-order terms.
-		ConsId \= pred_const(_, _)
-=======
-		Unif = construct(_, _, _, _, _, _, _)
->>>>>>> 1.12
+		ConsId \= pred_const(_, _, _)
 	->
 		Unifies1 = [Goal0 | Unifies0],
 		lco_in_conj(PredProcId, Goals0, Unifies1, Goals,
@@ -307,7 +279,7 @@
 			(
 				G = Expr - _,
 				Expr = unify(_, _, _, U, _),
-				U = construct(_, _, UVars, _)
+				U = construct(_, _, UVars, _, _, _, _)
 			->
 				set__insert_list(Vs0, UVars, Vs)
 			;
@@ -367,7 +339,7 @@
 
 goal_is_no_tag_construction(Module, Proc, Goal) :-
 	Goal = unify(_, _, _, Unif, _) - _,
-	Unif = construct(Var, _, _, _),
+	Unif = construct(Var, _, _, _, _, _, _),
 	proc_info_vartypes(Proc, VarTypes),
 	map__search(VarTypes, Var, Type),
 	type_constructors(Type, Module, Constructors),
@@ -384,7 +356,7 @@
 	Lambda = lambda([Goal::in, Vars::out, N0::in, N::out] is det, 
 		( 
 			Goal = unify(_, _, _, Unif, _) - _,
-			Unif = construct(_, _, Vars0, _)
+			Unif = construct(_, _, Vars0, _, _, _, _)
 		->
 			Vars = N0 - Vars0,
 			N is N0 + 1
@@ -799,11 +771,11 @@
 		)
 	).
 
-fix_modes_of_binding_goal_2(higher_order_call(A, Vars0, C, D, E, F), FMI0,
+fix_modes_of_binding_goal_2(generic_call(A, Vars0, C, D), FMI0,
 		GoalInfo0, Module, _AliasedVars, Var, Goal, FMI) :-
 	add_unification_to_goal(Vars0, FMI0, GoalInfo0, Module, Var,
 		Vars, FMI, GoalInfo, Assign),
-	HigherOrder = higher_order_call(A, Vars, C, D, E, F) - GoalInfo,
+	HigherOrder = generic_call(A, Vars, C, D) - GoalInfo,
 	Goal = conj([HigherOrder, Assign]).
 
 fix_modes_of_binding_goal_2(switch(SVar, Det, Cases0, SM), FMI0, _, 
@@ -848,8 +820,8 @@
 fix_modes_of_binding_goal_2(not(Goal), FMI, _, _, _, _, not(Goal),
 		FMI).
 
-fix_modes_of_binding_goal_2(some(Vars, Goal0), FMI0, _, Module, AliasedVars,
-		Var, some(Vars, Goal), FMI) :-
+fix_modes_of_binding_goal_2(some(Vars, CanRemove, Goal0), FMI0, _, Module,
+		AliasedVars, Var, some(Vars, CanRemove, Goal), FMI) :-
 	fix_modes_of_binding_goal(Module, AliasedVars, Var, Goal0, Goal, FMI0,
 		FMI).
 
@@ -873,13 +845,6 @@
 	PragmaC = pragma_c_code(A, B, C, Vars, E, F, G) - GoalInfo,
 	Goal = conj([PragmaC, Assign]).
 
-fix_modes_of_binding_goal_2(class_method_call(A, B, Vars0, D, E, F), FMI0,
-		GoalInfo0, Module, _AliasedVars, Var, Goal, FMI) :-
-	add_unification_to_goal(Vars0, FMI0, GoalInfo0, Module, Var, Vars, FMI,
-		GoalInfo, Assign),
-	ClassMethodCall = class_method_call(A, B, Vars, D, E, F) - GoalInfo,
-	Goal = conj([ClassMethodCall, Assign]).
-
 :- pred add_unification_to_goal(list(prog_var), fix_modes_info, hlds_goal_info,
 		module_info, prog_var, list(prog_var), fix_modes_info,
 		hlds_goal_info, hlds_goal).
@@ -928,10 +893,10 @@
 :- mode fix_modes_of_unify(in, in, in, in, in, in, in, out, out, out, out,
 		out, out) is det.
 
-fix_modes_of_unify(construct(LHSVar, ConsId, Vars, UniModes0), RHS, Modes, 
-		FMI0, GoalInfo, Module, Var,
-		construct(LHSVar, ConsId, Vars, UniModes), RHS, Modes, FMI,
-		GoalInfo, no) :-
+fix_modes_of_unify(construct(LHSVar, ConsId, Vars, UniModes0, E, F, G),
+		RHS, Modes, FMI0, GoalInfo, Module, Var,
+		construct(LHSVar, ConsId, Vars, UniModes, E, F, G),
+		RHS, Modes, FMI, GoalInfo, no) :-
 	( LHSVar = Var ->
 		FMI0 = fix_modes_info(VarSet, VarTypes, InstTable0, InstMap),
 		list__map_foldl(fix_uni_mode(Module, InstMap), 
--- live_vars.m	1999/07/14 00:26:57	1.2
+++ live_vars.m	1999/07/16 05:22:23
@@ -246,47 +246,6 @@
 	;
 		ResumeVars = ResumeVars0
 	).
-<<<<<<< live_vars.m
-
-build_live_sets_in_goal_2(higher_order_call(_PredVar, ArgVars,
-				Types, argument_modes(IKT, Modes), Det,
-				_IsPredOrFunc),
-		Liveness, ResumeVars0, LiveSets0,
-		GoalInfo, ModuleInfo, ProcInfo,
-		Liveness, ResumeVars, LiveSets) :-
-	% The variables which need to be saved onto the stack
-	% before the call are all the variables that are live
-	% after the call, except for the output arguments produced
-	% by the call, plus all the variables that may be needed
-	% at an enclosing resumption point.
-
-	determinism_to_code_model(Det, CallModel),
-	instmap__init_reachable(BogusInstMap),
-	make_arg_infos(Types, Modes, CallModel, BogusInstMap, IKT,
-			ModuleInfo, ArgInfos),
-	find_output_vars_from_arg_info(ArgVars, ArgInfos, OutVars),
-	set__difference(Liveness, OutVars, InputLiveness),
-	set__union(InputLiveness, ResumeVars0, StackVars0),
-
-	% Might need to add more live variables with alternate liveness
-	% calculation.
-
-	maybe_add_alternate_liveness_typeinfos(ModuleInfo, ProcInfo,
-		OutVars, StackVars0, StackVars),
-
-	set__insert(LiveSets0, StackVars, LiveSets),
-
-	% If this is a nondet call, then all the stack slots we need
-	% must be protected against reuse in following code.
-
-	goal_info_get_code_model(GoalInfo, CodeModel),
-	( CodeModel = model_non ->
-		ResumeVars = StackVars		% includes ResumeVars0
-	;
-		ResumeVars = ResumeVars0
-	).
-=======
->>>>>>> 1.83
 
 build_live_sets_in_goal_2(
 		generic_call(_GenericCall, ArgVars, Modes, Det),
@@ -300,16 +259,12 @@
 	% at an enclosing resumption point.
 
 	determinism_to_code_model(Det, CallModel),
-<<<<<<< live_vars.m
+	proc_info_vartypes(ProcInfo, VarTypes),
+	map__apply_to_list(ArgVars, VarTypes, Types),
 	Modes = argument_modes(ArgInstTable, ArgModes),
 	instmap__init_reachable(BogusInstMap),
 	make_arg_infos(Types, ArgModes, CallModel, BogusInstMap,
 			ArgInstTable, ModuleInfo, ArgInfos),
-=======
-	proc_info_vartypes(ProcInfo, VarTypes),
-	map__apply_to_list(ArgVars, VarTypes, Types),
-	make_arg_infos(Types, Modes, CallModel, ModuleInfo, ArgInfos),
->>>>>>> 1.83
 	find_output_vars_from_arg_info(ArgVars, ArgInfos, OutVars),
 	set__difference(Liveness, OutVars, InputLiveness),
 	set__union(InputLiveness, ResumeVars0, StackVars0),
--- liveness.m	1999/07/14 00:26:57	1.2
+++ liveness.m	1999/07/16 05:22:23
@@ -130,8 +130,9 @@
 	% This consists of the {pre,post}{birth,death} sets and
 	% resume point information.
 
-:- pred detect_liveness_proc(proc_info, pred_id, module_info, proc_info).
-:- mode detect_liveness_proc(in, in, in, out) is det.
+:- pred detect_liveness_proc(pred_id, proc_info, proc_info,
+		module_info, module_info).
+:- mode detect_liveness_proc(in, in, out, in, out) is det.
 
 	% initial_liveness(ProcInfo, PredId, ModuleInfo, InitialLiveness,
 	%		InitialRefs).
@@ -156,11 +157,24 @@
 :- import_module bool, map, std_util, list, assoc_list, require.
 :- import_module string.
 
-detect_liveness_proc(ProcInfo0, PredId, ModuleInfo, ProcInfo) :-
+detect_liveness_proc(PredId, ProcInfo0, ProcInfo, ModuleInfo0, ModuleInfo) :-
+
+	%
+	% XXX Requantifying and recomputing the instmap_deltas isn't
+	% necessary all the time, and could be quite expensive.
+	% Passes which invalidate the quantification information
+	% or instmap_deltas should run these themselves only when needed.
+	%
 	requantify_proc(ProcInfo0, ProcInfo1),
-	proc_info_goal(ProcInfo1, Goal0),
-	proc_info_varset(ProcInfo1, Varset),
-	proc_info_vartypes(ProcInfo1, VarTypes),
+	% recompute_instmap_delta must be run after requantifying
+	% because some non-local variables to a goal may have been
+	% made local, but they may still have entries in instmap_deltas.
+	recompute_instmap_delta_proc(ProcInfo1, ProcInfo2,
+		ModuleInfo0, ModuleInfo),
+
+	proc_info_goal(ProcInfo2, Goal0),
+	proc_info_varset(ProcInfo2, Varset),
+	proc_info_vartypes(ProcInfo2, VarTypes),
 	module_info_globals(ModuleInfo, Globals),
 	globals__lookup_bool_option(Globals, typeinfo_liveness,
 		TypeInfoLiveness0),
@@ -177,27 +191,27 @@
 	;
 		TypeInfoLiveness = TypeInfoLiveness0
 	),
-	live_info_init(ModuleInfo, ProcInfo1, TypeInfoLiveness,
+	live_info_init(ModuleInfo, ProcInfo2, TypeInfoLiveness,
 		VarTypes, Varset, LiveInfo),
 
-	initial_liveness(ProcInfo1, PredId, ModuleInfo, Liveness0, Refs0),
+	initial_liveness(ProcInfo2, PredId, ModuleInfo, Liveness0, Refs0),
 	detect_liveness_in_goal(Goal0, Liveness0, Refs0, LiveInfo,
 		_, _, _, Goal1),
 
-	initial_deadness(ProcInfo1, LiveInfo, ModuleInfo, Deadness0),
+	initial_deadness(ProcInfo2, LiveInfo, ModuleInfo, Deadness0),
 	detect_deadness_in_goal(Goal1, Deadness0, LiveInfo, _, Goal2),
 
 	globals__get_trace_level(Globals, TraceLevel),
 	( TraceLevel \= none ->
-		trace__fail_vars(ModuleInfo, ProcInfo0, ResumeVars0)
+		trace__fail_vars(ModuleInfo, ProcInfo2, ResumeVars0)
 	;
 		set__init(ResumeVars0)
 	),
 	detect_resume_points_in_goal(Goal2, Liveness0, LiveInfo,
 		ResumeVars0, Goal, _),
 
-	proc_info_set_goal(ProcInfo1, Goal, ProcInfo2),
-	proc_info_set_liveness_info(ProcInfo2, Liveness0, ProcInfo).
+	proc_info_set_goal(ProcInfo2, Goal, ProcInfo3),
+	proc_info_set_liveness_info(ProcInfo3, Liveness0, ProcInfo).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -335,32 +349,15 @@
 	add_liveness_after_goal(Then1, ResidueThen, Refs, Then),
 	add_liveness_after_goal(Else1, ResidueElse, Refs, Else).
 
-<<<<<<< liveness.m
-detect_liveness_in_goal_2(some(Vars, Goal0), Liveness0, Refs0, _, LiveInfo,
-		Liveness, some(Vars, Goal)) :-
+detect_liveness_in_goal_2(some(Vars, CanRemove, Goal0), Liveness0, Refs0,
+		_, LiveInfo, Liveness, some(Vars, CanRemove, Goal)) :-
 	detect_liveness_in_goal(Goal0, Liveness0, Refs0, LiveInfo, Liveness, _,
 		_, Goal).
-=======
-detect_liveness_in_goal_2(some(Vars, CanRemove, Goal0), Liveness0, _, LiveInfo,
-		Liveness, some(Vars, CanRemove, Goal)) :-
-	detect_liveness_in_goal(Goal0, Liveness0, LiveInfo, Liveness, Goal).
->>>>>>> 1.100
-
-<<<<<<< liveness.m
-detect_liveness_in_goal_2(higher_order_call(_,_,_,_,_,_), _, _, _, _, _, _) :-
-=======
-detect_liveness_in_goal_2(generic_call(_,_,_,_), _, _, _, _, _) :-
->>>>>>> 1.100
-	error("higher-order-call in detect_liveness_in_goal_2").
-
-<<<<<<< liveness.m
-detect_liveness_in_goal_2(class_method_call(_,_,_,_,_,_), _, _, _, _, _, _) :-
-	error("class method call in detect_liveness_in_goal_2").
+
+detect_liveness_in_goal_2(generic_call(_,_,_,_), _, _, _, _, _, _) :-
+	error("generic_call in detect_liveness_in_goal_2").
 
 detect_liveness_in_goal_2(call(_,_,_,_,_,_), _, _, _, _, _, _) :-
-=======
-detect_liveness_in_goal_2(call(_,_,_,_,_,_), _, _, _, _, _) :-
->>>>>>> 1.100
 	error("call in detect_liveness_in_goal_2").
 
 detect_liveness_in_goal_2(unify(_,_,_,_,_), _, _, _, _, _, _) :-
--- magic.m	1999/07/14 00:26:57	1.2
+++ magic.m	1999/07/16 05:28:21
@@ -404,25 +404,16 @@
 	{ proc_info_argmodes(ProcInfo,
 		argument_modes(ArgInstTable, ArgModes0)) },
 	{ pred_info_arg_types(PredInfo, ArgTypes0) },
-<<<<<<< magic.m
-	{ magic_util__remove_aditi_state(ArgTypes0, ArgTypes0, ArgTypes) },
-	{ magic_util__remove_aditi_state(ArgTypes0, ArgModes0, ArgModes) },
+	{ type_util__remove_aditi_state(ArgTypes0, ArgTypes0, ArgTypes) },
+	{ type_util__remove_aditi_state(ArgTypes0, ArgModes0, ArgModes) },
 
 	{ proc_info_get_initial_instmap(ProcInfo, ModuleInfo, InstMap) },
 	{ partition_args(InstMap, ArgInstTable, ModuleInfo,
 		ArgModes, ArgModes, InputModes, _) },
 	{ partition_args(InstMap, ArgInstTable, ModuleInfo,
 		ArgModes, ArgTypes, InputTypes, _) },
-	{ term__context_init(Context) },
-	{ Type = term__functor(term__atom("pred"), InputTypes, Context) },
-=======
-	{ type_util__remove_aditi_state(ArgTypes0, ArgTypes0, ArgTypes) },
-	{ type_util__remove_aditi_state(ArgTypes0, ArgModes0, ArgModes) },
-	{ partition_args(ModuleInfo, ArgModes, ArgModes, InputModes, _) },
-	{ partition_args(ModuleInfo, ArgModes, ArgTypes, InputTypes, _) },
 	{ construct_higher_order_type(predicate, (aditi_bottom_up),
 		InputTypes, Type) },
->>>>>>> 1.6
 	{ GetOutputMode = lambda([ArgMode::in, OutputMode::out] is det, (
 			mode_get_insts(ModuleInfo, ArgMode, _, OutputInst),
 			OutputMode = (free(unique) -> OutputInst)
@@ -492,9 +483,10 @@
 	{ pred_info_get_indexes(PredInfo0, Indexes) },
 		% type classes aren't supported in Aditi.
 	{ ClassConstraints = constraints([], []) },
+	{ set__init(Assertions) },
 	{ pred_info_create(Module, NewName, TVarSet,
 		ExistQVars, ArgTypes, true, Context, Status, Markers, 
-		PredOrFunc, ClassConstraints, Owner, ProcInfo0, 
+		PredOrFunc, ClassConstraints, Owner, Assertions, ProcInfo0, 
 		NewProcId, NewPredInfo0) },
 	{ pred_info_set_indexes(NewPredInfo0, Indexes, NewPredInfo) },
 
@@ -875,13 +867,8 @@
 	{ proc_info_get_initial_instmap(CProcInfo, ModuleInfo0, InstMap) },
 	{ proc_info_inst_table(CProcInfo, InstTable) },
 	{ pred_info_arg_types(CPredInfo, ArgTypes) },
-<<<<<<< magic.m
-	{ magic_util__remove_aditi_state(ArgTypes, ArgModes0, ArgModes) },
-	{ partition_args(InstMap, InstTable, ModuleInfo0, ArgModes, ArgModes,
-=======
 	{ type_util__remove_aditi_state(ArgTypes, ArgModes0, ArgModes) },
-	{ partition_args(ModuleInfo0, ArgModes, ArgModes,
->>>>>>> 1.6
+	{ partition_args(InstMap, InstTable, ModuleInfo0, ArgModes, ArgModes,
 		InputArgModes, OutputArgModes) },
 	(
 		% If the Aditi procedure has no inputs we don't need to
@@ -966,17 +953,11 @@
 		{ instmap_delta_init_reachable(HOCallDelta) },
 		{ goal_info_init(HOCallNonLocals, HOCallDelta, nondet,
 			InputGoalInfo) },
-<<<<<<< magic.m
-		{ InputGoal = higher_order_call(ClosureVar,
-			InputArgs, InputVarTypes,
-			argument_modes(ArgInstTable, MagicArgModes),
-			nondet, predicate) - InputGoalInfo },
-=======
 		{ list__length(InputArgs, Arity) },
 		{ InputGoal = generic_call(
 			higher_order(ClosureVar, predicate, Arity),
-			InputArgs, MagicArgModes, nondet) - InputGoalInfo },
->>>>>>> 1.6
+			InputArgs, argument_modes(ArgInstTable, MagicArgModes),
+			nondet) - InputGoalInfo },
 
 		% Build a call to the original C proc.
 		{ CPredProcId = proc(CPredId, CProcId) },
@@ -1061,9 +1042,10 @@
 	{ varset__init(TVarSet) },	% must be empty.
 	{ term__context_init(DummyContext) },
 	{ ExistQVars = [] },
+	{ set__init(Assertions) },
 	{ pred_info_create(PredModule, NewPredName,
 		TVarSet, ExistQVars, NewArgTypes, true, DummyContext,
-		exported, Markers, predicate, ClassContext, User,
+		exported, Markers, predicate, ClassContext, User, Assertions,
 		JoinProcInfo, JoinProcId, JoinPredInfo1) },
 
 	magic_info_get_module_info(ModuleInfo0),
@@ -1095,16 +1077,10 @@
 	magic_info_get_module_info(ModuleInfo0),
 	{ module_info_pred_proc_info(ModuleInfo0, CPredProcId,
 		CPredInfo0, CProcInfo0) },
-<<<<<<< magic.m
-	{ pred_info_module(CPredInfo0, PredModule) },
-	{ pred_info_arg_types(CPredInfo0, TVarSet, ExistQVars, ArgTypes) },
+	{ pred_info_arg_types(CPredInfo0, ArgTypes) },
 	{ proc_info_argmodes(CProcInfo0,
 		argument_modes(ArgInstTable, ArgModes)) },
 	{ proc_info_get_initial_instmap(CProcInfo0, ModuleInfo0, InstMap) },
-=======
-	{ pred_info_arg_types(CPredInfo0, ArgTypes) },
-	{ proc_info_argmodes(CProcInfo0, ArgModes) },
->>>>>>> 1.6
 	{ proc_info_headvars(CProcInfo0, HeadVars) },
 	{ proc_info_inst_table(CProcInfo0, InstTable) },
 
@@ -1126,20 +1102,12 @@
 
 	magic_info_get_module_info(ModuleInfo1),
 
-<<<<<<< magic.m
 	{ partition_args(InstMap, ArgInstTable, ModuleInfo1,
-		ArgModes1, ArgTypes1, InputArgTypes, OutputArgTypes) },
+		ArgModes1, ArgTypes1, InputArgTypes, _OutputArgTypes) },
 	{ partition_args(InstMap, ArgInstTable, ModuleInfo1,
 		ArgModes1, ArgModes1, InputArgModes, OutputArgModes) },
 	{ partition_args(InstMap, ArgInstTable, ModuleInfo1,
 		ArgModes1, TypeInfoVars,
-=======
-	{ partition_args(ModuleInfo1, ArgModes1, ArgTypes1,
-		InputArgTypes, _OutputArgTypes) },
-	{ partition_args(ModuleInfo1, ArgModes1, ArgModes1,
-		InputArgModes, OutputArgModes) },
-	{ partition_args(ModuleInfo1, ArgModes1, TypeInfoVars,
->>>>>>> 1.6
 		InputTypeInfoVars, OutputTypeInfoVars) },
 	{ partition_args(InstMap, ArgInstTable, ModuleInfo1, ArgModes1,
 		HeadVars1, InputArgs, OutputArgs) },
@@ -1158,68 +1126,16 @@
 	{ list__length(OutputArgs, NumOutputArgs) },
 	{ list__duplicate(NumInputArgs, InMode, InputTypeInfoModes) },
 	{ list__duplicate(NumOutputArgs, InMode, OutputTypeInfoModes) },
-<<<<<<< magic.m
-	{ list__condense([[InMode, InMode, InMode, InMode],
-		InputTypeInfoModes, InputArgModes, OutputTypeInfoModes,
-		OutputArgModes], DoCallAditiArgModes) },
-
-	%
-	% Create a new procedure which is just an alias for do_*_aditi_call.
-	%
-	{ varset__init(VarSet0) },
-	{ list__length(DoCallAditiArgTypes, Arity) },
-	{ varset__new_vars(VarSet0, Arity, DoCallAditiHeadVars, VarSet) },
-	{ map__from_corresponding_lists(DoCallAditiHeadVars,
-		DoCallAditiArgTypes, DoCallAditiVarTypes) },
-	{ true_goal(DummyGoal) },
-	{ term__context_init(DummyContext) },
-	{ proc_info_inferred_determinism(CProcInfo5, Detism) },
-	{ map__init(TVarMap) },
-	{ map__init(TCVarMap) },
-	{ proc_info_create(VarSet, DoCallAditiVarTypes, DoCallAditiHeadVars,
-		argument_modes(ArgInstTable, DoCallAditiArgModes),
-		Detism, DummyGoal, DummyContext, TVarMap, TCVarMap,
-		address_is_not_taken, InstTable, DoCallAditiProcInfo) },
-
-	{ CPredProcId = proc(_, CProcId) },
-	magic_util__make_pred_name(CPredInfo1, CProcId, "Do_Aditi_Call_For",
-		no, CallPredName),
-	{ init_markers(Markers0) },
-	{ add_marker(Markers0, aditi_interface, Markers) },
-	{ ClassContext = constraints([], []) },
-	{ pred_info_get_aditi_owner(CPredInfo1, User) },
-	{ pred_info_create(PredModule, CallPredName,
-		TVarSet, ExistQVars, DoCallAditiArgTypes, true, DummyContext,
-		imported, Markers, predicate, ClassContext, User,
-		DoCallAditiProcInfo, DoCallAditiProcId, DoCallAditiPredInfo) },
-=======
 	{ list__condense([InputTypeInfoModes, InputArgModes,
 		OutputTypeInfoModes, OutputArgModes], DoCallAditiArgModes) },
->>>>>>> 1.6
-
-	magic_info_get_module_info(ModuleInfo2),
-	{ module_info_get_predicate_table(ModuleInfo2, PredTable0) },
-	{ predicate_table_insert(PredTable0, DoCallAditiPredInfo,
-		DoCallAditiPredId, PredTable) },
-	{ module_info_set_predicate_table(ModuleInfo2,
-		PredTable, ModuleInfo3) },
 
 	%
-<<<<<<< magic.m
-	% Make the C procedure call the new alias for do_*_aditi_call.
-=======
 	% Build the `aditi_call' goal.
->>>>>>> 1.6
 	%
 	{ set__list_to_set(DoCallAditiArgs, CallNonLocals) },
-<<<<<<< magic.m
 	% This will be filled in by recompute_instmap_delta.
 	{ instmap_delta_init_reachable(GoalDelta) },
-=======
-	{ instmap_delta_from_mode_list(DoCallAditiArgs, DoCallAditiArgModes,
-		ModuleInfo1, GoalDelta) },
 	{ proc_info_inferred_determinism(CProcInfo2, Detism) },
->>>>>>> 1.6
 	{ goal_info_init(CallNonLocals, GoalDelta, Detism, CallGoalInfo) },
 	{ pred_info_get_is_pred_or_func(CPredInfo1, CPredOrFunc) },
 	{ pred_info_module(CPredInfo1, CPredModule) },
@@ -1230,51 +1146,22 @@
 			aditi_call(AditiPredProcId, NumInputArgs,
 				InputArgTypes, NumOutputArgs),
 			CPredOrFunc - qualified(CPredModule, CPredName)/Arity),
-		DoCallAditiArgs, DoCallAditiArgModes, Detism) - CallGoalInfo },
+		DoCallAditiArgs,
+		argument_modes(InstTable, DoCallAditiArgModes),
+		Detism) - CallGoalInfo },
 	{ list__append(TypeInfoGoals, [DoCallAditiGoal], Goals) },
 	{ set__list_to_set(HeadVars, GoalNonLocals) },
 	{ goal_list_determinism(Goals, GoalDetism) },
 	{ goal_info_init(GoalNonLocals, GoalDelta, GoalDetism, GoalInfo) },
 	{ Goal = conj(Goals) - GoalInfo },
-<<<<<<< magic.m
-	{ proc_info_set_goal(CProcInfo5, Goal, CProcInfo6) },
-=======
-	{ proc_info_set_goal(CProcInfo2, Goal, CProcInfo) },
->>>>>>> 1.6
-
-<<<<<<< magic.m
-	{ recompute_instmap_delta_proc(CProcInfo6, CProcInfo,
-		ModuleInfo3, ModuleInfo4) },
-	{ module_info_set_pred_proc_info(ModuleInfo4, CPredProcId,
-=======
-	{ module_info_set_pred_proc_info(ModuleInfo1, CPredProcId,
->>>>>>> 1.6
+	{ proc_info_set_goal(CProcInfo2, Goal, CProcInfo3) },
+
+	{ recompute_instmap_delta_proc(CProcInfo3, CProcInfo,
+		ModuleInfo1, ModuleInfo2) },
+	{ module_info_set_pred_proc_info(ModuleInfo2, CPredProcId,
 		CPredInfo1, CProcInfo, ModuleInfo) },
 	magic_info_set_module_info(ModuleInfo).
 
-<<<<<<< magic.m
-:- pred magic__interface_pred_info(pred_proc_id::in, pred_proc_id::in,
-	string::out, string::out, magic_info::in, magic_info::out) is det.
-
-magic__interface_pred_info(CPredProcId, PredProcId,
-		ProcNameStr, InputSchema) -->
-	magic_info_get_module_info(ModuleInfo),
-	{ rl_gen__get_entry_proc_name(ModuleInfo, PredProcId, ProcName) },
-	{ rl__proc_name_to_string(ProcName, ProcNameStr) },
-	{ module_info_pred_proc_info(ModuleInfo, CPredProcId,
-		CPredInfo, CProcInfo) },
-	{ pred_info_arg_types(CPredInfo, ArgTypes0) },
-	{ proc_info_argmodes(CProcInfo,
-		argument_modes(ArgInstTable, ArgModes0)) },
-	{ proc_info_get_initial_instmap(CProcInfo, ModuleInfo, InstMap) },
-	{ magic_util__remove_aditi_state(ArgTypes0, ArgTypes0, ArgTypes) },
-	{ magic_util__remove_aditi_state(ArgTypes0, ArgModes0, ArgModes) },
-	{ partition_args(InstMap, ArgInstTable, ModuleInfo,
-		ArgModes, ArgTypes, InputArgTypes, _) },
-	{ rl__schema_to_string(ModuleInfo, InputArgTypes, InputSchema) }.
-
-=======
->>>>>>> 1.6
 :- pred magic__make_type_info_vars(list(type)::in, list(prog_var)::out,
 	list(hlds_goal)::out, pred_info::in, pred_info::out,
 	proc_info::in, proc_info::out, magic_info::in, magic_info::out) is det.
@@ -1298,17 +1185,13 @@
 	proc_info_create_var_from_type(ProcInfo0, Type, Var, ProcInfo),
 	set__singleton_set(NonLocals, Var),
 	Inst = bound(unique, [functor(ConsId, [])]),
-<<<<<<< magic.m
 	% To be filled in by recompute_instmap_delta.
 	instmap_delta_init_reachable(Delta),
 	UnifyMode = (free(unique) - Inst) - (Inst - Inst),
-	Uni = construct(Var, ConsId, [], []),
-=======
-	instmap_delta_init_reachable(Delta0),
-	instmap_delta_insert(Delta0, Var, Inst, Delta),
-	UnifyMode = (free -> Inst) - (Inst -> Inst),
-	Uni = construct(Var, ConsId, [], [], no, cell_is_unique, no),
->>>>>>> 1.6
+	ReuseVar = no,
+	RLExprnId = no,
+	Uni = construct(Var, ConsId, [], [],
+		ReuseVar, cell_is_unique, RLExprnId),
 	Context = unify_context(explicit, []),
 	goal_info_init(NonLocals, Delta, det, GoalInfo),
 	Goal = unify(Var, functor(ConsId, []), UnifyMode, Uni, Context) -
@@ -1386,16 +1269,11 @@
 		{ instmap_delta_from_assoc_list(InstAL0, InstMapDelta0) },
 		{ goal_info_init(NonLocals0, InstMapDelta0,
 			nondet, GoalInfo0) },
-<<<<<<< magic.m
-		{ Goal0 = higher_order_call(CurrPredVar, InputArgs0,
-			InputTypes, argument_modes(InstTable, OutputModes0),
-			nondet, predicate) - GoalInfo0 },
-=======
 		{ list__length(InputArgs0, Arity) },
 		{ Goal0 = generic_call(
 			higher_order(CurrPredVar, predicate, Arity),
-			InputArgs0, OutputModes0, nondet) - GoalInfo0 },
->>>>>>> 1.6
+			InputArgs0, argument_modes(InstTable, OutputModes0),
+			nondet) - GoalInfo0 },
 		( { IsContext = yes(ArgsAL) } ->
 			% Create assignments to assign to the extra arguments.
 			{ magic__create_assignments(ModuleInfo0, ArgsAL,
@@ -1448,10 +1326,11 @@
 	{ pred_info_get_aditi_owner(PredInfo, Owner) },
 	{ ClassConstraints = constraints([], []) },
 	{ ExistQVars = [] },
+	{ set__init(Assertions) },
 	{ pred_info_create(ModuleName, SymName, TVarSet, ExistQVars,
 		AllArgTypes, true, Context, local, Markers, predicate,
-		ClassConstraints, Owner, MagicProcInfo, MagicProcId,
-		MagicPredInfo) },
+		ClassConstraints, Owner, Assertions, MagicProcInfo,
+		MagicProcId, MagicPredInfo) },
 
 	{ module_info_get_predicate_table(ModuleInfo0, PredTable0) },
 	{ predicate_table_insert(PredTable0, 
--- magic_util.m	1999/07/14 00:26:57	1.2
+++ magic_util.m	1999/07/16 05:22:26
@@ -265,19 +265,12 @@
 	module_info_pred_proc_info(ModuleInfo, PredId, ProcId,
 		PredInfo, ProcInfo),
 	pred_info_arg_types(PredInfo, ArgTypes),
-<<<<<<< magic_util.m
 	proc_info_argmodes(ProcInfo, argument_modes(InstTable, ArgModes0)),
 	proc_info_get_initial_instmap(ProcInfo, ModuleInfo, InstMap),
-	magic_util__remove_aditi_state(ArgTypes, ArgModes0, ArgModes),
-	magic_util__remove_aditi_state(ArgTypes, Args0, Args),
-	partition_args(InstMap, InstTable, ModuleInfo,
-		ArgModes, Args, InputArgs, OutputArgs),
-=======
-	proc_info_argmodes(ProcInfo, ArgModes0),
 	type_util__remove_aditi_state(ArgTypes, ArgModes0, ArgModes),
 	type_util__remove_aditi_state(ArgTypes, Args0, Args),
-	partition_args(ModuleInfo, ArgModes, Args, InputArgs, OutputArgs),
->>>>>>> 1.4
+	partition_args(InstMap, InstTable, ModuleInfo,
+		ArgModes, Args, InputArgs, OutputArgs),
 	Call = db_call(no, Goal0, proc(PredId, ProcId), Args,
 		InputArgs, OutputArgs, no).
 
--- make_hlds.m	1999/07/14 00:26:57	1.2
+++ make_hlds.m	1999/07/16 05:31:13
@@ -71,7 +71,8 @@
 parse_tree_to_hlds(module(Name, Items), MQInfo0, EqvMap, Module, 
 		UndefTypes, UndefModes) -->
 	globals__io_get_globals(Globals),
-	{ module_info_init(Name, Globals, Module0) },
+	{ mq_info_get_partial_qualifier_info(MQInfo0, PQInfo) },
+	{ module_info_init(Name, Globals, PQInfo, Module0) },
 	add_item_list_decls_pass_1(Items,
 		item_status(local, may_be_unqualified), Module0, Module1),
 	globals__io_lookup_bool_option(statistics, Statistics),
@@ -935,7 +936,7 @@
 			Procs, NewPredInfo),
 		module_info_get_predicate_table(ModuleInfo2, PredTable0),
 		predicate_table_insert(PredTable0, NewPredInfo,
-			must_be_qualified, NewPredId, PredTable),
+			NewPredId, PredTable),
 		module_info_set_predicate_table(ModuleInfo2,
 			PredTable, ModuleInfo3),
 
@@ -1718,8 +1719,10 @@
 			{ Body = du_type(ConsList, _, _, _) }
 		->
 			{ module_info_ctors(Module0, Ctors0) },
-			ctors_add(ConsList, TypeId, NeedQual, 
-				Context, Ctors0, Ctors),
+			{ module_info_get_partial_qualifier_info(Module0,
+				PQInfo) },
+			ctors_add(ConsList, TypeId, NeedQual, PQInfo, Context,
+				Ctors0, Ctors),
 			{ module_info_set_ctors(Module0, Ctors, Module1) }
 		;
 			{ Module1 = Module0 }
@@ -1897,17 +1900,24 @@
 convert_type_defn(eqv_type(Name, Args, Body), _, Name, Args, eqv_type(Body)).
 convert_type_defn(abstract_type(Name, Args), _, Name, Args, abstract_type).
 
-:- pred ctors_add(list(constructor), type_id, need_qualifier, prog_context, 
-			cons_table, cons_table, io__state, io__state).
-:- mode ctors_add(in, in, in, in, in, out, di, uo) is det.
+:- pred ctors_add(list(constructor), type_id, need_qualifier,
+		partial_qualifier_info, prog_context, cons_table, cons_table,
+		io__state, io__state).
+:- mode ctors_add(in, in, in, in, in, in, out, di, uo) is det.
 
-ctors_add([], _TypeId, _NeedQual, _Context, Ctors, Ctors) --> [].
-ctors_add([Ctor | Rest], TypeId, NeedQual, Context, Ctors0, Ctors) -->
+ctors_add([], _, _, _, _, Ctors, Ctors) --> [].
+ctors_add([Ctor | Rest], TypeId, NeedQual, PQInfo, Context, Ctors0, Ctors) -->
 	{ Ctor = ctor(ExistQVars, Constraints, Name, Args) },
 	{ make_cons_id(Name, Args, TypeId, QualifiedConsId) },
 	{ assoc_list__values(Args, Types) },
 	{ ConsDefn = hlds_cons_defn(ExistQVars, Constraints, Types, TypeId,
 				Context) },
+	%
+	% Insert the fully-qualified version of this cons_id into the
+	% cons_table.
+	% Also check that there is at most one definition of a given
+	% cons_id in each type.
+	%
 	(
 		{ map__search(Ctors0, QualifiedConsId, QualifiedConsDefns0) }
 	->
@@ -1936,29 +1946,29 @@
 	),
 	{ map__set(Ctors0, QualifiedConsId, QualifiedConsDefns, Ctors1) },
 
-	% XXX the code below does the wrong thing if you mix
-	% `import_module' and `use_module' declarations for
-	% parent and child modules.
-	% It assumes that all parents of an imported module were imported,
-	% and that all parents of a used module were used.
-
-	{
-		QualifiedConsId = cons(qualified(Module, ConsName), Arity),
-		NeedQual = may_be_unqualified
-	->
-		% Add unqualified version of the cons_id to the cons_table.
-		UnqualifiedConsId = cons(unqualified(ConsName), Arity),
-		multi_map__set(Ctors1, UnqualifiedConsId, ConsDefn, Ctors2),
+	{ QualifiedConsId = cons(qualified(Module, ConsName), Arity) ->
+		% Add unqualified version of the cons_id to the
+		% cons_table, if appropriate.
+		(
+			NeedQual = may_be_unqualified
+		->
+			UnqualifiedConsId = cons(unqualified(ConsName), Arity),
+			multi_map__set(Ctors1, UnqualifiedConsId, ConsDefn,
+				Ctors2)
+		;
+			Ctors2 = Ctors1
+		),
 
 		% Add partially qualified versions of the cons_id
-		get_partial_qualifiers(Module, PartialQuals),
+		get_partial_qualifiers(Module, PQInfo, PartialQuals),
 		list__map_foldl(add_ctor(ConsName, Arity, ConsDefn),
 			PartialQuals, _PartiallyQualifiedConsIds,
 			Ctors2, Ctors3)
 	;
-		Ctors3 = Ctors1
+		error("ctors_add: cons_id not qualified")
 	},
-	ctors_add(Rest, TypeId, NeedQual, Context, Ctors3, Ctors).
+
+	ctors_add(Rest, TypeId, NeedQual, PQInfo, Context, Ctors3, Ctors).
 
 :- pred add_ctor(string::in, int::in, hlds_cons_defn::in, module_name::in,
 		cons_id::out, cons_table::in, cons_table::out) is det.
@@ -2384,8 +2394,10 @@
 				{ Module = Module0 }
 			)
 		;
+			{ module_info_get_partial_qualifier_info(Module1,
+				PQInfo) },
 			{ predicate_table_insert(PredicateTable0, PredInfo0, 
-				NeedQual, PredId, PredicateTable1) },
+				NeedQual, PQInfo, PredId, PredicateTable1) },
 			( 
 				{ code_util__predinfo_is_builtin(PredInfo0) }
 			->
@@ -2556,7 +2568,7 @@
 		_),
 
 	module_info_get_predicate_table(Module0, PredicateTable0),
-	predicate_table_insert(PredicateTable0, PredInfo, may_be_unqualified, 
+	predicate_table_insert(PredicateTable0, PredInfo,
 		PredId, PredicateTable),
 	module_info_set_predicate_table(Module0, PredicateTable,
 		Module1),
@@ -2720,8 +2732,10 @@
 		\+ predicate_table_search_pf_sym_arity(PredicateTable0,
 			PredOrFunc, PredName, Arity, _)
 	->
+		module_info_get_partial_qualifier_info(ModuleInfo,
+			MQInfo),
 		predicate_table_insert(PredicateTable0, PredInfo, 
-			may_be_unqualified, PredId, PredicateTable)
+			may_be_unqualified, MQInfo, PredId, PredicateTable)
 	;	
 		error("preds_add_implicit")
 	).
@@ -3495,17 +3509,7 @@
 	;
 		{ pred_info_get_is_pred_or_func(PredInfo0, PredOrFunc) }
 	),
-	(
-		{ PredOrFunc = predicate },
-		{ Arity = Arity0 }
-	;
-		{ PredOrFunc = function },
-		{ Arity is Arity0 + 1 }
-	),
-<<<<<<< make_hlds.m
-=======
 	{ adjust_func_arity(PredOrFunc, Arity0, Arity) },
->>>>>>> 1.299
 		
 		% print out a progress message
 	{ eval_method_to_string(EvalMethod, EvalMethodS) },
@@ -3899,11 +3903,7 @@
 	warn_singletons(Args, NonLocals, QuantVars, VarSet, Context,
 		PredCallId).
 
-<<<<<<< make_hlds.m
-warn_singletons_in_goal_2(higher_order_call(_, Args, _, _, _, _),
-=======
 warn_singletons_in_goal_2(generic_call(GenericCall, Args0, _, _),
->>>>>>> 1.299
 			GoalInfo, QuantVars, VarSet, PredCallId, _) -->
 	{ goal_util__generic_call_vars(GenericCall, Args1) },
 	{ list__append(Args0, Args1, Args) },
@@ -3912,14 +3912,6 @@
 	warn_singletons(Args, NonLocals, QuantVars, VarSet, Context,
 		PredCallId).
 
-	% This code should never be called anyway.
-warn_singletons_in_goal_2(class_method_call(_, _, Args, _, _, _),
-			GoalInfo, QuantVars, VarSet, PredCallId, _) -->
-	{ goal_info_get_nonlocals(GoalInfo, NonLocals) },
-	{ goal_info_get_context(GoalInfo, Context) },
-	warn_singletons(Args, NonLocals, QuantVars, VarSet, Context,
-		PredCallId).
-
 warn_singletons_in_goal_2(unify(Var, RHS, _, _, _),
 			GoalInfo, QuantVars, VarSet, PredCallId, MI) -->
 	warn_singletons_in_unify(Var, RHS, GoalInfo, QuantVars, VarSet,
@@ -3973,14 +3965,10 @@
 	warn_singletons([X | Vars], NonLocals, QuantVars, VarSet,
 			Context, CallPredId).
 
-<<<<<<< make_hlds.m
-warn_singletons_in_unify(X, lambda_goal(_PredOrFunc, _NonLocals, LambdaVars, 
-				_Modes, _Det, _IMDelta, LambdaGoal),
-=======
-warn_singletons_in_unify(X, lambda_goal(_PredOrFunc, _Eval, _Fix, _NonLocals,
-				LambdaVars, _Modes, _Det, LambdaGoal),
->>>>>>> 1.299
-			GoalInfo, QuantVars, VarSet, CallPredId, MI) -->
+warn_singletons_in_unify(X,
+		lambda_goal(_PredOrFunc, _Eval, _Fix, _NonLocals,
+			LambdaVars, _Modes, _Det, _IMDelta, LambdaGoal),
+		GoalInfo, QuantVars, VarSet, CallPredId, MI) -->
 	%
 	% warn if any lambda-quantified variables occur only in the quantifier
 	%
@@ -4004,13 +3992,8 @@
 
 %-----------------------------------------------------------------------------%
 
-<<<<<<< make_hlds.m
 :- pred maybe_warn_pragma_singletons(pragma_c_code_impl, instmap, inst_table,
-	list(maybe(pair(string, mode))), prog_context, pred_or_func_call_id,
-=======
-:- pred maybe_warn_pragma_singletons(pragma_c_code_impl,
 	list(maybe(pair(string, mode))), prog_context, simple_call_id,
->>>>>>> 1.299
 	module_info, io__state, io__state).
 :- mode maybe_warn_pragma_singletons(in, in, in, in, in, in, in,
 	di, uo) is det.
@@ -4029,26 +4012,14 @@
 	% warn_singletons_in_pragma_c_code checks to see if each variable is
 	% mentioned at least once in the c code fragments that ought to
 	% mention it. If not, it gives a warning.
-<<<<<<< make_hlds.m
 :- pred warn_singletons_in_pragma_c_code(pragma_c_code_impl, instmap,
 		inst_table, list(maybe(pair(string, mode))), prog_context,
-		pred_or_func_call_id, module_info, io__state, io__state).
+		simple_call_id, module_info, io__state, io__state).
 :- mode warn_singletons_in_pragma_c_code(in, in, in, in, in, in, in,
 		di, uo) is det.
-=======
-:- pred warn_singletons_in_pragma_c_code(pragma_c_code_impl,
-	list(maybe(pair(string, mode))), prog_context, simple_call_id,
-	module_info, io__state, io__state).
-:- mode warn_singletons_in_pragma_c_code(in, in, in, in, in, di, uo) is det.
->>>>>>> 1.299
 
-<<<<<<< make_hlds.m
 warn_singletons_in_pragma_c_code(PragmaImpl, InstMap, InstTable, ArgInfo,
-		Context, PredOrFunc - PredCallId, ModuleInfo) -->
-=======
-warn_singletons_in_pragma_c_code(PragmaImpl, ArgInfo, 
 		Context, PredOrFuncCallId, ModuleInfo) -->
->>>>>>> 1.299
 	(
 		{ PragmaImpl = ordinary(C_Code, _) },
 		{ c_code_to_name_list(C_Code, C_CodeList) },
@@ -4684,23 +4655,15 @@
 		->
 			{
 			  % initialize some fields to junk
-			  Modes = [],
 			  Det = erroneous,
-<<<<<<< make_hlds.m
 			  inst_table_init(InstTable),
-			  ArgModes = argument_modes(InstTable, Modes),
-			  Call = higher_order_call(PredVar, RealHeadVars,
-						   Types, ArgModes, Det,
-						   predicate),
-=======
-
+			  ArgModes = argument_modes(InstTable, []),
 			  GenericCall = higher_order(PredVar,
 			  	predicate, Arity),
 			  Call = generic_call(GenericCall,
-			  	RealHeadVars, Modes, Det),
+			  	RealHeadVars, ArgModes, Det),
 
 			  hlds_goal__generic_call_id(GenericCall, CallId),
->>>>>>> 1.299
 			  Purity1 = pure
 			},
 			(
@@ -4812,9 +4775,10 @@
 			invalid_pred_id(PredId),
 			Builtin = aditi_insert(PredId),
 			InsertCallId = PredOrFunc - SymName/InsertArity,
+			inst_table_init(ArgInstTable),
 			Call = generic_call(
-				aditi_builtin(Builtin, InsertCallId),
-				AllArgs, [], det),
+				aditi_builtin(Builtin, InsertCallId), AllArgs,
+				argument_modes(ArgInstTable, []), det),
 			Goal0 = Call - GoalInfo,
 			CallId = generic_call(aditi_builtin(Builtin,
 				InsertCallId)),
@@ -4991,10 +4955,13 @@
 		{ FixModes = modes_need_fixing },
 
 		% Build the lambda expression for the modification condition.
+		{ instmap_delta_init_reachable(IMDelta) },
+		{ inst_table_init(ArgInstTable) },
 		{ create_atomic_unification(LambdaVar,
 			lambda_goal(LambdaPredOrFunc, (aditi_top_down),
-				FixModes, LambdaNonLocals,
-				HeadArgs, Modes, semidet, PredGoal),
+				FixModes, LambdaNonLocals, HeadArgs,
+				argument_modes(ArgInstTable, Modes),
+				semidet, IMDelta, PredGoal),
 			Context, MainContext, [], LambdaConstruct) },
 
 		{ make_fresh_arg_var(AditiState0Term, AditiState0Var, [],
@@ -5004,7 +4971,7 @@
 		{ AllArgs = [LambdaVar, AditiState0Var, AditiStateVar] },
 		
 		% post_typecheck.m will fill this in.
-		{ GenericCallModes = [] },
+		{ GenericCallModes = argument_modes(ArgInstTable, []) },
 
 		{ Call = generic_call(aditi_builtin(Builtin, ModifiedCallId),
 			AllArgs, GenericCallModes, det) - GoalInfo },
@@ -5058,7 +5025,8 @@
 		{ ModifiedCallId = PredOrFunc - SymName/Arity },
 		
 		% post_typecheck.m will fill this in.
-		{ GenericCallModes = [] },
+		{ inst_table_init(ArgInstTable) },
+		{ GenericCallModes = argument_modes(ArgInstTable, []) },
 
 		{ Call = generic_call(aditi_builtin(Builtin, ModifiedCallId),
 			OtherArgs, GenericCallModes, det) - GoalInfo },
@@ -5133,7 +5101,9 @@
 			{ ModifiedCallId = PredOrFunc - SymName/Arity },
 
 			% post_typecheck.m will fill this in.
-			{ GenericCallModes = [] },
+			{ inst_table_init(ArgInstTable) },
+			{ GenericCallModes =
+				argument_modes(ArgInstTable, []) },
 
 			{ Call = generic_call(
 				aditi_builtin(Builtin, ModifiedCallId),
@@ -5728,16 +5698,12 @@
 	{ set__to_sorted_list(LambdaGoalVars2, LambdaNonLocals) },
 
 	{ instmap_delta_init_reachable(InstMapDelta) },
-	{ inst_table_init(InstTable) },
+	{ inst_table_init(ArgInstTable) },
 	{ create_atomic_unification(X,
-<<<<<<< make_hlds.m
-		lambda_goal(PredOrFunc, LambdaNonLocals, LambdaVars, 
-			argument_modes(InstTable, Modes), Det,
-			InstMapDelta, HLDS_Goal),
-=======
 		lambda_goal(PredOrFunc, EvalMethod, modes_are_ok,
-			LambdaNonLocals, LambdaVars, Modes, Det, HLDS_Goal),
->>>>>>> 1.299
+			LambdaNonLocals, LambdaVars,
+			argument_modes(ArgInstTable, Modes), Det,
+			InstMapDelta, HLDS_Goal),
 		Context, MainContext, SubContext, Goal) }.
 
 	% create the hlds_goal for a unification which cannot be
--- mercury_compile.m	1999/07/14 00:26:57	1.2
+++ mercury_compile.m	1999/07/16 05:22:27
@@ -1231,29 +1231,30 @@
 	),
 	write_proc_progress_message("% Computing liveness in ", PredId, ProcId,
 		ModuleInfo3),
-	{ detect_liveness_proc(ProcInfo3, PredId, ModuleInfo3, ProcInfo4) },
+	{ detect_liveness_proc(PredId, ProcInfo3, ProcInfo4,
+				ModuleInfo3, ModuleInfo4) },
 	write_proc_progress_message("% Allocating stack slots in ", PredId,
-		                ProcId, ModuleInfo3),
-	{ allocate_stack_slots_in_proc(ProcInfo4, PredId, ModuleInfo3,
+		                ProcId, ModuleInfo4),
+	{ allocate_stack_slots_in_proc(ProcInfo4, PredId, ModuleInfo4,
 		ProcInfo5) },
 	write_proc_progress_message(
 		"% Allocating storage locations for live vars in ",
-				PredId, ProcId, ModuleInfo3),
-	{ store_alloc_in_proc(ProcInfo5, PredId, ModuleInfo3, ProcInfo6) },
+				PredId, ProcId, ModuleInfo4),
+	{ store_alloc_in_proc(ProcInfo5, PredId, ModuleInfo4, ProcInfo6) },
 	globals__io_get_trace_level(TraceLevel),
 	( { TraceLevel \= none } ->
 		write_proc_progress_message(
 			"% Calculating goal paths in ",
-					PredId, ProcId, ModuleInfo3),
-		{ goal_path__fill_slots(ProcInfo6, ModuleInfo3, ProcInfo) }
+					PredId, ProcId, ModuleInfo4),
+		{ goal_path__fill_slots(ProcInfo6, ModuleInfo4, ProcInfo) }
 	;
 		{ ProcInfo = ProcInfo6 }
 	),
 	write_proc_progress_message(
 		"% Generating low-level (LLDS) code for ",
-				PredId, ProcId, ModuleInfo3),
-	{ module_info_get_cell_count(ModuleInfo3, CellCount0) },
-	{ generate_proc_code(PredInfo, ProcInfo, ProcId, PredId, ModuleInfo3,
+				PredId, ProcId, ModuleInfo4),
+	{ module_info_get_cell_count(ModuleInfo4, CellCount0) },
+	{ generate_proc_code(PredInfo, ProcInfo, ProcId, PredId, ModuleInfo4,
 		Globals, GlobalData0, GlobalData1, CellCount0, CellCount,
 		Proc0) },
 	{ globals__lookup_bool_option(Globals, optimize, Optimize) },
@@ -1265,10 +1266,10 @@
 	{ Proc = c_procedure(_, _, PredProcId, Instructions) },
 	write_proc_progress_message(
 		"% Generating call continuation information for ",
-			PredId, ProcId, ModuleInfo3),
+			PredId, ProcId, ModuleInfo4),
 	{ continuation_info__maybe_process_proc_llds(Instructions, PredProcId,
-		ModuleInfo3, GlobalData1, GlobalData) },
-	{ module_info_set_cell_count(ModuleInfo3, CellCount, ModuleInfo) }.
+		ModuleInfo4, GlobalData1, GlobalData) },
+	{ module_info_set_cell_count(ModuleInfo4, CellCount, ModuleInfo) }.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -1917,7 +1918,7 @@
 	maybe_write_string(Verbose, "% Computing liveness...\n"),
 	maybe_flush_output(Verbose),
 	process_all_nonimported_nonaditi_procs(
-		update_proc_predid(detect_liveness_proc),
+		update_module_predid(detect_liveness_proc),
 		HLDS0, HLDS),
 	maybe_write_string(Verbose, "% done.\n"),
 	maybe_report_stats(Stats).
--- mode_errors.m	1999/07/14 00:26:57	1.2
+++ mode_errors.m	1999/07/16 05:22:29
@@ -915,64 +915,10 @@
 write_mode_context(uninitialized, _Context, _ModuleInfo) -->
 	[].
 
-write_mode_context(higher_order_call(PredOrFunc, ArgNum), Context, _ModuleInfo)
-		-->
-	prog_out__write_context(Context),
-	io__write_string("  in "),
-	( { ArgNum = 0 } ->
-		io__write_string("higher-order "),
-		hlds_out__write_pred_or_func(PredOrFunc),
-		io__write_string(" call:\n")
-	;
-		io__write_string("argument "),
-		io__write_int(ArgNum),
-		io__write_string(" of higher-order "),
-		hlds_out__write_pred_or_func(PredOrFunc),
-		io__write_string(" call\n"),
-		prog_out__write_context(Context),
-		io__write_string("  (i.e. in "),
-		( { ArgNum = 1 } ->
-			io__write_string("the "),
-			hlds_out__write_pred_or_func(PredOrFunc),
-			io__write_string(" term")
-		;
-			io__write_string("argument "),
-			{ ArgNum1 is ArgNum - 1 },
-			io__write_int(ArgNum1),
-			io__write_string(" of the called "),
-			hlds_out__write_pred_or_func(PredOrFunc)
-		),
-		io__write_string("):\n")
-	).
-
-<<<<<<< mode_errors.m
-write_mode_context(call(PredId, ArgNum), Context, ModuleInfo) -->
-=======
 write_mode_context(call(CallId, ArgNum), Context, _ModuleInfo) -->
->>>>>>> 1.65
 	prog_out__write_context(Context),
 	io__write_string("  in "),
-<<<<<<< mode_errors.m
-	( { ArgNum =< 0 } ->
-		% Argument numbers that are less than or equal to zero
-		% are used for the type_info and typeclass_info arguments
-		% that are introduced by polymorphism.m.
-		% I think argument number equal to zero might also be used
-		% in some other cases when we just don't have any information
-		% about which argument it is.
-		% For both of these, we just say "in call to"
-		% rather than "in argument N of call to".
-		[]
-	;
-		io__write_string("argument "),
-		io__write_int(ArgNum),
-		io__write_string(" of ")
-	),
-	io__write_string("call to "),
-	hlds_out__write_pred_id(ModuleInfo, PredId),
-=======
 	hlds_out__write_call_arg_id(CallId, ArgNum),
->>>>>>> 1.65
 	io__write_string(":\n").
 
 write_mode_context(unify(UnifyContext, _Side), Context, _ModuleInfo) -->
--- mode_info.m	1999/07/14 00:26:57	1.2
+++ mode_info.m	1999/07/16 05:22:30
@@ -614,17 +614,8 @@
 
 mode_info_set_call_arg_context(ArgNum, ModeInfo0, ModeInfo) :-
 	mode_info_get_mode_context(ModeInfo0, ModeContext0),
-<<<<<<< mode_info.m
-	( ModeContext0 = call(PredId, _) ->
-		mode_info_set_mode_context(call(PredId, ArgNum),
-=======
 	( ModeContext0 = call(CallId, _) ->
 		mode_info_set_mode_context(call(CallId, ArgNum),
->>>>>>> 1.51
-			ModeInfo0, ModeInfo)
-	; ModeContext0 = higher_order_call(PredOrFunc, _) ->
-		mode_info_set_mode_context(
-			higher_order_call(PredOrFunc, ArgNum),
 			ModeInfo0, ModeInfo)
 	; ModeContext0 = unify(_UnifyContext, _Side) ->
 		% This only happens when checking that the typeinfo variables
--- mode_util.m	1999/07/14 00:26:57	1.2
+++ mode_util.m	1999/07/19 00:21:12
@@ -823,14 +823,9 @@
 		% XXX do we need to sort the BoundInsts?
 		Inst = bound(Uniq, BoundInsts)
 	).
-<<<<<<< mode_util.m
 propagate_ctor_info(ground(Uniq, no), Type, Constructors, _, ModuleInfo,
 		Inst) :-
-	( type_is_higher_order(Type, function, ArgTypes) ->
-=======
-propagate_ctor_info(ground(Uniq, no), Type, Constructors, ModuleInfo, Inst) :-
 	( type_is_higher_order(Type, function, _, ArgTypes) ->
->>>>>>> 1.116
 		default_higher_order_func_inst(ArgTypes, ModuleInfo,
 			HigherOrderInstInfo),
 		Inst = ground(Uniq, yes(HigherOrderInstInfo))
@@ -847,13 +842,8 @@
 	PredInstInfo = pred_inst_info(PredOrFunc,
 		argument_modes(ArgInstTable, ArgModes), Det),
 	(
-<<<<<<< mode_util.m
-		type_is_higher_order(Type, PredOrFunc, ArgTypes),
-		list__same_length(ArgTypes, ArgModes0)
-=======
 		type_is_higher_order(Type, PredOrFunc, _, ArgTypes),
-		list__same_length(ArgTypes, Modes0)
->>>>>>> 1.116
+		list__same_length(ArgTypes, ArgModes0)
 	->
 		propagate_types_into_mode_list(ArgTypes, ArgInstTable,
 			ModuleInfo, ArgModes0, ArgModes)
@@ -932,13 +922,8 @@
 		argument_modes(ArgInstTable, ArgModes), Det),
 	apply_type_subst(Type0, Subst, Type),
 	(
-<<<<<<< mode_util.m
-		type_is_higher_order(Type, PredOrFunc, ArgTypes),
-		list__same_length(ArgTypes, ArgModes0)
-=======
 		type_is_higher_order(Type, PredOrFunc, _, ArgTypes),
-		list__same_length(ArgTypes, Modes0)
->>>>>>> 1.116
+		list__same_length(ArgTypes, ArgModes0)
 	->
 		propagate_types_into_mode_list(ArgTypes, ArgInstTable,
 			ModuleInfo, ArgModes0, ArgModes)
@@ -1470,16 +1455,10 @@
 			% the final instmap.
 			instmap__is_unreachable(InstMap0)
 		;
-<<<<<<< mode_util.m
 			% If the determinism is erroneous or failure the
 			% instmap_delta should be "unreachable".
 			goal_info_get_determinism(GoalInfo0, Det),
 			determinism_components(Det, _, at_most_zero)
-=======
-			% Lambda expressions always need to be processed.
-			{ Goal0 = unify(_, Rhs, _, _, _) },
-			{ Rhs \= lambda_goal(_, _, _, _, _, _, _, _) }
->>>>>>> 1.116
 		)
 	->
 		instmap_delta_init_unreachable(Unreachable),
@@ -1629,40 +1608,13 @@
 		recompute_info_set_inst_table(InstTable)
 	).
 
-<<<<<<< mode_util.m
-recompute_instmap_delta_3(some(Vars, Goal0), GoalInfo,
-		some(Vars, Goal), GoalInfo, InstMap, InstMapDelta) -->
-	recompute_instmap_delta_2(Goal0, Goal, InstMap, _, InstMapDelta).
-=======
-recompute_instmap_delta_2(Atomic, some(Vars, CanRemove, Goal0), _,
-		some(Vars, CanRemove, Goal),
+recompute_instmap_delta_3(some(Vars, CanRemove, Goal0), GoalInfo,
+		some(Vars, CanRemove, Goal), GoalInfo,
 		InstMap, InstMapDelta) -->
-	recompute_instmap_delta(Atomic, Goal0, Goal, InstMap, InstMapDelta).
->>>>>>> 1.116
-
-<<<<<<< mode_util.m
-recompute_instmap_delta_3(higher_order_call(A, Vars, B, Modes, C, D), GoalInfo,
-		higher_order_call(A, Vars, B, Modes, C, D), GoalInfo,
-		InstMap0, InstMapDelta) -->
-	=(RI0),
-	{ recompute_info_get_inst_table(RI0, InstTable0) },
-	{ Modes = argument_modes(ArgInstTable, ArgModes0) },
-	{ inst_table_create_sub(InstTable0, ArgInstTable, Sub, InstTable) },
-	{ list__map(apply_inst_key_sub_mode(Sub), ArgModes0, ArgModes) },
-	recompute_info_set_inst_table(InstTable),
-	recompute_instmap_delta_call_2(Vars, InstMap0, ArgModes, InstMap),
-	{ compute_instmap_delta(InstMap0, InstMap, InstMapDelta) }.
-=======
-recompute_instmap_delta_2(_, generic_call(A, Vars, Modes, D), _,
-		generic_call(A, Vars, Modes, D),
-		_InstMap, InstMapDelta) -->
-	=(ModuleInfo),
-	{ instmap_delta_from_mode_list(Vars, Modes,
-		ModuleInfo, InstMapDelta) }.
->>>>>>> 1.116
+	recompute_instmap_delta_2(Goal0, Goal, InstMap, _, InstMapDelta).
 
-recompute_instmap_delta_3(class_method_call(A, B, Vars, C, Modes, D), GoalInfo,
-		class_method_call(A, B, Vars, C, Modes, D), GoalInfo,
+recompute_instmap_delta_3(generic_call(A, Vars, Modes, D), GoalInfo,
+		generic_call(A, Vars, Modes, D), GoalInfo,
 		InstMap0, InstMapDelta) -->
 	=(RI0),
 	{ recompute_info_get_inst_table(RI0, InstTable0) },
@@ -1678,32 +1630,6 @@
 		InstMapDelta) -->
 	recompute_instmap_delta_call(PredId, ProcId,
 		Args, InstMap, InstMapDelta).
-<<<<<<< mode_util.m
-=======
-
-recompute_instmap_delta_2(Atomic, unify(A, Rhs0, UniMode0, Uni, E), GoalInfo, 
-		unify(A, Rhs, UniMode, Uni, E), InstMap0, InstMapDelta) -->
-	(
-		{ Rhs0 = lambda_goal(PorF, EvalMethod, FixModes, NonLocals,
-			LambdaVars, Modes, Det, Goal0) }
-	->
-		=(ModuleInfo0),
-		{ instmap__pre_lambda_update(ModuleInfo0, LambdaVars, Modes,
-			InstMap0, InstMap) },
-		recompute_instmap_delta(Atomic, Goal0, Goal, InstMap),
-		{ Rhs = lambda_goal(PorF, EvalMethod, FixModes, NonLocals,
-			LambdaVars, Modes, Det, Goal) }
-	;
-		{ Rhs = Rhs0 }
-	),
-	( { Atomic = yes } ->
-		recompute_instmap_delta_unify(Uni, UniMode0, UniMode,
-			GoalInfo, InstMap0, InstMapDelta)
-	;
-		{ UniMode = UniMode0 },
-		{ goal_info_get_instmap_delta(GoalInfo, InstMapDelta) }
-	).
->>>>>>> 1.116
 
 recompute_instmap_delta_3(unify(Var, UnifyRhs0, UniMode0, Uni0, UniContext),
 		GoalInfo0, Goal, GoalInfo, InstMap, InstMapDelta) -->
@@ -1999,9 +1925,11 @@
 		map__init(StoreMap),
 		Goal = disj([], StoreMap)
 	;
-		Unification0 = construct(_, RealConsId, _, _)
+		Unification0 = construct(_, RealConsId, _, _,
+			ReuseVar, CellIsUnique, RLExprnId)
 	->
-		Unification = construct(Var, RealConsId, Vars, UniModes),
+		Unification = construct(Var, RealConsId, Vars, UniModes,
+				ReuseVar, CellIsUnique, RLExprnId),
 		Det = det,
 		Goal = unify(Var, UnifyRhs, UniMode, Unification, UniContext)
 	;
@@ -2032,10 +1960,11 @@
 
 	% var-lambda unification
 	%
-recompute_instmap_delta_unify(Var, lambda_goal(PredOrFunc, LambdaNonLocals,
-		Vars, LambdaModes, LambdaDet, _, LambdaGoal0), _UniMode0,
-		Unification0, UniContext, _GoalInfo, Goal, Det, InstMap0,
-		InstMapDelta, RI0, RI) :-
+recompute_instmap_delta_unify(Var,
+		lambda_goal(PredOrFunc, EvalMethod, FixModes, LambdaNonLocals,
+			Vars, LambdaModes, LambdaDet, _, LambdaGoal0),
+		_UniMode0, Unification0, UniContext, _GoalInfo, Goal, Det,
+		InstMap0, InstMapDelta, RI0, RI) :-
 
 	% First, compute the instmap_delta of the goal.
 
@@ -2088,16 +2017,21 @@
 	ModeOfX = (InstOfX - UnifyInst),
 	ModeOfY = (InstOfY - UnifyInst),
 	UniMode = ModeOfX - ModeOfY,
-	UnifyRhs = lambda_goal(PredOrFunc, LambdaNonLocals, Vars,
-			LambdaModes, LambdaDet, IMDelta, LambdaGoal),
-	( Unification0 = construct(_, RealConsId, _, _) ->
+	UnifyRhs = lambda_goal(PredOrFunc, EvalMethod, FixModes,
+			LambdaNonLocals, Vars, LambdaModes,
+			LambdaDet, IMDelta, LambdaGoal),
+	(
+		Unification0 = construct(_, RealConsId, _, _,
+			ReuseVar, CellIsUnique, RLExprnId)
+	->
 		list__delete_elems(LambdaNonLocals, Vars, ArgVars),
 		instmap__lookup_vars(ArgVars, InstMap0, ArgInsts),
 		assoc_list__from_corresponding_lists(ArgInsts, ArgInsts,
 			ArgModes0),
 		mode_util__inst_pairs_to_uni_modes(ArgModes0, ArgModes0,
 			ArgModes),
-		Unification = construct(Var, RealConsId, Vars, ArgModes)
+		Unification = construct(Var, RealConsId, Vars, ArgModes,
+			ReuseVar, CellIsUnique, RLExprnId)
 	;
 		error("recompute_instmap_delta_unify: bad var-lambda unification")
 	),
@@ -2222,7 +2156,7 @@
 	compute_instmap_delta(InstMap0, InstMap, InstMapDelta),
 	recompute_info_set_module_info(ModuleInfo, RI0, RI1),
 	recompute_info_set_inst_table(InstTable, RI1, RI2),
-	( GoalChanged = bool:yes ->
+	( GoalChanged = bool__yes ->
 		recompute_info_set_goal_changed(RI2, RI)
 	;
 		RI = RI2
@@ -2463,10 +2397,6 @@
 
 uo_mode(Mode) :- make_std_mode("uo", [], Mode).
 
-<<<<<<< mode_util.m
-%-----------------------------------------------------------------------------%
-
-=======
 unused_mode(Mode) :- make_std_mode("unused", [], Mode).
 
 aditi_ui_mode = Mode :- in_mode(Mode). 
@@ -2475,7 +2405,6 @@
 
 aditi_uo_mode = Mode :- out_mode(Mode).
 
->>>>>>> 1.116
 :- pred make_std_mode(string, list(inst), mode).
 :- mode make_std_mode(in, in, out) is det.
 
--- modecheck_call.m	1999/07/14 00:26:57	1.2
+++ modecheck_call.m	1999/07/16 05:22:30
@@ -32,30 +32,15 @@
 		mode_info_di, mode_info_uo) is det.
 
 :- pred modecheck_higher_order_call(pred_or_func, prog_var, list(prog_var),
-<<<<<<< modecheck_call.m
-		list(type), argument_modes, determinism, list(prog_var),
-=======
-		list(mode), determinism, list(prog_var),
->>>>>>> 1.32
+		argument_modes, determinism, list(prog_var),
 		extra_goals, mode_info, mode_info).
 :- mode modecheck_higher_order_call(in, in, in, out, out, out, out,
 		mode_info_di, mode_info_uo) is det.
 
-<<<<<<< modecheck_call.m
-:- pred modecheck_higher_order_pred_call(prog_var, list(prog_var), pred_or_func,
-		hlds_goal_info, hlds_goal_expr, mode_info, mode_info).
-:- mode modecheck_higher_order_pred_call(in, in, in, in, out,
-		mode_info_di, mode_info_uo) is det.
-
-:- pred modecheck_higher_order_func_call(prog_var, list(prog_var), prog_var,
-		hlds_goal_info, hlds_goal_expr, mode_info, mode_info).
-:- mode modecheck_higher_order_func_call(in, in, in, in, out,
-=======
 :- pred modecheck_aditi_builtin(aditi_builtin, simple_call_id,
-		list(prog_var), list(mode), determinism,
+		list(prog_var), argument_modes, determinism,
 		list(prog_var), extra_goals, mode_info, mode_info).
 :- mode modecheck_aditi_builtin(in, in, in, in, out, out, out,
->>>>>>> 1.32
 		mode_info_di, mode_info_uo) is det.
 
 	%
@@ -88,52 +73,7 @@
 :- import_module mode_info, mode_debug, modes, mode_util, mode_errors.
 :- import_module clause_to_proc, inst_match, inst_util, make_hlds.
 :- import_module det_report, unify_proc.
-<<<<<<< modecheck_call.m
-:- import_module map, bool, set, require.
-
-modecheck_higher_order_pred_call(PredVar, Args0, PredOrFunc, GoalInfo0, Goal)
-		-->
-	mode_checkpoint(enter, "higher-order call", GoalInfo0),
-	mode_info_set_call_context(higher_order_call(PredOrFunc)),
-	=(ModeInfo0),
-
-	{ mode_info_get_instmap(ModeInfo0, InstMap0) },
-	modecheck_higher_order_call(PredOrFunc, PredVar, Args0,
-			Types, Modes, Det, Args, ExtraGoals),
-
-	{ Call = higher_order_call(PredVar, Args, Types, Modes, Det,
-			PredOrFunc) },
-	handle_extra_goals(Call, ExtraGoals, GoalInfo0,
-			[PredVar | Args0], [PredVar | Args],
-			InstMap0, Goal),
-	mode_info_unset_call_context,
-	mode_checkpoint(exit, "higher-order predicate call", GoalInfo0).
-
-modecheck_higher_order_func_call(FuncVar, Args0, RetVar, GoalInfo0, Goal) -->
-	mode_checkpoint(enter, "higher-order function call", GoalInfo0),
-	mode_info_set_call_context(higher_order_call(function)),
-
-	=(ModeInfo0),
-	{ mode_info_get_instmap(ModeInfo0, InstMap0) },
-
-	{ list__append(Args0, [RetVar], Args1) },
-	modecheck_higher_order_call(function, FuncVar, Args1,
-			Types, Modes, Det, Args, ExtraGoals),
-
-	{ Call = higher_order_call(FuncVar, Args, Types, Modes, Det,
-				function) },
-	handle_extra_goals(Call, ExtraGoals, GoalInfo0,
-			[FuncVar | Args1], [FuncVar | Args],
-			InstMap0, Goal),
-
-	mode_info_unset_call_context,
-	mode_checkpoint(exit, "higher-order function call", GoalInfo0).
-
-modecheck_higher_order_call(PredOrFunc, PredVar, Args0, Types, Modes, Det, Args,
-		ExtraGoals, ModeInfo0, ModeInfo) :-
-=======
 :- import_module int, map, bool, set, require.
->>>>>>> 1.32
 
 modecheck_higher_order_call(PredOrFunc, PredVar, Args0, Modes, Det,
 		Args, ExtraGoals, ModeInfo0, ModeInfo) :-
@@ -151,61 +91,20 @@
 	(
 		PredVarInst = ground(_Uniq, yes(PredInstInfo)),
 		PredInstInfo = pred_inst_info(_PredOrFunc, Modes0, Det0),
-		Modes0 = argument_modes(ArgInstTable, ArgModes0),
+		Modes0 = argument_modes(_, ArgModes0),
 		list__length(ArgModes0, Arity)
 	->
 		Det = Det0,
 		Modes = Modes0,
 		ArgOffset = 1,
-<<<<<<< modecheck_call.m
 
-		%
-		% Check that `Args0' have livenesses which match the
-		% expected livenesses.
-		%
-			% YYY InstMap0 is probably incorrect here
-		get_arg_lives(ArgModes0, InstMap0, ArgInstTable, ModuleInfo0,
-			ExpectedArgLives),
-		modecheck_var_list_is_live(Args0, ExpectedArgLives, ArgOffset,
-=======
-		modecheck_arg_list(ArgOffset, Args0, Args, Modes, ExtraGoals,
->>>>>>> 1.32
-			ModeInfo0, ModeInfo1),
-
-<<<<<<< modecheck_call.m
-		inst_table_create_sub(InstTable0, ArgInstTable, Sub, InstTable1),
-		list__map(apply_inst_key_sub_mode(Sub), ArgModes0, ArgModes),
-		mode_info_set_inst_table(InstTable1, ModeInfo1, ModeInfo2),
-
-		%
-		% Check that `Args0' have insts which match the expected
-		% initial insts, set their new final insts (introducing
-		% extra unifications for implied modes, if necessary),
-		% then check that the final insts of the vars match the
-		% declared final insts.
-		%
-		mode_list_get_initial_insts(ArgModes, ModuleInfo0,
-				InitialInsts),
-		modecheck_var_has_inst_list(Args0, InitialInsts, ArgOffset,
-					ModeInfo2, ModeInfo3),
-		mode_list_get_final_insts(ArgModes, ModuleInfo0, FinalInsts),
-		modecheck_set_var_inst_list(Args0, InitialInsts, FinalInsts,
-			ArgOffset, Args, ExtraGoals, ModeInfo3, ModeInfo4),
-=======
->>>>>>> 1.32
+		modecheck_arg_list(ArgOffset, Args0, Args, Modes,
+			ExtraGoals, ModeInfo0, ModeInfo1),
 		( determinism_components(Det, _, at_most_zero) ->
 			instmap__init_unreachable(Instmap),
-<<<<<<< modecheck_call.m
-			mode_info_set_instmap(Instmap, ModeInfo4, ModeInfo)
-=======
 			mode_info_set_instmap(Instmap, ModeInfo1, ModeInfo)
->>>>>>> 1.32
 		;
-<<<<<<< modecheck_call.m
-			ModeInfo = ModeInfo4
-=======
 			ModeInfo = ModeInfo1
->>>>>>> 1.32
 		)
 	;
 		% the error occurred in argument 1, i.e. the pred term
@@ -250,34 +149,50 @@
 aditi_builtin_determinism(aditi_bulk_operation(_, _), det).
 aditi_builtin_determinism(aditi_modify(_, _), det).
 
-:- pred modecheck_arg_list(int, list(prog_var), list(prog_var), list(mode),
-		extra_goals, mode_info, mode_info).
+:- pred modecheck_arg_list(int, list(prog_var), list(prog_var),
+		argument_modes, extra_goals, mode_info, mode_info).
 :- mode modecheck_arg_list(in, in, out, in, out,
 		mode_info_di, mode_info_uo) is det.
 
 modecheck_arg_list(ArgOffset, Args0, Args, Modes,
 		ExtraGoals, ModeInfo0, ModeInfo) :-
 
+	Modes = argument_modes(ArgInstTable, ArgModes0),
+
 	%
 	% Check that `Args0' have livenesses which match the
 	% expected livenesses.
 	%
 	mode_info_get_module_info(ModeInfo0, ModuleInfo0),
-	get_arg_lives(Modes, ModuleInfo0, ExpectedArgLives),
+	mode_info_get_instmap(ModeInfo0, InstMap0),
+
+		% YYY InstMap0 is probably incorrect here
+	get_arg_lives(ArgModes0, InstMap0, ArgInstTable, ModuleInfo0,
+		ExpectedArgLives),
 	modecheck_var_list_is_live(Args0, ExpectedArgLives, ArgOffset,
-		ModeInfo0, ModeInfo1),
+		ModeInfo0, ModeInfo1),	
+
+	%
+	% Substitute the inst_keys in the argument_modes.
+	%
+	mode_info_get_inst_table(ModeInfo1, InstTable0),
+	inst_table_create_sub(InstTable0, ArgInstTable, Sub, InstTable1),
+	list__map(apply_inst_key_sub_mode(Sub), ArgModes0, ArgModes),
+	mode_info_set_inst_table(InstTable1, ModeInfo1, ModeInfo2),
 
 	%
 	% Check that `Args0' have insts which match the expected
-	% initial insts, and set their new final insts (introducing
-	% extra unifications for implied modes, if necessary).
+	% initial insts, set their new final insts (introducing
+	% extra unifications for implied modes, if necessary),
+	% then check that the final insts of the vars match the
+	% declared final insts.
 	%
-	mode_list_get_initial_insts(Modes, ModuleInfo0, InitialInsts),
+	mode_list_get_initial_insts(ArgModes, ModuleInfo0, InitialInsts),
 	modecheck_var_has_inst_list(Args0, InitialInsts, ArgOffset,
-				ModeInfo1, ModeInfo2),
-	mode_list_get_final_insts(Modes, ModuleInfo0, FinalInsts),
+		ModeInfo2, ModeInfo3),
+	mode_list_get_final_insts(ArgModes, ModuleInfo0, FinalInsts),
 	modecheck_set_var_inst_list(Args0, InitialInsts, FinalInsts,
-		ArgOffset, Args, ExtraGoals, ModeInfo2, ModeInfo).
+		ArgOffset, Args, ExtraGoals, ModeInfo3, ModeInfo).
 
 modecheck_call_pred(PredId, ProcId0, ArgVars0, DeterminismKnown,
 		TheProcId, ArgVars, ExtraGoals, ModeInfo0, ModeInfo) :-
--------------------------------------------------------------------------
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