[m-dev.] diff: merge trunk changes into alias branch [2/2]

David Overton dmo at cs.mu.OZ.AU
Tue Jul 13 14:39:08 AEST 1999


--- modes.m	Tue Jul 13 14:16:53 1999
+++ /home/pgrad/dmo/mer0/alias_merge/mercury/compiler/modes.m	Tue Jul  6 16:24:25 1999
@@ -196,15 +196,7 @@
 :- pred unify_rhs_vars(unify_rhs, list(prog_var)).
 :- mode unify_rhs_vars(in, out) is det.
 
-<<<<<<< modes.m
-=======
-	% Given a list of variables, and a list of livenesses,
-	% select the live variables.
 	%
-:- pred get_live_vars(list(prog_var), list(is_live), list(prog_var)).
-:- mode get_live_vars(in, in, out) is det.
-
-	%
 	% calculate the argument number offset that needs to be passed to
 	% modecheck_var_list_is_live, modecheck_var_has_inst_list, and
 	% modecheck_set_var_inst_list.  This offset number is calculated
@@ -214,7 +206,6 @@
 :- pred compute_arg_offset(pred_info, int).
 :- mode compute_arg_offset(in, out) is det.
 
->>>>>>> 1.231
 	% Given a list of variables and a list of expected liveness, ensure
 	% that the inst of each variable satisfies the corresponding expected
 	% liveness.
@@ -240,14 +231,8 @@
 :- mode modecheck_force_set_var_inst(in, in, mode_info_di, mode_info_uo) is det.
 
 :- pred modecheck_set_var_inst_list(list(prog_var), list(inst), list(inst),
-<<<<<<< modes.m
-					list(prog_var), extra_goals,
-					mode_info, mode_info).
-:- mode modecheck_set_var_inst_list(in, in, in, out, out,
-=======
 		int, list(prog_var), extra_goals, mode_info, mode_info).
 :- mode modecheck_set_var_inst_list(in, in, in, in, out, out,
->>>>>>> 1.231
 					mode_info_di, mode_info_uo) is det.
 
 	% check that the final insts of the head vars of a lambda
@@ -858,26 +843,15 @@
 			FinalInsts, ModeInfo) :-
 	mode_info_get_module_info(ModeInfo0, ModuleInfo),
 	mode_info_get_instmap(ModeInfo0, InstMap),
-<<<<<<< modes.m
 	mode_info_get_inst_table(ModeInfo0, InstTable),
-=======
 	mode_info_get_var_types(ModeInfo0, VarTypes),
->>>>>>> 1.231
 	instmap__lookup_vars(HeadVars, InstMap, VarFinalInsts1),
-<<<<<<< modes.m
 	% YYY Check for non-legitimate aliasing here.
-=======
 	map__apply_to_list(HeadVars, VarTypes, ArgTypes),
->>>>>>> 1.231
 
 	( InferModes = yes ->
-<<<<<<< modes.m
-		normalise_insts(VarFinalInsts1, InstMap, InstTable, ModuleInfo,
-			VarFinalInsts2),
-=======
-		normalise_insts(VarFinalInsts1, ArgTypes, ModuleInfo,
-			VarFinalInsts2),
->>>>>>> 1.231
+		normalise_insts(VarFinalInsts1, ArgTypes, InstMap, InstTable,
+			ModuleInfo, VarFinalInsts2),
 		%
 		% make sure we set the final insts of any variables which
 		% we assumed were dead to `clobbered'.
@@ -1085,12 +1059,7 @@
 	modecheck_goal(A0, A),
 	mode_info_dcg_get_instmap(InstMapA),
 	mode_info_remove_live_vars(B_Vars),
-<<<<<<< modes.m
 	mode_info_unlock_vars(if_then_else, InnerNonLocals),
-	modecheck_goal(B0, B),
-	mode_info_dcg_get_instmap(InstMapB),
-=======
-	mode_info_unlock_vars(if_then_else, NonLocals),
 	( { instmap__is_reachable(InstMapA) } ->
 		modecheck_goal(B0, B),
 		mode_info_dcg_get_instmap(InstMapB)
@@ -1101,7 +1070,6 @@
 		{ true_goal(B) },
 		{ InstMapB = InstMapA }
 	),
->>>>>>> 1.231
 	mode_info_set_instmap(InstMap0),
 	modecheck_goal(C0, C),
 	mode_info_dcg_get_instmap(InstMapC),
@@ -1127,13 +1095,9 @@
 
 modecheck_goal_expr(call(PredId, ProcId0, Args0, _, Context, PredName),
 		GoalInfo0, Goal) -->
-<<<<<<< modes.m
-	mode_checkpoint(enter, "call", GoalInfo0),
-=======
 	{ prog_out__sym_name_to_string(PredName, PredNameString) },
 	{ string__append("call ", PredNameString, CallString) },
-	mode_checkpoint(enter, CallString),
->>>>>>> 1.231
+	mode_checkpoint(enter, CallString, GoalInfo0),
 	mode_info_set_call_context(call(PredId)),
 	=(ModeInfo0),
 	{ mode_info_get_instmap(ModeInfo0, InstMap0) },
@@ -1150,11 +1114,7 @@
 				InstMap0, Goal),
 
 	mode_info_unset_call_context,
-<<<<<<< modes.m
-	mode_checkpoint(exit, "call", GoalInfo0).
-=======
-	mode_checkpoint(exit, CallString).
->>>>>>> 1.231
+	mode_checkpoint(exit, CallString, GoalInfo0).
 
 modecheck_goal_expr(higher_order_call(PredVar, Args0, _, _, _, PredOrFunc),
 		GoalInfo0, Goal) -->
@@ -1650,22 +1610,13 @@
 
 		% record the fact that Var was bound to ConsId in the
 		% instmap before processing this case
-<<<<<<< modes.m
 	mode_info_bind_var_to_functor(Var, ConsId),
 	mode_info_dcg_get_instmap(InstMap1),
 	{ compute_instmap_delta(InstMap0, InstMap1, IMDelta) },
 
-	modecheck_goal(Goal0, Goal1),
-	mode_info_dcg_get_instmap(InstMap),
-=======
-	{ cons_id_arity(ConsId, Arity) },
-	{ list__duplicate(Arity, free, ArgInsts) },
-	modecheck_set_var_inst(Var,
-		bound(unique, [functor(ConsId, ArgInsts)])),
-
 		% modecheck this case (if it is reachable)
-	mode_info_dcg_get_instmap(InstMap1),
-	( { instmap__is_reachable(InstMap1) } ->
+	mode_info_dcg_get_instmap(InstMap2),
+	( { instmap__is_reachable(InstMap2) } ->
 		modecheck_goal(Goal0, Goal1),
 		mode_info_dcg_get_instmap(InstMap)
 	;
@@ -1673,18 +1624,13 @@
 		% Instead we optimize the goal away, so that later passes
 		% won't complain about it not having mode information.
 		{ true_goal(Goal1) },
-		{ InstMap = InstMap1 }
+		{ InstMap = InstMap2 }
 	),
 
->>>>>>> 1.231
 	% Don't lose the information added by the functor test above.
-<<<<<<< modes.m
 	% { fixup_switch_var(Var, InstMap0, InstMap, Goal1, Goal) },
 	{ Goal1 = Goal },
-=======
-	{ fixup_switch_var(Var, InstMap0, InstMap, Goal1, Goal) },
 
->>>>>>> 1.231
 	mode_info_set_instmap(InstMap0),
 	modecheck_case_list(Cases0, Var, Cases, InstMaps).
 
@@ -1834,13 +1780,8 @@
 
 %-----------------------------------------------------------------------------%
 
-<<<<<<< modes.m
-modecheck_set_var_inst_list(Vars0, InitialInsts, FinalInsts,
-			Vars, Goals) -->
-=======
 modecheck_set_var_inst_list(Vars0, InitialInsts, FinalInsts, ArgOffset,
 		Vars, Goals) -->
->>>>>>> 1.231
 	(
 		modecheck_set_var_inst_list_2(Vars0, InitialInsts, FinalInsts,
 			no_extra_goals, ArgOffset, Vars1, Goals1)
--- polymorphism.m	Tue Jul 13 14:16:57 1999
+++ /home/pgrad/dmo/mer0/alias_merge/mercury/compiler/polymorphism.m	Mon Jul 12 12:41:42 1999
@@ -504,41 +504,6 @@
 
 %---------------------------------------------------------------------------%
 
-<<<<<<< polymorphism.m
-%	It is misleading to output this message for predicates which are
-%	not defined in this module, and we get far too many of them anyway.
-	% write_proc_progress_message("% Transforming polymorphism for ",
-	% 			PredId, ProcId, ModuleInfo0, IO0, IO1),
-	IO1 = IO0,
-
-	polymorphism__process_proc(ProcId, ProcInfo0, PredInfo0, 
-		ModuleInfo0, ProcInfo, PredInfo1, ModuleInfo1),
-
-	pred_info_procedures(PredInfo1, ProcTable1),
-	map__det_update(ProcTable1, ProcId, ProcInfo, ProcTable),
-	pred_info_set_procedures(PredInfo1, ProcTable, PredInfo),
-	module_info_preds(ModuleInfo1, PredTable1),
-	map__det_update(PredTable1, PredId, PredInfo, PredTable),
-	module_info_set_preds(ModuleInfo1, PredTable, ModuleInfo2),
-
-	polymorphism__process_procs(PredId, ProcIds, ModuleInfo2, ModuleInfo,
-			IO1, IO).
-
-polymorphism__no_type_info_builtin(MercuryBuiltin, "unsafe_type_cast", 2) :-
-	mercury_private_builtin_module(MercuryBuiltin).
-polymorphism__no_type_info_builtin(MercuryBuiltin,
-		"unsafe_promise_unique", 2) :-
-	mercury_public_builtin_module(MercuryBuiltin).
-polymorphism__no_type_info_builtin(MercuryBuiltin,
-		"superclass_from_typeclass_info", 3) :-
-	mercury_private_builtin_module(MercuryBuiltin).
-polymorphism__no_type_info_builtin(MercuryBuiltin,
-		"instance_constraint_from_typeclass_info", 3) :-
-	mercury_private_builtin_module(MercuryBuiltin).
-polymorphism__no_type_info_builtin(MercuryBuiltin,
-		"type_info_from_typeclass_info", 3) :-
-	mercury_private_builtin_module(MercuryBuiltin).
-=======
 polymorphism__no_type_info_builtin(ModuleName, PredName, Arity) :-
 	no_type_info_builtin_2(ModuleNameType, PredName, Arity),
 	check_module_name(ModuleNameType, ModuleName).
@@ -564,7 +529,6 @@
 no_type_info_builtin_2(private_builtin, "type_info_from_typeclass_info", 3).
 no_type_info_builtin_2(private_builtin, "table_restore_any_ans", 3).
 no_type_info_builtin_2(private_builtin, "table_lookup_insert_enum", 4).
->>>>>>> 1.166
 
 %---------------------------------------------------------------------------%
 
@@ -584,81 +548,6 @@
 	%
 	module_info_preds(ModuleInfo0, PredTable0),
 	map__lookup(PredTable0, PredId, PredInfo0),
-<<<<<<< polymorphism.m
-	pred_info_procedures(PredInfo0, ProcTable0),
-	pred_info_procids(PredInfo0, ProcIds),
-	( ProcIds = [ProcId | _] ->
-		map__lookup(ProcTable0, ProcId, ProcInfo),
-		proc_info_vartypes(ProcInfo, VarTypes),
-		proc_info_headvars(ProcInfo, HeadVars),
-		pred_info_arg_types(PredInfo0, TypeVarSet, ExistQVars,
-			ArgTypes0),
-		list__length(ArgTypes0, NumOldArgs),
-		list__length(HeadVars, NumNewArgs),
-		NumExtraArgs is NumNewArgs - NumOldArgs,
-		(
-			list__split_list(NumExtraArgs, HeadVars, ExtraHeadVars,
-					_OldHeadVars)
-		->
-			map__apply_to_list(ExtraHeadVars, VarTypes,
-				ExtraArgTypes),
-			list__append(ExtraArgTypes, ArgTypes0, ArgTypes)
-		;
-			error("polymorphism.m: list__split_list failed")
-		),
-
-		%
-		% If there were any existentially quantified type variables,
-		% either in this predicate or in any predicate that it calls,
-		% then we may need to recompute the instmap deltas too.
-		% (The instmap deltas only need to be recomputed if we
-		% change which variables are bound by the subgoals, i.e.
-		% if any of the new variables that we introduced have mode
-		% `out' rather than mode `in'.  This can happen only if some
-		% of the type variables are existentially quantified rather
-		% than universally quantified.)
-		%
-		(
-			ExistQVars = [],
-			pred_info_get_head_type_params(PredInfo0,
-				HeadTypeParams),
-			term__vars_list(ArgTypes, HeadTypeParams)
-		->
-			PredInfo1 = PredInfo0,
-			ModuleInfo1 = ModuleInfo0
-		;
-			polymorphism__fixup_procs(ProcIds, PredId, ProcTable0,
-				ProcTable, ModuleInfo0, ModuleInfo1),
-			pred_info_set_procedures(PredInfo0, ProcTable,
-				PredInfo1)
-		),
-		pred_info_set_arg_types(PredInfo1, TypeVarSet, ExistQVars,
-			ArgTypes, PredInfo),
-		map__det_update(PredTable0, PredId, PredInfo, PredTable),
-		module_info_set_preds(ModuleInfo1, PredTable, ModuleInfo2)
-	;
-		ModuleInfo2 = ModuleInfo0
-	),
-	polymorphism__fixup_preds(PredIds, ModuleInfo2, ModuleInfo).
-
-:- pred polymorphism__fixup_procs(list(proc_id), pred_id,
-			proc_table, proc_table, module_info, module_info).
-:- mode polymorphism__fixup_procs(in, in, in, out, in, out) is det.
-
-polymorphism__fixup_procs([], _, ProcTable, ProcTable, ModuleInfo, ModuleInfo).
-polymorphism__fixup_procs([ProcId | ProcIds], PredId, ProcTable0, ProcTable,
-		ModuleInfo0, ModuleInfo) :-
-	map__lookup(ProcTable0, ProcId, ProcInfo0),
-	proc_info_headvars(ProcInfo0, HeadVars),
-	proc_info_arglives(ProcInfo0, ModuleInfo0, ArgLives),
-	proc_info_get_initial_instmap(ProcInfo0, ModuleInfo0, InstMap),
-	proc_info_inst_table(ProcInfo0, InstTable0),
-	proc_info_vartypes(ProcInfo0, VarTypes),
-	(
-		list__same_length(HeadVars, ArgLives)
-	->
-		proc_info_goal(ProcInfo0, Goal0)
-=======
 	pred_info_clauses_info(PredInfo0, ClausesInfo),
 	clauses_info_vartypes(ClausesInfo, VarTypes),
 	clauses_info_headvars(ClausesInfo, HeadVars),
@@ -674,25 +563,9 @@
 		map__apply_to_list(ExtraHeadVars, VarTypes,
 			ExtraArgTypes),
 		list__append(ExtraArgTypes, ArgTypes0, ArgTypes)
->>>>>>> 1.166
 	;
-<<<<<<< polymorphism.m
-		error("polymorphism__fixup_procs")
-=======
 		error("polymorphism.m: list__split_list failed")
->>>>>>> 1.166
 	),
