[m-rev.] diff: delete code_exprn.m

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon May 5 10:53:02 AEST 2003


This is an old diff, on which I believe I addressed all the old review
comments.

Zoltan.

Estimated hours taken: 3

Delete the old, lazy LLDS code generator, since we won't be maintaining it
anymore. Its deletion speeds up the compiler by 0.2% when using the LLDS
back end.

compiler/code_exprn.m:
	Delete the module.

compiler/ll_backend.m:
	Delete code_exprn from the list of submodules of this module.

compiler/notes/compiler_design.html:
	Delete the documentation of code_exprn.m, and update the documentation
	of var_locn.m.

compiler/options.m:
	Delete the --lazy-code option that used to select code_exprn over
	var_locn.

	Delete the follow_vars option, since the LLDS backend now always
	executes the follow_vars pass.

compiler/handle_options.m:
	Delete the code setting the follow_vars option.

	Make the setting of static_ground_terms conditional on the use of the
	LLDS backend (which now implies the eager code generator).

compiler/code_info.m:
	Delete lots of code that switches between code_exprn.m and var_locn.m.

	Simplify the data structures accordingly.

compiler/store_alloc.m:
	Delete the code and data structures required to cater for the case
	where the follow_vars pass isn't run.

compiler/pragma_c_gen.m:
compiler/var_locn.m:
compiler/hlds_goal.m:
compiler/lookup_switch.m:
	Update a comment.

doc/user_guide.texi:
	Delete the documentation of --follow-vars. --lazy-code was already
	undocumented.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/code_exprn.m
===================================================================
RCS file: compiler/code_exprn.m
diff -N compiler/code_exprn.m
--- compiler/code_exprn.m	1 May 2003 22:50:47 -0000	1.67
+++ /dev/null	1 Jan 1970 00:00:00 -0000
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.275
diff -u -b -r1.275 code_info.m
--- compiler/code_info.m	1 May 2003 22:50:47 -0000	1.275
+++ compiler/code_info.m	3 May 2003 08:16:12 -0000
@@ -19,7 +19,7 @@
 %	- handling failure continuations
 %	- handling liveness issues
 %	- saving and restoring heap pointers, trail tickets etc
-%	- interfacing to code_exprn
+%	- interfacing to var_locn
 %	- managing the info required by garbage collection and value numbering
 %	- managing stack slots
 %
@@ -54,7 +54,6 @@
 :- import_module libs__options.
 :- import_module libs__tree.
 :- import_module ll_backend__arg_info.
-:- import_module ll_backend__code_exprn.
 :- import_module ll_backend__code_util.
 :- import_module ll_backend__exprn_aux.
 :- import_module ll_backend__llds_out.
@@ -192,10 +191,10 @@
 :- pred code_info__set_zombies(set(prog_var)::in,
 	code_info::in, code_info::out) is det.
 
