[m-rev.] for post-commit review: restructure goal_infos

Zoltan Somogyi zs at csse.unimelb.edu.au
Thu Aug 2 09:53:36 AEST 2007


Rearrange the fields of the goal_info structure in preparation for new
additions by Quan.

By making sure that the main hlds_goal_info type has only eight fields,
not ten, we get a 2% speedup on our usual compiler benchmark (since it avoids
having the Boehm allocator rounding up the cell size to 16 words).

In the process of making this change, I noticed that the code to rename
variables in goals and goal_infos had three separate bugs:

- it did not rename variables in ctgc_infos in hlds_goal_infos
- it did not rename variables in mode_constraint_infos in hlds_goal_infos
- it did not rename variables in complicated_unifies in hlds_goal_exprs

This diff fixes those bugs. To avoid unnecessary inefficiency in the fixed code
and to make such bugs much less likely in the future, this diff also moves the
code for renaming variables in goals and goal_infos from goal_util to
hlds_goal.

The bug fix reduces the speedup to 1.1%, but this is still a good deal.

compiler/hlds_goal.m:
	Make the changes described above.

compiler/goal_util.m:
	Delete the stuff moved to hlds_goal.m, as well as an old unused
	predicate.

compiler/quantification.m:
compiler/make_hlds_warn.m:
	Delay extracting the context from goal_infos until it is needed
	in the creation of an error message. This is useful since contexts
	have been moved from the main hlds_goal_info structure to the
	extra_goal_info substructure. In make_hlds_warn.m, this change
	also allows us to pass around one fewer argument (the context arguments
	were redundant, since we also always passed the goal_info that they
	came from).

	(The three other pieces of code that are responsible for most of the
	calls to goal_info_get_context are the parts of the type checker, mode
	checker and unique mode checker that conditionally update the current
	context in e.g. the typecheck_info. Unfortunately, this technique of
	delay-the-extraction cannot be applied to them.)