-<<<<<<< polymorphism.m
-	recompute_instmap_delta(HeadVars, ArgLives, VarTypes, Goal0, Goal,
-		InstMap, InstTable0, InstTable, _, ModuleInfo0, ModuleInfo1),
-	proc_info_set_inst_table(ProcInfo0, InstTable, ProcInfo1),
-	proc_info_set_goal(ProcInfo1, Goal, ProcInfo),
-	% proc_info_set_maybe_arglives(ProcInfo2, yes(ArgLives), ProcInfo),
-	map__det_update(ProcTable0, ProcId, ProcInfo, ProcTable1),
-	polymorphism__fixup_procs(ProcIds, PredId, ProcTable1, ProcTable,
-		ModuleInfo1, ModuleInfo).
-
-=======
 
 	pred_info_set_arg_types(PredInfo0, TypeVarSet, ExistQVars,
 		ArgTypes, PredInfo),
@@ -701,22 +574,8 @@
 
 	polymorphism__fixup_preds(PredIds, ModuleInfo1, ModuleInfo).
 
->>>>>>> 1.166
 %---------------------------------------------------------------------------%
 
-<<<<<<< polymorphism.m
-
-:- pred polymorphism__process_proc(proc_id, proc_info, pred_info,
-			module_info, proc_info, pred_info, module_info).
-:- mode polymorphism__process_proc(in, in, in, in, out, out, out) is det.
-
-polymorphism__process_proc(ProcId, ProcInfo0, PredInfo0, ModuleInfo0,
-				ProcInfo, PredInfo, ModuleInfo) :-
-	proc_info_goal(ProcInfo0, Goal0),
-	init_poly_info(ModuleInfo0, PredInfo0, ProcInfo0, Info0),
-	polymorphism__setup_headvars(PredInfo0, ProcInfo0,
-			HeadVars, ArgModes, UnconstrainedTVars,
-=======
 :- pred polymorphism__process_pred(pred_id, module_info, module_info,
 			io__state, io__state).
 :- mode polymorphism__process_pred(in, in, out, di, uo) is det.
@@ -768,7 +627,6 @@
 	polymorphism__setup_headvars(PredInfo0, HeadVars0,
 			HeadVars, ExtraArgModes, _HeadTypeVars,
 			UnconstrainedTVars,
->>>>>>> 1.166
 			ExtraTypeInfoHeadVars, ExistTypeClassInfoHeadVars,
 			PolyInfo0, PolyInfo1),
 
@@ -822,18 +680,6 @@
 			ExistTypeClassInfoHeadVars,
 			Goal1, Goal2),
 
-<<<<<<< polymorphism.m
-		pred_info_get_exist_quant_tvars(PredInfo0, ExistQVars),
-		polymorphism__fixup_quantification(HeadVars, ExistQVars,
-			Goal2, Goal, Info3, Info)
-	),
-
-	%
-	% set the new values of the fields in proc_info and pred_info
-	%
-	proc_info_set_headvars(ProcInfo0, HeadVars, ProcInfo1),
-	proc_info_set_goal(ProcInfo1, Goal, ProcInfo2),
-=======
 		{ pred_info_get_exist_quant_tvars(PredInfo0, ExistQVars) },
 		polymorphism__fixup_quantification(NewHeadVars, ExistQVars,
 			Goal2, Goal),
@@ -879,49 +725,27 @@
 	;
 		copy_clauses_to_proc(ProcId, ClausesInfo, ProcInfo0, ProcInfo1)
 	),
->>>>>>> 1.166
 
-<<<<<<< polymorphism.m
-		% Clear the arglives, because the arity of the
-		% proc may have changed.  These will be put back
-		% in polymorphism__fixup_procs.
-	proc_info_set_maybe_arglives(ProcInfo2, no, ProcInfo3),
-	proc_info_set_argmodes(ProcInfo3, ArgModes, ProcInfo4),
-	poly_info_extract(Info, PredInfo0, PredInfo,
-		ProcInfo4, ProcInfo, ModuleInfo).
-=======
 	%
 	% add the ExtraArgModes to the proc_info argmodes
 	%
-	proc_info_argmodes(ProcInfo1, ArgModes1),
+	proc_info_argmodes(ProcInfo1, argument_modes(IT, ArgModes1)),
 	list__append(ExtraArgModes, ArgModes1, ArgModes),
-	proc_info_set_argmodes(ProcInfo1, ArgModes, ProcInfo).
->>>>>>> 1.166
+	proc_info_set_argmodes(ProcInfo1, argument_modes(IT, ArgModes),
+		ProcInfo).
 
 % XXX the following code ought to be rewritten to handle
 % existential/universal type_infos and type_class_infos
 % in a more consistent manner.
 
-<<<<<<< polymorphism.m
-:- pred polymorphism__setup_headvars(pred_info, proc_info,
-		list(prog_var), argument_modes, list(tvar), list(prog_var),
-		list(prog_var), poly_info, poly_info).
-:- mode polymorphism__setup_headvars(in, in, out, out, out, out, out,
-=======
 :- pred polymorphism__setup_headvars(pred_info, list(prog_var),
 		list(prog_var), list(mode), list(tvar), list(tvar),
 		list(prog_var), list(prog_var), poly_info, poly_info).
 :- mode polymorphism__setup_headvars(in, in, out, out, out, out, out, out,
->>>>>>> 1.166
 		in, out) is det.
 
-<<<<<<< polymorphism.m
-polymorphism__setup_headvars(PredInfo, ProcInfo, HeadVars, ArgModes,
-		UnconstrainedTVars, ExtraHeadTypeInfoVars,
-=======
 polymorphism__setup_headvars(PredInfo, HeadVars0, HeadVars, ExtraArgModes,
 		HeadTypeVars, UnconstrainedTVars, ExtraHeadTypeInfoVars,
->>>>>>> 1.166
 		ExistHeadTypeClassInfoVars, PolyInfo0, PolyInfo) :-
 	%
 	% grab the appropriate fields from the pred_info
@@ -1001,14 +825,8 @@
 	list__duplicate(NumUnconstrainedExistTVars, Out, ExistTypeInfoModes),
 	list__duplicate(NumUnivClassInfoVars, In, UnivTypeClassInfoModes),
 	list__duplicate(NumExistClassInfoVars, Out, ExistTypeClassInfoModes),
-	ArgModes0 = argument_modes(ArgIT, Modes0),
 	list__condense([UnivTypeClassInfoModes, ExistTypeClassInfoModes,
-<<<<<<< polymorphism.m
-		UnivTypeInfoModes, ExistTypeInfoModes, Modes0], Modes),
-	ArgModes = argument_modes(ArgIT, Modes),
-=======
 		UnivTypeInfoModes, ExistTypeInfoModes], ExtraArgModes),
->>>>>>> 1.166
 		
 	%
 	% Add the locations of the typeinfos
@@ -1151,25 +969,7 @@
 	create_atomic_unification(Var1, var(Var2), Context, explicit,
 		[], Goal).
 