-:- pred code_info__get_var_locns_info(var_locns_info::out,
+:- pred code_info__get_var_locn_info(var_locn_info::out,
 	code_info::in, code_info::out) is det.
 
-:- pred code_info__set_var_locns_info(var_locns_info::in,
+:- pred code_info__set_var_locn_info(var_locn_info::in,
 	code_info::in, code_info::out) is det.
 
 :- pred code_info__get_temps_in_use(set(lval)::out,
@@ -309,7 +308,7 @@
 				% Zombie variables; variables that are not
 				% forward live but which are protected by
 				% an enclosing resume point.
-		var_locns_info :: var_locns_info,
+		var_locn_info :: var_locn_info,
 				% A map storing the information about
 				% the status of each known variable.
 				% (Known vars = forward live vars + zombies)
@@ -369,10 +368,6 @@
 				% more temporary nondet frames.
 	).
 
-:- type var_locns_info
-	--->	exprn_info(exprn_info)
-	;	var_locn_info(var_locn_info).
-
 %---------------------------------------------------------------------------%
 
 code_info__init(SaveSuccip, Globals, PredId, ProcId, PredInfo, ProcInfo,
@@ -384,7 +379,6 @@
 	arg_info__build_input_arg_list(ProcInfo, ArgList),
 	proc_info_varset(ProcInfo, VarSet),
 	proc_info_stack_slots(ProcInfo, StackSlots),
-	globals__lookup_bool_option(Globals, lazy_code, LazyCode),
 	globals__get_options(Globals, Options),
 	globals__get_trace_level(Globals, TraceLevel),
 	( eff_trace_level_is_none(PredInfo, ProcInfo, TraceLevel) = no ->
@@ -395,19 +389,8 @@
 		MaybeFailVars = no,
 		EffLiveness = Liveness
 	),
-	(
-		LazyCode = yes,
-		ArgRvalList = assoc_list__map_values(
-			exprn_aux__var_lval_to_rval, ArgList),
-		code_exprn__init_state(ArgRvalList, VarSet, StackSlots,
-			FollowVars, Options, ExprnInfo),
-		VarLocnsInfo = exprn_info(ExprnInfo)
-	;
-		LazyCode = no,
 		var_locn__init_state(ArgList, EffLiveness, VarSet,
 			StackSlots, FollowVars, Options, VarLocnInfo),
-		VarLocnsInfo = var_locn_info(VarLocnInfo)
-	),
 	stack__init(ResumePoints),
 	globals__lookup_bool_option(Globals, allow_hijacks, AllowHijack),
 	(
@@ -446,7 +429,7 @@
 			Liveness,
 			InstMap,
 			Zombies,
-			VarLocnsInfo,
+			VarLocnInfo,
 			TempsInUse,
 			DummyFailInfo	% code_info__init_fail_info
 					% will override this dummy value
@@ -499,7 +482,7 @@
 	CI, CI).
 code_info__get_instmap(CI^code_info_loc_dep^instmap, CI, CI).
 code_info__get_zombies(CI^code_info_loc_dep^zombies, CI, CI).
-code_info__get_var_locns_info(CI^code_info_loc_dep^var_locns_info, CI, CI).
+code_info__get_var_locn_info(CI^code_info_loc_dep^var_locn_info, CI, CI).
 code_info__get_temps_in_use(CI^code_info_loc_dep^temps_in_use, CI, CI).
 code_info__get_fail_info(CI^code_info_loc_dep^fail_info, CI, CI).
 code_info__get_label_counter(CI^code_info_persistent^label_num_src, CI, CI).
@@ -525,8 +508,8 @@
 	CI^code_info_loc_dep^forward_live_vars := LV).
 code_info__set_instmap(IM, CI, CI^code_info_loc_dep^instmap := IM).
 code_info__set_zombies(Zs, CI, CI^code_info_loc_dep^zombies := Zs).
-code_info__set_var_locns_info(EI, CI,
-	CI^code_info_loc_dep^var_locns_info := EI).
+code_info__set_var_locn_info(EI, CI,
+	CI^code_info_loc_dep^var_locn_info := EI).
 code_info__set_temps_in_use(TI, CI, CI^code_info_loc_dep^temps_in_use := TI).
 code_info__set_fail_info(FI, CI, CI^code_info_loc_dep^fail_info := FI).
 code_info__set_label_counter(LC, CI,
@@ -684,51 +667,21 @@
 :- mode code_info__add_resume_layout_for_label(in, in, in, out) is det.
 
 code_info__get_stack_slots(StackSlots, CI, CI) :-
-	code_info__get_var_locns_info(VarInfo, CI, _),
-	(
-		VarInfo = exprn_info(ExprnInfo),
-		code_exprn__get_stack_slots(StackSlots, ExprnInfo, _)
-	;
-		VarInfo = var_locn_info(VarLocnInfo),
-		var_locn__get_stack_slots(StackSlots, VarLocnInfo, _)
-	).
+	code_info__get_var_locn_info(VarLocnInfo, CI, _),
+	var_locn__get_stack_slots(StackSlots, VarLocnInfo, _).
 
 code_info__get_follow_var_map(FollowVarMap, CI, CI) :-
-	code_info__get_var_locns_info(VarInfo, CI, _),
-	(
-		VarInfo = exprn_info(ExprnInfo),
-		code_exprn__get_follow_vars(FollowVars, ExprnInfo, _),
-		FollowVars = follow_vars(FollowVarMap, _)
-	;
-		VarInfo = var_locn_info(VarLocnInfo),
-		var_locn__get_follow_var_map(FollowVarMap, VarLocnInfo, _)
-	).
+	code_info__get_var_locn_info(VarLocnInfo, CI, _),
+	var_locn__get_follow_var_map(FollowVarMap, VarLocnInfo, _).
 
 code_info__get_next_non_reserved(NextNonReserved, CI, CI) :-
-	code_info__get_var_locns_info(VarInfo, CI, _),
-	(
-		VarInfo = exprn_info(ExprnInfo),
-		code_exprn__get_follow_vars(FollowVars, ExprnInfo, _),
-		FollowVars = follow_vars(_, NextNonReserved)
-	;
-		VarInfo = var_locn_info(VarLocnInfo),
-		var_locn__get_next_non_reserved(NextNonReserved, VarLocnInfo,
-			_)
-	).
+	code_info__get_var_locn_info(VarLocnInfo, CI, _),
+	var_locn__get_next_non_reserved(NextNonReserved, VarLocnInfo, _).
 
 code_info__set_follow_vars(FollowVars, CI0, CI) :-
-	code_info__get_var_locns_info(VarInfo0, CI0, _),
-	(
-		VarInfo0 = exprn_info(ExprnInfo0),
-		code_exprn__set_follow_vars(FollowVars, ExprnInfo0, ExprnInfo),
-		VarInfo = exprn_info(ExprnInfo)
-	;
-		VarInfo0 = var_locn_info(VarLocnInfo0),
-		var_locn__set_follow_vars(FollowVars,
-			VarLocnInfo0, VarLocnInfo),
-		VarInfo = var_locn_info(VarLocnInfo)
-	),
-	code_info__set_var_locns_info(VarInfo, CI0, CI).
+	code_info__get_var_locn_info(VarLocnInfo0, CI0, _),
+	var_locn__set_follow_vars(FollowVars, VarLocnInfo0, VarLocnInfo),
+	code_info__set_var_locn_info(VarLocnInfo, CI0, CI).
 
 %-----------------------------------------------------------------------------%
 
@@ -1012,24 +965,18 @@
 	code_info__set_fail_info(NewFailInfo).
 
 code_info__generate_branch_end(StoreMap, MaybeEnd0, MaybeEnd, Code) -->
-	{ map__to_assoc_list(StoreMap, VarLocs) },
-	code_info__get_var_locns_info(VarInfo),
-	(
-		{ VarInfo = exprn_info(_) }
-	;
-			% The eager code generator generates better code
+		% The code generator generates better code
 			% if it knows in advance where each variable should
 			% go. We don't need to reset the follow_vars
 			% afterwards, since every goal following a branched
 			% control structure must in any case be annotated with
 			% its own follow_var set.
-		{ VarInfo = var_locn_info(_) },
+	{ map__to_assoc_list(StoreMap, VarLocs) },
 		{ map__from_assoc_list(VarLocs, FollowVarsMap) },
 		{ assoc_list__values(VarLocs, Locs) },
 		{ code_util__max_mentioned_reg(Locs, MaxMentionedReg) },
 		code_info__set_follow_vars(follow_vars(FollowVarsMap,
-			MaxMentionedReg + 1))
-	),
+		MaxMentionedReg + 1)),
 	code_info__get_instmap(InstMap),
 	( { instmap__is_reachable(InstMap) } ->
 		code_info__place_vars(VarLocs, Code)
@@ -1126,19 +1073,9 @@
 
 code_info__remake_with_store_map(StoreMap) -->
 	{ map__to_assoc_list(StoreMap, VarLvals) },
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		VarRvals = assoc_list__map_values(exprn_aux__var_lval_to_rval,
-			VarLvals),
-		code_exprn__reinit_state(VarRvals, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocnInfo0),
-		var_locn__reinit_state(VarLvals, VarLocnInfo0, VarLocnInfo),
-		VarInfo = var_locn_info(VarLocnInfo)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__reinit_state(VarLvals, VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__save_hp_in_branch(Code, Slot, Pos0, Pos) :-
 	Pos0 = position_info(CodeInfo0),
@@ -2596,19 +2533,9 @@
 code_info__set_var_locations(Map) -->
 	{ map__to_assoc_list(Map, LvalList0) },
 	{ code_info__flatten_varlval_list(LvalList0, LvalList) },
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		RvalList = assoc_list__map_values(exprn_aux__var_lval_to_rval,
-			LvalList),
-		code_exprn__reinit_state(RvalList, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocnInfo0),
-		var_locn__reinit_state(LvalList, VarLocnInfo0, VarLocnInfo),
-		VarInfo = var_locn_info(VarLocnInfo)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__reinit_state(LvalList, VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 :- pred code_info__flatten_varlval_list(assoc_list(prog_var, set(lval))::in,
 	assoc_list(prog_var, lval)::out) is det.
@@ -2774,69 +2701,34 @@
 
 code_info__make_vars_forward_live(Vars) -->
 	code_info__get_stack_slots(StackSlots),
-	code_info__get_var_locns_info(VarInfo0),
+	code_info__get_var_locn_info(VarLocnInfo0),
 	{ set__to_sorted_list(Vars, VarList) },
 	{ code_info__make_vars_forward_live_2(VarList, StackSlots, 1,
-		VarInfo0, VarInfo) },
-	code_info__set_var_locns_info(VarInfo).
+		VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
-:- pred code_info__make_vars_forward_live_2(list(prog_var), stack_slots, int,
-	var_locns_info, var_locns_info).
-:- mode code_info__make_vars_forward_live_2(in, in, in, in, out) is det.
+:- pred code_info__make_vars_forward_live_2(list(prog_var)::in,
+	stack_slots::in, int::in, var_locn_info::in, var_locn_info::out) is det.
 
-code_info__make_vars_forward_live_2([], _, _, VarInfo, VarInfo).
+code_info__make_vars_forward_live_2([], _, _, VarLocnInfo, VarLocnInfo).
 code_info__make_vars_forward_live_2([Var | Vars], StackSlots, N0,
-		VarInfo0, VarInfo) :-
+		VarLocnInfo0, VarLocnInfo) :-
 	( map__search(StackSlots, Var, Lval0) ->
 		Lval = Lval0,
 		N1 = N0
 	;
-		code_info__find_unused_reg(N0, VarInfo0, N1),
+		code_info__find_unused_reg(N0, VarLocnInfo0, N1),
 		Lval = reg(r, N1)
 	),
-	(
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__maybe_set_var_location(Var, Lval, Exprn0, Exprn1),
-		VarInfo1 = exprn_info(Exprn1)
-	;
-		VarInfo0 = var_locn_info(VarLocn0),
-		var_locn__set_magic_var_location(Var, Lval,
-			VarLocn0, VarLocn1),
-		VarInfo1 = var_locn_info(VarLocn1)
-	),
+	var_locn__set_magic_var_location(Var, Lval, VarLocnInfo0, VarLocnInfo1),
 	code_info__make_vars_forward_live_2(Vars, StackSlots, N1,
-		VarInfo1, VarInfo).
-
-:- pred code_info__find_unused_reg(int, var_locns_info, int).
-:- mode code_info__find_unused_reg(in, in, out) is det.
-
-code_info__find_unused_reg(N0, VarInfo0, N) :-
-	(
-		VarInfo0 = exprn_info(Exprn0),
-		code_info__find_unused_reg_lazy(N0, Exprn0, N)
-	;
-		VarInfo0 = var_locn_info(VarLocn0),
-		code_info__find_unused_reg_eager(N0, VarLocn0, N)
-	).
+		VarLocnInfo1, VarLocnInfo).
 
-:- pred code_info__find_unused_reg_eager(int, var_locn_info, int).
-:- mode code_info__find_unused_reg_eager(in, in, out) is det.
+:- pred code_info__find_unused_reg(int::in, var_locn_info::in, int::out) is det.
 
-code_info__find_unused_reg_eager(N0, Exprn0, N) :-
+code_info__find_unused_reg(N0, Exprn0, N) :-
 	( var_locn__lval_in_use(reg(r, N0), Exprn0, _) ->
-		N1 is N0 + 1,
-		code_info__find_unused_reg_eager(N1, Exprn0, N)
-	;
-		N = N0
-	).
-
-:- pred code_info__find_unused_reg_lazy(int, exprn_info, int).
-:- mode code_info__find_unused_reg_lazy(in, in, out) is det.
-
-code_info__find_unused_reg_lazy(N0, Exprn0, N) :-
-	( code_exprn__lval_in_use(reg(r, N0), Exprn0, _) ->
-		N1 is N0 + 1,
-		code_info__find_unused_reg_lazy(N1, Exprn0, N)
+		code_info__find_unused_reg(N0 + 1, Exprn0, N)
 	;
 		N = N0
 	).
@@ -2864,17 +2756,10 @@
 
 code_info__maybe_make_vars_forward_dead_2([], _) --> [].
 code_info__maybe_make_vars_forward_dead_2([V | Vs], FirstTime) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__var_becomes_dead(V, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocn0),
-		var_locn__var_becomes_dead(V, FirstTime, VarLocn0, VarLocn),
-		VarInfo = var_locn_info(VarLocn)
-	},
-	code_info__set_var_locns_info(VarInfo),
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__var_becomes_dead(V, FirstTime,
+		VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo),
 	code_info__maybe_make_vars_forward_dead_2(Vs, FirstTime).
 
 code_info__pickup_zombies(Zombies) -->
@@ -3133,7 +3018,7 @@
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
 
-	% Submodule to deal with code_exprn or var_locn.
+	% Submodule to deal with var_locn.
 
 :- interface.
 
@@ -3213,10 +3098,10 @@
 :- pred code_info__setup_return(assoc_list(prog_var, arg_info)::in,
 	set(lval)::out, code_tree::out, code_info::in, code_info::out) is det.
 
-:- pred code_info__eager_lock_regs(int::in, assoc_list(prog_var, lval)::in,
+:- pred code_info__lock_regs(int::in, assoc_list(prog_var, lval)::in,
 	code_info::in, code_info::out) is det.
 
-:- pred code_info__eager_unlock_regs(code_info::in, code_info::out) is det.
+:- pred code_info__unlock_regs(code_info::in, code_info::out) is det.
 
 	% Record the fact that all the registers have been clobbered (as by a
 	% call). If the bool argument is true, then the call cannot return, and
@@ -3242,22 +3127,9 @@
 
 :- implementation.
 
-:- pred code_info__pick_and_place_vars(assoc_list(prog_var, set(lval))::in,
-	set(lval)::out, code_tree::out, code_info::in, code_info::out) is det.
-
-:- pred code_info__place_vars(assoc_list(prog_var, lval)::in,
-	code_tree::out, code_info::in, code_info::out) is det.
-
 code_info__variable_locations(Lvals) -->
-	code_info__get_var_locns_info(VarInfo),
-	{
-		VarInfo = exprn_info(Exprn),
-		code_exprn__get_varlocs(Exprn, Rvals),
-		Lvals = map__map_values(code_info__rval_map_to_lval_map, Rvals)
-	;
-		VarInfo = var_locn_info(VarLocn),
-		var_locn__get_var_locations(VarLocn, Lvals)
-	}.
+	code_info__get_var_locn_info(VarLocnInfo),
+	{ var_locn__get_var_locations(VarLocnInfo, Lvals) }.
 
 :- func code_info__rval_map_to_lval_map(prog_var, set(rval)) = set(lval).
 
@@ -3269,116 +3141,55 @@
 code_info__rval_is_lval(lval(Lval)) = Lval.
 
 code_info__set_var_location(Var, Lval) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__set_var_location(Var, Lval, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocn0),
-		var_locn__check_and_set_magic_var_location(Var, Lval,
-			VarLocn0, VarLocn),
-		VarInfo = var_locn_info(VarLocn)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__check_and_set_magic_var_location(Var, Lval,
+		VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__assign_var_to_var(Var, AssignedVar) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__cache_exprn(Var, var(AssignedVar), Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocInfo0),
-		var_locn__assign_var_to_var(Var, AssignedVar,
-			VarLocInfo0, VarLocInfo),
-		VarInfo = var_locn_info(VarLocInfo)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__assign_var_to_var(Var, AssignedVar,
+		VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__assign_lval_to_var(Var, Lval, Code) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__cache_exprn(Var, lval(Lval), Exprn0, Exprn),
-		Code = empty,
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocInfo0),
-		var_locn__assign_lval_to_var(Var, Lval, Code,
-			VarLocInfo0, VarLocInfo),
-		VarInfo = var_locn_info(VarLocInfo)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__assign_lval_to_var(Var, Lval, Code,
+		VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__assign_const_to_var(Var, ConstRval) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__cache_exprn(Var, ConstRval, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocInfo0),
-		var_locn__assign_const_to_var(Var, ConstRval,
-			VarLocInfo0, VarLocInfo),
-		VarInfo = var_locn_info(VarLocInfo)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__assign_const_to_var(Var, ConstRval,
+		VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__assign_expr_to_var(Var, Rval, Code) -->
-	code_info__get_var_locns_info(VarInfo0),
+	code_info__get_var_locn_info(VarLocnInfo0),
 	{
 		code_util__lvals_in_rval(Rval, Lvals),
 		Lvals = []
 	->
-		(
-			VarInfo0 = exprn_info(Exprn0),
-			code_exprn__cache_exprn(Var, Rval, Exprn0, Exprn),
-			VarInfo = exprn_info(Exprn),
-			Code = empty
-		;
-			VarInfo0 = var_locn_info(VarLocInfo0),
 			var_locn__assign_expr_to_var(Var, Rval, Code,
-				VarLocInfo0, VarLocInfo),
-			VarInfo = var_locn_info(VarLocInfo)
-		)
+			VarLocnInfo0, VarLocnInfo)
 	;
 		error("code_info__assign_expr_to_var: non-var lvals")
 	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__assign_cell_to_var(Var, Ptag, Vector, TypeMsg, Code) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-			% XXX Later we will need to worry about
-			% whether the cell must be unique or not.
-		Reuse = no,
-		Rval = create(Ptag, Vector, uniform(no), can_be_either,
-			TypeMsg, Reuse),
-		code_exprn__cache_exprn(Var, Rval, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn),
-		Code = empty
-	;
-		VarInfo0 = var_locn_info(VarLocInfo0),
-		var_locn__assign_cell_to_var(Var, Ptag, Vector, TypeMsg,
-			Code, VarLocInfo0, VarLocInfo),
-		VarInfo = var_locn_info(VarLocInfo)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__assign_cell_to_var(Var, Ptag, Vector, TypeMsg,
+		Code, VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__place_var(Var, Lval, Code) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__place_var(Var, Lval, Code, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocn0),
-		var_locn__place_var(Var, Lval, Code, VarLocn0, VarLocn),
-		VarInfo = var_locn_info(VarLocn)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__place_var(Var, Lval, Code, VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
+
+:- pred code_info__pick_and_place_vars(assoc_list(prog_var, set(lval))::in,
+	set(lval)::out, code_tree::out, code_info::in, code_info::out) is det.
 
 code_info__pick_and_place_vars(VarLocSets, LiveLocs, Code) -->
 	{ code_info__pick_var_places(VarLocSets, VarLocs) },
@@ -3401,178 +3212,89 @@
 		VarLvals = VarLvals0
 	).
 
+:- pred code_info__place_vars(assoc_list(prog_var, lval)::in,
+	code_tree::out, code_info::in, code_info::out) is det.
+
 code_info__place_vars(VarLocs, Code) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__place_vars(VarLocs, Code, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocn0),
-		var_locn__place_vars(VarLocs, Code, VarLocn0, VarLocn),
-		VarInfo = var_locn_info(VarLocn)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__place_vars(VarLocs, Code, VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__produce_variable(Var, Code, Rval) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__produce_var(Var, Rval, Code, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocn0),
-		var_locn__produce_var(Var, Rval, Code, VarLocn0, VarLocn),
-		VarInfo = var_locn_info(VarLocn)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__produce_var(Var, Rval, Code, VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__produce_variable_in_reg(Var, Code, Lval) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__produce_var_in_reg(Var, Lval, Code, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocn0),
-		var_locn__produce_var_in_reg(Var, Lval, Code,
-			VarLocn0, VarLocn),
-		VarInfo = var_locn_info(VarLocn)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__produce_var_in_reg(Var, Lval, Code,
+		VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__produce_variable_in_reg_or_stack(Var, Code, Lval) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__produce_var_in_reg_or_stack(Var, Lval, Code,
-			Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocn0),
-		var_locn__produce_var_in_reg_or_stack(Var, Lval, Code,
-			VarLocn0, VarLocn),
-		VarInfo = var_locn_info(VarLocn)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__produce_var_in_reg_or_stack(Var, Lval, Code,
+		VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
-code_info__materialize_vars_in_rval(Rval0, Rval, Code) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__materialize_vars_in_rval(Rval0, Rval, Code,
-			Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocnInfo0),
+code_info__materialize_vars_in_rval(Rval0, Rval, Code, CI0, CI) :-
+	code_info__get_var_locn_info(VarLocnInfo0, CI0, CI1),
 		( Rval0 = lval(Lval0) ->
 			var_locn__materialize_vars_in_lval(Lval0, Lval, Code,
 				VarLocnInfo0, VarLocnInfo),
-			Rval = lval(Lval),
-			VarInfo = var_locn_info(VarLocnInfo)
+		Rval = lval(Lval)
 		; exprn_aux__vars_in_rval(Rval0, []) ->
 			Rval = Rval0,
 			Code = empty,
-			VarInfo = VarInfo0
+		VarLocnInfo = VarLocnInfo0
 		;
-			error("eager code_info__materialize_vars_in_rval")
-		)
-	},
-	code_info__set_var_locns_info(VarInfo).
+		error("code_info__materialize_vars_in_rval")
+	),
+	code_info__set_var_locn_info(VarLocnInfo, CI1, CI).
 
 code_info__acquire_reg_for_var(Var, Lval) -->
 	code_info__get_follow_var_map(FollowVarsMap),
 	code_info__get_next_non_reserved(NextNonReserved),
-	code_info__get_var_locns_info(VarInfo0),
+	code_info__get_var_locn_info(VarLocnInfo0),
 	{
 		map__search(FollowVarsMap, Var, PrefLval),
 		PrefLval = reg(PrefRegType, PrefRegNum),
 		PrefRegNum >= 1
 	->
-		(
-			VarInfo0 = exprn_info(Exprn0),
-			code_exprn__acquire_reg_prefer_given(PrefRegType,
-				PrefRegNum, Lval, Exprn0, Exprn),
-			VarInfo = exprn_info(Exprn)
-		;
-			VarInfo0 = var_locn_info(VarLocn0),
 			require(unify(PrefRegType, r), "acquire non-r reg"),
 			var_locn__acquire_reg_prefer_given(PrefRegNum, Lval,
-				VarLocn0, VarLocn),
-			VarInfo = var_locn_info(VarLocn)
-		)
+			VarLocnInfo0, VarLocnInfo)
 	;
 		% XXX We should only get a register if the map__search
 		% succeeded; otherwise we should put the var in its stack slot.
-		(
-			VarInfo0 = exprn_info(Exprn0),
-			code_exprn__acquire_reg(r, Lval, Exprn0, Exprn),
-			VarInfo = exprn_info(Exprn)
-		;
-			VarInfo0 = var_locn_info(VarLocn0),
-			var_locn__acquire_reg_start_at_given(
-				NextNonReserved, Lval, VarLocn0, VarLocn),
-			VarInfo = var_locn_info(VarLocn)
-		)
+		var_locn__acquire_reg_start_at_given(NextNonReserved, Lval,
+			VarLocnInfo0, VarLocnInfo)
 	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__acquire_reg(Type, Lval) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__acquire_reg(Type, Lval, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocnInfo0),
-		require(unify(Type, r),
-			"code_info__acquire_reg: unknown reg type"),
-		var_locn__acquire_reg(Lval, VarLocnInfo0, VarLocnInfo),
-		VarInfo = var_locn_info(VarLocnInfo)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ require(unify(Type, r),
+		"code_info__acquire_reg: unknown reg type") },
+	{ var_locn__acquire_reg(Lval, VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__release_reg(Lval) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__release_reg(Lval, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocnInfo0),
-		var_locn__release_reg(Lval, VarLocnInfo0, VarLocnInfo),
-		VarInfo = var_locn_info(VarLocnInfo)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__release_reg(Lval, VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__reserve_r1(Code) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(_Exprn0),
-		VarInfo = VarInfo0,
-		Code = empty
-	;
-		VarInfo0 = var_locn_info(VarLocnInfo0),
-		var_locn__clear_r1(Code, VarLocnInfo0, VarLocnInfo1),
-		var_locn__acquire_reg_require_given(reg(r, 1), VarLocnInfo1,
-			VarLocnInfo),
-		VarInfo = var_locn_info(VarLocnInfo)
-	},
-	code_info__set_var_locns_info(VarInfo).
-
-code_info__clear_r1(Code) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__clear_r1(Code, Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocnInfo0),
-		var_locn__release_reg(reg(r, 1), VarLocnInfo0, VarLocnInfo),
-		VarInfo = var_locn_info(VarLocnInfo),
-		Code = empty
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__clear_r1(Code, VarLocnInfo0, VarLocnInfo1) },
+	{ var_locn__acquire_reg_require_given(reg(r, 1),
+		VarLocnInfo1, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
+
+code_info__clear_r1(empty) -->
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__release_reg(reg(r, 1), VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 %---------------------------------------------------------------------------%
 
@@ -3613,62 +3335,32 @@
 		)
 	),
 
-	code_info__get_var_locns_info(VarInfo0),
-	(
-		{ VarInfo0 = exprn_info(_) },
-
-		code_info__place_vars(StackVarLocs, StackCode),
-		{ assoc_list__values(StackVarLocs, StackLocs) },
-		{ set__list_to_set(StackLocs, StackLiveLocs) },
-
-		code_info__setup_call_args_lazy(InArgInfos, caller,
-			ArgLiveLocs, ArgCode),
-		{ set__union(StackLiveLocs, ArgLiveLocs, LiveLocs) },
-		{ Code = tree(StackCode, ArgCode) }
-	;
-		{ VarInfo0 = var_locn_info(VarLocnInfo0) },
+	code_info__get_var_locn_info(VarLocnInfo0),
 		{ code_info__var_arg_info_to_lval(InArgInfos, InArgLocs) },
 		{ list__append(StackVarLocs, InArgLocs, AllLocs) },
 		{ var_locn__place_vars(AllLocs, Code,
 			VarLocnInfo0, VarLocnInfo) },
-		code_info__set_var_locns_info(var_locn_info(VarLocnInfo)),
+	code_info__set_var_locn_info(VarLocnInfo),
 		{ assoc_list__values(AllLocs, LiveLocList) },
-		{ set__list_to_set(LiveLocList, LiveLocs) }
+	{ set__list_to_set(LiveLocList, LiveLocs) }.
 
 		% { assoc_list__keys(InArgLocs, InArgVars) },
 		% { set__init(DeadVars0) },
 		% code_info__which_variables_are_forward_live(InArgVars,
 		% 	DeadVars0, DeadVars),
 		% code_info__make_vars_forward_dead(DeadVars)
-	).
 
 :- pred code_info__setup_call_args(assoc_list(prog_var, arg_info)::in,
 	call_direction::in, set(lval)::out, code_tree::out,
 	code_info::in, code_info::out) is det.
 
-code_info__setup_call_args(VarArgInfos, Direction, LiveLocs, Code) -->
-	code_info__get_var_locns_info(VarInfo0),
-	(
-		{ VarInfo0 = exprn_info(_) },
-		code_info__setup_call_args_lazy(VarArgInfos, Direction,
-			LiveLocs, Code)
-	;
-		{ VarInfo0 = var_locn_info(_) },
-		code_info__setup_call_args_eager(VarArgInfos, Direction,
-			LiveLocs, Code)
-	).
-
-:- pred code_info__setup_call_args_eager(assoc_list(prog_var, arg_info)::in,
-	call_direction::in, set(lval)::out, code_tree::out,
-	code_info::in, code_info::out) is det.
-
-code_info__setup_call_args_eager(AllArgsInfos, Direction, LiveLocs, Code) -->
+code_info__setup_call_args(AllArgsInfos, Direction, LiveLocs, Code) -->
 	{ list__filter(code_info__call_arg_in_selected_dir(Direction),
 		AllArgsInfos, ArgsInfos) },
 	{ code_info__var_arg_info_to_lval(ArgsInfos, ArgsLocns) },
-	code_info__get_eager_var_locns_info(VarLocnInfo0),
+	code_info__get_var_locn_info(VarLocnInfo0),
 	{ var_locn__place_vars(ArgsLocns, Code, VarLocnInfo0, VarLocnInfo1) },
-	code_info__set_var_locns_info(var_locn_info(VarLocnInfo1)),
+	code_info__set_var_locn_info(VarLocnInfo1),
 	{ assoc_list__values(ArgsLocns, LiveLocList) },
 	{ set__list_to_set(LiveLocList, LiveLocs) },
 	{ assoc_list__keys(ArgsLocns, ArgVars) },
@@ -3701,68 +3393,6 @@
 	),
 	code_info__which_variables_are_forward_live(Vars, DeadVars1, DeadVars).
 
-:- pred code_info__setup_call_args_lazy(assoc_list(prog_var, arg_info)::in,
-	call_direction::in, set(lval)::out, code_tree::out,
-	code_info::in, code_info::out) is det.
-
-code_info__setup_call_args_lazy([], _Direction, set__init, empty) --> [].
-code_info__setup_call_args_lazy([First | Rest], Direction, LiveLocs, Code) -->
-	( { code_info__call_arg_in_selected_dir(Direction, First) } ->
-		{ First = V - arg_info(Loc, _Mode) },
-		{ code_util__arg_loc_to_register(Loc, Reg) },
-		code_info__get_lazy_var_locns_info(Exprn0),
-		{ code_exprn__place_var(V, Reg, Code0, Exprn0, Exprn1) },
-			% We need to test that either the variable
-			% is live OR it occurs in the remaining arguments
-			% because of a bug in polymorphism.m which
-			% causes some compiler generated code to violate
-			% superhomogeneous form
-		(
-			code_info__variable_is_forward_live(V)
-		->
-			{ IsLive = yes }
-		;
-			{ IsLive = no }
-		),
-		{
-			list__member(Vtmp - _, Rest),
-			V = Vtmp
-		->
-			Occurs = yes
-		;
-			Occurs = no
-		},
-		(
-				% We can't simply use a disj here
-				% because of bugs in modes/det_analysis
-			{ bool__or(Occurs, IsLive, yes) }
-		->
-			{ code_exprn__lock_reg(Reg, Exprn1, Exprn2) },
-			code_info__set_var_locns_info(exprn_info(Exprn2)),
-			code_info__setup_call_args_lazy(Rest, Direction,
-				LiveLocs1, Code1),
-			code_info__get_lazy_var_locns_info(Exprn3),
-			{ code_exprn__unlock_reg(Reg, Exprn3, Exprn) },
-			code_info__set_var_locns_info(exprn_info(Exprn)),
-			{ Code = tree(Code0, Code1) }
-		;
-			{ code_exprn__lock_reg(Reg, Exprn1, Exprn2) },
-			code_info__set_var_locns_info(exprn_info(Exprn2)),
-			{ set__singleton_set(Vset, V) },
-			code_info__make_vars_forward_dead(Vset),
-			code_info__setup_call_args_lazy(Rest, Direction,
-				LiveLocs1, Code1),
-			code_info__get_lazy_var_locns_info(Exprn4),
-			{ code_exprn__unlock_reg(Reg, Exprn4, Exprn) },
-			code_info__set_var_locns_info(exprn_info(Exprn)),
-			{ Code = tree(Code0, Code1) }
-		),
-		{ set__insert(LiveLocs1, Reg, LiveLocs) }
-	;
-		code_info__setup_call_args_lazy(Rest, Direction,
-			LiveLocs, Code)
-	).
-
 :- pred code_info__call_arg_in_selected_dir(call_direction::in,
 	pair(prog_var, arg_info)::in) is semidet.
 
@@ -3775,85 +3405,26 @@
 		Direction = callee
 	).
 
-code_info__eager_lock_regs(N, Exceptions) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(_),
-		VarInfo = VarInfo0
-	;
-		VarInfo0 = var_locn_info(VarLocnInfo0),
-		var_locn__lock_regs(N, Exceptions, VarLocnInfo0, VarLocnInfo),
-		VarInfo = var_locn_info(VarLocnInfo)
-	},
-	code_info__set_var_locns_info(VarInfo).
-
-code_info__eager_unlock_regs -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(_),
-		VarInfo = VarInfo0
-	;
-		VarInfo0 = var_locn_info(VarLocnInfo0),
-		var_locn__unlock_regs(VarLocnInfo0, VarLocnInfo),
-		VarInfo = var_locn_info(VarLocnInfo)
-	},
-	code_info__set_var_locns_info(VarInfo).
-
-:- pred code_info__get_eager_var_locns_info(var_locn_info::out,
-	code_info::in, code_info::out) is det.
-
-code_info__get_eager_var_locns_info(VarLocnInfo) -->
-	code_info__get_var_locns_info(VarInfo),
-	{
-		VarInfo = exprn_info(_),
-		error("lazy code_info__get_eager_var_locns_info")
-	;
-		VarInfo = var_locn_info(VarLocnInfo)
-	}.
-
-:- pred code_info__get_lazy_var_locns_info(exprn_info::out,
-	code_info::in, code_info::out) is det.
-
-code_info__get_lazy_var_locns_info(Exprn) -->
-	code_info__get_var_locns_info(VarInfo),
-	{
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo = var_locn_info(_),
-		error("eager code_info__get_lazy_var_locns_info")
-	}.
+code_info__lock_regs(N, Exceptions) -->
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__lock_regs(N, Exceptions, VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
+
+code_info__unlock_regs -->
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__unlock_regs(VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
-	% As a sanity check, we could test whether any known variable
-	% has its only value in a register, but we do so only with eager
-	% code generation.
 code_info__clear_all_registers(OkToDeleteAny) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(Exprn0),
-		code_exprn__clobber_regs([], Exprn0, Exprn),
-		VarInfo = exprn_info(Exprn)
-	;
-		VarInfo0 = var_locn_info(VarLocn0),
-		var_locn__clobber_all_regs(OkToDeleteAny, VarLocn0, VarLocn),
-		VarInfo = var_locn_info(VarLocn)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__clobber_all_regs(OkToDeleteAny,
+		VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__clobber_regs(Regs) -->
-	code_info__get_var_locns_info(VarInfo0),
-	{
-		VarInfo0 = exprn_info(_Exprn0),
-		% The clobber_regs predicate has no function except to ensure
-		% that sanity check in eager code generation does not fail
-		% when it shouldn't. Since lazy code generation lacks this
-		% sanity check, it doesn't need to do anything.
-		VarInfo = VarInfo0
-	;
-		VarInfo0 = var_locn_info(VarLocn0),
-		var_locn__clobber_regs(Regs, VarLocn0, VarLocn),
-		VarInfo = var_locn_info(VarLocn)
-	},
-	code_info__set_var_locns_info(VarInfo).
+	code_info__get_var_locn_info(VarLocnInfo0),
+	{ var_locn__clobber_regs(Regs, VarLocnInfo0, VarLocnInfo) },
+	code_info__set_var_locn_info(VarLocnInfo).
 
 code_info__save_variables(OutArgs, SavedLocs, Code) -->
 	code_info__compute_forward_live_var_saves(OutArgs, VarLocs),
@@ -3888,14 +3459,8 @@
 	code_info__get_variable_slot(Var, Slot).
 
 code_info__max_reg_in_use(Max) -->
-	code_info__get_var_locns_info(VarInfo),
-	{
-		VarInfo = exprn_info(Exprn),
-		code_exprn__max_reg_in_use(Exprn, Max)
-	;
-		VarInfo = var_locn_info(VarLocn),
-		var_locn__max_reg_in_use(VarLocn, Max)
-	}.
+	code_info__get_var_locn_info(VarLocnInfo),
+	{ var_locn__max_reg_in_use(VarLocnInfo, Max) }.
 
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.180
diff -u -b -r1.180 handle_options.m
--- compiler/handle_options.m	15 Apr 2003 08:32:51 -0000	1.180
+++ compiler/handle_options.m	4 May 2003 22:24:31 -0000
@@ -1245,17 +1245,13 @@
 :- pred postprocess_options_lowlevel(io__state::di, io__state::uo) is det.
 
 postprocess_options_lowlevel -->
-		% --no-lazy-code assumes that const(_) rvals are really
-		% constant, and that create(_) rvals with constant arguments
-		% can be materialized in an assignable rval without further
-		% code. For float_consts, the former is true only if either
-		% static_ground_terms or unboxed_floats is true, and the latter
-		% cannot be true without static_ground_terms.
-	option_neg_implies(lazy_code, static_ground_terms, bool(yes)),
-
-		% --no-lazy-code requires --follow-vars for acceptable
-		% performance.
-	option_neg_implies(lazy_code, follow_vars, bool(yes)),
+		% The low level code generator assumes that const(_) rvals are
+		% really constant, and that create(_) rvals with constant
+		% arguments can be materialized in an assignable rval without
+		% further code. For float_consts, the former is true only if
+		% either static_ground_terms or unboxed_floats is true, and
+		% the latter cannot be true without static_ground_terms.
+	option_neg_implies(highlevel_code, static_ground_terms, bool(yes)),
 
 		% --optimize-saved-vars-cell requires --use-local-vars for
 		% acceptable performance.
Index: compiler/hlds_goal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.105
diff -u -b -r1.105 hlds_goal.m
--- compiler/hlds_goal.m	18 Mar 2003 02:43:36 -0000	1.105
+++ compiler/hlds_goal.m	26 Mar 2003 06:26:03 -0000
@@ -549,7 +549,7 @@
 	% alternative is set by the `mark_static_terms.m' pass,
 	% and is currently only used for the MLDS back-end
 	% (for the LLDS back-end, the same optimization is
-	% handled by code_exprn.m).
+	% handled by var_locn.m).
 	% The `reuse_cell' alternative is not yet used.
 :- type how_to_construct
 	--->	construct_statically(		% Use a statically initialized
Index: compiler/ll_backend.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ll_backend.m,v
retrieving revision 1.3
diff -u -b -r1.3 ll_backend.m
--- compiler/ll_backend.m	14 Mar 2003 08:10:06 -0000	1.3
+++ compiler/ll_backend.m	17 Mar 2003 03:21:20 -0000
@@ -55,7 +55,6 @@
    :- include_module trace.
 
    :- include_module code_info.
-   :- include_module code_exprn.
    :- include_module exprn_aux.
    :- include_module code_aux. % XXX
    :- include_module continuation_info.
Index: compiler/lookup_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/lookup_switch.m,v
retrieving revision 1.46
diff -u -b -r1.46 lookup_switch.m
--- compiler/lookup_switch.m	1 May 2003 22:50:49 -0000	1.46
+++ compiler/lookup_switch.m	3 May 2003 08:33:04 -0000
@@ -19,11 +19,11 @@
  
 % The current implementation works out whether or not it can do a lookup
 % switch by generating code for each case and looking to see that no code
-% got generated (ie only the exprn cache got modified) and that the output
-% variables of the switch are all constants. This is potentially quite in-
-% efficient because it does the work of generating code for the cases and
-% then may throw it away if a subsequent case generates actual code, or non
-% constant outputs.
+% got generated (i.e. only the code generation state got modified) and that
+% the output variables of the switch are all constants. This is potentially
+% quite inefficient because it does the work of generating code for the cases
+% and then may throw it away if a subsequent case generates actual code, or
+% non constant outputs.
 
 % A potential improvement would be to make a single array for each switch,
 % since putting the values produced for each tag value side-by-side in
@@ -256,9 +256,6 @@
 	% true iff Rval is a constant. This depends on the options governing
 	% nonlocal gotos, asm labels enabled, and static ground terms, etc.
 :- pred lookup_switch__rval_is_constant(rval::in, exprn_opts::in) is semidet.
-
-	% Based on code_exprn__rval_is_constant, but differs in
-	% that it doesn't happen with respect to the expression cache.
 
 lookup_switch__rval_is_constant(const(Const), ExprnOpts) :-
 	exprn_aux__const_is_constant(Const, ExprnOpts, yes).
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.409
diff -u -b -r1.409 options.m
--- compiler/options.m	15 Mar 2003 03:09:04 -0000	1.409
+++ compiler/options.m	4 May 2003 22:18:04 -0000
@@ -369,7 +369,6 @@
 		;	reclaim_heap_on_failure
 		;	reclaim_heap_on_semidet_failure
 		;	reclaim_heap_on_nondet_failure
-		;	lazy_code
 		;	have_delay_slot
 		;	num_real_r_regs
 		;	num_real_f_regs
@@ -474,7 +473,6 @@
 		;	static_ground_terms
 		;	middle_rec
 		;	simple_neg
-		;	follow_vars
 		;	allow_hijacks
 	%	- MLDS
 		;	optimize_tailcalls
@@ -932,7 +930,6 @@
 	low_level_debug		-	bool(no),
 	trad_passes		-	bool(yes),
 	polymorphism		-	bool(yes),
-	lazy_code		-	bool(no),
 	reclaim_heap_on_failure	-	bool_special,
 	reclaim_heap_on_semidet_failure	-	bool(yes),
 	reclaim_heap_on_nondet_failure	-	bool(yes),
@@ -1060,7 +1057,6 @@
 	static_ground_terms	-	bool(no),
 	middle_rec		-	bool(no),
 	simple_neg		-	bool(no),
-	follow_vars		-	bool(no),
 	allow_hijacks		-	bool(yes),
 % MLDS
 	optimize_tailcalls	- 	bool(no),
@@ -1551,7 +1547,6 @@
 long_option("low-level-debug",		low_level_debug).
 long_option("polymorphism",		polymorphism).
 long_option("trad-passes",		trad_passes).
-long_option("lazy-code",		lazy_code).
 long_option("reclaim-heap-on-failure",	reclaim_heap_on_failure).
 long_option("reclaim-heap-on-semidet-failure",
 					reclaim_heap_on_semidet_failure).
@@ -1701,7 +1696,6 @@
 long_option("static-ground-terms",	static_ground_terms).
 long_option("middle-rec",		middle_rec).
 long_option("simple-neg",		simple_neg).
-long_option("follow-vars",		follow_vars).
 long_option("allow-hijacks",		allow_hijacks).
 
 % MLDS optimizations
@@ -2217,7 +2211,6 @@
 	c_optimize		-	bool(yes),	% XXX we want `gcc -O1'
 	optimize_frames		-	bool(yes),
 	optimize_delay_slot	-	bool(DelaySlot),
-	follow_vars		-	bool(yes),
 	middle_rec		-	bool(yes),
 	emit_c_loops		-	bool(yes),
 	optimize_tailcalls	-	bool(yes)
@@ -3562,9 +3555,7 @@
 		"--no-middle-rec",
 		"\tDisable the middle recursion optimization.",
 		"--no-simple-neg",
-		"\tDon't generate simplified code for simple negations.",
-		"--no-follow-vars",
-		"\tDon't optimize the assignment of registers in branched goals."
+		"\tDon't generate simplified code for simple negations."
 %		"--no-allow-hijacks",
 %		"\tDo not generate code in which a procedure hijacks",
 %		"\ta nondet stack frame that possibly belongs to",
Index: compiler/pragma_c_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pragma_c_gen.m,v
retrieving revision 1.57
diff -u -b -r1.57 pragma_c_gen.m
--- compiler/pragma_c_gen.m	16 Mar 2003 08:01:30 -0000	1.57
+++ compiler/pragma_c_gen.m	17 Mar 2003 03:21:25 -0000
@@ -422,8 +422,8 @@
 	% currently in r1 elsewhere, so that the C code can assign to
 	% SUCCESS_INDICATOR without clobbering anything important.
 	%
-	% With --no-lazy-code, the call to code_info__reserve_r1 will have
-	% reserved r1, ensuring that none of InArgs is placed there, and
+	% The call to code_info__reserve_r1 will have reserved r1,
+	% ensuring that none of InArgs is placed there, and
 	% code_info__clear_r1 just releases r1. This reservation of r1
 	% is not strictly necessary, as we generate assignments from
 	% the input registers to C variables before we invoke code that could
Index: compiler/store_alloc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/store_alloc.m,v
retrieving revision 1.81
diff -u -b -r1.81 store_alloc.m
--- compiler/store_alloc.m	15 Mar 2003 03:09:10 -0000	1.81
+++ compiler/store_alloc.m	17 Mar 2003 03:21:26 -0000
@@ -63,11 +63,7 @@
 
 allocate_store_maps(RunType, ProcInfo0, PredId, ModuleInfo, ProcInfo) :-
 	module_info_globals(ModuleInfo, Globals),
-	globals__lookup_bool_option(Globals, follow_vars, ApplyFollowVars),
-	(
-		RunType = final_allocation,
-		ApplyFollowVars = yes
-	->
+	( RunType = final_allocation ->
 		proc_info_goal(ProcInfo0, Goal0),
 
 		find_final_follow_vars(ProcInfo0,
@@ -94,10 +90,8 @@
 	),
 	arg_info__build_input_arg_list(ProcInfo0, InputArgLvals),
 	LastLocns0 = initial_last_locns(InputArgLvals),
-	globals__lookup_int_option(Globals, num_real_r_regs, NumRealRRegs),
 	proc_info_stack_slots(ProcInfo0, StackSlots),
-	StoreAllocInfo = store_alloc_info(ModuleInfo, ApplyFollowVars,
-		NumRealRRegs, StackSlots),
+	StoreAllocInfo = store_alloc_info(ModuleInfo, StackSlots),
 	store_alloc_in_goal(Goal2, Liveness0, ResumeVars0, LastLocns0,
 		StoreAllocInfo, Goal, _, _),
 	proc_info_set_goal(ProcInfo0, Goal, ProcInfo).
@@ -114,10 +108,6 @@
 :- type store_alloc_info
 	--->	store_alloc_info(
 			module_info		:: module_info,
-			done_follow_vars	:: bool,
-						% was follow_vars run?
-			num_real_r_regs		:: int,
-						% the number of real r regs
 			stack_slots		:: stack_slots
 						% maps each var to its stack
 						% slot (if it has one)
@@ -427,25 +417,14 @@
 	;
 		% We have not yet allocated a slot for this variable,
 		% which means it is not in the follow vars (if any).
-		StoreAllocInfo = store_alloc_info(_, FollowVars, NumRealRRegs,
-			StackSlots),
+		StoreAllocInfo = store_alloc_info(_, StackSlots),
 		(
 			map__search(StackSlots, Var, StackSlot),
-			\+ set__member(StackSlot, SeenLvals0),
-			(
-				FollowVars = yes
-				% If follow_vars was run, then the only
+			\+ set__member(StackSlot, SeenLvals0)
+			% Follow_vars was run, so the only
 				% reason why a var would not be in the
 				% follow_vars set is if it was supposed to
 				% be in its stack slot.
-			;
-				FollowVars = no,
-				% If follow_vars was not run, then we
-				% prefer to put the variable in a register,
-				% provided it is a real register.
-				next_free_reg(N0, SeenLvals0, TentativeReg),
-				TentativeReg =< NumRealRRegs
-			)
 		->
 			Locn = StackSlot,
 			N1 = N0
Index: compiler/var_locn.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/var_locn.m,v
retrieving revision 1.8
diff -u -b -r1.8 var_locn.m
--- compiler/var_locn.m	1 May 2003 22:50:50 -0000	1.8
+++ compiler/var_locn.m	4 May 2003 22:21:08 -0000
@@ -1630,8 +1630,7 @@
 % CheckInUse = yes. If all else fails, we get spare, unused register.
 % (Note that if the follow_vars pass has not been run, then all follow vars
 % maps will be empty, which would cause this predicate to try to put far too
-% many things in stack slots. This is why the --no-lazy-code option implies
-% --follow-vars.)
+% many things in stack slots.)
 
 :- pred var_locn__select_preferred_reg_or_stack(prog_var::in, lval::out,
 	var_locn_info::in, var_locn_info::out) is det.
cvs diff: Diffing compiler/notes
Index: compiler/notes/compiler_design.html
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/notes/compiler_design.html,v
retrieving revision 1.83
diff -u -b -r1.83 compiler_design.html
--- compiler/notes/compiler_design.html	18 Mar 2003 02:43:47 -0000	1.83
+++ compiler/notes/compiler_design.html	5 May 2003 00:44:48 -0000
@@ -811,23 +811,15 @@
 		<dt> code_info.m
 			<dd>
 			The main data structure for the code generator.
-		<dt> code_exprn.m
-			<dd>
-			This defines the exprn_info type, which is 
-			a sub-component of the code_info data structure
-			which holds the information about
-			the contents of registers and
-			the values/locations of variables.
-			It implements lazy code generation.
-		<dt> exprn_aux.m
-			<dd>
-			Various preds which use exprn_info.
 		<dt> var_locn.m
 			<dd>
-			This defines the var_locn type, which is an alternative
-			to code_exprn; like code_exprn, it keeps track of
-			the values and locations of variables.
+			This defines the var_locn type, which is a
+			sub-component of the code_info data structure;
+			it keeps track of the values and locations of variables.
 			It implements eager code generation.
+		<dt> exprn_aux.m
+			<dd>
+			Various utility predicates.
 		<dt> code_util.m
 			<dd>
 			Some miscellaneous preds used for code generation.
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.364
diff -u -b -r1.364 user_guide.texi
--- doc/user_guide.texi	16 Apr 2003 12:36:24 -0000	1.364
+++ doc/user_guide.texi	4 May 2003 22:22:21 -0000
@@ -6129,12 +6129,6 @@
 @findex --simple-neg
 Don't generate simplified code for simple negations.
 
- at sp 1
- at item --no-follow-vars
- at findex --follow-vars
- at findex --no-follow-vars
-Don't optimize the assignment of registers in branched goals.
-
 @end table
 
 @node Low-level (LLDS -> LLDS) optimization options
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list