compiler/*.m:
	Conform to the move of the rename predicates, mostly by deleting
	unnecessary module qualifications.

Zoltan.

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/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/accumulator.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/accumulator.m,v
retrieving revision 1.67
diff -u -b -r1.67 accumulator.m
--- compiler/accumulator.m	17 May 2007 03:52:38 -0000	1.67
+++ compiler/accumulator.m	1 Aug 2007 10:14:25 -0000
@@ -1222,7 +1222,7 @@
         % Swap the arguments.
         [A, B] = set.to_sorted_list(Vars),
         map.from_assoc_list([A-B, B-A], Subst),
-        goal_util.rename_some_vars_in_goal(Subst, Goal, SwappedGoal),
+        rename_some_vars_in_goal(Subst, Goal, SwappedGoal),
         CSGoal = SwappedGoal - InstMap
     ),
 
@@ -1568,7 +1568,7 @@
     U = create_new_orig_recursive_goals(UpdateBase, Update,
         HeadToCallSubst, UpdateSubst, C),
 
-    goal_util.rename_some_vars_in_goal(CallToHeadSubst, Call, BaseCall),
+    rename_some_vars_in_goal(CallToHeadSubst, Call, BaseCall),
     Cbefore = goal_list(set.to_sorted_list(Before), C),
     Uupdate = goal_list(set.to_sorted_list(UpdateBase) ++
         set.to_sorted_list(Update), U),
@@ -1591,7 +1591,7 @@
     BaseIds = base(_UpdateBase, AssocBase, OtherBase),
     Sets = sets(Before, Assoc, ConstructAssoc, Construct, Update, _Reject),
 
-    goal_util.rename_some_vars_in_goal(RecCallSubst, Call, RecCall),
+    rename_some_vars_in_goal(RecCallSubst, Call, RecCall),
 
     Cbefore = goal_list(set.to_sorted_list(Before), C),
 
@@ -1795,7 +1795,7 @@
     list.foldl(
         (pred(Id::in, GS0::in, GS::out) is det :-
             goal_store_lookup(From, Id, Goal0 - InstMap),
-            goal_util.rename_some_vars_in_goal(Subst, Goal0, Goal),
+            rename_some_vars_in_goal(Subst, Goal0, Goal),
             goal_store_det_insert(Id, Goal - InstMap, GS0, GS)
         ), Ids, Initial, Final).
 
Index: compiler/ctgc.util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ctgc.util.m,v
retrieving revision 1.11
diff -u -b -r1.11 ctgc.util.m
--- compiler/ctgc.util.m	1 Dec 2006 15:03:53 -0000	1.11
+++ compiler/ctgc.util.m	1 Aug 2007 10:27:19 -0000
@@ -16,7 +16,7 @@
 :- module transform_hlds.ctgc.util.
 :- interface.
 
-:- import_module hlds.goal_util.
+:- import_module hlds.hlds_goal.
 :- import_module hlds.hlds_module.
 :- import_module hlds.hlds_pred.
 :- import_module parse_tree.prog_data.
Index: compiler/deforest.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/deforest.m,v
retrieving revision 1.79
diff -u -b -r1.79 deforest.m
--- compiler/deforest.m	6 Jan 2007 09:23:28 -0000	1.79
+++ compiler/deforest.m	1 Aug 2007 10:15:03 -0000
@@ -1425,7 +1425,7 @@
     goal_util.create_variables(FirstVersionVars,
         FirstVersionVarSet, FirstVersionVarTypes,
         !VarSet, !VarTypes, FirstRenaming0, FirstRenaming),
-    goal_util.must_rename_vars_in_goal(FirstRenaming,
+    must_rename_vars_in_goal(FirstRenaming,
         FirstVersionGoal, RenamedFirstVersionGoal),
 
     % Look up the version which was generalised to create the version
Index: compiler/equiv_type_hlds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/equiv_type_hlds.m,v
retrieving revision 1.41
diff -u -b -r1.41 equiv_type_hlds.m
--- compiler/equiv_type_hlds.m	19 Jan 2007 07:04:11 -0000	1.41
+++ compiler/equiv_type_hlds.m	1 Aug 2007 10:15:17 -0000
@@ -859,8 +859,8 @@
         !:Info = !.Info ^ module_info := ModuleInfo,
         !:Info = !.Info ^ tvarset := TVarSet,
 
-        goal_util.rename_vars_in_goals(no,
-            map.from_assoc_list([TypeInfoVar - Var]), Goals0, Goals),
+        rename_vars_in_goals(no, map.from_assoc_list([TypeInfoVar - Var]),
+            Goals0, Goals),
         ( Goals = [hlds_goal(GoalExpr1, _)] ->
             GoalExpr = GoalExpr1
         ;
Index: compiler/erl_code_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/erl_code_util.m,v
retrieving revision 1.11
diff -u -b -r1.11 erl_code_util.m
--- compiler/erl_code_util.m	1 Aug 2007 05:47:06 -0000	1.11
+++ compiler/erl_code_util.m	1 Aug 2007 09:24:55 -0000
@@ -17,7 +17,6 @@
 :- interface.
 
 :- import_module erl_backend.elds.
-:- import_module hlds.goal_util.
 :- import_module hlds.hlds_goal.
 :- import_module hlds.hlds_module.
 :- import_module hlds.hlds_pred.
@@ -204,6 +203,7 @@
 :- import_module check_hlds.inst_match.
 :- import_module check_hlds.mode_util.
 :- import_module check_hlds.type_util.
+:- import_module hlds.goal_util.
 :- import_module libs.compiler_util.
 
 :- import_module int.
Index: compiler/goal_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/goal_util.m,v
retrieving revision 1.149
diff -u -b -r1.149 goal_util.m
--- compiler/goal_util.m	6 Jul 2007 02:35:21 -0000	1.149
+++ compiler/goal_util.m	1 Aug 2007 09:46:31 -0000
@@ -32,7 +32,6 @@
 :- import_module bool.
 :- import_module io.
 :- import_module list.
-:- import_module map.
 :- import_module maybe.
 :- import_module set.
 :- import_module term.
@@ -44,8 +43,6 @@
     %
 :- pred update_instmap(hlds_goal::in, instmap::in, instmap::out) is det.
 
-:- type prog_var_renaming == map(prog_var, prog_var).
-
     % create_renaming(OutputVars, InstMapDelta, !VarTypes, !VarSet,
     %   UnifyGoals, NewVars, Renaming):
     %
@@ -62,36 +59,6 @@
     prog_varset::in, prog_varset::out, vartypes::in, vartypes::out,
     hlds_goals::out, prog_vars::out, prog_var_renaming::out) is det.
 
-% The predicates rename_var* take a structure and a mapping from var -> var
-% and apply that translation. If a var in the input structure does not
-% occur as a key in the mapping, then the variable is left unsubstituted.
-
-    % rename_vars_in_goals(MustRename, Substitution, GoalList, NewGoalList).
-    %
-:- pred rename_vars_in_goals(bool::in, prog_var_renaming::in,
-    hlds_goals::in, hlds_goals::out) is det.
-
-:- pred rename_some_vars_in_goal(prog_var_renaming::in,
-    hlds_goal::in, hlds_goal::out) is det.
-
-:- pred must_rename_vars_in_goal(prog_var_renaming::in,
-    hlds_goal::in, hlds_goal::out) is det.
-
-:- pred rename_vars_in_goal_expr(bool::in, prog_var_renaming::in,
-    hlds_goal_expr::in, hlds_goal_expr::out) is det.
-
-:- pred rename_vars_in_goal_info(bool::in, prog_var_renaming::in,
-    hlds_goal_info::in, hlds_goal_info::out) is det.
-
-:- pred rename_vars_in_var_set(bool::in, prog_var_renaming::in,
-    set(prog_var)::in, set(prog_var)::out) is det.
-
-:- pred rename_var_list(bool::in, map(var(T), var(T))::in,
-    list(var(T))::in, list(var(T))::out) is det.
-
-:- pred rename_var(bool::in, map(var(V), var(V))::in,
-    var(V)::in, var(V)::out) is det.
-
     % create_variables(OldVariables, OldVarNames, OldVarTypes,
     %   !Varset, !VarTypes, !Subn):
     %
@@ -406,6 +373,7 @@
 :- import_module parse_tree.prog_util.
 
 :- import_module int.
+:- import_module map.
 :- import_module pair.
 :- import_module solutions.
 :- import_module string.
@@ -486,343 +454,6 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred init_subn(assoc_list(prog_var, prog_var)::in,
-    prog_var_renaming::in, prog_var_renaming::out) is det.
-
-init_subn([], !Subn).
-init_subn([A - H | Vs], !Subn) :-
-    svmap.set(H, A, !Subn),
-    init_subn(Vs, !Subn).
-
-%-----------------------------------------------------------------------------%
-
-:- pred rename_var_pair_list(bool::in, prog_var_renaming::in,
-    assoc_list(prog_var, T)::in, list(pair(prog_var, T))::out) is det.
-
-rename_var_pair_list(_Must, _Subn, [], []).
-rename_var_pair_list(Must, Subn, [V - D | VDs], [N - D | NDs]) :-
-    rename_var(Must, Subn, V, N),
-    rename_var_pair_list(Must, Subn, VDs, NDs).
-
-rename_var_list(_Must, _Subn, [], []).
-rename_var_list(Must, Subn, [V | Vs], [N | Ns]) :-
-    rename_var(Must, Subn, V, N),
-    rename_var_list(Must, Subn, Vs, Ns).
-
-rename_var(Must, Subn, V, N) :-
-    ( map.search(Subn, V, N0) ->
-        N = N0
-    ;
-        (
-            Must = no,
-            N = V
-        ;
-            Must = yes,
-            term.var_to_int(V, VInt),
-            string.format("rename_var: no substitute for var %i", [i(VInt)],
-                Msg),
-            unexpected(this_file, Msg)
-        )
-    ).
-
-%-----------------------------------------------------------------------------%
-
-rename_some_vars_in_goal(Subn, Goal0, Goal) :-
-    rename_vars_in_goal(no, Subn, Goal0, Goal).
-
-must_rename_vars_in_goal(Subn, Goal0, Goal) :-
-    rename_vars_in_goal(yes, Subn, Goal0, Goal).
-
-%-----------------------------------------------------------------------------%
-
-rename_vars_in_goals(_, _, [], []).
-rename_vars_in_goals(Must, Subn, [Goal0 | Goals0], [Goal | Goals]) :-
-    rename_vars_in_goal(Must, Subn, Goal0, Goal),
-    rename_vars_in_goals(Must, Subn, Goals0, Goals).
-
-:- pred rename_vars_in_goal(bool::in, prog_var_renaming::in,
-    hlds_goal::in, hlds_goal::out) is det.
-
-rename_vars_in_goal(Must, Subn, Goal0, Goal) :-
-    Goal0 = hlds_goal(GoalExpr0, GoalInfo0),
-    rename_vars_in_goal_expr(Must, Subn, GoalExpr0, GoalExpr),
-    rename_vars_in_goal_info(Must, Subn, GoalInfo0, GoalInfo),
-    Goal = hlds_goal(GoalExpr, GoalInfo).
-
-%-----------------------------------------------------------------------------%
-
-rename_vars_in_goal_expr(Must, Subn, conj(ConjType, Goals0),
-        conj(ConjType, Goals)) :-
-    rename_vars_in_goals(Must, Subn, Goals0, Goals).
-
-rename_vars_in_goal_expr(Must, Subn, disj(Goals0), disj(Goals)) :-
-    rename_vars_in_goals(Must, Subn, Goals0, Goals).
-
-rename_vars_in_goal_expr(Must, Subn,
-        switch(Var0, Det, Cases0), switch(Var, Det, Cases)) :-
-    rename_var(Must, Subn, Var0, Var),
-    rename_vars_in_cases(Must, Subn, Cases0, Cases).
-
-rename_vars_in_goal_expr(Must, Subn,
-        if_then_else(Vars0, Cond0, Then0, Else0),
-        if_then_else(Vars, Cond, Then, Else)) :-
-    rename_var_list(Must, Subn, Vars0, Vars),
-    rename_vars_in_goal(Must, Subn, Cond0, Cond),
-    rename_vars_in_goal(Must, Subn, Then0, Then),
-    rename_vars_in_goal(Must, Subn, Else0, Else).
-
-rename_vars_in_goal_expr(Must, Subn, negation(Goal0), negation(Goal)) :-
-    rename_vars_in_goal(Must, Subn, Goal0, Goal).
-
-rename_vars_in_goal_expr(Must, Subn,
-        scope(Reason0, Goal0), scope(Reason, Goal)) :-
-    (
-        Reason0 = exist_quant(Vars0),
-        rename_var_list(Must, Subn, Vars0, Vars),
-        Reason = exist_quant(Vars)
-    ;
-        Reason0 = promise_purity(_, _),
-        Reason = Reason0
-    ;
-        Reason0 = promise_solutions(Vars0, Kind),
-        rename_var_list(Must, Subn, Vars0, Vars),
-        Reason = promise_solutions(Vars, Kind)
-    ;
-        Reason0 = barrier(_),
-        Reason = Reason0
-    ;
-        Reason0 = commit(_),
-        Reason = Reason0
-    ;
-        Reason0 = from_ground_term(Var0),
-        rename_var(Must, Subn, Var0, Var),
-        Reason = from_ground_term(Var)
-    ;
-        Reason0 = trace_goal(Flag, Grade, Env, Vars, QuantVars0),
-        rename_var_list(Must, Subn, QuantVars0, QuantVars),
-        Reason = trace_goal(Flag, Grade, Env, Vars, QuantVars)
-    ),
-    rename_vars_in_goal(Must, Subn, Goal0, Goal).
-
-rename_vars_in_goal_expr(Must, Subn,
-        generic_call(GenericCall0, Args0, Modes, Det),
-        generic_call(GenericCall, Args, Modes, Det)) :-
-    rename_generic_call(Must, Subn, GenericCall0, GenericCall),
-    rename_var_list(Must, Subn, Args0, Args).
-
-rename_vars_in_goal_expr(Must, Subn,
-        plain_call(PredId, ProcId, Args0, Builtin, Context, Sym),
-        plain_call(PredId, ProcId, Args, Builtin, Context, Sym)) :-
-    rename_var_list(Must, Subn, Args0, Args).
-
-rename_vars_in_goal_expr(Must, Subn,
-        unify(LHS0, RHS0, Mode, Unify0, Context),
-        unify(LHS, RHS, Mode, Unify, Context)) :-
-    rename_var(Must, Subn, LHS0, LHS),
-    rename_unify_rhs(Must, Subn, RHS0, RHS),
-    rename_unify(Must, Subn, Unify0, Unify).
-
-rename_vars_in_goal_expr(Must, Subn,
-        call_foreign_proc(Attrs, PredId, ProcId, Args0, Extra0, MTRC, Impl),
-        call_foreign_proc(Attrs, PredId, ProcId, Args, Extra, MTRC, Impl)) :-
-    rename_arg_list(Must, Subn, Args0, Args),
-    rename_arg_list(Must, Subn, Extra0, Extra).
-
-rename_vars_in_goal_expr(Must, Subn,
-        shorthand(ShorthandGoal0), shorthand(ShrothandGoal)) :-
-    rename_vars_in_shorthand(Must, Subn, ShorthandGoal0, ShrothandGoal).
-
-%-----------------------------------------------------------------------------%
-
-:- pred rename_vars_in_shorthand(bool::in, prog_var_renaming::in,
-    shorthand_goal_expr::in, shorthand_goal_expr::out) is det.
-
-rename_vars_in_shorthand(Must, Subn,
-        bi_implication(LHS0, RHS0), bi_implication(LHS, RHS)) :-
-    rename_vars_in_goal(Must, Subn, LHS0, LHS),
-    rename_vars_in_goal(Must, Subn, RHS0, RHS).
-
-%-----------------------------------------------------------------------------%
-
-:- pred rename_arg_list(bool::in, prog_var_renaming::in,
-    list(foreign_arg)::in, list(foreign_arg)::out) is det.
-
-rename_arg_list(_Must, _Subn, [], []).
-rename_arg_list(Must, Subn, [Arg0 | Args0], [Arg | Args]) :-
-    rename_arg(Must, Subn, Arg0, Arg),
-    rename_arg_list(Must, Subn, Args0, Args).
-
-:- pred rename_arg(bool::in, prog_var_renaming::in,
-    foreign_arg::in, foreign_arg::out) is det.
-
-rename_arg(Must, Subn, Arg0, Arg) :-
-    Arg0 = foreign_arg(Var0, B, C, D),
-    rename_var(Must, Subn, Var0, Var),
-    Arg = foreign_arg(Var, B, C, D).
-
-%-----------------------------------------------------------------------------%
-
-:- pred rename_vars_in_cases(bool::in, prog_var_renaming::in,
-    list(case)::in, list(case)::out) is det.
-
-rename_vars_in_cases(_Must, _Subn, [], []).
-rename_vars_in_cases(Must, Subn,
-        [case(Cons, G0) | Gs0], [case(Cons, G) | Gs]) :-
-    rename_vars_in_goal(Must, Subn, G0, G),
-    rename_vars_in_cases(Must, Subn, Gs0, Gs).
-
-%-----------------------------------------------------------------------------%
-
-:- pred rename_unify_rhs(bool::in, prog_var_renaming::in,
-    unify_rhs::in, unify_rhs::out) is det.
-
-rename_unify_rhs(Must, Subn, rhs_var(Var0), rhs_var(Var)) :-
-    rename_var(Must, Subn, Var0, Var).
-rename_unify_rhs(Must, Subn,
-        rhs_functor(Functor, E, ArgVars0), rhs_functor(Functor, E, ArgVars)) :-
-    rename_var_list(Must, Subn, ArgVars0, ArgVars).
-rename_unify_rhs(Must, Subn,
-        rhs_lambda_goal(Purity, PredOrFunc, EvalMethod,
-            NonLocals0, Vars0, Modes, Det, Goal0),
-        rhs_lambda_goal(Purity, PredOrFunc, EvalMethod,
-            NonLocals, Vars, Modes, Det, Goal)) :-
-    rename_var_list(Must, Subn, NonLocals0, NonLocals),
-    rename_var_list(Must, Subn, Vars0, Vars),
-    rename_vars_in_goal(Must, Subn, Goal0, Goal).
-
-:- pred rename_unify(bool::in, prog_var_renaming::in,
-    unification::in, unification::out) is det.
-
-rename_unify(Must, Subn,
-        construct(Var0, ConsId, Vars0, Modes, How0, Uniq, SubInfo0),
-        construct(Var, ConsId, Vars, Modes, How, Uniq, SubInfo)) :-
-    rename_var(Must, Subn, Var0, Var),
-    rename_var_list(Must, Subn, Vars0, Vars),
-    (
-        How0 = reuse_cell(cell_to_reuse(ReuseVar0, B, C)),
-        rename_var(Must, Subn, ReuseVar0, ReuseVar),
-        How = reuse_cell(cell_to_reuse(ReuseVar, B, C))
-    ;
-        How0 = construct_dynamically,
-        How = How0
-    ;
-        How0 = construct_statically(_),
-        How = How0
-    ;
-        How0 = construct_in_region(RegVar0),
-        rename_var(Must, Subn, RegVar0, RegVar),
-        How = construct_in_region(RegVar)
-    ),
-    (
-        SubInfo0 = construct_sub_info(MTA, MaybeSize0),
-        (
-            MaybeSize0 = no,
-            MaybeSize = no
-        ;
-            MaybeSize0 = yes(Size0),
-            (
-                Size0 = known_size(_),
-                Size = Size0
-            ;
-                Size0 = dynamic_size(SizeVar0),
-                rename_var(Must, Subn, SizeVar0, SizeVar),
-                Size = dynamic_size(SizeVar)
-            ),
-            MaybeSize = yes(Size)
-        ),
-        SubInfo = construct_sub_info(MTA, MaybeSize)
-    ;
-        SubInfo0 = no_construct_sub_info,
-        SubInfo = no_construct_sub_info
-    ).
-rename_unify(Must, Subn,
-        deconstruct(Var0, ConsId, Vars0, Modes, Cat, CanCGC),
-        deconstruct(Var, ConsId, Vars, Modes, Cat, CanCGC)) :-
-    rename_var(Must, Subn, Var0, Var),
-    rename_var_list(Must, Subn, Vars0, Vars).
-rename_unify(Must, Subn, assign(L0, R0), assign(L, R)) :-
-    rename_var(Must, Subn, L0, L),
-    rename_var(Must, Subn, R0, R).
-rename_unify(Must, Subn, simple_test(L0, R0), simple_test(L, R)) :-
-    rename_var(Must, Subn, L0, L),
-    rename_var(Must, Subn, R0, R).
-rename_unify(_Must, _Subn,
-        complicated_unify(Modes, Cat, TypeInfoVars),
-        complicated_unify(Modes, Cat, TypeInfoVars)).
-
-%-----------------------------------------------------------------------------%
-
-:- pred rename_generic_call(bool::in, prog_var_renaming::in,
-    generic_call::in, generic_call::out) is det.
-
-rename_generic_call(Must, Subn,
-        higher_order(Var0, Purity, PredOrFunc, Arity),
-        higher_order(Var, Purity, PredOrFunc, Arity)) :-
-    rename_var(Must, Subn, Var0, Var).
-rename_generic_call(Must, Subn,
-        class_method(Var0, Method, ClassId, MethodId),
-        class_method(Var, Method, ClassId, MethodId)) :-
-    rename_var(Must, Subn, Var0, Var).
-rename_generic_call(_, _, event_call(EventName), event_call(EventName)).
-rename_generic_call(_, _, cast(CastKind), cast(CastKind)).
-
-%-----------------------------------------------------------------------------%
-
-:- pred rename_var_maps(bool::in, prog_var_renaming::in,
-    map(prog_var, T)::in, map(prog_var, T)::out) is det.
-
-rename_var_maps(Must, Subn, Map0, Map) :-
-    map.to_assoc_list(Map0, AssocList0),
-    rename_var_maps_2(Must, Subn, AssocList0, AssocList),
-    map.from_assoc_list(AssocList, Map).
-
-:- pred rename_var_maps_2(bool::in, map(var(V), var(V))::in,
-    assoc_list(var(V), T)::in, assoc_list(var(V), T)::out) is det.
-
-rename_var_maps_2(_Must, _Subn, [], []).
-rename_var_maps_2(Must, Subn, [V - L | Vs], [N - L | Ns]) :-
-    rename_var(Must, Subn, V, N),
-    rename_var_maps_2(Must, Subn, Vs, Ns).
-
-%-----------------------------------------------------------------------------%
-
-rename_vars_in_goal_info(Must, Subn, !GoalInfo) :-
-    goal_info_get_nonlocals(!.GoalInfo, NonLocals0),
-    rename_vars_in_var_set(Must, Subn, NonLocals0, NonLocals),
-    goal_info_set_nonlocals(NonLocals, !GoalInfo),
-
-    goal_info_get_instmap_delta(!.GoalInfo, InstMap0),
-    instmap_delta_apply_sub(Must, Subn, InstMap0, InstMap),
-    goal_info_set_instmap_delta(InstMap, !GoalInfo),
-
-    goal_info_get_code_gen_info(!.GoalInfo, CodeGenInfo0),
-    rename_vars_in_code_gen_info(Must, Subn, CodeGenInfo0, CodeGenInfo),
-    goal_info_set_code_gen_info(CodeGenInfo, !GoalInfo).
-
-%-----------------------------------------------------------------------------%
-
-rename_vars_in_var_set(Must, Subn, Vars0, Vars) :-
-    set.to_sorted_list(Vars0, VarsList0),
-    rename_var_list(Must, Subn, VarsList0, VarsList),
-    set.list_to_set(VarsList, Vars).
-
-:- pred rename_vars_in_code_gen_info(bool::in,
-    prog_var_renaming::in,
-    hlds_goal_code_gen_info::in, hlds_goal_code_gen_info::out) is det.
-
-rename_vars_in_code_gen_info(Must, Subn,
-        CodeGenInfo0, CodeGenInfo) :-
-    (
-        CodeGenInfo0 = no_code_gen_info,
-        CodeGenInfo = no_code_gen_info
-    ;
-        CodeGenInfo0 = llds_code_gen_info(LldsInfo0),
-        rename_vars_in_llds_code_gen_info(Must, Subn, LldsInfo0, LldsInfo),
-        CodeGenInfo = llds_code_gen_info(LldsInfo)
-    ).
-
-%-----------------------------------------------------------------------------%
-
 goal_vars(hlds_goal(GoalExpr, _GoalInfo), Set) :-
     goal_vars_2(GoalExpr, set.init, Set).
 
Index: compiler/headvar_names.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/headvar_names.m,v
retrieving revision 1.2
diff -u -b -r1.2 headvar_names.m
--- compiler/headvar_names.m	17 May 2007 03:52:42 -0000	1.2
+++ compiler/headvar_names.m	1 Aug 2007 10:13:16 -0000
@@ -78,7 +78,7 @@
                 VarSet0, VarSet, map.init, Subst, [], RevConj),
 
             goal_info_get_nonlocals(GoalInfo0, NonLocals0),
-            goal_util.rename_vars_in_var_set(no, Subst, NonLocals0, NonLocals),
+            rename_vars_in_var_set(no, Subst, NonLocals0, NonLocals),
             goal_info_set_nonlocals(NonLocals, GoalInfo0, GoalInfo),
             conj_list_to_goal(list.reverse(RevConj), GoalInfo, Goal),
 
Index: compiler/hlds_goal.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.178
diff -u -b -r1.178 hlds_goal.m
--- compiler/hlds_goal.m	6 Jul 2007 02:35:20 -0000	1.178
+++ compiler/hlds_goal.m	1 Aug 2007 09:48:06 -0000
@@ -1135,9 +1135,8 @@
 :- type short_reuse_description
     --->    cell_died
     ;       cell_reused(
-                dead_var,       % The dead variable selected
-                                % for reusing.
-                is_conditional, % states if the reuse is conditional.
+                dead_var,       % The dead variable selected for reusing.
+                is_conditional, % States whether the reuse is conditional.
                 list(cons_id),  % What are the possible cons_ids that the
                                 % variable to be reused can have.
                 list(needs_update)
@@ -1185,6 +1184,48 @@
 
 %-----------------------------------------------------------------------------%
 %
+% The rename_var* predicates take a structure and a mapping from var -> var
+% and apply that translation. If a var in the input structure does not
+% occur as a key in the mapping, then the variable is left unsubstituted
+% (if Must = no) or we throw an exception (if Must = yes).
+%
+% We keep these predicates here to allow rename_vars_in_goal_info to exploit
+% knowledge of the actual representation of hlds_goal_infos; since
+% hlds_goal_info is an abstract type, this knowledge is not available
+% in any other module.
+%
+% This exploitation also makes the code of rename_vars_in_goal_info depend on
+% the structure of hlds_goal_infos, which makes accidentally forgetting to
+% update that predicate after modifying the hlds_goal_info type much harder.
+
+:- type prog_var_renaming == map(prog_var, prog_var).
+
+:- pred rename_some_vars_in_goal(prog_var_renaming::in,
+    hlds_goal::in, hlds_goal::out) is det.
+
+:- pred must_rename_vars_in_goal(prog_var_renaming::in,
+    hlds_goal::in, hlds_goal::out) is det.
+
+:- pred rename_vars_in_goals(bool::in, prog_var_renaming::in,
+    hlds_goals::in, hlds_goals::out) is det.
+
+:- pred rename_vars_in_goal_expr(bool::in, prog_var_renaming::in,
+    hlds_goal_expr::in, hlds_goal_expr::out) is det.
+
+:- pred rename_vars_in_goal_info(bool::in, prog_var_renaming::in,
+    hlds_goal_info::in, hlds_goal_info::out) is det.
+
+:- pred rename_vars_in_var_set(bool::in, prog_var_renaming::in,
+    set(prog_var)::in, set(prog_var)::out) is det.
+
+:- pred rename_var_list(bool::in, map(var(T), var(T))::in,
+    list(var(T))::in, list(var(T))::out) is det.
+
+:- pred rename_var(bool::in, map(var(V), var(V))::in,
+    var(V)::in, var(V)::out) is det.
+
+%-----------------------------------------------------------------------------%
+%
 % Miscellaneous utility procedures for dealing with HLDS goals.
 %
 
@@ -1490,8 +1531,13 @@
 % Information stored with all kinds of goals
 %
 
-    % NB. Don't forget to check goal_util.name_apart_goalinfo
-    % if this structure is modified.
+    % This type has eight fields, which means that the Boehm collector
+    % allocates eight words for it. For a type with nine or ten fields,
+    % the Boehm collector would allocate a sixteen word block, so if
+    % you need any new fields, you probably want to add them to the
+    % extension structure in the hlds_goal_extra_info field instead of
+    % directly to this type.
+
 :- type hlds_goal_info
     --->    goal_info(
                 determinism     :: determinism,
@@ -1523,8 +1569,6 @@
                                 % Normally the instmap_delta will list only
                                 % the nonlocal variables of the goal.
 
-                context         :: prog_context,
-
                 nonlocals       :: set(prog_var),
                                 % The non-local vars in the goal, i.e. the
                                 % variables that occur both inside and outside
@@ -1544,9 +1588,6 @@
                                 % The path to this goal from the root in
                                 % reverse order.
 
-                maybe_mode_constraint_info ::
-                                maybe(mode_constraint_goal_info),
-
                 code_gen_info   :: hlds_goal_code_gen_info,
 
                 extra_goal_info :: hlds_goal_extra_info
@@ -1555,24 +1596,37 @@
                                 % passes, e.g closure analysis.
             ).
 
+:- type hlds_goal_extra_info
+    --->    extra_goal_info(
+                context                     :: prog_context,
+
+                extra_info_ho_vals          :: ho_values,
+
+                % Any information related to structure reuse (CTGC).
+                extra_info_maybe_ctgc_info  :: maybe(ctgc_info),
+
+                maybe_mode_constraint_info  ::
+                                maybe(mode_constraint_goal_info)
+            ).
+
 :- type mode_constraint_goal_info
     --->    mode_constraint_goal_info(
+                % Inst_graph nodes that are reachable from variables
+                % that occur in the goal.
                 mci_occurring_vars :: set(prog_var),
-                                % Inst_graph nodes that are reachable from
-                                % variables that occur in the goal.
 
-                mci_producing_vars :: set(prog_var),
                                 % Inst_graph nodes produced by this goal.
+                mci_producing_vars          :: set(prog_var),
 
-                mci_consuming_vars :: set(prog_var),
                                 % Inst_graph nodes consumed by this goal.
+                mci_consuming_vars          :: set(prog_var),
 
+                % The variables that this goal makes visible.
                 mci_make_visible_vars :: set(prog_var),
-                                % Variables that this goal makes visible.
 
-                mci_need_visible_vars :: set(prog_var)
-                                % Variables that this goal need to be visible
+                % The variables that this goal needs to be visible
                                 % before it is executed.
+                mci_need_visible_vars       :: set(prog_var)
             ).
 
 :- pragma inline(goal_info_init/1).
@@ -1583,8 +1637,8 @@
     set.init(NonLocals),
     term.context_init(Context),
     set.init(Features),
-    GoalInfo = goal_info(Detism, InstMapDelta, Context, NonLocals, purity_pure,
-        Features, [], no, no_code_gen_info, hlds_goal_extra_info_init).
+    GoalInfo = goal_info(Detism, InstMapDelta, NonLocals, purity_pure,
+        Features, [], no_code_gen_info, hlds_goal_extra_info_init(Context)).
 
 :- pragma inline(goal_info_init/2).
 
@@ -1593,23 +1647,28 @@
     instmap_delta_init_unreachable(InstMapDelta),
     set.init(NonLocals),
     set.init(Features),
-    GoalInfo = goal_info(Detism, InstMapDelta, Context, NonLocals, purity_pure,
-        Features, [], no, no_code_gen_info, hlds_goal_extra_info_init).
+    GoalInfo = goal_info(Detism, InstMapDelta, NonLocals, purity_pure,
+        Features, [], no_code_gen_info, hlds_goal_extra_info_init(Context)).
 
 goal_info_init(NonLocals, InstMapDelta, Detism, Purity, GoalInfo) :-
-    term.context_init(Context),
     set.init(Features),
-    GoalInfo = goal_info(Detism, InstMapDelta, Context, NonLocals, Purity,
-        Features, [], no, no_code_gen_info, hlds_goal_extra_info_init).
+    term.context_init(Context),
+    GoalInfo = goal_info(Detism, InstMapDelta, NonLocals, Purity,
+        Features, [], no_code_gen_info, hlds_goal_extra_info_init(Context)).
 
 goal_info_init(NonLocals, InstMapDelta, Detism, Purity, Context, GoalInfo) :-
     set.init(Features),
-    GoalInfo = goal_info(Detism, InstMapDelta, Context, NonLocals, Purity,
-        Features, [], no, no_code_gen_info, hlds_goal_extra_info_init).
+    GoalInfo = goal_info(Detism, InstMapDelta, NonLocals, Purity,
+        Features, [], no_code_gen_info, hlds_goal_extra_info_init(Context)).
+
+:- func hlds_goal_extra_info_init(term.context) = hlds_goal_extra_info.
+
+hlds_goal_extra_info_init(Context) = ExtraInfo :-
+    HO_Values = map.init,
+    ExtraInfo = extra_goal_info(Context, HO_Values, no, no).
 
 goal_info_get_determinism(GoalInfo, GoalInfo ^ determinism).
 goal_info_get_instmap_delta(GoalInfo, GoalInfo ^ instmap_delta).
-goal_info_get_context(GoalInfo, GoalInfo ^ context).
 goal_info_get_nonlocals(GoalInfo, GoalInfo ^ nonlocals).
 goal_info_get_purity(GoalInfo, GoalInfo ^ purity).
 goal_info_get_features(GoalInfo, GoalInfo ^ features).
@@ -1617,69 +1676,94 @@
 goal_info_get_code_gen_info(GoalInfo, GoalInfo ^ code_gen_info).
 goal_info_get_extra_info(GoalInfo) = GoalInfo ^ extra_goal_info.
 
+goal_info_set_determinism(Determinism, GoalInfo,
+        GoalInfo ^ determinism := Determinism).
+goal_info_set_instmap_delta(InstMapDelta, GoalInfo,
+        GoalInfo ^ instmap_delta := InstMapDelta).
+goal_info_set_nonlocals(NonLocals, GoalInfo,
+        GoalInfo ^ nonlocals := NonLocals).
+goal_info_set_purity(Purity, GoalInfo,
+        GoalInfo ^ purity := Purity).
+goal_info_set_features(Features, GoalInfo, GoalInfo ^ features := Features).
+goal_info_set_goal_path(GoalPath, GoalInfo,
+        GoalInfo ^ goal_path := GoalPath).
+goal_info_set_code_gen_info(CodeGenInfo, GoalInfo,
+        GoalInfo ^ code_gen_info := CodeGenInfo).
+goal_info_set_extra_info(ExtraInfo, GoalInfo,
+        GoalInfo ^ extra_goal_info := ExtraInfo).
+
+    % The code-gen non-locals are always the same as the
+    % non-locals when structure reuse is not being performed.
+goal_info_get_code_gen_nonlocals(GoalInfo, NonLocals) :-
+    goal_info_get_nonlocals(GoalInfo, NonLocals).
+    % The code-gen non-locals are always the same as the
+    % non-locals when structure reuse is not being performed.
+goal_info_set_code_gen_nonlocals(NonLocals, !GoalInfo) :-
+    goal_info_set_nonlocals(NonLocals, !GoalInfo).
+
+goal_info_get_context(GoalInfo,
+    GoalInfo ^ extra_goal_info ^ context).
+goal_info_set_context(Context, GoalInfo,
+    GoalInfo ^ extra_goal_info ^ context := Context).
+
+goal_info_get_ho_values(GoalInfo) =
+    GoalInfo ^ extra_goal_info ^ extra_info_ho_vals.
+
+goal_info_set_ho_values(Values, !GoalInfo) :-
+    !:GoalInfo = !.GoalInfo ^ extra_goal_info ^ extra_info_ho_vals := Values.
+
 goal_info_get_occurring_vars(GoalInfo, OccurringVars) :-
-    ( GoalInfo ^ maybe_mode_constraint_info = yes(MCI) ->
+    MMCI = GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info,
+    (
+        MMCI = yes(MCI),
         OccurringVars = MCI ^ mci_occurring_vars
     ;
+        MMCI = no,
         OccurringVars = set.init
     ).
 
 goal_info_get_producing_vars(GoalInfo, ProducingVars) :-
-    ( GoalInfo ^ maybe_mode_constraint_info = yes(MCI) ->
+    MMCI = GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info,
+    (
+        MMCI = yes(MCI),
         ProducingVars = MCI ^ mci_producing_vars
     ;
+        MMCI = no,
         ProducingVars = set.init
     ).
 
 goal_info_get_consuming_vars(GoalInfo, ConsumingVars) :-
-    ( GoalInfo ^ maybe_mode_constraint_info = yes(MCI) ->
+    MMCI = GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info,
+    (
+        MMCI = yes(MCI),
         ConsumingVars = MCI ^ mci_consuming_vars
     ;
+        MMCI = no,
         ConsumingVars = set.init
     ).
 
 goal_info_get_make_visible_vars(GoalInfo, MakeVisibleVars) :-
-    ( GoalInfo ^ maybe_mode_constraint_info = yes(MCI) ->
+    MMCI = GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info,
+    (
+        MMCI = yes(MCI),
         MakeVisibleVars = MCI ^ mci_make_visible_vars
     ;
+        MMCI = no,
         MakeVisibleVars = set.init
     ).
 
 goal_info_get_need_visible_vars(GoalInfo, NeedVisibleVars) :-
-    ( GoalInfo ^ maybe_mode_constraint_info = yes(MCI) ->
+    MMCI = GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info,
+    (
+        MMCI = yes(MCI),
         NeedVisibleVars = MCI ^ mci_need_visible_vars
     ;
+        MMCI = no,
         NeedVisibleVars = set.init
     ).
 
-goal_info_set_determinism(Determinism, GoalInfo,
-        GoalInfo ^ determinism := Determinism).
-goal_info_set_instmap_delta(InstMapDelta, GoalInfo,
-        GoalInfo ^ instmap_delta := InstMapDelta).
-goal_info_set_context(Context, GoalInfo, GoalInfo ^ context := Context).
-goal_info_set_nonlocals(NonLocals, GoalInfo,
-        GoalInfo ^ nonlocals := NonLocals).
-goal_info_set_purity(Purity, GoalInfo,
-        GoalInfo ^ purity := Purity).
-goal_info_set_features(Features, GoalInfo, GoalInfo ^ features := Features).
-goal_info_set_goal_path(GoalPath, GoalInfo,
-        GoalInfo ^ goal_path := GoalPath).
-goal_info_set_code_gen_info(CodeGenInfo, GoalInfo,
-        GoalInfo ^ code_gen_info := CodeGenInfo).
-goal_info_set_extra_info(ExtraInfo, GoalInfo,
-    GoalInfo ^ extra_goal_info := ExtraInfo).
-
-    % The code-gen non-locals are always the same as the
-    % non-locals when structure reuse is not being performed.
-goal_info_get_code_gen_nonlocals(GoalInfo, NonLocals) :-
-    goal_info_get_nonlocals(GoalInfo, NonLocals).
-    % The code-gen non-locals are always the same as the
-    % non-locals when structure reuse is not being performed.
-goal_info_set_code_gen_nonlocals(NonLocals, !GoalInfo) :-
-    goal_info_set_nonlocals(NonLocals, !GoalInfo).
-
 goal_info_set_occurring_vars(OccurringVars, !GoalInfo) :-
-    MMCI0 = !.GoalInfo ^ maybe_mode_constraint_info,
+    MMCI0 = !.GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info,
     (
         MMCI0 = yes(MCI0),
         MCI = MCI0 ^ mci_occurring_vars := OccurringVars
@@ -1692,10 +1776,11 @@
         MCI = mode_constraint_goal_info(OccurringVars, ProducingVars,
             ConsumingVars, MakeVisibleVars, NeedVisibleVars)
     ),
-    !:GoalInfo = !.GoalInfo ^ maybe_mode_constraint_info := yes(MCI).
+    !:GoalInfo = !.GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info
+        := yes(MCI).
 
 goal_info_set_producing_vars(ProducingVars, !GoalInfo) :-
-    MMCI0 = !.GoalInfo ^ maybe_mode_constraint_info,
+    MMCI0 = !.GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info,
     (
         MMCI0 = yes(MCI0),
         MCI = MCI0 ^ mci_producing_vars := ProducingVars
@@ -1708,10 +1793,11 @@
         MCI = mode_constraint_goal_info(OccurringVars, ProducingVars,
             ConsumingVars, MakeVisibleVars, NeedVisibleVars)
     ),
-    !:GoalInfo = !.GoalInfo ^ maybe_mode_constraint_info := yes(MCI).
+    !:GoalInfo = !.GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info
+        := yes(MCI).
 
 goal_info_set_consuming_vars(ConsumingVars, !GoalInfo) :-
-    MMCI0 = !.GoalInfo ^ maybe_mode_constraint_info,
+    MMCI0 = !.GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info,
     (
         MMCI0 = yes(MCI0),
         MCI = MCI0 ^ mci_consuming_vars := ConsumingVars
@@ -1724,10 +1810,11 @@
         MCI = mode_constraint_goal_info(OccurringVars, ProducingVars,
             ConsumingVars, MakeVisibleVars, NeedVisibleVars)
     ),
-    !:GoalInfo = !.GoalInfo ^ maybe_mode_constraint_info := yes(MCI).
+    !:GoalInfo = !.GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info
+        := yes(MCI).
 
 goal_info_set_make_visible_vars(MakeVisibleVars, !GoalInfo) :-
-    MMCI0 = !.GoalInfo ^ maybe_mode_constraint_info,
+    MMCI0 = !.GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info,
     (
         MMCI0 = yes(MCI0),
         MCI = MCI0 ^ mci_make_visible_vars := MakeVisibleVars
@@ -1740,10 +1827,11 @@
         MCI = mode_constraint_goal_info(OccurringVars, ProducingVars,
             ConsumingVars, MakeVisibleVars, NeedVisibleVars)
     ),
-    !:GoalInfo = !.GoalInfo ^ maybe_mode_constraint_info := yes(MCI).
+    !:GoalInfo = !.GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info
+        := yes(MCI).
 
 goal_info_set_need_visible_vars(NeedVisibleVars, !GoalInfo) :-
-    MMCI0 = !.GoalInfo ^ maybe_mode_constraint_info,
+    MMCI0 = !.GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info,
     (
         MMCI0 = yes(MCI0),
         MCI = MCI0 ^ mci_need_visible_vars := NeedVisibleVars
@@ -1756,7 +1844,8 @@
         MCI = mode_constraint_goal_info(OccurringVars, ProducingVars,
             ConsumingVars, MakeVisibleVars, NeedVisibleVars)
     ),
-    !:GoalInfo = !.GoalInfo ^ maybe_mode_constraint_info := yes(MCI).
+    !:GoalInfo = !.GoalInfo ^ extra_goal_info ^ maybe_mode_constraint_info
+        := yes(MCI).
 
 producing_vars(GoalInfo) = ProducingVars :-
     goal_info_get_producing_vars(GoalInfo, ProducingVars).
@@ -1783,6 +1872,112 @@
     goal_info_set_need_visible_vars(NeedVisibleVars, GoalInfo0, GoalInfo).
 
 %-----------------------------------------------------------------------------%
+%
+% Information about compile-time garbage collection.
+
+:- type ctgc_info
+    --->    ctgc_info(
+                % The local forward use set: this set contains the variables
+                % that are syntactically needed during forward execution.
+                % It is computed as the set of instantiated vars (input vars
+                % + sum(pre_births), minus the set of dead vars
+                % (sum(post_deaths and pre_deaths).
+                % The information is needed for determining the direct reuses.
+                lfu     :: set(prog_var),
+
+                % The local backward use set. This set contains the
+                % instantiated variables that are needed upon backtracking
+                % (i.e. syntactically appearing in any nondet call preceding
+                % this goal).
+                lbu     :: set(prog_var),
+
+                % Any structure reuse information related to this call.
+                reuse   :: reuse_description
+            ).
+
+:- func ctgc_info_init = ctgc_info.
+
+ctgc_info_init = ctgc_info(set.init, set.init, no_reuse_info).
+
+goal_info_get_lfu(GoalInfo) = LFU :-
+    ( goal_info_maybe_get_lfu(GoalInfo, LFU0) ->
+        LFU = LFU0
+    ;
+        unexpected(this_file,
+            "Requesting LFU information while CTGC field not set.")
+    ).
+
+goal_info_get_lbu(GoalInfo) = LBU :-
+    ( goal_info_maybe_get_lbu(GoalInfo, LBU0) ->
+        LBU = LBU0
+    ;
+        unexpected(this_file,
+            "Requesting LBU information while CTGC field not set.")
+    ).
+
+goal_info_get_reuse(GoalInfo) = Reuse :-
+    ( goal_info_maybe_get_reuse(GoalInfo, Reuse0) ->
+        Reuse = Reuse0
+    ;
+        unexpected(this_file,
+            "Requesting reuse information while CTGC field not set.")
+    ).
+
+goal_info_maybe_get_lfu(GoalInfo, LFU) :-
+    MaybeCTGC = GoalInfo ^ extra_goal_info ^ extra_info_maybe_ctgc_info,
+    MaybeCTGC = yes(CTGC),
+    LFU = CTGC ^ lfu.
+
+goal_info_maybe_get_lbu(GoalInfo, LBU) :-
+    MaybeCTGC = GoalInfo ^ extra_goal_info ^ extra_info_maybe_ctgc_info,
+    MaybeCTGC = yes(CTGC),
+    LBU = CTGC ^ lbu.
+
+goal_info_maybe_get_reuse(GoalInfo, Reuse) :-
+    MaybeCTGC = GoalInfo ^ extra_goal_info ^ extra_info_maybe_ctgc_info,
+    MaybeCTGC = yes(CTGC),
+    Reuse = CTGC ^ reuse.
+
+goal_info_set_lfu(LFU, !GoalInfo) :-
+    MaybeCTGC0 = !.GoalInfo ^ extra_goal_info ^ extra_info_maybe_ctgc_info,
+    (
+        MaybeCTGC0 = yes(CTGC0)
+    ;
+        MaybeCTGC0 = no,
+        CTGC0 = ctgc_info_init
+    ),
+    CTGC = CTGC0 ^ lfu := LFU,
+    MaybeCTGC = yes(CTGC),
+    !:GoalInfo = !.GoalInfo ^ extra_goal_info
+        ^ extra_info_maybe_ctgc_info := MaybeCTGC.
+
+goal_info_set_lbu(LBU, !GoalInfo) :-
+    MaybeCTGC0 = !.GoalInfo ^ extra_goal_info ^ extra_info_maybe_ctgc_info,
+    (
+        MaybeCTGC0 = yes(CTGC0)
+    ;
+        MaybeCTGC0 = no,
+        CTGC0 = ctgc_info_init
+    ),
+    CTGC = CTGC0 ^ lbu := LBU,
+    MaybeCTGC = yes(CTGC),
+    !:GoalInfo = !.GoalInfo ^ extra_goal_info
+        ^ extra_info_maybe_ctgc_info := MaybeCTGC.
+
+goal_info_set_reuse(Reuse, !GoalInfo) :-
+    MaybeCTGC0 = !.GoalInfo ^ extra_goal_info ^ extra_info_maybe_ctgc_info,
+    (
+        MaybeCTGC0 = yes(CTGC0)
+    ;
+        MaybeCTGC0 = no,
+        CTGC0 = ctgc_info_init
+    ),
+    CTGC = CTGC0 ^ reuse := Reuse,
+    MaybeCTGC = yes(CTGC),
+    !:GoalInfo = !.GoalInfo ^ extra_goal_info
+        ^ extra_info_maybe_ctgc_info := MaybeCTGC.
+
+%-----------------------------------------------------------------------------%
 
 worst_contains_trace(contains_trace_goal, contains_trace_goal) =
     contains_trace_goal.
@@ -1848,6 +2043,383 @@
 
 %-----------------------------------------------------------------------------%
 %
+% Rename predicates.
+%
+
+rename_some_vars_in_goal(Subn, Goal0, Goal) :-
+    rename_vars_in_goal(no, Subn, Goal0, Goal).
+
+must_rename_vars_in_goal(Subn, Goal0, Goal) :-
+    rename_vars_in_goal(yes, Subn, Goal0, Goal).
+
+:- pred rename_vars_in_goal(bool::in, prog_var_renaming::in,
+    hlds_goal::in, hlds_goal::out) is det.
+
+rename_vars_in_goal(Must, Subn, Goal0, Goal) :-
+    Goal0 = hlds_goal(GoalExpr0, GoalInfo0),
+    rename_vars_in_goal_expr(Must, Subn, GoalExpr0, GoalExpr),
+    rename_vars_in_goal_info(Must, Subn, GoalInfo0, GoalInfo),
+    Goal = hlds_goal(GoalExpr, GoalInfo).
+
+rename_vars_in_goals(_, _, [], []).
+rename_vars_in_goals(Must, Subn, [Goal0 | Goals0], [Goal | Goals]) :-
+    rename_vars_in_goal(Must, Subn, Goal0, Goal),
+    rename_vars_in_goals(Must, Subn, Goals0, Goals).
+
+%-----------------------------------------------------------------------------%
+
+rename_vars_in_goal_expr(Must, Subn, Expr0, Expr) :-
+    (
+        Expr0 = conj(ConjType, Goals0),
+        rename_vars_in_goals(Must, Subn, Goals0, Goals),
+        Expr = conj(ConjType, Goals)
+    ;
+        Expr0 = disj(Goals0),
+        rename_vars_in_goals(Must, Subn, Goals0, Goals),
+        Expr = disj(Goals)
+    ;
+        Expr0 = switch(Var0, Det, Cases0),
+        rename_var(Must, Subn, Var0, Var),
+        rename_vars_in_cases(Must, Subn, Cases0, Cases),
+        Expr = switch(Var, Det, Cases)
+    ;
+        Expr0 = if_then_else(Vars0, Cond0, Then0, Else0),
+        rename_var_list(Must, Subn, Vars0, Vars),
+        rename_vars_in_goal(Must, Subn, Cond0, Cond),
+        rename_vars_in_goal(Must, Subn, Then0, Then),
+        rename_vars_in_goal(Must, Subn, Else0, Else),
+        Expr = if_then_else(Vars, Cond, Then, Else)
+    ;
+        Expr0 = negation(Goal0),
+        rename_vars_in_goal(Must, Subn, Goal0, Goal),
+        Expr = negation(Goal)
+    ;
+        Expr0 = scope(Reason0, Goal0),
+        (
+            Reason0 = exist_quant(Vars0),
+            rename_var_list(Must, Subn, Vars0, Vars),
+            Reason = exist_quant(Vars)
+        ;
+            Reason0 = promise_purity(_, _),
+            Reason = Reason0
+        ;
+            Reason0 = promise_solutions(Vars0, Kind),
+            rename_var_list(Must, Subn, Vars0, Vars),
+            Reason = promise_solutions(Vars, Kind)
+        ;
+            Reason0 = barrier(_),
+            Reason = Reason0
+        ;
+            Reason0 = commit(_),
+            Reason = Reason0
+        ;
+            Reason0 = from_ground_term(Var0),
+            rename_var(Must, Subn, Var0, Var),
+            Reason = from_ground_term(Var)
+        ;
+            Reason0 = trace_goal(Flag, Grade, Env, Vars, QuantVars0),
+            rename_var_list(Must, Subn, QuantVars0, QuantVars),
+            Reason = trace_goal(Flag, Grade, Env, Vars, QuantVars)
+        ),
+        rename_vars_in_goal(Must, Subn, Goal0, Goal),
+        Expr = scope(Reason, Goal)
+    ;
+        Expr0 = generic_call(GenericCall0, Args0, Modes, Det),
+        rename_generic_call(Must, Subn, GenericCall0, GenericCall),
+        rename_var_list(Must, Subn, Args0, Args),
+        Expr = generic_call(GenericCall, Args, Modes, Det)
+    ;
+        Expr0 = plain_call(PredId, ProcId, Args0, Builtin, Context, Sym),
+        rename_var_list(Must, Subn, Args0, Args),
+        Expr = plain_call(PredId, ProcId, Args, Builtin, Context, Sym)
+    ;
+        Expr0 = unify(LHS0, RHS0, Mode, Unify0, Context),
+        rename_var(Must, Subn, LHS0, LHS),
+        rename_unify_rhs(Must, Subn, RHS0, RHS),
+        rename_unify(Must, Subn, Unify0, Unify),
+        Expr = unify(LHS, RHS, Mode, Unify, Context)
+    ;
+        Expr0 = call_foreign_proc(Attrs, PredId, ProcId, Args0, Extra0,
+            MTRC, Impl),
+        rename_arg_list(Must, Subn, Args0, Args),
+        rename_arg_list(Must, Subn, Extra0, Extra),
+        Expr = call_foreign_proc(Attrs, PredId, ProcId, Args, Extra,
+            MTRC, Impl)
+    ;
+        Expr0 = shorthand(ShorthandGoal0),
+        rename_vars_in_shorthand(Must, Subn, ShorthandGoal0, ShorthandGoal),
+        Expr = shorthand(ShorthandGoal)
+    ).
+
+:- pred rename_vars_in_shorthand(bool::in, prog_var_renaming::in,
+    shorthand_goal_expr::in, shorthand_goal_expr::out) is det.
+
+rename_vars_in_shorthand(Must, Subn,
+        bi_implication(LHS0, RHS0), bi_implication(LHS, RHS)) :-
+    rename_vars_in_goal(Must, Subn, LHS0, LHS),
+    rename_vars_in_goal(Must, Subn, RHS0, RHS).
+
+:- pred rename_arg_list(bool::in, prog_var_renaming::in,
+    list(foreign_arg)::in, list(foreign_arg)::out) is det.
+
+rename_arg_list(_Must, _Subn, [], []).
+rename_arg_list(Must, Subn, [Arg0 | Args0], [Arg | Args]) :-
+    rename_arg(Must, Subn, Arg0, Arg),
+    rename_arg_list(Must, Subn, Args0, Args).
+
+:- pred rename_arg(bool::in, prog_var_renaming::in,
+    foreign_arg::in, foreign_arg::out) is det.
+
+rename_arg(Must, Subn, Arg0, Arg) :-
+    Arg0 = foreign_arg(Var0, B, C, D),
+    rename_var(Must, Subn, Var0, Var),
+    Arg = foreign_arg(Var, B, C, D).
+
+:- pred rename_vars_in_cases(bool::in, prog_var_renaming::in,
+    list(case)::in, list(case)::out) is det.
+
+rename_vars_in_cases(_Must, _Subn, [], []).
+rename_vars_in_cases(Must, Subn,
+        [case(Cons, G0) | Gs0], [case(Cons, G) | Gs]) :-
+    rename_vars_in_goal(Must, Subn, G0, G),
+    rename_vars_in_cases(Must, Subn, Gs0, Gs).
+
+:- pred rename_unify_rhs(bool::in, prog_var_renaming::in,
+    unify_rhs::in, unify_rhs::out) is det.
+
+rename_unify_rhs(Must, Subn, rhs_var(Var0), rhs_var(Var)) :-
+    rename_var(Must, Subn, Var0, Var).
+rename_unify_rhs(Must, Subn,
+        rhs_functor(Functor, E, ArgVars0), rhs_functor(Functor, E, ArgVars)) :-
+    rename_var_list(Must, Subn, ArgVars0, ArgVars).
+rename_unify_rhs(Must, Subn,
+        rhs_lambda_goal(Purity, PredOrFunc, EvalMethod,
+            NonLocals0, Vars0, Modes, Det, Goal0),
+        rhs_lambda_goal(Purity, PredOrFunc, EvalMethod,
+            NonLocals, Vars, Modes, Det, Goal)) :-
+    rename_var_list(Must, Subn, NonLocals0, NonLocals),
+    rename_var_list(Must, Subn, Vars0, Vars),
+    rename_vars_in_goal(Must, Subn, Goal0, Goal).
+
+:- pred rename_unify(bool::in, prog_var_renaming::in,
+    unification::in, unification::out) is det.
+
+rename_unify(Must, Subn, Unify0, Unify) :-
+    (
+        Unify0 = construct(Var0, ConsId, Vars0, Modes, How0, Uniq, SubInfo0),
+        rename_var(Must, Subn, Var0, Var),
+        rename_var_list(Must, Subn, Vars0, Vars),
+        (
+            How0 = reuse_cell(cell_to_reuse(ReuseVar0, B, C)),
+            rename_var(Must, Subn, ReuseVar0, ReuseVar),
+            How = reuse_cell(cell_to_reuse(ReuseVar, B, C))
+        ;
+            How0 = construct_dynamically,
+            How = How0
+        ;
+            How0 = construct_statically(_),
+            How = How0
+        ;
+            How0 = construct_in_region(RegVar0),
+            rename_var(Must, Subn, RegVar0, RegVar),
+            How = construct_in_region(RegVar)
+        ),
+        (
+            SubInfo0 = construct_sub_info(MTA, MaybeSize0),
+            (
+                MaybeSize0 = no,
+                MaybeSize = no
+            ;
+                MaybeSize0 = yes(Size0),
+                (
+                    Size0 = known_size(_),
+                    Size = Size0
+                ;
+                    Size0 = dynamic_size(SizeVar0),
+                    rename_var(Must, Subn, SizeVar0, SizeVar),
+                    Size = dynamic_size(SizeVar)
+                ),
+                MaybeSize = yes(Size)
+            ),
+            SubInfo = construct_sub_info(MTA, MaybeSize)
+        ;
+            SubInfo0 = no_construct_sub_info,
+            SubInfo = no_construct_sub_info
+        ),
+        Unify = construct(Var, ConsId, Vars, Modes, How, Uniq, SubInfo)
+    ;
+        Unify0 = deconstruct(Var0, ConsId, Vars0, Modes, Cat, CanCGC),
+        rename_var(Must, Subn, Var0, Var),
+        rename_var_list(Must, Subn, Vars0, Vars),
+        Unify = deconstruct(Var, ConsId, Vars, Modes, Cat, CanCGC)
+    ;
+        Unify0 = assign(L0, R0),
+        rename_var(Must, Subn, L0, L),
+        rename_var(Must, Subn, R0, R),
+        Unify = assign(L, R)
+    ;
+        Unify0 = simple_test(L0, R0),
+        rename_var(Must, Subn, L0, L),
+        rename_var(Must, Subn, R0, R),
+        Unify = simple_test(L, R)
+    ;
+        Unify0 = complicated_unify(Modes, Cat, TypeInfoVars0),
+        rename_var_list(Must, Subn, TypeInfoVars0, TypeInfoVars),
+        Unify = complicated_unify(Modes, Cat, TypeInfoVars)
+    ).
+
+:- pred rename_generic_call(bool::in, prog_var_renaming::in,
+    generic_call::in, generic_call::out) is det.
+
+rename_generic_call(Must, Subn, Call0, Call) :-
+    (
+        Call0 = higher_order(Var0, Purity, PredOrFunc, Arity),
+        rename_var(Must, Subn, Var0, Var),
+        Call = higher_order(Var, Purity, PredOrFunc, Arity)
+    ;
+        Call0 = class_method(Var0, Method, ClassId, MethodId),
+        rename_var(Must, Subn, Var0, Var),
+        Call = class_method(Var, Method, ClassId, MethodId)
+    ;
+        ( Call0 = event_call(_EventName)
+        ; Call0 = cast(_CastKind)
+        ),
+        Call = Call0
+    ).
+
+rename_vars_in_goal_info(Must, Subn, !GoalInfo) :-
+    !.GoalInfo = goal_info(Detism, InstMapDelta0, NonLocals0, Purity,
+        Features, GoalPath, CodeGenInfo0, ExtraInfo0),
+
+    rename_vars_in_var_set(Must, Subn, NonLocals0, NonLocals),
+    instmap_delta_apply_sub(Must, Subn, InstMapDelta0, InstMapDelta),
+    (
+        CodeGenInfo0 = no_code_gen_info,
+        CodeGenInfo = no_code_gen_info
+    ;
+        CodeGenInfo0 = llds_code_gen_info(LldsInfo0),
+        rename_vars_in_llds_code_gen_info(Must, Subn, LldsInfo0, LldsInfo),
+        CodeGenInfo = llds_code_gen_info(LldsInfo)
+    ),
+
+    ExtraInfo0 = extra_goal_info(Context, HO_Values, MaybeCTGC0, MaybeMCI0),
+    (
+        MaybeCTGC0 = no,
+        MaybeCTGC = no
+    ;
+        MaybeCTGC0 = yes(CTGC0),
+        CTGC0 = ctgc_info(ForwardUse0, BackwardUse0, ReuseDesc0),
+        rename_vars_in_var_set(Must, Subn, ForwardUse0, ForwardUse),
+        rename_vars_in_var_set(Must, Subn, BackwardUse0, BackwardUse),
+        (
+            ( ReuseDesc0 = no_reuse_info
+            ; ReuseDesc0 = missed_reuse(_)
+            ),
+            ReuseDesc = ReuseDesc0
+        ;
+            ReuseDesc0 = potential_reuse(ShortReuseDesc0),
+            rename_vars_in_short_reuse_desc(Must, Subn,
+                ShortReuseDesc0, ShortReuseDesc),
+            ReuseDesc = potential_reuse(ShortReuseDesc)
+        ;
+            ReuseDesc0 = reuse(ShortReuseDesc0),
+            rename_vars_in_short_reuse_desc(Must, Subn,
+                ShortReuseDesc0, ShortReuseDesc),
+            ReuseDesc = reuse(ShortReuseDesc)
+        ),
+        CTGC = ctgc_info(ForwardUse, BackwardUse, ReuseDesc),
+        MaybeCTGC = yes(CTGC)
+    ),
+    (
+        MaybeMCI0 = no,
+        MaybeMCI = no
+    ;
+        MaybeMCI0 = yes(MCI0),
+        MCI0 = mode_constraint_goal_info(Occurring0, Producing0, Consuming0,
+            MakeVisible0, NeedVisible0),
+        rename_vars_in_var_set(Must, Subn, Occurring0, Occurring),
+        rename_vars_in_var_set(Must, Subn, Producing0, Producing),
+        rename_vars_in_var_set(Must, Subn, Consuming0, Consuming),
+        rename_vars_in_var_set(Must, Subn, MakeVisible0, MakeVisible),
+        rename_vars_in_var_set(Must, Subn, NeedVisible0, NeedVisible),
+        MCI = mode_constraint_goal_info(Occurring, Producing, Consuming,
+            MakeVisible, NeedVisible),
+        MaybeMCI = yes(MCI)
+    ),
+    ExtraInfo = extra_goal_info(Context, HO_Values, MaybeCTGC, MaybeMCI),
+
+    !:GoalInfo = goal_info(Detism, InstMapDelta, NonLocals, Purity,
+        Features, GoalPath, CodeGenInfo, ExtraInfo).
+
+:- pred rename_vars_in_short_reuse_desc(bool::in, prog_var_renaming::in,
+    short_reuse_description::in, short_reuse_description::out) is det.
+
+rename_vars_in_short_reuse_desc(Must, Subn, ShortReuseDesc0, ShortReuseDesc) :-
+    (
+        ( ShortReuseDesc0 = cell_died
+        ; ShortReuseDesc0 = reuse_call(_)
+        ),
+        ShortReuseDesc = ShortReuseDesc0
+    ;
+        ShortReuseDesc0 = cell_reused(DeadVar0, IsCond, ConsIds,
+            FieldNeedUpdates),
+        rename_var(Must, Subn, DeadVar0, DeadVar),
+        ShortReuseDesc = cell_reused(DeadVar, IsCond, ConsIds,
+            FieldNeedUpdates)
+    ).
+
+:- pred rename_var_maps(bool::in, prog_var_renaming::in,
+    map(prog_var, T)::in, map(prog_var, T)::out) is det.
+
+rename_var_maps(Must, Subn, Map0, Map) :-
+    map.to_assoc_list(Map0, AssocList0),
+    rename_var_maps_2(Must, Subn, AssocList0, AssocList),
+    map.from_assoc_list(AssocList, Map).
+
+:- pred rename_var_maps_2(bool::in, map(var(V), var(V))::in,
+    assoc_list(var(V), T)::in, assoc_list(var(V), T)::out) is det.
+
+rename_var_maps_2(_Must, _Subn, [], []).
+rename_var_maps_2(Must, Subn, [V - L | Vs], [N - L | Ns]) :-
+    rename_var(Must, Subn, V, N),
+    rename_var_maps_2(Must, Subn, Vs, Ns).
+
+rename_vars_in_var_set(Must, Subn, Vars0, Vars) :-
+    set.to_sorted_list(Vars0, VarsList0),
+    rename_var_list(Must, Subn, VarsList0, VarsList),
+    set.list_to_set(VarsList, Vars).
+
+:- pred rename_var_pair_list(bool::in, prog_var_renaming::in,
+    assoc_list(prog_var, T)::in, list(pair(prog_var, T))::out) is det.
+
+rename_var_pair_list(_Must, _Subn, [], []).
+rename_var_pair_list(Must, Subn, [V - D | VDs], [N - D | NDs]) :-
+    rename_var(Must, Subn, V, N),
+    rename_var_pair_list(Must, Subn, VDs, NDs).
+
+rename_var_list(_Must, _Subn, [], []).
+rename_var_list(Must, Subn, [V | Vs], [N | Ns]) :-
+    rename_var(Must, Subn, V, N),
+    rename_var_list(Must, Subn, Vs, Ns).
+
+rename_var(Must, Subn, V, N) :-
+    ( map.search(Subn, V, N0) ->
+        N = N0
+    ;
+        (
+            Must = no,
+            N = V
+        ;
+            Must = yes,
+            term.var_to_int(V, VInt),
+            string.format("rename_var: no substitute for var %i", [i(VInt)],
+                Msg),
+            unexpected(this_file, Msg)
+        )
+    ).
+
+%-----------------------------------------------------------------------------%
+%
 % Miscellaneous utility procedures for dealing with HLDS goals.
 %
 
@@ -2315,131 +2887,6 @@
     get_pragma_foreign_var_names_2(MaybeNames, !Names).
 
 %-----------------------------------------------------------------------------%
-%
-% Extra goal info.
-%
-
-:- type hlds_goal_extra_info
-    --->    extra_info(
-                extra_info_ho_vals              :: ho_values,
-                extra_info_maybe_ctgc_info      :: maybe(ctgc_info)
-                    % Any information related to structure reuse (CTGC).
-            ).
-
-:- func hlds_goal_extra_info_init = hlds_goal_extra_info.
-
-hlds_goal_extra_info_init = ExtraInfo :-
-    HO_Values = map.init,
-    ExtraInfo = extra_info(HO_Values, no).
-
-goal_info_get_ho_values(GoalInfo) =
-    GoalInfo ^ extra_goal_info ^ extra_info_ho_vals.
-
-goal_info_set_ho_values(Values, !GoalInfo) :-
-    !:GoalInfo = !.GoalInfo ^ extra_goal_info ^ extra_info_ho_vals := Values.
-
-%-----------------------------------------------------------------------------%
-% hlds_goal_reuse_info
-
-:- type ctgc_info
-    --->    ctgc_info(
-                % The local forward use set: this set contains the variables
-                % that are syntactically needed during forward execution.
-                % It is computed as the set of instantiated vars (input vars
-                % + sum(pre_births), minus the set of dead vars
-                % (sum(post_deaths and pre_deaths).
-                % The information is needed for determining the direct reuses.
-                lfu     :: set(prog_var),
-
-                % The local backward use set. This set contains the
-                % instantiated variables that are needed upon backtracking
-                % (i.e. syntactically appearing in any nondet call preceding
-                % this goal).
-                lbu     :: set(prog_var),
-
-                % Any structure reuse information related to this call.
-                reuse   :: reuse_description
-            ).
-
-:- func ctgc_info_init = ctgc_info.
-
-ctgc_info_init = ctgc_info(set.init, set.init, no_reuse_info).
-
-goal_info_get_lfu(GoalInfo) = LFU :-
-    ( goal_info_maybe_get_lfu(GoalInfo, LFU0) ->
-        LFU = LFU0
-    ;
-        unexpected(this_file,
-            "Requesting LFU information while CTGC field not set.")
-    ).
-goal_info_get_lbu(GoalInfo) = LBU :-
-    ( goal_info_maybe_get_lbu(GoalInfo, LBU0) ->
-        LBU = LBU0
-    ;
-        unexpected(this_file,
-            "Requesting LBU information while CTGC field not set.")
-    ).
-goal_info_get_reuse(GoalInfo) = Reuse :-
-    ( goal_info_maybe_get_reuse(GoalInfo, Reuse0) ->
-        Reuse = Reuse0
-    ;
-        unexpected(this_file,
-            "Requesting reuse information while CTGC field not set.")
-    ).
-
-goal_info_maybe_get_lfu(GoalInfo, LFU) :-
-    MaybeCTGC = GoalInfo ^ extra_goal_info ^ extra_info_maybe_ctgc_info,
-    MaybeCTGC = yes(CTGC),
-    LFU = CTGC ^ lfu.
-goal_info_maybe_get_lbu(GoalInfo, LBU) :-
-    MaybeCTGC = GoalInfo ^ extra_goal_info ^ extra_info_maybe_ctgc_info,
-    MaybeCTGC = yes(CTGC),
-    LBU = CTGC ^ lbu.
-goal_info_maybe_get_reuse(GoalInfo, Reuse) :-
-    MaybeCTGC = GoalInfo ^ extra_goal_info ^ extra_info_maybe_ctgc_info,
-    MaybeCTGC = yes(CTGC),
-    Reuse = CTGC ^ reuse.
-
-goal_info_set_lfu(LFU, !GoalInfo) :-
-    MaybeCTGC0 = !.GoalInfo ^ extra_goal_info ^ extra_info_maybe_ctgc_info,
-    (
-        MaybeCTGC0 = yes(CTGC0)
-    ;
-        MaybeCTGC0 = no,
-        CTGC0 = ctgc_info_init
-    ),
-    CTGC = CTGC0 ^ lfu := LFU,
-    MaybeCTGC = yes(CTGC),
-    !:GoalInfo = !.GoalInfo ^ extra_goal_info
-        ^ extra_info_maybe_ctgc_info := MaybeCTGC.
-
-goal_info_set_lbu(LBU, !GoalInfo) :-
-    MaybeCTGC0 = !.GoalInfo ^ extra_goal_info ^ extra_info_maybe_ctgc_info,
-    (
-        MaybeCTGC0 = yes(CTGC0)
-    ;
-        MaybeCTGC0 = no,
-        CTGC0 = ctgc_info_init
-    ),
-    CTGC = CTGC0 ^ lbu := LBU,
-    MaybeCTGC = yes(CTGC),
-    !:GoalInfo = !.GoalInfo ^ extra_goal_info
-        ^ extra_info_maybe_ctgc_info := MaybeCTGC.
-
-goal_info_set_reuse(Reuse, !GoalInfo) :-
-    MaybeCTGC0 = !.GoalInfo ^ extra_goal_info ^ extra_info_maybe_ctgc_info,
-    (
-        MaybeCTGC0 = yes(CTGC0)
-    ;
-        MaybeCTGC0 = no,
-        CTGC0 = ctgc_info_init
-    ),
-    CTGC = CTGC0 ^ reuse := Reuse,
-    MaybeCTGC = yes(CTGC),
-    !:GoalInfo = !.GoalInfo ^ extra_goal_info
-        ^ extra_info_maybe_ctgc_info := MaybeCTGC.
-
-%-----------------------------------------------------------------------------%
 
 :- func this_file = string.
 
Index: compiler/hlds_llds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_llds.m,v
retrieving revision 1.17
diff -u -b -r1.17 hlds_llds.m
--- compiler/hlds_llds.m	6 Jan 2007 09:23:34 -0000	1.17
+++ compiler/hlds_llds.m	1 Aug 2007 06:06:03 -0000
@@ -513,14 +513,15 @@
 goal_info_initialize_liveness_info(PreBirths, PostBirths,
         PreDeaths, PostDeaths, ResumePoint, !GoalInfo) :-
     goal_info_get_code_gen_info(!.GoalInfo, CodeGenInfo0),
-    LLDSInfo0 = get_details(CodeGenInfo0),
-    LLDSInfo = (((((LLDSInfo0
-        ^ pre_births := PreBirths)
-        ^ post_births := PostBirths)
-        ^ pre_deaths := PreDeaths)
-        ^ post_deaths := PostDeaths)
-        ^ resume_point := ResumePoint),
-    CodeGenInfo = llds_code_gen_info(LLDSInfo),
+    some [!LLDSInfo] (
+        !:LLDSInfo = get_details(CodeGenInfo0),
+        !:LLDSInfo = !.LLDSInfo ^ pre_births := PreBirths,
+        !:LLDSInfo = !.LLDSInfo ^ post_births := PostBirths,
+        !:LLDSInfo = !.LLDSInfo ^ pre_deaths := PreDeaths,
+        !:LLDSInfo = !.LLDSInfo ^ post_deaths := PostDeaths,
+        !:LLDSInfo = !.LLDSInfo ^ resume_point := ResumePoint,
+        CodeGenInfo = llds_code_gen_info(!.LLDSInfo)
+    ),
     goal_info_set_code_gen_info(CodeGenInfo, !GoalInfo).
 
 goal_info_set_pre_births(PreBirths, !GoalInfo) :-
@@ -608,8 +609,7 @@
         Resume = resume_point(Vars, Locs)
     ;
         Resume = no_resume_point,
-        unexpected(this_file,
-            "goal_info_resume_vars_and_loc: no resume point")
+        unexpected(this_file, "goal_info_resume_vars_and_loc: no resume point")
     ).
 
 %-----------------------------------------------------------------------------%
Index: compiler/inlining.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/inlining.m,v
retrieving revision 1.154
diff -u -b -r1.154 inlining.m
--- compiler/inlining.m	25 Jun 2007 05:00:33 -0000	1.154
+++ compiler/inlining.m	1 Aug 2007 10:15:27 -0000
@@ -816,7 +816,7 @@
     goal_util.create_variables(CalleeListOfVars,
         CalleeVarSet, CalleeVarTypes,
         VarSet0, VarSet, VarTypes1, VarTypes, Subn0, Subn),
-    goal_util.must_rename_vars_in_goal(Subn, CalledGoal, Goal).
+    must_rename_vars_in_goal(Subn, CalledGoal, Goal).
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/interval.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/interval.m,v
retrieving revision 1.30
diff -u -b -r1.30 interval.m
--- compiler/interval.m	6 Jul 2007 02:35:22 -0000	1.30
+++ compiler/interval.m	1 Aug 2007 09:47:06 -0000
@@ -1170,7 +1170,7 @@
     ( map.is_empty(Subst) ->
         Goal = Goal0
     ;
-        goal_util.rename_some_vars_in_goal(Subst, Goal0, Goal)
+        rename_some_vars_in_goal(Subst, Goal0, Goal)
     ).
 
 :- pred build_headvar_subst(list(prog_var)::in, rename_map::in,
Index: compiler/make_hlds_warn.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make_hlds_warn.m,v
retrieving revision 1.22
diff -u -b -r1.22 make_hlds_warn.m
--- compiler/make_hlds_warn.m	6 Jan 2007 09:23:40 -0000	1.22
+++ compiler/make_hlds_warn.m	1 Aug 2007 07:47:11 -0000
@@ -152,10 +152,9 @@
             Vars = [_ | _]
         ->
             SubGoalVars = free_goal_vars(SubGoal),
-            goal_info_get_context(GoalInfo, Context),
             set.init(EmptySet),
             warn_singletons_goal_vars(Vars, GoalInfo, EmptySet, SubGoalVars,
-                VarSet, Context, PredCallId, !Specs),
+                VarSet, PredCallId, !Specs),
             set.insert_list(QuantVars, Vars, SubQuantVars)
         ;
             SubQuantVars = QuantVars
@@ -172,10 +171,9 @@
             CondVars = free_goal_vars(Cond),
             ThenVars = free_goal_vars(Then),
             set.union(CondVars, ThenVars, CondThenVars),
-            goal_info_get_context(GoalInfo, Context),
             set.init(EmptySet),
             warn_singletons_goal_vars(Vars, GoalInfo, EmptySet, CondThenVars,
-                VarSet, Context, PredCallId, !Specs)
+                VarSet, PredCallId, !Specs)
         ;
             Vars = []
         ),
@@ -189,17 +187,15 @@
     ;
         GoalExpr = plain_call(_, _, Args, _, _, _),
         goal_info_get_nonlocals(GoalInfo, NonLocals),
-        goal_info_get_context(GoalInfo, Context),
         warn_singletons_goal_vars(Args, GoalInfo, NonLocals, QuantVars, VarSet,
-            Context, PredCallId, !Specs)
+            PredCallId, !Specs)
     ;
         GoalExpr = generic_call(GenericCall, Args0, _, _),
         goal_util.generic_call_vars(GenericCall, Args1),
         list.append(Args0, Args1, Args),
         goal_info_get_nonlocals(GoalInfo, NonLocals),
-        goal_info_get_context(GoalInfo, Context),
         warn_singletons_goal_vars(Args, GoalInfo, NonLocals, QuantVars, VarSet,
-            Context, PredCallId, !Specs)
+            PredCallId, !Specs)
     ;
         GoalExpr = unify(Var, RHS, _, _, _),
         warn_singletons_in_unify(Var, RHS, GoalInfo, QuantVars, VarSet,
@@ -260,30 +256,27 @@
 warn_singletons_in_unify(X, rhs_var(Y), GoalInfo, QuantVars, VarSet,
         CallPredId, _, !Specs) :-
     goal_info_get_nonlocals(GoalInfo, NonLocals),
-    goal_info_get_context(GoalInfo, Context),
     warn_singletons_goal_vars([X, Y], GoalInfo, NonLocals, QuantVars,
-        VarSet, Context, CallPredId, !Specs).
+        VarSet, CallPredId, !Specs).
 warn_singletons_in_unify(X, rhs_functor(_ConsId, _, Vars), GoalInfo,
         QuantVars, VarSet, CallPredId, _, !Specs) :-
     goal_info_get_nonlocals(GoalInfo, NonLocals),
-    goal_info_get_context(GoalInfo, Context),
     warn_singletons_goal_vars([X | Vars], GoalInfo, NonLocals, QuantVars,
-        VarSet, Context, CallPredId, !Specs).
+        VarSet, CallPredId, !Specs).
 warn_singletons_in_unify(X, rhs_lambda_goal(_Purity, _PredOrFunc, _Eval,
         _NonLocals, LambdaVars, _Modes, _Det, LambdaGoal),
         GoalInfo, QuantVars, VarSet, CallPredId, ModuleInfo, !Specs) :-
     % Warn if any lambda-quantified variables occur only in the quantifier.
     LambdaGoal = hlds_goal(_, LambdaGoalInfo),
     goal_info_get_nonlocals(LambdaGoalInfo, LambdaNonLocals),
-    goal_info_get_context(GoalInfo, Context),
     warn_singletons_goal_vars(LambdaVars, GoalInfo, LambdaNonLocals, QuantVars,
-        VarSet, Context, CallPredId, !Specs),
+        VarSet, CallPredId, !Specs),
 
     % Warn if X (the variable we're unifying the lambda expression with)
     % is singleton.
     goal_info_get_nonlocals(GoalInfo, NonLocals),
     warn_singletons_goal_vars([X], GoalInfo, NonLocals, QuantVars,
-        VarSet, Context, CallPredId, !Specs),
+        VarSet, CallPredId, !Specs),
 
     % Warn if the lambda-goal contains singletons.
     warn_singletons_in_goal(LambdaGoal, QuantVars, VarSet, CallPredId,
@@ -299,12 +292,11 @@
     % Omit the warning if GoalInfo says we should.
     %
 :- pred warn_singletons_goal_vars(list(prog_var)::in, hlds_goal_info::in,
-    set(prog_var)::in, set(prog_var)::in, prog_varset::in,
-    prog_context::in, simple_call_id::in,
+    set(prog_var)::in, set(prog_var)::in, prog_varset::in, simple_call_id::in,
     list(error_spec)::in, list(error_spec)::out) is det.
 
 warn_singletons_goal_vars(GoalVars, GoalInfo, NonLocals, QuantVars, VarSet,
-        Context, PredOrFuncCallId, !Specs) :-
+        PredOrFuncCallId, !Specs) :-
     % Find all the variables in the goal that don't occur outside the goal
     % (i.e. are singleton), have a variable name that doesn't start with "_"
     % or "DCG_", and don't have the same name as any variable in QuantVars
@@ -335,7 +327,8 @@
             SinglesPieces = [words("warning: variables"), SingleVarsPiece,
                 words("occur only once in this scope."), nl]
         ),
-        SinglesMsg = simple_msg(Context,
+        goal_info_get_context(GoalInfo, Context1),
+        SinglesMsg = simple_msg(Context1,
             [option_is_set(warn_singleton_vars, yes,
                 [always(SinglesPreamble ++ SinglesPieces)])]),
         SingleSeverity = severity_conditional(warn_singleton_vars, yes,
@@ -365,7 +358,8 @@
             MultiPieces = [words("warning: variables"), MultiVarsPiece,
                 words("ccur more than once in this scope."), nl]
         ),
-        MultiMsg = simple_msg(Context,
+        goal_info_get_context(GoalInfo, Context2),
+        MultiMsg = simple_msg(Context2,
             [option_is_set(warn_singleton_vars, yes,
                 [always(MultiPreamble ++ MultiPieces)])]),
         MultiSeverity = severity_conditional(warn_singleton_vars, yes,
Index: compiler/quantification.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/quantification.m,v
retrieving revision 1.118
diff -u -b -r1.118 quantification.m
--- compiler/quantification.m	6 Jul 2007 02:35:22 -0000	1.118
+++ compiler/quantification.m	1 Aug 2007 10:14:00 -0000
@@ -273,8 +273,7 @@
 implicitly_quantify_goal_quant_info(Goal0, Goal, !Info) :-
     Goal0 = hlds_goal(GoalExpr0, GoalInfo0),
     get_seen(!.Info, SeenVars),
-    goal_info_get_context(GoalInfo0, Context),
-    implicitly_quantify_goal_quant_info_2(GoalExpr0, GoalExpr1, Context,
+    implicitly_quantify_goal_quant_info_2(GoalExpr0, GoalExpr1, GoalInfo0,
         !Info),
     get_nonlocals(!.Info, NonLocalVars),
     get_nonlocals_to_recompute(!.Info, NonLocalsToRecompute),
@@ -323,11 +322,15 @@
     % doesn't, so we don't.)  Thus we replace `scope(exist_quant(Vars), Goal0)'
     % with an empty quantifier `scope(exist_quant([]), Goal)'.
     %
+    % We pass GoalInfo0 to allow warnings to have the proper context. We don't
+    % pass the context itself to avoid the work of extracting the context from
+    % goal_infos in the usual (no warning) case.
+    %
 :- pred implicitly_quantify_goal_quant_info_2(
-    hlds_goal_expr::in, hlds_goal_expr::out, prog_context::in,
+    hlds_goal_expr::in, hlds_goal_expr::out, hlds_goal_info::in,
     quant_info::in, quant_info::out) is det.
 
-implicitly_quantify_goal_quant_info_2(Expr0, Expr, Context, !Info) :-
+implicitly_quantify_goal_quant_info_2(Expr0, Expr, GoalInfo0, !Info) :-
     Expr0 = scope(Reason0, Goal0),
     (
         Reason0 = exist_quant(Vars0),
@@ -369,13 +372,13 @@
         Vars = Vars0,
         Reason = Reason1
     ;
+        goal_info_get_context(GoalInfo0, Context),
         warn_overlapping_scope(RenameVars, Context, !Info),
         rename_apart(RenameVars, RenameMap, Goal0, Goal1, !Info),
-        goal_util.rename_var_list(no, RenameMap, Vars0, Vars),
+        rename_var_list(no, RenameMap, Vars0, Vars),
         (
             Reason1 = promise_solutions(PromiseVars0, Kind),
-            goal_util.rename_var_list(no, RenameMap,
-                PromiseVars0, PromiseVars),
+            rename_var_list(no, RenameMap, PromiseVars0, PromiseVars),
             Reason = promise_solutions(PromiseVars, Kind)
         ;
             Reason1 = exist_quant(_),
@@ -444,7 +447,7 @@
     set_outside(OutsideVars, !Info),
     set_quant_vars(QuantVars, !Info).
 
-implicitly_quantify_goal_quant_info_2(Expr0, Expr, Context, !Info) :-
+implicitly_quantify_goal_quant_info_2(Expr0, Expr, GoalInfo0, !Info) :-
     Expr0 = if_then_else(Vars0, Cond0, Then0, Else0),
     % After this pass, explicit quantifiers are redundant, since all variables
     % which were explicitly quantified have been renamed apart. So we don't
@@ -465,10 +468,11 @@
         Then1 = Then0,
         Vars = Vars0
     ;
+        goal_info_get_context(GoalInfo0, Context),
         warn_overlapping_scope(RenameVars, Context, !Info),
         rename_apart(RenameVars, RenameMap, Cond0, Cond1, !Info),
-        goal_util.rename_some_vars_in_goal(RenameMap, Then0, Then1),
-        goal_util.rename_var_list(no, RenameMap, Vars0, Vars)
+        rename_some_vars_in_goal(RenameMap, Then0, Then1),
+        rename_var_list(no, RenameMap, Vars0, Vars)
     ),
     insert_list(QuantVars, Vars, QuantVars1),
     get_nonlocals_to_recompute(!.Info, NonLocalsToRecompute),
@@ -510,7 +514,7 @@
     list.append(ArgVars0, CallArgVars, ArgVars),
     implicitly_quantify_atomic_goal(ArgVars, !Info).
 
-implicitly_quantify_goal_quant_info_2(Expr0, Expr, Context, !Info) :-
+implicitly_quantify_goal_quant_info_2(Expr0, Expr, GoalInfo0, !Info) :-
     Expr0 = unify(Var, UnifyRHS0, Mode, Unification0, UnifyContext),
     get_outside(!.Info, OutsideVars),
     get_lambda_outside(!.Info, LambdaOutsideVars),
@@ -548,7 +552,7 @@
         MaybeSizeVar = no,
         MaybeRegionVar = no
     ),
-    implicitly_quantify_unify_rhs(MaybeSetArgs, Context, UnifyRHS0, UnifyRHS,
+    implicitly_quantify_unify_rhs(MaybeSetArgs, GoalInfo0, UnifyRHS0, UnifyRHS,
         Unification0, Unification, !Info),
     Expr = unify(Var, UnifyRHS, Mode, Unification, UnifyContext),
     get_nonlocals(!.Info, VarsUnifyRHS),
@@ -588,17 +592,17 @@
     list.append(Vars, ExtraVars, AllVars),
     implicitly_quantify_atomic_goal(AllVars, !Info).
 
-implicitly_quantify_goal_quant_info_2(Expr0, Expr, Context, !Info) :-
+implicitly_quantify_goal_quant_info_2(Expr0, Expr, GoalInfo0, !Info) :-
     Expr0 = shorthand(ShorthandGoal),
-    implicitly_quantify_goal_quant_info_2_shorthand(ShorthandGoal, Context,
-        Expr, !Info).
+    implicitly_quantify_goal_quant_info_2_shorthand(ShorthandGoal, Expr,
+        GoalInfo0, !Info).
 
 :- pred implicitly_quantify_goal_quant_info_2_shorthand(
-    shorthand_goal_expr::in, prog_context::in, hlds_goal_expr::out,
+    shorthand_goal_expr::in, hlds_goal_expr::out, hlds_goal_info::in,
     quant_info::in, quant_info::out) is det.
 
 implicitly_quantify_goal_quant_info_2_shorthand(bi_implication(LHS0, RHS0),
-        Context, GoalExpr, !Info) :-
+        GoalExpr, OldGoalInfo, !Info) :-
 
     % Get the initial values of various settings.
     get_quant_vars(!.Info, QuantVars0),
@@ -661,6 +665,7 @@
     % ===>
     %   (not (LHS, not RHS)), (not (RHS, not LHS))
 
+    goal_info_get_context(OldGoalInfo, Context),
     goal_info_init(GoalInfo0),
     goal_info_set_context(Context, GoalInfo0, GoalInfo1),
     set_goal_nonlocals(LHS_NonLocalVars, GoalInfo1, LHS_GI, !Info),
@@ -697,9 +702,9 @@
     union(NonLocals1, NonLocals2, NonLocals),
     set_nonlocals(NonLocals, !Info).
 
-:- pred implicitly_quantify_unify_rhs(maybe(list(bool))::in, prog_context::in,
-    unify_rhs::in, unify_rhs::out, unification::in, unification::out,
-    quant_info::in, quant_info::out) is det.
+:- pred implicitly_quantify_unify_rhs(maybe(list(bool))::in,
+    hlds_goal_info::in, unify_rhs::in, unify_rhs::out,
+    unification::in, unification::out, quant_info::in, quant_info::out) is det.
 
 implicitly_quantify_unify_rhs(_, _, !RHS, !Unification, !Info) :-
     !.RHS = rhs_var(X),
@@ -720,7 +725,7 @@
         Vars = list_to_set(ArgVars)
     ),
     set_nonlocals(Vars, !Info).
-implicitly_quantify_unify_rhs(_, Context, !RHS, !Unification, !Info) :-
+implicitly_quantify_unify_rhs(_, GoalInfo0, !RHS, !Unification, !Info) :-
     !.RHS = rhs_lambda_goal(Purity, PredOrFunc, EvalMethod,
         LambdaNonLocals0, LambdaVars0, Modes, Det, Goal0),
 
@@ -737,6 +742,7 @@
     ( empty(RenameVars0) ->
         true
     ;
+        goal_info_get_context(GoalInfo0, Context),
         warn_overlapping_scope(RenameVars0, Context, !Info)
     ),
     % We need to rename apart any of the lambda vars that we have already seen,
@@ -746,7 +752,7 @@
 
     union(RenameVars0, RenameVars1, RenameVars),
     rename_apart(RenameVars, RenameMap, Goal0, Goal1, !Info),
-    goal_util.rename_var_list(no, RenameMap, LambdaVars0, LambdaVars),
+    rename_var_list(no, RenameMap, LambdaVars0, LambdaVars),
 
     % Quantified variables cannot be pushed inside a lambda goal,
     % so we insert the quantified vars into the outside vars set,
@@ -1373,7 +1379,7 @@
         map.init(RenameMap0),
         goal_util.create_variables(RenameList, Varset0, VarTypes0,
             Varset0, Varset, VarTypes0, VarTypes, RenameMap0, RenameMap),
-        goal_util.rename_some_vars_in_goal(RenameMap, !Goal),
+        rename_some_vars_in_goal(RenameMap, !Goal),
         set_varset(Varset, !Info),
         set_vartypes(VarTypes, !Info)
 
Index: compiler/structure_reuse.domain.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_reuse.domain.m,v
retrieving revision 1.7
diff -u -b -r1.7 structure_reuse.domain.m
--- compiler/structure_reuse.domain.m	19 Jan 2007 07:04:31 -0000	1.7
+++ compiler/structure_reuse.domain.m	1 Aug 2007 10:27:45 -0000
@@ -17,7 +17,7 @@
 :- module transform_hlds.ctgc.structure_reuse.domain.
 :- interface.
 
-:- import_module hlds.goal_util.
+:- import_module hlds.hlds_goal.
 :- import_module hlds.hlds_module.
 :- import_module hlds.hlds_pred.
 :- import_module parse_tree.prog_data.
Index: compiler/structure_sharing.domain.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_sharing.domain.m,v
retrieving revision 1.20
diff -u -b -r1.20 structure_sharing.domain.m
--- compiler/structure_sharing.domain.m	19 Jan 2007 07:04:31 -0000	1.20
+++ compiler/structure_sharing.domain.m	1 Aug 2007 10:28:33 -0000
@@ -38,6 +38,7 @@
 %     to any existing sharing.
 % 
 % Additional operations:
+%
 %   * extend_datastruct: compute the set of datastructures referring to the
 %     same memory space as a given datastructure, using sharing information;
 %     needed by the reuse analysis to check whether a given datastructure is
@@ -51,7 +52,6 @@
 :- module transform_hlds.ctgc.structure_sharing.domain.
 :- interface.
 
-:- import_module hlds.goal_util.
 :- import_module hlds.hlds_goal.
 :- import_module hlds.hlds_module.
 :- import_module hlds.hlds_pred.
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
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/fixed
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_allegro
cvs diff: Diffing extras/graphics/mercury_allegro/examples
cvs diff: Diffing extras/graphics/mercury_allegro/samples
cvs diff: Diffing extras/graphics/mercury_allegro/samples/demo
cvs diff: Diffing extras/graphics/mercury_allegro/samples/mandel
cvs diff: Diffing extras/graphics/mercury_allegro/samples/pendulum2
cvs diff: Diffing extras/graphics/mercury_allegro/samples/speed
cvs diff: Diffing extras/graphics/mercury_glut
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/gears
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/log4m
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/mopenssl
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/net
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/posix/samples
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/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
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/c_interface/standalone_c
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/solver_types
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 slice
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/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
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 messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list