-<<<<<<< polymorphism.m
-	% Doing just this wouldn't work, because we also need to fill in
-	% the mode and determinism info:
-	%	term__context_init(Context),
-	%	create_atomic_unification(Var1, var(Var2), Context, explicit,
-	% 		[], Goal),
-
-	Ground = ground(shared, no),
-	Mode = ((free(unique) - Ground) - (Ground - Ground)),
-	UnifyInfo = assign(Var1, Var2),
-	UnifyC = unify_context(explicit, []),
-	set__list_to_set([Var1, Var2], NonLocals),
-	instmap_delta_from_assoc_list([Var1 - Ground], InstMapDelta),
-	Determinism = det,
-	goal_info_init(NonLocals, InstMapDelta, Determinism, GoalInfo),
-	Goal = unify(Var1, var(Var2), Mode, UnifyInfo, UnifyC) - GoalInfo.
-=======
 %-----------------------------------------------------------------------------%
->>>>>>> 1.166
 
 :- pred polymorphism__process_goal(hlds_goal, hlds_goal,
 					poly_info, poly_info).
@@ -1237,147 +1037,12 @@
 	{ list__append(ExtraGoals, [Call], GoalList) },
 	{ conj_list_to_goal(GoalList, GoalInfo, Goal) }.
 
-<<<<<<< polymorphism.m
-polymorphism__process_goal_expr(unify(XVar, Y, Mode, Unification, Context),
-				GoalInfo, Goal) -->
-	(
-		{ Unification = complicated_unify(UniMode, CanFail) },
-		{ Y = var(YVar) }
-	->
-		=(Info0),
-		{ poly_info_get_var_types(Info0, VarTypes) },
-		{ poly_info_get_type_info_map(Info0, TypeInfoMap) },
-		{ poly_info_get_module_info(Info0, ModuleInfo) },
-		{ poly_info_get_inst_table(Info0, InstTable) },
-		{ map__lookup(VarTypes, XVar, Type) },
-		( { Type = term__variable(TypeVar) } ->
-			% Convert polymorphic unifications into calls to
-			% `unify/2', the general unification predicate, passing
-			% the appropriate Type_info
-			% 	=(TypeInfoVar, X, Y)
-			% where TypeInfoVar is the type_info variable
-			% associated with the type of the variables that
-			% are being unified.
-
-			{ module_info_get_predicate_table(ModuleInfo,
-				PredicateTable) },
-			{ mercury_public_builtin_module(MercuryBuiltin) },
-			{ predicate_table_search_pred_m_n_a(PredicateTable,
-				MercuryBuiltin, "unify", 2, [CallPredId])
-			->
-				PredId = CallPredId
-			;
-				error("polymorphism.m: can't find `builtin:unify/2'")
-			},
-%		YYY we don't have an instmap here.  
-%		Polymorphic unification should be caught earlier 
-%		(e.g. in mode analysis).
-%		`tests/invalid/polymorphic_unification' will fail until this
-%		error is caught properly.
-%			{ Mode = XMode - YMode },
-%			{
-%				mode_is_fully_input(ModuleInfo, XMode),
-%				mode_is_fully_input(ModuleInfo, YMode)
-%			->
-%				true
-%			;
-%				goal_info_get_context(GoalInfo, GoalContext),
-%				context_to_string(GoalContext, ContextMsg),
-%				string__append(ContextMsg,
-%"Sorry, not implemented: polymorphic unification in mode other than (in, in)",
-%						ErrorMsg),
-%				error(ErrorMsg)
-%			},
-			{ hlds_pred__in_in_unification_proc_id(ProcId) },
-			{ map__lookup(TypeInfoMap, TypeVar, TypeInfoLocn) },
-			{ SymName = unqualified("unify") },
-			{ code_util__builtin_state(ModuleInfo, PredId, ProcId,
-				BuiltinState) },
-			{ CallContext = call_unify_context(XVar, Y, Context) },
-			(
-					% If the typeinfo is available in a
-					% variable, just use it
-				{ TypeInfoLocn = type_info(TypeInfoVar) },
-				{ ArgVars = [TypeInfoVar, XVar, YVar] },
-				{ Goal = call(PredId, ProcId, ArgVars,
-					BuiltinState, yes(CallContext), SymName)
-					- GoalInfo }
-			;
-					% If the typeinfo is in a
-					% typeclass_info, first extract it, 
-					% then use it
-				{ TypeInfoLocn =
-					typeclass_info(TypeClassInfoVar,
-					Index) },
-				extract_type_info(Type, TypeVar,
-					TypeClassInfoVar, Index,
-					Goals, TypeInfoVar),
-
-				{ ArgVars = [TypeInfoVar, XVar, YVar] },
-				{ Call = call(PredId, ProcId, ArgVars,
-					BuiltinState, yes(CallContext), SymName)
-					- GoalInfo },
-
-				{ list__append(Goals, [Call], TheGoals) },
-				{ Goal = conj(TheGoals) - GoalInfo }
-			)
-
-		; { type_is_higher_order(Type, _, _) } ->
-			{ SymName = unqualified("builtin_unify_pred") },
-			{ ArgVars = [XVar, YVar] },
-			{ module_info_get_predicate_table(ModuleInfo,
-				PredicateTable) },
-			{
-				mercury_private_builtin_module(PrivateBuiltin),
-				predicate_table_search_pred_m_n_a(
-				    PredicateTable,
-				    PrivateBuiltin, "builtin_unify_pred", 2,
-				    [PredId0])
-			->
-				PredId = PredId0
-			;
-				error("can't locate private_builtin:builtin_unify_pred/2")
-			},
-			{ hlds_pred__in_in_unification_proc_id(ProcId) },
-			{ CallContext = call_unify_context(XVar, Y, Context) },
-			{ Call = call(PredId, ProcId, ArgVars, not_builtin,
-				yes(CallContext), SymName) },
-			polymorphism__process_goal_expr(Call, GoalInfo, Goal)
-			
-		; { type_to_type_id(Type, TypeId, _) } ->
-=======
 polymorphism__process_goal_expr(Goal0, GoalInfo, Goal) -->
 	{ Goal0 = pragma_c_code(IsRecursive, PredId, ProcId,
 		ArgVars0, ArgInfo0, OrigArgTypes0, PragmaCode) },
 	polymorphism__process_call(PredId, ArgVars0, GoalInfo,
 		ArgVars, ExtraVars, CallGoalInfo, ExtraGoals),
->>>>>>> 1.166
 
-<<<<<<< polymorphism.m
-			% Convert other complicated unifications into
-			% calls to specific unification predicates, and then
-			% recursively call polymorphism__process_goal_expr
-			% to insert extra arguments if necessary.
-
-			{ module_info_get_special_pred_map(ModuleInfo,
-				SpecialPredMap) },
-			{ map__lookup(SpecialPredMap, unify - TypeId, PredId) },
-			{ determinism_components(Det, CanFail, at_most_one) },
-			{ unify_proc__lookup_mode_num(InstTable, ModuleInfo,
-				TypeId, UniMode, Det, ProcId) },
-			{ SymName = unqualified("__Unify__") },
-			{ ArgVars = [XVar, YVar] },
-			{ CallContext = call_unify_context(XVar, Y, Context) },
-			{ Call = call(PredId, ProcId, ArgVars, not_builtin,
-				yes(CallContext), SymName) },
-			polymorphism__process_goal_expr(Call, GoalInfo, Goal)
-		;
-			{ error("polymorphism: type_to_type_id failed") }
-		)
-	; 
-		{ Y = lambda_goal(PredOrFunc, ArgVars, LambdaVars,
-			Modes, Det, _IMDelta, LambdaGoal0) }
-=======
 	%
 	% insert the type_info vars into the arg-name map,
 	% so that the c_code can refer to the type_info variable
@@ -1395,7 +1060,6 @@
 	(
 		{ polymorphism__no_type_info_builtin(PredModule,
 			PredName, PredArity)  }
->>>>>>> 1.166
 	->
 		{ Goal = Goal0 - GoalInfo }
 	;
@@ -1482,7 +1146,7 @@
 			Unification0, UnifyContext, GoalInfo0, Goal)
 	;
 		{ Y = lambda_goal(PredOrFunc, ArgVars0, LambdaVars,
-			Modes, Det, LambdaGoal0) },
+			Modes, Det, IMD, LambdaGoal0) },
 		%
 		% for lambda expressions, we must recursively traverse the
 		% lambda goal
@@ -1498,7 +1162,7 @@
 				NonLocalTypeInfosList) },
 		{ list__append(NonLocalTypeInfosList, ArgVars0, ArgVars) },
 		{ Y1 = lambda_goal(PredOrFunc, ArgVars, LambdaVars,
-			Modes, Det, LambdaGoal) },
+			Modes, Det, IMD, LambdaGoal) },
                 { goal_info_get_nonlocals(GoalInfo0, NonLocals0) },
 		{ set__union(NonLocals0, NonLocalTypeInfos, NonLocals) },
 		{ goal_info_set_nonlocals(GoalInfo0, NonLocals, GoalInfo) },
@@ -1569,9 +1233,10 @@
 		list__append(FuncArgVars, [X0], ArgVars),
 		map__apply_to_list(ArgVars, VarTypes0, ArgTypes),
 		Modes = [],
+		inst_table_init(IT),
 		Det = erroneous,
 		HOCall = higher_order_call(FuncVar, ArgVars, ArgTypes,
-			Modes, Det, function),
+			argument_modes(IT, Modes), Det, function),
 
 		/*******
 		%
@@ -1812,7 +1477,7 @@
 	% work out the modes of the introduced lambda variables
 	% and the determinism of the lambda goal
 	%
-	proc_info_argmodes(ProcInfo, ArgModes),
+	proc_info_argmodes(ProcInfo, argument_modes(ArgIT, ArgModes)),
 	list__length(ArgModes, NumArgModes),
 	list__length(LambdaVars, NumLambdaVars),
 	( list__drop(NumArgModes - NumLambdaVars, ArgModes, LambdaModes0) ->
@@ -1827,11 +1492,14 @@
 		error("Sorry, not implemented: determinism inference for higher-order predicate terms")
 	),
 
+	instmap_delta_init_reachable(InstMapDelta),
+
 	%
 	% construct the lambda expression
 	%
 	Functor = lambda_goal(PredOrFunc, ArgVars0, LambdaVars, 
-			LambdaModes, LambdaDet, LambdaGoal).
+			argument_modes(ArgIT, LambdaModes), LambdaDet,
+			InstMapDelta, LambdaGoal).
 
 :- pred make_fresh_vars(list(type), prog_varset, map(prog_var, type),
 			list(prog_var), prog_varset, map(prog_var, type)).
@@ -2261,52 +1929,7 @@
 		%
 		goal_info_get_nonlocals(GoalInfo0, NonLocals0),
 		set__insert_list(NonLocals0, ExtraVars, NonLocals),
-<<<<<<< polymorphism.m
-		goal_info_set_nonlocals(GoalInfo0, NonLocals, GoalInfo1),
-
-		%
-		% update the instmap delta for typeinfo vars and
-		% typeclassinfo vars for any existentially quantified
-		% type vars in the callee's type: such typeinfo variables
-		% are produced by this call
-		% (universally quantified typeinfo and typeclassinfo vars
-		% are input to the goal, and their inst is not changed by
-		% the goal, so they don't need to be mentioned in the
-		% instmap delta)
-		%
-% YYY Andrew, why is this commented out? - dmo
-%		poly_info_get_type_info_map(Info, TypeVarMap),
-%		poly_info_get_typeclass_info_map(Info, TypeClassVarMap),
-%		goal_info_get_instmap_delta(GoalInfo1, InstmapDelta0),
-%		AddInstDelta = lambda([TVar::in, IMD0::in, IMD::out] is det, (
-%			map__lookup(TypeVarMap, TVar, TypeInfoLocn),
-%			(
-%				TypeInfoLocn = type_info(TypeInfoVar),
-%				instmap_delta_set(IMD0, TypeInfoVar,
-%					ground(shared, no), IMD)
-%			;
-%				TypeInfoLocn = typeclass_info(_, _),
-%				% the instmap delta for the type class info
-%				% variable will be added by AddTCInstDelta
-%				% (below)
-%				IMD = IMD0
-%			))),
-%		AddTCInstDelta = lambda([Constraint::in, IMD0::in, IMD::out]
-%					is det, (
-%			map__lookup(TypeClassVarMap, Constraint,
-%				TypeClassInfoVar),
-%			instmap_delta_set(IMD0, TypeClassInfoVar,
-%				ground(shared, no), IMD)
-%			)),
-%		list__foldl(AddInstDelta, PredExistQVars,
-%			InstmapDelta0, InstmapDelta1),
-%		list__foldl(AddTCInstDelta, ExistentialConstraints,
-%			InstmapDelta1, InstmapDelta),
-%		goal_info_set_instmap_delta(GoalInfo1, InstmapDelta, GoalInfo)
-		GoalInfo = GoalInfo1
-=======
 		goal_info_set_nonlocals(GoalInfo0, NonLocals, GoalInfo)
->>>>>>> 1.166
 	).
 
 :- pred polymorphism__update_typeclass_infos(list(class_constraint),
@@ -2429,61 +2052,6 @@
 
 %-----------------------------------------------------------------------------%
 
-<<<<<<< polymorphism.m
-:- pred polymorphism__process_lambda(pred_or_func, list(prog_var),
-		argument_modes, determinism, list(prog_var), set(prog_var),
-		hlds_goal, unification, unify_rhs, unification,
-		poly_info, poly_info).
-:- mode polymorphism__process_lambda(in, in, in, in, in, in, in, in, out, out,
-		in, out) is det.
-
-polymorphism__process_lambda(PredOrFunc, Vars, Modes, Det, OrigNonLocals,
-		NonLocalTypeInfos, LambdaGoal, Unification0, Functor,
-		Unification, PolyInfo0, PolyInfo) :-
-	PolyInfo0 = poly_info(VarSet, VarTypes, TVarSet, TVarMap, 
-			TCVarMap, _Proofs, PredName, ModuleInfo0, InstTable0,
-			Markers, Owner),
-
-		% Calculate the constraints which apply to this lambda
-		% expression. 
-		% XXX Note currently we only allow lambda expressions
-		% to have universally quantified constraints.
-	map__keys(TCVarMap, AllConstraints),
-	map__apply_to_list(Vars, VarTypes, LambdaVarTypes),
-	list__map(type_util__vars, LambdaVarTypes, LambdaTypeVarsList),
-	list__condense(LambdaTypeVarsList, LambdaTypeVars),
-	list__filter(polymorphism__constraint_contains_vars(LambdaTypeVars), 
-		AllConstraints, UnivConstraints),
-
-	Modes = argument_modes(ArgInstTable, ArgModes0),
-	inst_table_create_sub(InstTable0, ArgInstTable, Sub, InstTable),
-	list__map(apply_inst_key_sub_mode(Sub), ArgModes0, ArgModes),
-
-	Constraints = constraints(UnivConstraints, []),
-	lambda__transform_lambda(PredOrFunc, PredName, Vars, ArgModes, Det,
-		OrigNonLocals, NonLocalTypeInfos, LambdaGoal, Unification0,
-		VarSet, VarTypes, Constraints, TVarSet, TVarMap, TCVarMap,
-		Markers, Owner, InstTable, ModuleInfo0, Functor,
-		Unification, ModuleInfo),
-	poly_info_set_module_info(ModuleInfo, PolyInfo0, PolyInfo).
-
-:- pred polymorphism__constraint_contains_vars(list(tvar), class_constraint).
-:- mode polymorphism__constraint_contains_vars(in, in) is semidet.
-
-polymorphism__constraint_contains_vars(LambdaVars, ClassConstraint) :-
-	ClassConstraint = constraint(_, ConstraintTypes),
-	list__map(type_util__vars, ConstraintTypes, ConstraintVarsList),
-	list__condense(ConstraintVarsList, ConstraintVars),
-		% Probably not the most efficient way of doing it, but I
-		% wouldn't think that it matters.
-	set__list_to_set(LambdaVars, LambdaVarsSet),
-	set__list_to_set(ConstraintVars, ConstraintVarsSet),
-	set__subset(ConstraintVarsSet, LambdaVarsSet).
-
-%---------------------------------------------------------------------------%
-
-=======
->>>>>>> 1.166
 % Given the list of constraints for a called predicate, create a list of
 % variables to hold the typeclass_info for those constraints,
 % and create a list of goals to initialize those typeclass_info variables
@@ -2562,13 +2130,8 @@
 	ClassId = class_id(ClassName, ClassArity),
 
 	Info0 = poly_info(VarSet0, VarTypes0, TypeVarSet, TypeInfoMap0, 
-<<<<<<< polymorphism.m
-		TypeClassInfoMap0, Proofs, PredName, ModuleInfo, InstTable,
-		Markers, Owner),
-=======
 		TypeClassInfoMap0, Proofs, PredName, ModuleInfo,
 		unit, unit),
->>>>>>> 1.166
 
 	(
 		map__search(TypeClassInfoMap0, Constraint, Location)
@@ -2688,12 +2251,7 @@
 
 			Info1 = poly_info(VarSet1, VarTypes1, TypeVarSet, 
 				TypeInfoMap0, TypeClassInfoMap0, Proofs, 
-<<<<<<< polymorphism.m
-				PredName, ModuleInfo, InstTable,
-				Markers, Owner),
-=======
 				PredName, ModuleInfo, unit, unit),
->>>>>>> 1.166
 
 				% Make the typeclass_info for the subclass
 			polymorphism__make_typeclass_info_var(
@@ -3008,7 +2566,6 @@
 		polymorphism__construct_type_info(Type, TypeId, TypeArgs,
 			no, ExistQVars, Context, Var, ExtraGoals, Info0, Info)
 	;
-<<<<<<< polymorphism.m
 		Type = term__variable(TypeVar),
 		poly_info_get_type_info_map(Info0, TypeInfoMap0),
 		map__search(TypeInfoMap0, TypeVar, TypeInfoLocn)
@@ -3040,16 +2597,14 @@
 				% If the typeinfo is in a typeclass_info, first
 				% extract it, then use it
 			TypeInfoLocn = typeclass_info(TypeClassInfoVar, Index),
-			extract_type_info(Type, TypeVar, TypeClassInfoVar,
+			extract_type_info(TypeVar, TypeClassInfoVar,
 				Index, ExtraGoals, Var, Info0, Info)
 		)
 	;
-=======
 	%
 	% Now handle the cases of types which are not known statically
 	% (i.e. type variables)
 	%
->>>>>>> 1.166
 		Type = term__variable(TypeVar)
 	->
 		poly_info_get_type_info_map(Info0, TypeInfoMap0),
@@ -3429,12 +2984,6 @@
 	map__set(VarTypes0, Var, UnifyPredType, VarTypes).
 
 %---------------------------------------------------------------------------%
-<<<<<<< polymorphism.m
-
-:- pred extract_type_info(type, tvar, prog_var, int, list(hlds_goal),
-		prog_var, poly_info, poly_info).
-:- mode extract_type_info(in, in, in, in, out, out, in, out) is det.
-=======
 
 % Generate code to get the value of a type variable.
 
@@ -3457,17 +3006,12 @@
 		extract_type_info(TypeVar, TypeClassInfoVar,
 			Index, ExtraGoals, Var, Info0, Info)
 	).
->>>>>>> 1.166
 
-<<<<<<< polymorphism.m
-extract_type_info(Type, TypeVar, TypeClassInfoVar, Index, Goals,
-=======
 :- pred extract_type_info(tvar, prog_var, int, list(hlds_goal),
 		prog_var, poly_info, poly_info).
 :- mode extract_type_info(in, in, in, out, out, in, out) is det.
 
 extract_type_info(TypeVar, TypeClassInfoVar, Index, Goals,
->>>>>>> 1.166
 		TypeInfoVar, PolyInfo0, PolyInfo) :-
 	poly_info_get_varset(PolyInfo0, VarSet0),
 	poly_info_get_var_types(PolyInfo0, VarTypes0),
@@ -3865,14 +3409,8 @@
 
 			pred_info,
 			module_info,
-<<<<<<< polymorphism.m
-			inst_table,
-			pred_markers,		% from the pred_info
-			aditi_owner
-=======
 			unit,
 			unit
->>>>>>> 1.166
 		).
 
 %---------------------------------------------------------------------------%
@@ -3888,22 +3426,9 @@
 	clauses_info_vartypes(ClausesInfo, VarTypes),
 	pred_info_typevarset(PredInfo, TypeVarSet),
 	pred_info_get_constraint_proofs(PredInfo, Proofs),
-<<<<<<< polymorphism.m
-	pred_info_get_markers(PredInfo, Markers),
-	pred_info_get_aditi_owner(PredInfo, Owner),
-	proc_info_varset(ProcInfo, VarSet),
-	proc_info_vartypes(ProcInfo, VarTypes),
-	proc_info_inst_table(ProcInfo, InstTable),
-=======
->>>>>>> 1.166
 	map__init(TypeInfoMap),
 	map__init(TypeClassInfoMap),
 	PolyInfo = poly_info(VarSet, VarTypes, TypeVarSet,
-<<<<<<< polymorphism.m
-		TypeInfoMap, TypeClassInfoMap, Proofs, PredName,
-		ModuleInfo, InstTable, Markers, Owner).
-
-=======
 			TypeInfoMap, TypeClassInfoMap,
 			Proofs, PredInfo, ModuleInfo, unit, unit).
 
@@ -3920,17 +3445,11 @@
 			TypeInfoMap, TypeClassInfoMap,
 			Proofs, PredInfo, ModuleInfo, unit, unit).
 
->>>>>>> 1.166
 poly_info_extract(Info, PredInfo0, PredInfo,
                 ProcInfo0, ProcInfo, ModuleInfo) :-
 	Info = poly_info(VarSet, VarTypes, TypeVarSet, TypeInfoMap,
-<<<<<<< polymorphism.m
-		TypeclassInfoLocations, _Proofs, _Name, ModuleInfo,
-		InstTable, _, _),
-=======
 		TypeclassInfoLocations, _Proofs, _OldPredInfo, ModuleInfo,
 		_, _),
->>>>>>> 1.166
 
 	% set the new values of the fields in proc_info and pred_info
 	proc_info_set_varset(ProcInfo0, VarSet, ProcInfo1),
@@ -3937,8 +3456,7 @@
 	proc_info_set_vartypes(ProcInfo1, VarTypes, ProcInfo2),
 	proc_info_set_typeinfo_varmap(ProcInfo2, TypeInfoMap, ProcInfo3),
 	proc_info_set_typeclass_info_varmap(ProcInfo3, TypeclassInfoLocations,
-		ProcInfo4),
-	proc_info_set_inst_table(ProcInfo4, InstTable, ProcInfo),
+		ProcInfo),
 	pred_info_set_typevarset(PredInfo0, TypeVarSet, PredInfo).
 
 %---------------------------------------------------------------------------%
@@ -3947,25 +3465,25 @@
 :- mode poly_info_get_varset(in, out) is det.
 
 poly_info_get_varset(PolyInfo, VarSet) :-
-	PolyInfo = poly_info(VarSet, _, _, _, _, _, _, _, _, _, _).
+	PolyInfo = poly_info(VarSet, _, _, _, _, _, _, _, _, _).
 
 :- pred poly_info_get_var_types(poly_info, map(prog_var, type)).
 :- mode poly_info_get_var_types(in, out) is det.
 
 poly_info_get_var_types(PolyInfo, VarTypes) :-
-	PolyInfo = poly_info(_, VarTypes, _, _, _, _, _, _, _, _, _).
+	PolyInfo = poly_info(_, VarTypes, _, _, _, _, _, _, _, _).
 
 :- pred poly_info_get_typevarset(poly_info, tvarset).
 :- mode poly_info_get_typevarset(in, out) is det.
 
 poly_info_get_typevarset(PolyInfo, TypeVarSet) :-
-	PolyInfo = poly_info(_, _, TypeVarSet, _, _, _, _, _, _, _, _).
+	PolyInfo = poly_info(_, _, TypeVarSet, _, _, _, _, _, _, _).
 
 :- pred poly_info_get_type_info_map(poly_info, map(tvar, type_info_locn)).
 :- mode poly_info_get_type_info_map(in, out) is det.
 
 poly_info_get_type_info_map(PolyInfo, TypeInfoMap) :-
-	PolyInfo = poly_info(_, _, _, TypeInfoMap, _, _, _, _, _, _, _).
+	PolyInfo = poly_info(_, _, _, TypeInfoMap, _, _, _, _, _, _).
 
 :- pred poly_info_get_typeclass_info_map(poly_info,
 					map(class_constraint, prog_var)).
@@ -3972,7 +3490,7 @@
 :- mode poly_info_get_typeclass_info_map(in, out) is det.
 
 poly_info_get_typeclass_info_map(PolyInfo, TypeClassInfoMap) :-
-	PolyInfo = poly_info(_, _, _, _, TypeClassInfoMap, _, _, _, _, _, _).
+	PolyInfo = poly_info(_, _, _, _, TypeClassInfoMap, _, _, _, _, _).
 
 :- pred poly_info_get_proofs(poly_info,
 				map(class_constraint, constraint_proof)).
@@ -3979,52 +3497,26 @@
 :- mode poly_info_get_proofs(in, out) is det.
 
 poly_info_get_proofs(PolyInfo, Proofs) :-
-	PolyInfo = poly_info(_, _, _, _, _, Proofs, _, _, _, _, _).
+	PolyInfo = poly_info(_, _, _, _, _, Proofs, _, _, _, _).
 
 :- pred poly_info_get_pred_info(poly_info, pred_info).
 :- mode poly_info_get_pred_info(in, out) is det.
 
-<<<<<<< polymorphism.m
-poly_info_get_pred_name(PolyInfo, PredName) :-
-	PolyInfo = poly_info(_, _, _, _, _, _, PredName, _, _, _, _).
-=======
 poly_info_get_pred_info(PolyInfo, PredInfo) :-
 	PolyInfo = poly_info(_, _, _, _, _, _, PredInfo, _, _, _).
->>>>>>> 1.166
 
 :- pred poly_info_get_module_info(poly_info, module_info).
 :- mode poly_info_get_module_info(in, out) is det.
 
 poly_info_get_module_info(PolyInfo, ModuleInfo) :-
-	PolyInfo = poly_info(_, _, _, _, _, _, _, ModuleInfo, _, _, _).
+	PolyInfo = poly_info(_, _, _, _, _, _, _, ModuleInfo, _, _).
 
-:- pred poly_info_get_inst_table(poly_info, inst_table).
-:- mode poly_info_get_inst_table(in, out) is det.
-
-poly_info_get_inst_table(PolyInfo, InstTable) :-
-	PolyInfo = poly_info(_, _, _, _, _, _, _, _, InstTable, _, _).
-
-:- pred poly_info_get_markers(poly_info, pred_markers).
-:- mode poly_info_get_markers(in, out) is det.
-
-<<<<<<< polymorphism.m
-poly_info_get_markers(PolyInfo, Markers) :-
-	PolyInfo = poly_info(_, _, _, _, _, _, _, _, _, Markers, _).
-
-:- pred poly_info_get_aditi_owner(poly_info, aditi_owner).
-:- mode poly_info_get_aditi_owner(in, out) is det.
-
-poly_info_get_aditi_owner(PolyInfo, Owner) :-
-	PolyInfo = poly_info(_, _, _, _, _, _, _, _, _, _, Owner).
-
-=======
->>>>>>> 1.166
 :- pred poly_info_set_varset(prog_varset, poly_info, poly_info).
 :- mode poly_info_set_varset(in, in, out) is det.
 
 poly_info_set_varset(VarSet, PolyInfo0, PolyInfo) :-
-	PolyInfo0 = poly_info(_, B, C, D, E, F, G, H, I, J, K),
-	PolyInfo = poly_info(VarSet, B, C, D, E, F, G, H, I, J, K).
+	PolyInfo0 = poly_info(_, B, C, D, E, F, G, H, I, J),
+	PolyInfo = poly_info(VarSet, B, C, D, E, F, G, H, I, J).
 
 :- pred poly_info_set_varset_and_types(prog_varset, map(prog_var, type),
 					poly_info, poly_info).
@@ -4031,15 +3523,15 @@
 :- mode poly_info_set_varset_and_types(in, in, in, out) is det.
 
 poly_info_set_varset_and_types(VarSet, VarTypes, PolyInfo0, PolyInfo) :-
-	PolyInfo0 = poly_info(_, _, C, D, E, F, G, H, I, J, K),
-	PolyInfo = poly_info(VarSet, VarTypes, C, D, E, F, G, H, I, J, K).
+	PolyInfo0 = poly_info(_, _, C, D, E, F, G, H, I, J),
+	PolyInfo = poly_info(VarSet, VarTypes, C, D, E, F, G, H, I, J).
 
 :- pred poly_info_set_typevarset(tvarset, poly_info, poly_info).
 :- mode poly_info_set_typevarset(in, in, out) is det.
 
 poly_info_set_typevarset(TypeVarSet, PolyInfo0, PolyInfo) :-
-	PolyInfo0 = poly_info(A, B, _, D, E, F, G, H, I, J, K),
-	PolyInfo = poly_info(A, B, TypeVarSet, D, E, F, G, H, I, J, K).
+	PolyInfo0 = poly_info(A, B, _, D, E, F, G, H, I, J),
+	PolyInfo = poly_info(A, B, TypeVarSet, D, E, F, G, H, I, J).
 
 :- pred poly_info_set_type_info_map(map(tvar, type_info_locn),
 					poly_info, poly_info).
@@ -4046,8 +3538,8 @@
 :- mode poly_info_set_type_info_map(in, in, out) is det.
 
 poly_info_set_type_info_map(TypeInfoMap, PolyInfo0, PolyInfo) :-
-	PolyInfo0 = poly_info(A, B, C, _, E, F, G, H, I, J, K),
-	PolyInfo = poly_info(A, B, C, TypeInfoMap, E, F, G, H, I, J, K).
+	PolyInfo0 = poly_info(A, B, C, _, E, F, G, H, I, J),
+	PolyInfo = poly_info(A, B, C, TypeInfoMap, E, F, G, H, I, J).
 
 :- pred poly_info_set_typeclass_info_map(map(class_constraint, prog_var),
 					poly_info, poly_info).
@@ -4054,8 +3546,8 @@
 :- mode poly_info_set_typeclass_info_map(in, in, out) is det.
 
 poly_info_set_typeclass_info_map(TypeClassInfoMap, PolyInfo0, PolyInfo) :-
-	PolyInfo0 = poly_info(A, B, C, D, _, F, G, H, I, J, K),
-	PolyInfo = poly_info(A, B, C, D, TypeClassInfoMap, F, G, H, I, J, K).
+	PolyInfo0 = poly_info(A, B, C, D, _, F, G, H, I, J),
+	PolyInfo = poly_info(A, B, C, D, TypeClassInfoMap, F, G, H, I, J).
 
 :- pred poly_info_set_proofs(map(class_constraint, constraint_proof),
 				poly_info, poly_info).
@@ -4062,22 +3554,15 @@
 :- mode poly_info_set_proofs(in, in, out) is det.
 
 poly_info_set_proofs(Proofs, PolyInfo0, PolyInfo) :-
-	PolyInfo0 = poly_info(A, B, C, D, E, _, G, H, I, J, K),
-	PolyInfo = poly_info(A, B, C, D, E, Proofs, G, H, I, J, K).
+	PolyInfo0 = poly_info(A, B, C, D, E, _, G, H, I, J),
+	PolyInfo = poly_info(A, B, C, D, E, Proofs, G, H, I, J).
 
 :- pred poly_info_set_module_info(module_info, poly_info, poly_info).
 :- mode poly_info_set_module_info(in, in, out) is det.
 
 poly_info_set_module_info(ModuleInfo, PolyInfo0, PolyInfo) :-
-	PolyInfo0 = poly_info(A, B, C, D, E, F, G, _, I, J, K),
-	PolyInfo = poly_info(A, B, C, D, E, F, G, ModuleInfo, I, J, K).
-
-:- pred poly_info_set_inst_table(inst_table, poly_info, poly_info).
-:- mode poly_info_set_inst_table(in, in, out) is det.
-
-poly_info_set_inst_table(InstTable, PolyInfo0, PolyInfo) :-
-	PolyInfo0 = poly_info(A, B, C, D, E, F, G, H, _, J, K),
-	PolyInfo = poly_info(A, B, C, D, E, F, G, H, InstTable, J, K).
+	PolyInfo0 = poly_info(A, B, C, D, E, F, G, _, I, J),
+	PolyInfo = poly_info(A, B, C, D, E, F, G, ModuleInfo, I, J).
 
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
--- prog_data.m	Tue Jul 13 14:17:09 1999
+++ /home/pgrad/dmo/mer0/alias_merge/mercury/compiler/prog_data.m	Mon Jul 12 14:11:51 1999
@@ -23,6 +23,9 @@
 % should be defined here, rather than in hlds*.m.
 
 :- import_module (inst).
+:- import_module hlds_data.
+	% YYY hlds_data needed for inst_table definition.  We should move the
+	% definition of inst_table somewhere else.
 :- import_module bool, list, assoc_list, map, varset, term, std_util.
 
 %-----------------------------------------------------------------------------%
@@ -104,13 +107,10 @@
 :- type type_and_mode	
 	--->	type_only(type)
 	;	type_and_mode(type, mode).
-<<<<<<< prog_data.m
 
 :- type types_and_modes
 	--->	types_and_modes(inst_table, list(type_and_mode)).
 
-=======
-
 :- type pred_or_func
 	--->	predicate
 	;	function.
@@ -140,7 +140,6 @@
 % Pragmas
 %
 
->>>>>>> 1.47
 :- type pragma_type 
 	--->	c_header_code(string)
 
@@ -242,16 +241,10 @@
 	;	promise_pure(sym_name, arity)
 			% Predname, Arity
 
-<<<<<<< prog_data.m
 	;	termination_info(pred_or_func, sym_name, argument_modes,
-			maybe(arg_size_info), maybe(termination_info))
-			% the argument_modes is the declared argmodes of the
-=======
-	;	termination_info(pred_or_func, sym_name, list(mode),
 				maybe(pragma_arg_size_info),
 				maybe(pragma_termination_info))
-			% the list(mode) is the declared argmodes of the
->>>>>>> 1.47
+			% the argument_modes is the declared argmodes of the
 			% procedure, unless there are no declared argmodes,
 			% in which case the inferred argmodes are used.
 			% This pragma is used to define information about a
--- prog_io_pragma.m	Tue Jul 13 14:17:22 1999
+++ /home/pgrad/dmo/mer0/alias_merge/mercury/compiler/prog_io_pragma.m	Mon Jul 12 13:07:32 1999
@@ -22,13 +22,8 @@
 
 :- implementation.
 
-<<<<<<< prog_io_pragma.m
-:- import_module prog_io, prog_io_goal, prog_util, hlds_data, hlds_pred.
-:- import_module term_util, term_errors, rl.
-=======
-:- import_module prog_io, prog_io_goal, prog_util.
+:- import_module prog_io, prog_io_goal, prog_util, hlds_data.
 :- import_module term_util, term_errors.
->>>>>>> 1.20
 :- import_module int, map, string, std_util, bool, require.
 
 parse_pragma(ModuleName, VarSet, PragmaTerms, Result) :-
--- purity.m	Tue Jul 13 14:17:31 1999
+++ /home/pgrad/dmo/mer0/alias_merge/mercury/compiler/purity.m	Mon Jul 12 12:41:46 1999
@@ -442,13 +442,8 @@
 		pure, NumErrors0, NumErrors) -->
 	{ Unif0 = unify(A,RHS0,C,D,E) },
 	{ Unif  = unify(A,RHS,C,D,E) },
-<<<<<<< purity.m
-	(   { RHS0 = lambda_goal(F, G, H, I, J, K, Goal0 - Info0) } ->
+	( { RHS0 = lambda_goal(F, G, H, I, J, K, Goal0 - Info0) } ->
 		{ RHS = lambda_goal(F, G, H, I, J, K, Goal - Info0) },
-=======
-	( { RHS0 = lambda_goal(F, G, H, I, J, Goal0 - Info0) } ->
-		{ RHS = lambda_goal(F, G, H, I, J, Goal - Info0) },
->>>>>>> 1.16
 		compute_expr_purity(Goal0, Goal, Info0, PredInfo, ModuleInfo,
 				    yes, Purity, NumErrors0, NumErrors1),
 		error_if_closure_impure(GoalInfo, Purity,
--- simplify.m	Tue Jul 13 14:17:44 1999
+++ /home/pgrad/dmo/mer0/alias_merge/mercury/compiler/simplify.m	Tue Jul  6 16:27:36 1999
@@ -81,12 +81,8 @@
 :- import_module hlds_module, hlds_data, (inst), inst_match, varset.
 :- import_module options, passes_aux, prog_data, mode_util, type_util.
 :- import_module code_util, quantification, modes, purity, pd_cost.
-<<<<<<< simplify.m
-:- import_module unify_proc, mode_info.
-:- import_module set, require, std_util, int.
-=======
 :- import_module prog_util, unify_proc, special_pred, polymorphism.
->>>>>>> 1.67
+:- import_module mode_info.
 
 :- import_module set, require, std_util, int, term.
 
@@ -364,12 +360,8 @@
 		( set__empty(NonLocals0) ->
 			Info2 = Info1
 		;
-<<<<<<< simplify.m
-			simplify_info_set_requantify(Info0, Info0a),
-			simplify_info_set_recompute_instmap_delta(Info0a, Info1)
-=======
-			simplify_info_set_requantify(Info1, Info2)
->>>>>>> 1.67
+			simplify_info_set_requantify(Info1, Info1a),
+			simplify_info_set_recompute_instmap_delta(Info1a, Info2)
 		),
 		pd_cost__goal(Goal0, CostDelta),
 		simplify_info_incr_cost_delta(Info2, CostDelta, Info3),
@@ -439,12 +431,8 @@
 		( set__empty(NonLocals0) ->
 			Info2 = Info1
 		;
-<<<<<<< simplify.m
-			simplify_info_set_requantify(Info0, Info0a),
-			simplify_info_set_recompute_instmap_delta(Info0a, Info1)
-=======
-			simplify_info_set_requantify(Info1, Info2)
->>>>>>> 1.67
+			simplify_info_set_requantify(Info1, Info1a),
+			simplify_info_set_recompute_instmap_delta(Info1a, Info2)
 		),
 		pd_cost__goal(Goal0, CostDelta),
 		simplify_info_incr_cost_delta(Info2, CostDelta, Info3),
@@ -456,19 +444,12 @@
 	),
 	simplify_info_maybe_clear_structs(before, Goal1, Info3, Info4),
 	Goal1 = GoalExpr1 - GoalInfo1,
-<<<<<<< simplify.m
-	simplify__goal_2(GoalExpr1, GoalInfo1, Goal, GoalInfo2, Info3, Info4),
-	simplify__enforce_invariant(GoalInfo2, GoalInfo, Info4, Info5),
+	simplify__goal_2(GoalExpr1, GoalInfo1, Goal, GoalInfo2, Info4, Info5),
+	simplify__enforce_invariant(GoalInfo2, GoalInfo, Info5, Info6),
 	goal_info_get_instmap_delta(GoalInfo, InstMapDelta),
 	instmap__apply_instmap_delta(InstMap0, InstMapDelta, InstMap),
-	simplify_info_set_instmap(Info5, InstMap, Info6),
-	simplify_info_maybe_clear_structs(after, Goal - GoalInfo2, Info6, Info).
-=======
-	simplify__goal_2(GoalExpr1, GoalInfo1, Goal, GoalInfo2, Info4, Info5),
-	simplify_info_maybe_clear_structs(after, Goal - GoalInfo2,
-		Info5, Info6),
-	simplify__enforce_invariant(GoalInfo2, GoalInfo, Info6, Info).
->>>>>>> 1.67
+	simplify_info_set_instmap(Info6, InstMap, Info7),
+	simplify_info_maybe_clear_structs(after, Goal - GoalInfo2, Info7, Info).
 
 :- pred simplify__enforce_invariant(hlds_goal_info, hlds_goal_info,
 		simplify_info, simplify_info).
@@ -1118,6 +1099,7 @@
 		Context, GoalInfo0, Goal) -->
 	=(Info0),
 	{ simplify_info_get_module_info(Info0, ModuleInfo) },
+	{ simplify_info_get_inst_table(Info0, InstTable) },
 	{ simplify_info_get_var_types(Info0, VarTypes) },
 	{ map__lookup(VarTypes, XVar, Type) },
 	( { Type = term__variable(TypeVar) } ->
@@ -1206,7 +1188,7 @@
 			SpecialPredMap) },
 		{ map__lookup(SpecialPredMap, unify - TypeId, PredId) },
 		{ determinism_components(Det, CanFail, at_most_one) },
-		{ unify_proc__lookup_mode_num(ModuleInfo, TypeId,
+		{ unify_proc__lookup_mode_num(InstTable, ModuleInfo, TypeId,
 		 	UniMode, Det, ProcId) },
 		{ SymName = unqualified("__Unify__") },
 		{ CallContext = call_unify_context(XVar, var(YVar), Context) },
@@ -2205,6 +2187,6 @@
 	list__member(Goal, DisjList).
 direct_subgoal(switch(_, _, CaseList, _), Goal) :-
 	list__member(Case, CaseList),
-	Case = case(_, Goal).
+	Case = case(_, _, Goal).
 
 %-----------------------------------------------------------------------------%
--- table_gen.m	Tue Jul 13 14:17:46 1999
+++ /home/pgrad/dmo/mer0/alias_merge/mercury/compiler/table_gen.m	Tue Jul  6 16:28:12 1999
@@ -260,39 +260,21 @@
 	(
 		CodeModel = model_det,
 		table_gen__create_new_det_goal(EvalMethod, OrigGoal,
-<<<<<<< table_gen.m
-			PredId, ProcId, PredInfo0, Module0,
-			InitInstMap, HeadVars, ArgModes, VarTypes0,
-			VarTypes, VarSet0, VarSet, Goal)
-=======
-			PredId, ProcId, HeadVars, ArgModes,
+			PredId, ProcId, InitInstMap, HeadVars, ArgModes,
 			VarTypes0, VarTypes, VarSet0, VarSet,
 			TableInfo0, TableInfo, Goal)
->>>>>>> 1.8
 	;
 		CodeModel = model_semi,
 		table_gen__create_new_semi_goal(EvalMethod, OrigGoal,
-<<<<<<< table_gen.m
-			PredId, ProcId, PredInfo0, Module0,
-			InitInstMap, HeadVars, ArgModes, VarTypes0,
-			VarTypes, VarSet0, VarSet, Goal)
-=======
-			PredId, ProcId, HeadVars, ArgModes,
+			PredId, ProcId, InitInstMap, HeadVars, ArgModes,
 			VarTypes0, VarTypes, VarSet0, VarSet,
 			TableInfo0, TableInfo, Goal)
->>>>>>> 1.8
 	;
 		CodeModel = model_non,
 		table_gen__create_new_non_goal(EvalMethod, OrigGoal,
-<<<<<<< table_gen.m
-			PredId, ProcId, PredInfo0, Module0,
-			InitInstMap, HeadVars, ArgModes, VarTypes0,
-			VarTypes, VarSet0, VarSet, Goal)
-=======
-			PredId, ProcId, HeadVars, ArgModes,
+			PredId, ProcId, InitInstMap, HeadVars, ArgModes,
 			VarTypes0, VarTypes, VarSet0, VarSet,
 			TableInfo0, TableInfo, Goal)
->>>>>>> 1.8
 	),
 
 	table_info_extract(TableInfo, Module1, PredInfo1, ProcInfo1),
@@ -316,36 +298,21 @@
 		% Transform deterministic procedures.
 		%
 :- pred table_gen__create_new_det_goal(eval_method, hlds_goal,
-<<<<<<< table_gen.m
-	pred_id, proc_id, pred_info, module_info, instmap,
-	list(prog_var), argument_modes, map(prog_var, type),
-	map(prog_var, type), prog_varset, prog_varset, hlds_goal).
-:- mode table_gen__create_new_det_goal(in, in, in, in, in, in, in, in, in,
-	in, out, in, out, out) is det.
-=======
-	pred_id, proc_id, list(prog_var), list(mode),
+	pred_id, proc_id, instmap, list(prog_var), argument_modes,
 	map(prog_var, type), map(prog_var, type), prog_varset, prog_varset,
 	table_info, table_info, hlds_goal).
-:- mode table_gen__create_new_det_goal(in, in, in, in, in, in,
+:- mode table_gen__create_new_det_goal(in, in, in, in, in, in, in,
 		in, out, in, out, in, out, out) is det.
->>>>>>> 1.8
 
 table_gen__create_new_det_goal(EvalMethod, OrigGoal, PredId, ProcId,
-<<<<<<< table_gen.m
-		PredInfo, Module, InstMap0, HeadVars, HeadVarModes,
-		VarTypes0, VarTypes, VarSet0, VarSet, Goal) :-
-	HeadVarModes = argument_modes(ArgInstTable, ArgModes),
-	get_input_output_vars(HeadVars, ArgModes, InstMap0, ArgInstTable,
-		Module, InputVars, OutputVars),
-=======
-		HeadVars, HeadVarModes,
+		InstMap0, HeadVars, HeadVarModes,
 		VarTypes0, VarTypes, VarSet0, VarSet, TableInfo0, TableInfo,
 		Goal) :-
 	table_info_get_module_info(TableInfo0, Module),
 
-	get_input_output_vars(HeadVars, HeadVarModes, Module, InputVars,
-		OutputVars),
->>>>>>> 1.8
+	HeadVarModes = argument_modes(ArgInstTable, ArgModes),
+	get_input_output_vars(HeadVars, ArgModes, InstMap0, ArgInstTable,
+		Module, InputVars, OutputVars),
 
 	generate_det_lookup_goal(InputVars, PredId, ProcId,
 		VarTypes0, VarTypes1, VarSet0, VarSet1, TableInfo0, TableInfo1,
@@ -418,42 +385,24 @@
 		% Transform semi deterministic procedures
 		%
 :- pred table_gen__create_new_semi_goal(eval_method, hlds_goal,
-<<<<<<< table_gen.m
-	pred_id, proc_id, pred_info, module_info, instmap,
-	list(prog_var), argument_modes, map(prog_var, type),
-	map(prog_var, type), prog_varset, prog_varset, hlds_goal).
-:- mode table_gen__create_new_semi_goal(in, in, in, in, in, in, in, in, in,
-	in, out, in, out, out) is det.
-=======
-	pred_id, proc_id, list(prog_var), list(mode),
+	pred_id, proc_id, instmap, list(prog_var), argument_modes,
 	map(prog_var, type), map(prog_var, type), prog_varset, prog_varset,
 	table_info, table_info, hlds_goal).
-:- mode table_gen__create_new_semi_goal(in, in, in, in, in, in,
+:- mode table_gen__create_new_semi_goal(in, in, in, in, in, in, in,
 	in, out, in, out, in, out, out) is det.
->>>>>>> 1.8
 
 table_gen__create_new_semi_goal(EvalMethod, OrigGoal, PredId, ProcId,
-<<<<<<< table_gen.m
-		PredInfo, Module, InstMap0, HeadVars, HeadVarModes,
-		VarTypes0, VarTypes, VarSet0, VarSet, Goal) :-
-	HeadVarModes = argument_modes(ArgInstTable, ArgModes),
-	get_input_output_vars(HeadVars, ArgModes, InstMap0, ArgInstTable,
-		Module, InputVars, OutputVars),
-
-	generate_det_lookup_goal(InputVars, Module, PredId, ProcId,
-		VarTypes0, VarTypes1, VarSet0, VarSet1, TableVar, LookUpGoal),
-=======
-		HeadVars, HeadVarModes,
+		InstMap0, HeadVars, HeadVarModes,
 		VarTypes0, VarTypes, VarSet0, VarSet, TableInfo0, TableInfo,
 		Goal) :-
 	table_info_get_module_info(TableInfo0, Module),
-	get_input_output_vars(HeadVars, HeadVarModes, Module, InputVars,
-		OutputVars),
+	HeadVarModes = argument_modes(ArgInstTable, ArgModes),
+	get_input_output_vars(HeadVars, ArgModes, InstMap0, ArgInstTable,
+		Module, InputVars, OutputVars),
 
 	generate_det_lookup_goal(InputVars, PredId, ProcId,
 		VarTypes0, VarTypes1, VarSet0, VarSet1, TableInfo0, TableInfo1,
 		TableVar, LookUpGoal),
->>>>>>> 1.8
 	generate_call("table_simple_is_complete", [TableVar],
 		semidet, semipure, [], Module, CompleteCheckGoal),
 	generate_save_goal(OutputVars, TableVar, VarTypes1, VarTypes2,
@@ -572,42 +521,24 @@
 		% Transform non deterministic procedures
 		%
 :- pred table_gen__create_new_non_goal(eval_method, hlds_goal,
-<<<<<<< table_gen.m
-	pred_id, proc_id, pred_info, module_info, instmap,
-	list(prog_var), argument_modes, map(prog_var, type),
-	map(prog_var, type), prog_varset, prog_varset, hlds_goal).
-:- mode table_gen__create_new_non_goal(in, in, in, in, in, in, in, in, in,
-	in, out, in, out, out) is det.
-=======
-	pred_id, proc_id, list(prog_var), list(mode),
+	pred_id, proc_id, instmap, list(prog_var), argument_modes,
 	map(prog_var, type), map(prog_var, type), prog_varset, prog_varset,
 	table_info, table_info, hlds_goal).
-:- mode table_gen__create_new_non_goal(in, in, in, in, in, in,
+:- mode table_gen__create_new_non_goal(in, in, in, in, in, in, in,
 	in, out, in, out, in, out, out) is det.
->>>>>>> 1.8
 
 table_gen__create_new_non_goal(EvalMethod, OrigGoal, PredId, ProcId,
-<<<<<<< table_gen.m
-		PredInfo, Module, InstMap0, HeadVars, HeadVarModes,
-		VarTypes0, VarTypes, VarSet0, VarSet, Goal) :-
-	HeadVarModes = argument_modes(ArgInstTable, ArgModes),
-	get_input_output_vars(HeadVars, ArgModes, InstMap0, ArgInstTable,
-		Module, InputVars, OutputVars),
-
-	generate_non_lookup_goal(InputVars, Module, PredId, ProcId,
-		VarTypes0, VarTypes1, VarSet0, VarSet1, TableVar, LookUpGoal),
-=======
-		HeadVars, HeadVarModes,
+		InstMap0, HeadVars, HeadVarModes,
 		VarTypes0, VarTypes, VarSet0, VarSet, TableInfo0, TableInfo,
 		Goal) :-
 	table_info_get_module_info(TableInfo0, Module),
-	get_input_output_vars(HeadVars, HeadVarModes, Module, InputVars,
-		OutputVars),
+	HeadVarModes = argument_modes(ArgInstTable, ArgModes),
+	get_input_output_vars(HeadVars, ArgModes, InstMap0, ArgInstTable,
+		Module, InputVars, OutputVars),
 
 	generate_non_lookup_goal(InputVars, PredId, ProcId,
 		VarTypes0, VarTypes1, VarSet0, VarSet1, TableInfo0, TableInfo1,
 		TableVar, LookUpGoal),
->>>>>>> 1.8
 	generate_call("table_nondet_is_complete", [TableVar], semidet, semipure,
 		[], Module, CompleteCheckGoal),
 	generate_non_save_goal(OutputVars, TableVar, VarTypes1, VarTypes2,
@@ -718,13 +649,6 @@
 
 %-----------------------------------------------------------------------------%
 
-<<<<<<< table_gen.m
-:- pred generate_det_lookup_goal(list(prog_var), module_info,
-	pred_id, proc_id, map(prog_var, type), map(prog_var, type),
-	prog_varset, prog_varset, prog_var, hlds_goal).
-:- mode generate_det_lookup_goal(in, in, in, in,
-	in, out, in, out, out, out) is det.
-=======
 :- pred generate_det_lookup_goal(list(prog_var), pred_id, proc_id,
 		map(prog_var, type), map(prog_var, type),
 		prog_varset, prog_varset, table_info, table_info,
@@ -731,15 +655,9 @@
 		prog_var, hlds_goal).
 :- mode generate_det_lookup_goal(in, in, in, in, out, in, out, in, out,
 		out, out) is det.
->>>>>>> 1.8
 
-<<<<<<< table_gen.m
-generate_det_lookup_goal(Vars, Module, PredId, ProcId,
-		VarTypes0, VarTypes, VarSet0, VarSet, TableVar, Goal) :-
-=======
 generate_det_lookup_goal(Vars, PredId, ProcId, VarTypes0, VarTypes,
 		VarSet0, VarSet, TableInfo0, TableInfo, TableVar, Goal) :-
->>>>>>> 1.8
 
 	generate_get_table_goal(VarTypes0, VarTypes1, VarSet0, VarSet1,
 		PredId, ProcId, PredTableVar, GetTableGoal),
@@ -754,15 +672,6 @@
 	goal_info_init(NonLocals, InstMapDelta, det,
 		GoalInfo),
 	Goal = GoalEx - GoalInfo.
-<<<<<<< table_gen.m
-
-:- pred generate_non_lookup_goal(list(prog_var), module_info,
-	pred_id, proc_id, map(prog_var, type), map(prog_var, type),
-	prog_varset, prog_varset, prog_var, hlds_goal).
-:- mode generate_non_lookup_goal(in, in, in, in,
-	in, out, in, out, out, out) is det.
-=======
->>>>>>> 1.8
 
 :- pred generate_non_lookup_goal(list(prog_var), pred_id, proc_id,
 		map(prog_var, type), map(prog_var, type),
--- termination.m	Tue Jul 13 14:17:58 1999
+++ /home/pgrad/dmo/mer0/alias_merge/mercury/compiler/termination.m	Mon Jul 12 13:09:11 1999
@@ -47,13 +47,8 @@
 
 :- interface.
 
-<<<<<<< termination.m
 :- import_module io, bool, std_util.
-:- import_module prog_data, hlds_module, hlds_pred, term_util.
-=======
-:- import_module io, bool, std_util, list.
 :- import_module prog_data, hlds_module, term_util.
->>>>>>> 1.19
 
 	% Perform termination analysis on the module.
 
@@ -83,13 +78,8 @@
 :- implementation.
 
 :- import_module term_pass1, term_pass2, term_errors.
-<<<<<<< termination.m
 :- import_module instmap, inst_match, passes_aux, options, globals.
-:- import_module hlds_data, hlds_goal, dependency_graph.
-=======
-:- import_module inst_match, passes_aux, options, globals.
-:- import_module hlds_data, hlds_goal, hlds_pred, dependency_graph, varset.
->>>>>>> 1.19
+:- import_module hlds_data, hlds_goal, hlds_pred, dependency_graph.
 :- import_module mode_util, hlds_out, code_util, prog_out, prog_util.
 :- import_module mercury_to_mercury, type_util, special_pred.
 :- import_module modules.
--- unify_gen.m	Tue Jul 13 14:18:16 1999
+++ /home/pgrad/dmo/mer0/alias_merge/mercury/compiler/unify_gen.m	Mon Jul 12 13:09:52 1999
@@ -40,12 +40,8 @@
 :- import_module builtin_ops.
 :- import_module hlds_module, hlds_pred, prog_data, prog_out, code_util.
 :- import_module mode_util, type_util, code_aux, hlds_out, tree, arg_info.
-<<<<<<< unify_gen.m
 :- import_module globals, options, continuation_info, stack_layout, inst_match.
-=======
-:- import_module globals, options, continuation_info, stack_layout.
 
->>>>>>> 1.100
 :- import_module term, bool, string, int, list, map, require, std_util.
 
 :- type uni_val		--->	ref(prog_var)
--- unify_proc.m	Tue Jul 13 14:18:19 1999
+++ /home/pgrad/dmo/mer0/alias_merge/mercury/compiler/unify_proc.m	Thu Jul  1 14:42:27 1999
@@ -248,12 +248,7 @@
 
 		% convert from `uni_mode' to `list(mode)'
 		UnifyMode = ((X_Initial - Y_Initial) -> (X_Final - Y_Final)),
-<<<<<<< unify_proc.m
-		ArgModes = [(X_Initial -> X_Final), (Y_Initial -> Y_Final)],
-		Modes = argument_modes(InstTable, ArgModes),
-=======
 		ArgModes0 = [(X_Initial -> X_Final), (Y_Initial -> Y_Final)],
->>>>>>> 1.77
 
 		% for polymorphic types, add extra modes for the type_infos
 		TypeId = _TypeName - TypeArity,
@@ -263,6 +258,7 @@
 
 		ArgLives = no,  % XXX ArgLives should be part of the UnifyId
 
+		Modes = argument_modes(InstTable, ArgModes),
 		unify_proc__request_proc(PredId, Modes, ArgLives,
 			yes(Determinism), Context, ModuleInfo0,
 			ProcId, ModuleInfo1),
--- unique_modes.m	Tue Jul 13 14:18:21 1999
+++ /home/pgrad/dmo/mer0/alias_merge/mercury/compiler/unique_modes.m	Thu Jul  1 14:49:29 1999
@@ -357,13 +357,7 @@
 	mode_info_add_live_vars(B_Vars),
 	unique_modes__check_goal(A0, A),
 	mode_info_remove_live_vars(B_Vars),
-<<<<<<< unique_modes.m
 	mode_info_unlock_vars(if_then_else, InnerNonLocals),
-	% mode_info_dcg_get_instmap(InstMapA),
-	unique_modes__check_goal(B0, B),
-	mode_info_dcg_get_instmap(InstMapB),
-=======
-	mode_info_unlock_vars(if_then_else, NonLocals),
 	mode_info_dcg_get_instmap(InstMapA),
 	( { instmap__is_reachable(InstMapA) } ->
 		unique_modes__check_goal(B0, B),
@@ -375,7 +369,6 @@
 		{ true_goal(B) },
 		{ InstMapB = InstMapA }
 	),
->>>>>>> 1.53
 	mode_info_set_instmap(InstMap0),
 	unique_modes__check_goal(C0, C),
 	mode_info_dcg_get_instmap(InstMapC),
@@ -413,7 +406,6 @@
 		NeverSucceeds = no
 	},
 	{ determinism_to_code_model(Det, CodeModel) },
-<<<<<<< unique_modes.m
 	{ Modes = argument_modes(ArgInstTable, ArgModes0) },
 	mode_info_dcg_get_inst_table(InstTable0),
 	{ inst_table_create_sub(InstTable0, ArgInstTable, Sub, InstTable) },
@@ -420,12 +412,8 @@
 	mode_info_set_inst_table(InstTable),
 	{ list__map(apply_inst_key_sub_mode(Sub), ArgModes0, ArgModes) },
 
-	unique_modes__check_call_modes(Args, ArgModes, CodeModel,
+	unique_modes__check_call_modes(Args, ArgModes, 0, CodeModel,
 		NeverSucceeds),
-=======
-	unique_modes__check_call_modes(Args, Modes, 0,
-			CodeModel, NeverSucceeds),
->>>>>>> 1.53
 	{ Goal = higher_order_call(PredVar, Args, Types, Modes, Det,
 			PredOrFunc) },
 	mode_info_unset_call_context,
@@ -446,29 +434,19 @@
 		NeverSucceeds = no
 	},
 	{ determinism_to_code_model(Det, CodeModel) },
-<<<<<<< unique_modes.m
 	{ Modes = argument_modes(_ArgInstTable, ArgModes) },
 	% YYY What about if ArgInstTable is non-null?
-	unique_modes__check_call_modes(Args, ArgModes, CodeModel,
+	unique_modes__check_call_modes(Args, ArgModes, 0, CodeModel,
 			NeverSucceeds),
-=======
-	unique_modes__check_call_modes(Args, Modes, 0,
-			CodeModel, NeverSucceeds),
->>>>>>> 1.53
 	{ Goal = class_method_call(TCVar, Num, Args, Types, Modes, Det) },
 	mode_info_unset_call_context,
 	mode_checkpoint(exit, "class method call", GoalInfo0).
 
 unique_modes__check_goal_2(call(PredId, ProcId0, Args, Builtin, CallContext,
-<<<<<<< unique_modes.m
 		PredName), GoalInfo0, Goal) -->
-	mode_checkpoint(enter, "call", GoalInfo0),
-=======
-		PredName), _GoalInfo0, Goal) -->
 	{ prog_out__sym_name_to_string(PredName, PredNameString) },
 	{ string__append("call ", PredNameString, CallString) },
-	mode_checkpoint(enter, CallString),
->>>>>>> 1.53
+	mode_checkpoint(enter, CallString, GoalInfo0),
 	mode_info_set_call_context(call(PredId)),
 	unique_modes__check_call(PredId, ProcId0, Args, ProcId),
 	{ Goal = call(PredId, ProcId, Args, Builtin, CallContext, PredName) },
@@ -534,15 +512,10 @@
 	%
 	% first off, try using the existing mode
 	%
-<<<<<<< unique_modes.m
 	mode_info_get_module_info(ModeInfo1, ModuleInfo),
-	module_info_pred_proc_info(ModuleInfo, PredId, ProcId0, _, ProcInfo),
-=======
-	mode_info_get_module_info(ModeInfo0, ModuleInfo),
 	module_info_pred_proc_info(ModuleInfo, PredId, ProcId0,
 		PredInfo, ProcInfo),
 	compute_arg_offset(PredInfo, ArgOffset),
->>>>>>> 1.53
 	proc_info_argmodes(ProcInfo, ProcArgModes0),
 
 	ProcArgModes0 = argument_modes(ArgInstTable, ArgModes0),
@@ -553,13 +526,8 @@
 
 	proc_info_interface_code_model(ProcInfo, CodeModel),
 	proc_info_never_succeeds(ProcInfo, NeverSucceeds),
-<<<<<<< unique_modes.m
-	unique_modes__check_call_modes(ArgVars, ArgModes, CodeModel,
+	unique_modes__check_call_modes(ArgVars, ArgModes, ArgOffset, CodeModel,
 				NeverSucceeds, ModeInfo2, ModeInfo3),
-=======
-	unique_modes__check_call_modes(ArgVars, ProcArgModes0, ArgOffset,
-			CodeModel, NeverSucceeds, ModeInfo1, ModeInfo2),
->>>>>>> 1.53
 
 	%
 	% see whether or not that worked
@@ -737,21 +705,13 @@
 
 		% record the fact that Var was bound to ConsId in the
 		% instmap before processing this case
-<<<<<<< unique_modes.m
 	mode_info_bind_var_to_functor(Var, ConsId),
 	mode_info_dcg_get_instmap(InstMap1),
 	% { instmap__vars(InstMap0, InstMapVars) },
 	{ compute_instmap_delta(InstMap0, InstMap1, IMDelta) },
 
-	unique_modes__check_goal(Goal0, Goal1),
-=======
-	{ cons_id_arity(ConsId, Arity) },
-	{ list__duplicate(Arity, free, ArgInsts) },
-	modecheck_set_var_inst(Var,
-		bound(unique, [functor(ConsId, ArgInsts)])),
-
-	mode_info_dcg_get_instmap(InstMap1),
-	( { instmap__is_reachable(InstMap1) } ->
+	mode_info_dcg_get_instmap(InstMap2),
+	( { instmap__is_reachable(InstMap2) } ->
 		unique_modes__check_goal(Goal0, Goal1)
 	;
 		% We should not mode-analyse the goal, since it is unreachable.
@@ -760,15 +720,9 @@
 		{ true_goal(Goal1) }
 	),
 
->>>>>>> 1.53
 	mode_info_dcg_get_instmap(InstMap),
-<<<<<<< unique_modes.m
 	% { fixup_switch_var(Var, InstMap0, InstMap, Goal1, Goal) },
 	{ Goal = Goal1 },
-=======
-	{ fixup_switch_var(Var, InstMap0, InstMap, Goal1, Goal) },
-
->>>>>>> 1.53
 	mode_info_set_instmap(InstMap0),
 	unique_modes__check_case_list(Cases0, Var, Cases, InstMaps).
 
--- unused_args.m	Tue Jul 13 14:18:25 1999
+++ /home/pgrad/dmo/mer0/alias_merge/mercury/compiler/unused_args.m	Mon Jul 12 12:41:57 1999
@@ -548,11 +548,7 @@
 	).
 	
 	% These should be transformed into calls by polymorphism.m.
-<<<<<<< unused_args.m
-traverse_goal(_, _, _, unify(Var, Rhs, _, complicated_unify(_, _), _), _,
-=======
-traverse_goal(_, unify(Var, Rhs, _, complicated_unify(_, _, _), _),
->>>>>>> 1.58
+traverse_goal(_, _, _, unify(Var, Rhs, _, complicated_unify(_, _, _), _), _,
 		UseInf0, UseInf) :-
     	% This is here to cover the case where unused arguments is called 
 	% with --error-check-only and polymorphism has not been run.
@@ -1517,11 +1513,7 @@
 	).
 
 	% These should be transformed into calls by polymorphism.m.
-<<<<<<< unused_args.m
-fixup_unify(_, _, _, _, _, complicated_unify(_, _), _, _) :-
-=======
-fixup_unify(_, _, _, complicated_unify(_, _, _), _) :-
->>>>>>> 1.58
+fixup_unify(_, _, _, _, _, complicated_unify(_, _, _), _, _) :-
 		error("unused_args:fixup_goal : complicated unify").
 
 	% Check if any of the arguments of a deconstruction are unused, if

-- 
David Overton       Department of Computer Science & Software Engineering
MEngSc Student      The University of Melbourne, Australia
+61 3 9344 9159     http://www.cs.mu.oz.au/~dmo
--------------------------------------------------------------------------
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