[m-rev.] for review: ho_inst_info clarification

Mark Brown mark at mercurylang.org
Sun Nov 8 21:21:43 AEDT 2015


Hi,

I've gone through all of the uses of ho_inst_info 'none' in the
compiler and identified places I suspect may be a problem, and marked
them with an XXX comment. I haven't tried to fix anything in this
change; I'll look at fixing inst_match.m, inst_util.m and
modecheck_unify.m in separate changes. The problems in inst_match.m
look to be responsible for mantis bug 264.

The XXX comments in compiler/float_regs.m are for review by Peter.

Suggestions welcome for an alternative to the new name none_or_standard_func.

Cheers,
Mark.
-------------- next part --------------
Change 'none' to 'none_or_standard_func' in ho_inst_info. This value
is used for first-order values as well as for functions that have the
standard inst, and the new name better reflects that.

Places using this value have been checked for correctness. Issues that
need to be looked at have been marked with XXX, although have not been
addressed in this change.

compiler/prog_data.m:
	Update the type.

compiler/inst_match.m:
	Add XXX comments. This module needs to check for non-standard
	function insts in a bunch of places.

compiler/inst_util.m:
	Add XXX comments. We lose information about non-standard function
	insts when merging bound and any. The information needs to be
	either preserved or disallowed entirely.

compiler/float_regs.m:
	Add XXX comments. This module may miss cases involving standard
	function insts.

compiler/modecheck_unify.m:
	Add XXX comment. We should exclude pred and non-standard func
	lambda non-locals from becoming locked, an addition to standard
	functions.

compiler/*.m:
	No special handling is required for other modules.

-------------- next part --------------
diff --git a/compiler/accumulator.m b/compiler/accumulator.m
index ad9283a..da37fcd 100644
--- a/compiler/accumulator.m
+++ b/compiler/accumulator.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 1999-2000,2002-2007, 2009-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -1521,7 +1522,7 @@ acc_proc_info(Accs0, VarSet, VarTypes, Substs, OrigProcInfo,
     % than it should be. ie int_const(1) when it should be any integer.
     % However this will no longer handle partially instantiated data
     % structures.
-    Inst = ground(shared, none),
+    Inst = ground(shared, none_or_standard_func),
     inst_lists_to_mode_list([Inst], [Inst], Mode),
     list.duplicate(list.length(Accs), list.det_head(Mode), AccModes),
     HeadModes = AccModes ++ HeadModes0,
diff --git a/compiler/add_pred.m b/compiler/add_pred.m
index ec0edde..4346d81 100644
--- a/compiler/add_pred.m
+++ b/compiler/add_pred.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 1993-2012,2014 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -294,7 +295,7 @@ add_builtin(PredId, Types, CompilationTarget, !PredInfo) :-
         ExtraTypes = [int_type],
 
         Free = free,
-        Ground = ground(shared, none),
+        Ground = ground(shared, none_or_standard_func),
         ConsId = int_const(0),
         LHS = ZeroVar,
         RHS = rhs_functor(ConsId, is_not_exist_constr, []),
diff --git a/compiler/coverage_profiling.m b/compiler/coverage_profiling.m
index 8eae30f..2f81998 100644
--- a/compiler/coverage_profiling.m
+++ b/compiler/coverage_profiling.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 2001-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -1155,7 +1156,7 @@ make_coverage_point(CPOptions, CoveragePointInfo, Goals, !CoverageInfo) :-
 
     UseCalls = CPOptions ^ cpo_use_calls,
     ModuleInfo = !.CoverageInfo ^ ci_module_info,
-    Ground = ground(shared, none),
+    Ground = ground(shared, none_or_standard_func),
     DataType = CPOptions ^ cpo_dynamic_coverage,
     (
         DataType = dynamic_coverage_data,
diff --git a/compiler/deep_profiling.m b/compiler/deep_profiling.m
index f4acfe1..4f3b594 100644
--- a/compiler/deep_profiling.m
+++ b/compiler/deep_profiling.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 2001-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -1804,7 +1805,7 @@ generate_deep_call(ModuleInfo, Name, Arity, ArgVars, MaybeOutputVars, Detism,
     Goal = hlds_goal(GoalExpr, GoalInfo).
 
 generate_deep_const_unify(ConsId, Var, Goal) :-
-    Ground = ground(shared, none),
+    Ground = ground(shared, none_or_standard_func),
     NonLocals = set_of_var.make_singleton(Var),
     InstMapDelta = instmap_delta_bind_var(Var),
     Determinism = detism_det,
@@ -1822,7 +1823,7 @@ generate_deep_const_unify(ConsId, Var, Goal) :-
     prog_var::in, hlds_goal::out) is det.
 
 generate_deep_cell_unify(Length, ConsId, Args, Var, Goal) :-
-    Ground = ground(shared, none),
+    Ground = ground(shared, none_or_standard_func),
     NonLocals = set_of_var.list_to_set([Var | Args]),
     InstMapDelta = instmap_delta_bind_var(Var),
     Determinism = detism_det,
diff --git a/compiler/dep_par_conj.m b/compiler/dep_par_conj.m
index d7633ad..21de11c 100644
--- a/compiler/dep_par_conj.m
+++ b/compiler/dep_par_conj.m
@@ -1733,7 +1733,8 @@ replace_head_vars(ModuleInfo, FutureMap,
         ( mode_is_input(ModuleInfo, Mode0) ->
             Mode = Mode0
         ; mode_is_output(ModuleInfo, Mode0) ->
-            Mode = (ground(shared, none) -> ground(shared, none))
+            Ground = ground(shared, none_or_standard_func),
+            Mode = (Ground -> Ground)
         ;
             sorry($module, $pred,
                 "dependent parallel conjunction transformation " ++
@@ -3178,7 +3179,7 @@ make_future_name_var_and_goal(Name, FutureNameVar, Goal, !VarSet, !VarTypes,
     IntType = builtin_type(builtin_type_int),
     add_var_type(FutureNameVar, IntType, !VarTypes),
     allocate_ts_string(Name, NameId, !TSStringTable),
-    Ground = ground(unique, none),
+    Ground = ground(unique, none_or_standard_func),
     GoalExpr = unify(FutureNameVar,
         rhs_functor(int_const(NameId), is_not_exist_constr, []),
         (free(IntType) -> Ground) - (Ground -> Ground),
diff --git a/compiler/distance_granularity.m b/compiler/distance_granularity.m
index 129007c..1553e51 100644
--- a/compiler/distance_granularity.m
+++ b/compiler/distance_granularity.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 2006-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -706,7 +707,8 @@ apply_dg_to_else2(!GoalExpr, !IndexInConj, GranularityVar, CallerPredId,
                         MinusCallSymName),
                     set_of_var.list_to_set([GranularityVar, Var, VarResult],
                         NonLocals),
-                    VarResultDelta = VarResult - ground(unique, none),
+                    VarResultDelta =
+                        VarResult - ground(unique, none_or_standard_func),
                     VarDelta = Var - bound(shared, inst_test_results_fgtc,
                         [bound_functor(int_const(1), [])]),
                     InstMapDeltaDecrement = instmap_delta_from_assoc_list(
@@ -734,7 +736,7 @@ apply_dg_to_else2(!GoalExpr, !IndexInConj, GranularityVar, CallerPredId,
                     GoalExpr = plain_call(CalleePredId, CalleeProcId, CallArgs,
                         CallBuiltin, CallUnifyContext, CallSymName),
                     InstMapDelta0 = goal_info_get_instmap_delta(GoalInfo0),
-                    MerInst = ground(shared, none),
+                    MerInst = ground(shared, none_or_standard_func),
                     instmap_delta_insert_var(Var, MerInst,
                         InstMapDelta0, InstMapDelta),
                     goal_info_set_instmap_delta(InstMapDelta, GoalInfo0,
@@ -988,7 +990,7 @@ update_original_predicate_plain_call(!Goal, CallerPredId, CallerProcId,
         set_of_var.insert(Var, NonLocals0, NonLocals),
         goal_info_set_nonlocals(NonLocals, CallInfo0, CallInfo1),
         InstMapDelta0 = goal_info_get_instmap_delta(CallInfo1),
-        MerInst = ground(shared, none),
+        MerInst = ground(shared, none_or_standard_func),
         instmap_delta_insert_var(Var, MerInst, InstMapDelta0, InstMapDelta),
         goal_info_set_instmap_delta(InstMapDelta, CallInfo1, CallInfo),
         Call = hlds_goal(CallExpr, CallInfo),
diff --git a/compiler/equiv_type_hlds.m b/compiler/equiv_type_hlds.m
index 364a723..4736b3b 100644
--- a/compiler/equiv_type_hlds.m
+++ b/compiler/equiv_type_hlds.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 2003-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -851,8 +852,8 @@ replace_in_inst(TypeEqvMap, Inst0, Inst, Changed, !TVarSet, !Cache) :-
 type_may_occur_in_inst(Inst) = MayOccur :-
     (
         ( Inst = free
-        ; Inst = ground(_, none)
-        ; Inst = any(_, none)
+        ; Inst = ground(_, none_or_standard_func)
+        ; Inst = any(_, none_or_standard_func)
         ; Inst = not_reached
         ; Inst = inst_var(_)
         ),
@@ -1050,8 +1051,8 @@ record_inst_may_occur(_, _) :-
 replace_in_inst_2(TypeEqvMap, Inst0, Inst, Changed, !TVarSet, !Cache) :-
     (
         ( Inst0 = free
-        ; Inst0 = ground(_, none)
-        ; Inst0 = any(_, none)
+        ; Inst0 = ground(_, none_or_standard_func)
+        ; Inst0 = any(_, none_or_standard_func)
         ; Inst0 = not_reached
         ; Inst0 = inst_var(_)
         ),
diff --git a/compiler/erl_code_gen.m b/compiler/erl_code_gen.m
index a4a7e90..3dc0bb4 100644
--- a/compiler/erl_code_gen.m
+++ b/compiler/erl_code_gen.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 2007-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -1014,7 +1015,7 @@ ground_var_in_instmap(Var, !InstMap) :-
     % not bound before the place where the success expression will be
     % inserted).  For our purposes it doesn't matter what insts these variables
     % have, other than not being free, so we just use `ground'.
-    instmap_set_var(Var, ground(shared, none), !InstMap).
+    instmap_set_var(Var, ground(shared, none_or_standard_func), !InstMap).
 
 %-----------------------------------------------------------------------------%
 %
diff --git a/compiler/float_regs.m b/compiler/float_regs.m
index 6a18dec..746f2ec 100644
--- a/compiler/float_regs.m
+++ b/compiler/float_regs.m
@@ -379,8 +379,11 @@ add_arg_regs_in_inst(ModuleInfo, Seen0, Type, Inst0, Inst) :-
             )
         )
     ;
-        ( Inst0 = ground(_, none)
-        ; Inst0 = any(_, none)
+        % XXX handle functions with standard mode. If they have float
+        % arguments, we may need to include include the pred_inst_info
+        % even though they are standard.
+        ( Inst0 = ground(_, none_or_standard_func)
+        ; Inst0 = any(_, none_or_standard_func)
         ; Inst0 = free
         ; Inst0 = free(_)
         ; Inst0 = not_reached
@@ -953,10 +956,12 @@ rebuild_cell_inst(ModuleInfo, InstMap, ConsId, Args, Inst0, Inst) :-
         Inst = constrained_inst_vars(InstVarSet, SpecInst)
     ;
         % XXX do we need to handle any of these other cases?
+        % XXX handle functions with standard mode: look for pred_inst_info
+        % for the called proc if ConsId is a closure.
         ( Inst0 = free
         ; Inst0 = free(_)
-        ; Inst0 = any(_, none)
-        ; Inst0 = ground(_, none)
+        ; Inst0 = any(_, none_or_standard_func)
+        ; Inst0 = ground(_, none_or_standard_func)
         ; Inst0 = not_reached
         ; Inst0 = defined_inst(_)
         ),
diff --git a/compiler/format_call.m b/compiler/format_call.m
index f2472e4..6a7a66b 100644
--- a/compiler/format_call.m
+++ b/compiler/format_call.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %---------------------------------------------------------------------------%
 % Copyright (C) 2006-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %---------------------------------------------------------------------------%
@@ -1543,7 +1544,7 @@ replace_string_format_nonempty(ModuleInfo, HeadSpec, TailSpecs,
             only_mode, detism_det, purity_pure,
             [HeadSpecVar, TailSpecsVar, ResultVar], [],
             instmap_delta_from_assoc_list(
-                [ResultVar - ground(unique, none)]),
+                [ResultVar - ground(unique, none_or_standard_func)]),
             ModuleInfo, Context, AppendGoal),
         Goals = TailSpecsGoals ++ HeadSpecGoals ++ [AppendGoal]
     ).
@@ -1608,8 +1609,8 @@ replace_io_format(ModuleInfo, Specs, MaybeStreamVar, IOInVar, IOOutVar,
     (
         Specs = [],
         Unification = assign(IOOutVar, IOInVar),
-        Uniq = ground(unique, none),
-        Clobbered = ground(clobbered, none),
+        Uniq = ground(unique, none_or_standard_func),
+        Clobbered = ground(clobbered, none_or_standard_func),
         UniMode = ((free -> Uniq) - (Uniq -> Clobbered)),
         UnifyMainContext = umc_implicit("replace_io_format"),
         UnifyContext = unify_context(UnifyMainContext, []),
@@ -1748,7 +1749,7 @@ represent_spec(ModuleInfo, Spec, MaybeResultVar, ResultVar, Goals, Context,
             pf_predicate, only_mode, detism_det, purity_pure,
             [FlagsVar] ++ WidthVars ++ [ValueVar, ResultVar], [],
             instmap_delta_from_assoc_list(
-                [ResultVar - ground(unique, none)]),
+                [ResultVar - ground(unique, none_or_standard_func)]),
             ModuleInfo, Context, CallGoal),
         Goals = FlagsGoals ++ WidthGoals ++ [CallGoal]
     ;
@@ -1767,7 +1768,7 @@ represent_spec(ModuleInfo, Spec, MaybeResultVar, ResultVar, Goals, Context,
             pf_predicate, only_mode, detism_det, purity_pure,
             [FlagsVar] ++ WidthVars ++ PrecVars ++ [ValueVar, ResultVar], [],
             instmap_delta_from_assoc_list(
-                [ResultVar - ground(unique, none)]),
+                [ResultVar - ground(unique, none_or_standard_func)]),
             ModuleInfo, Context, CallGoal),
         Goals = FlagsGoals ++ WidthGoals ++ PrecGoals ++ [CallGoal]
     ;
@@ -1786,7 +1787,7 @@ represent_spec(ModuleInfo, Spec, MaybeResultVar, ResultVar, Goals, Context,
             pf_predicate, only_mode, detism_det, purity_pure,
             [FlagsVar] ++ WidthVars ++ PrecVars ++ [ValueVar, ResultVar], [],
             instmap_delta_from_assoc_list(
-                [ResultVar - ground(unique, none)]),
+                [ResultVar - ground(unique, none_or_standard_func)]),
             ModuleInfo, Context, CallGoal),
         Goals = FlagsGoals ++ WidthGoals ++ PrecGoals ++ [CallGoal]
     ;
@@ -1807,7 +1808,7 @@ represent_spec(ModuleInfo, Spec, MaybeResultVar, ResultVar, Goals, Context,
             [FlagsVar] ++ WidthVars ++ PrecVars ++
                 [BaseVar, ValueVar, ResultVar], [],
             instmap_delta_from_assoc_list(
-                [ResultVar - ground(unique, none)]),
+                [ResultVar - ground(unique, none_or_standard_func)]),
             ModuleInfo, Context, CallGoal),
         Goals = FlagsGoals ++ WidthGoals ++ PrecGoals ++ [BaseGoal, CallGoal]
     ;
@@ -1828,7 +1829,7 @@ represent_spec(ModuleInfo, Spec, MaybeResultVar, ResultVar, Goals, Context,
             [FlagsVar] ++ WidthVars ++ PrecVars ++
                 [KindVar, ValueVar, ResultVar], [],
             instmap_delta_from_assoc_list(
-                [ResultVar - ground(unique, none)]),
+                [ResultVar - ground(unique, none_or_standard_func)]),
             ModuleInfo, Context, CallGoal),
         Goals = FlagsGoals ++ WidthGoals ++ PrecGoals ++ [KindGoal, CallGoal]
     ).
@@ -2076,8 +2077,8 @@ make_result_var_if_needed(MaybeResultVar, ResultVar, !VarSet, !VarTypes) :-
     instmap_delta::out) is det.
 
 make_di_uo_instmap_delta(InVar, OutVar, InstMapDelta) :-
-    Uniq = ground(unique, none),
-    Clobbered = ground(clobbered, none),
+    Uniq = ground(unique, none_or_standard_func),
+    Clobbered = ground(clobbered, none_or_standard_func),
     InstMapDelta = instmap_delta_from_assoc_list(
         [InVar - Clobbered, OutVar - Uniq]).
 
diff --git a/compiler/higher_order.m b/compiler/higher_order.m
index f85b584..d5e5446 100644
--- a/compiler/higher_order.m
+++ b/compiler/higher_order.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 1996-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -1182,7 +1183,7 @@ get_typeclass_info_args_2(TypeClassInfoVar, PredId, ProcId, SymName,
 
     set_of_var.list_to_set(CallArgs, NonLocals),
     instmap_delta_init_reachable(InstMapDelta0),
-    instmap_delta_insert_var(ResultVar, ground(shared, none),
+    instmap_delta_insert_var(ResultVar, ground(shared, none_or_standard_func),
         InstMapDelta0, InstMapDelta),
     goal_info_init(NonLocals, InstMapDelta, detism_det, purity_pure, GoalInfo),
     CallGoalExpr = plain_call(PredId, ProcId, CallArgs, not_builtin,
@@ -2549,8 +2550,8 @@ unwrap_no_tag_arg(OuterType, WrappedType, Context, Constructor, Arg,
     proc_info_create_var_from_type(WrappedType, no, UnwrappedArg, !ProcInfo),
     type_to_ctor_det(OuterType, OuterTypeCtor),
     ConsId = cons(Constructor, 1, OuterTypeCtor),
-    UniModes = [(ground(shared, none) - free) ->
-        (ground(shared, none) - ground(shared, none))],
+    Ground = ground(shared, none_or_standard_func),
+    UniModes = [(Ground - free) -> (Ground - Ground)],
     set_of_var.list_to_set([Arg, UnwrappedArg], NonLocals),
     % This will be recomputed later.
     InstMapDelta = instmap_delta_bind_var(UnwrappedArg),
@@ -3248,7 +3249,7 @@ construct_higher_order_terms(ModuleInfo, HeadVars0, NewHeadVars, ArgModes0,
             NonCurriedArgModes, arg_reg_types_unset, ProcDetism))
     else
         in_mode(InMode),
-        GroundInstInfo = none,
+        GroundInstInfo = none_or_standard_func,
         list.duplicate(NumArgs, InMode, CurriedArgModes1)
     ),
 
diff --git a/compiler/hlds_code_util.m b/compiler/hlds_code_util.m
index 57a31c0..e3bc737 100644
--- a/compiler/hlds_code_util.m
+++ b/compiler/hlds_code_util.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 2002-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -465,8 +466,8 @@ match_insts_with_renaming(ModuleInfo, InstA, InstB, Renaming) :-
 match_ho_inst_infos_with_renaming(ModuleInfo, HOInstInfoA, HOInstInfoB,
         Renaming) :-
     (
-        HOInstInfoA = none,
-        HOInstInfoB = none,
+        HOInstInfoA = none_or_standard_func,
+        HOInstInfoB = none_or_standard_func,
         Renaming = map.init
     ;
         HOInstInfoA = higher_order(PredInstInfoA),
diff --git a/compiler/hlds_out_mode.m b/compiler/hlds_out_mode.m
index 6ee543c..dfe5132 100644
--- a/compiler/hlds_out_mode.m
+++ b/compiler/hlds_out_mode.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 2009-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -198,7 +199,7 @@ inst_to_term_with_context(Lang, Context, Inst) = Term :-
             Term = any_pred_inst_info_to_term(Lang, Context, Uniq,
                 PredInstInfo)
         ;
-            HOInstInfo = none,
+            HOInstInfo = none_or_standard_func,
             Term = make_atom(Context, any_inst_uniqueness(Uniq))
         )
     ;
@@ -230,7 +231,7 @@ inst_to_term_with_context(Lang, Context, Inst) = Term :-
             Term = ground_pred_inst_info_to_term(Lang, Context, Uniq,
                 PredInstInfo)
         ;
-            HOInstInfo = none,
+            HOInstInfo = none_or_standard_func,
             Term = make_atom(Context, inst_uniqueness(Uniq, "ground"))
         )
     ;
@@ -888,7 +889,7 @@ mercury_format_structured_inst(Suffix, Inst, Indent, Lang, InclAddr,
             mercury_format_any_pred_inst_info(output_debug, InstVarSet,
                 Uniq, PredInstInfo, !U)
         ;
-            HOInstInfo = none,
+            HOInstInfo = none_or_standard_func,
             mercury_format_any_uniqueness(Uniq, !U)
         ),
         add_string(Suffix, !U)
@@ -942,7 +943,7 @@ mercury_format_structured_inst(Suffix, Inst, Indent, Lang, InclAddr,
             mercury_format_ground_pred_inst_info(output_debug, InstVarSet,
                 Uniq, PredInstInfo, !U)
         ;
-            HOInstInfo = none,
+            HOInstInfo = none_or_standard_func,
             mercury_format_uniqueness(Uniq, "ground", !U)
         ),
         add_string(Suffix, !U)
diff --git a/compiler/inst_match.m b/compiler/inst_match.m
index e3330ef..7c7192f 100644
--- a/compiler/inst_match.m
+++ b/compiler/inst_match.m
@@ -508,7 +508,7 @@ inst_matches_initial_4(InstA, InstB, MaybeType, !Info) :-
         InstB = free
     ;
         InstA = bound(UniqA, _InstResultsA, BoundInstsA),
-        InstB = any(UniqB, none),
+        InstB = any(UniqB, none_or_standard_func),
         compare_uniqueness(!.Info ^ imi_uniqueness_comparison, UniqA, UniqB),
         compare_bound_inst_list_uniq(!.Info ^ imi_uniqueness_comparison,
             BoundInstsA, UniqB, !.Info ^ imi_module_info)
@@ -531,7 +531,7 @@ inst_matches_initial_4(InstA, InstB, MaybeType, !Info) :-
         )
     ;
         InstA = bound(UniqA, InstResultsA, BoundInstsA),
-        InstB = ground(UniqB, none),
+        InstB = ground(UniqB, none_or_standard_func),
         compare_uniqueness(!.Info ^ imi_uniqueness_comparison, UniqA, UniqB),
         inst_results_bound_inst_list_is_ground_mt(InstResultsA, BoundInstsA,
             MaybeType, !.Info ^ imi_module_info),
@@ -541,6 +541,7 @@ inst_matches_initial_4(InstA, InstB, MaybeType, !Info) :-
         InstA = bound(Uniq, InstResultsA, BoundInstsA),
         InstB = abstract_inst(_,_),
         Uniq = unique,
+        % XXX check that InstA does not contain non-standard funcs
         inst_results_bound_inst_list_is_ground_mt(InstResultsA, BoundInstsA,
             no, !.Info ^ imi_module_info),
         bound_inst_list_is_unique(BoundInstsA, !.Info ^ imi_module_info)
@@ -548,6 +549,7 @@ inst_matches_initial_4(InstA, InstB, MaybeType, !Info) :-
         InstA = bound(Uniq, InstResultsA, BoundInstsA),
         InstB = abstract_inst(_,_),
         Uniq = mostly_unique,
+        % XXX check that InstA does not contain non-standard funcs
         inst_results_bound_inst_list_is_ground_mt(InstResultsA, BoundInstsA,
             no, !.Info ^ imi_module_info),
         bound_inst_list_is_mostly_unique(BoundInstsA, !.Info ^ imi_module_info)
@@ -577,7 +579,7 @@ inst_matches_initial_4(InstA, InstB, MaybeType, !Info) :-
         ho_inst_info_matches_initial(HOInstInfoA, HOInstInfoB, MaybeType,
             !Info)
     ;
-        InstA = ground(_UniqA, none),
+        InstA = ground(_UniqA, none_or_standard_func),
         InstB = abstract_inst(_,_),
         % I don't know what this should do.
         % Abstract insts aren't really supported.
@@ -585,7 +587,7 @@ inst_matches_initial_4(InstA, InstB, MaybeType, !Info) :-
             "inst_matches_initial(ground, abstract_inst) == ??")
     ;
         InstA = abstract_inst(_,_),
-        InstB = any(shared, none)
+        InstB = any(shared, none_or_standard_func)
     ;
         InstA = abstract_inst(_,_),
         InstB = free
@@ -624,7 +626,8 @@ ground_matches_initial_bound_inst_list(Uniq, [BoundInst | BoundInsts],
 ground_matches_initial_inst_list(_, [], [], !Info).
 ground_matches_initial_inst_list(Uniq, [Inst | Insts],
         [MaybeType | MaybeTypes], !Info) :-
-    inst_matches_initial_mt(ground(Uniq, none), Inst, MaybeType, !Info),
+    Ground = ground(Uniq, none_or_standard_func),
+    inst_matches_initial_mt(Ground, Inst, MaybeType, !Info),
     ground_matches_initial_inst_list(Uniq, Insts, MaybeTypes, !Info).
 
 %-----------------------------------------------------------------------------%
@@ -719,11 +722,11 @@ greater_than_disregard_module_qual(ConsIdA, ConsIdB) :-
 
 ho_inst_info_matches_initial(HOInstInfoA, HOInstInfoB, MaybeType, !Info) :-
     (
-        HOInstInfoB = none,
+        HOInstInfoB = none_or_standard_func,
         not ho_inst_info_is_nonstandard_func_mode(!.Info ^ imi_module_info,
             HOInstInfoA)
     ;
-        HOInstInfoA = none,
+        HOInstInfoA = none_or_standard_func,
         HOInstInfoB = higher_order(PredInstB),
         PredInstB = pred_inst_info(pf_function, ArgModes, _, _Det),
         Arity = list.length(ArgModes),
@@ -852,6 +855,7 @@ compare_bound_inst_list_uniq(uc_instantiated, BoundInsts, Uniq, ModuleInfo) :-
     module_info::in) is semidet.
 
 bound_inst_list_matches_uniq(BoundInsts, Uniq, ModuleInfo) :-
+    % XXX check that BoundsInsts does not contain non-standard funcs
     ( if Uniq = unique then
         bound_inst_list_is_unique(BoundInsts, ModuleInfo)
     else if Uniq = mostly_unique then
@@ -864,6 +868,7 @@ bound_inst_list_matches_uniq(BoundInsts, Uniq, ModuleInfo) :-
     module_info::in) is semidet.
 
 uniq_matches_bound_inst_list(Uniq, BoundInsts, ModuleInfo) :-
+    % XXX check that BoundsInsts does not contain non-standard funcs
     ( if Uniq = shared then
         bound_inst_list_is_not_partly_unique(BoundInsts, ModuleInfo)
     else if Uniq = mostly_unique then
@@ -982,7 +987,7 @@ inst_matches_final_3(InstA, InstB, MaybeType, !Info) :-
         InstB = free
     ;
         InstA = bound(UniqA, InstResultsA, BoundInstsA),
-        InstB = any(UniqB, none),
+        InstB = any(UniqB, none_or_standard_func),
         unique_matches_final(UniqA, UniqB),
         bound_inst_list_matches_uniq(BoundInstsA, UniqB,
             !.Info ^ imi_module_info),
@@ -999,7 +1004,7 @@ inst_matches_final_3(InstA, InstB, MaybeType, !Info) :-
             !Info)
     ;
         InstA = bound(UniqA, InstResultsA, BoundInstsA),
-        InstB = ground(UniqB, none),
+        InstB = ground(UniqB, none_or_standard_func),
         unique_matches_final(UniqA, UniqB),
         inst_results_bound_inst_list_is_ground_mt(InstResultsA, BoundInstsA,
             MaybeType, !.Info ^ imi_module_info),
@@ -1038,7 +1043,7 @@ inst_matches_final_3(InstA, InstB, MaybeType, !Info) :-
         unique_matches_final(UniqA, UniqB)
     ;
         InstA = abstract_inst(_, _),
-        InstB = any(shared, none)
+        InstB = any(shared, none_or_standard_func)
     ;
         InstA = abstract_inst(Name, ArgsA),
         InstB = abstract_inst(Name, ArgsB),
@@ -1064,11 +1069,11 @@ inst_matches_final_3(InstA, InstB, MaybeType, !Info) :-
 
 ho_inst_info_matches_final(HOInstInfoA, HOInstInfoB, MaybeType, !Info) :-
     (
-        HOInstInfoB = none,
+        HOInstInfoB = none_or_standard_func,
         not ho_inst_info_is_nonstandard_func_mode(!.Info ^ imi_module_info,
             HOInstInfoA)
     ;
-        HOInstInfoA = none,
+        HOInstInfoA = none_or_standard_func,
         HOInstInfoB = higher_order(PredInstB),
         PredInstB = pred_inst_info(pf_function, ArgModes, _, _Det),
         Arity = list.length(ArgModes),
@@ -1208,12 +1213,14 @@ inst_matches_binding_3(InstA, InstB, MaybeType, !Info) :-
             !Info)
     ;
         InstA = bound(_UniqA, InstResultsA, BoundInstsA),
-        InstB = ground(_UniqB, none),
+        InstB = ground(_UniqB, none_or_standard_func),
+        % XXX check that InstA does not contain non-standard funcs.
         inst_results_bound_inst_list_is_ground_mt(InstResultsA, BoundInstsA,
             MaybeType, !.Info ^ imi_module_info)
     ;
         InstA = ground(_UniqA, _),
         InstB = bound(_UniqB, InstResultsB, BoundInstsB),
+        % XXX check that InstB does not contain non-standard funcs
         inst_results_bound_inst_list_is_ground_mt(InstResultsB, BoundInstsB,
             MaybeType, !.Info ^ imi_module_info),
         (
@@ -1246,9 +1253,10 @@ inst_matches_binding_3(InstA, InstB, MaybeType, !Info) :-
 ho_inst_info_matches_binding(HOInstInfoA, HOInstInfoB, MaybeType,
         ModuleInfo) :-
     (
-        HOInstInfoB = none
+        % XXX Non-standard funcs should not match-binding with standard ones.
+        HOInstInfoB = none_or_standard_func
     ;
-        HOInstInfoA = none,
+        HOInstInfoA = none_or_standard_func,
         HOInstInfoB = higher_order(PredInstB),
         PredInstB = pred_inst_info(pf_function, ArgModes, _, _Det),
         Arity = list.length(ArgModes),
diff --git a/compiler/inst_test.m b/compiler/inst_test.m
index 2d0f4a3..b5344ba 100644
--- a/compiler/inst_test.m
+++ b/compiler/inst_test.m
@@ -1301,7 +1301,7 @@ inst_list_contains_inst_name([Inst | Insts], ModuleInfo, InstName, Contains,
 
 %-----------------------------------------------------------------------------%
 
-maybe_any_to_bound(yes(Type), ModuleInfo, Uniq, none, Inst) :-
+maybe_any_to_bound(yes(Type), ModuleInfo, Uniq, none_or_standard_func, Inst) :-
     not type_is_solver_type(ModuleInfo, Type),
     ( if type_constructors(ModuleInfo, Type, Constructors) then
         type_to_ctor_det(Type, TypeCtor),
@@ -1325,7 +1325,7 @@ maybe_any_to_bound(yes(Type), ModuleInfo, Uniq, none, Inst) :-
         % that we will use `any' for this type.
         fail
     else
-        Inst = ground(Uniq, none)
+        Inst = ground(Uniq, none_or_standard_func)
     ).
 
 :- pred type_may_contain_solver_type(module_info::in, mer_type::in) is semidet.
diff --git a/compiler/inst_util.m b/compiler/inst_util.m
index 1a00bbb..6f9faeb 100644
--- a/compiler/inst_util.m
+++ b/compiler/inst_util.m
@@ -486,7 +486,7 @@ abstractly_unify_inst_3(Live, InstA, InstB, Real, Inst, Detism, !ModuleInfo) :-
     ;
         InstA = ground(UniqA, HOInstInfoA),
         (
-            HOInstInfoA = none,
+            HOInstInfoA = none_or_standard_func,
             make_ground_inst(InstB, Live, UniqA, Real, Inst, Detism,
                 !ModuleInfo)
         ;
@@ -566,7 +566,7 @@ abstractly_unify_inst_3(Live, InstA, InstB, Real, Inst, Detism, !ModuleInfo) :-
     ;
         InstA = any(UniqA, HOInstInfoA),
         (
-            HOInstInfoA = none,
+            HOInstInfoA = none_or_standard_func,
             make_any_inst(InstB, Live, UniqA, Real, Inst, Detism,
                 !ModuleInfo)
         ;
@@ -1190,7 +1190,7 @@ make_ground_inst(Inst0, Live, Uniq1, Real, Inst, Detism, !ModuleInfo) :-
     ;
         Inst0 = free,
         unify_uniq(Live, Real, detism_det, unique, Uniq1, Uniq),
-        Inst = ground(Uniq, none),
+        Inst = ground(Uniq, none_or_standard_func),
         Detism = detism_det
     ;
         Inst0 = free(T),
@@ -1215,10 +1215,11 @@ make_ground_inst(Inst0, Live, Uniq1, Real, Inst, Detism, !ModuleInfo) :-
     ;
         Inst0 = constrained_inst_vars(InstVars, SubInst0),
         abstractly_unify_constrained_inst_vars(Live, InstVars,
-            SubInst0, ground(Uniq1, none), Real, Inst, Detism, !ModuleInfo)
+            SubInst0, ground(Uniq1, none_or_standard_func), Real, Inst, Detism,
+            !ModuleInfo)
     ;
         Inst0 = abstract_inst(_, _),
-        Inst = ground(shared, none),
+        Inst = ground(shared, none_or_standard_func),
         Detism = detism_semi
     ;
         Inst0 = defined_inst(InstName),
@@ -1317,16 +1318,17 @@ make_any_inst(Inst0, Live, Uniq1, Real, Inst, Detism, !ModuleInfo) :-
     ;
         Inst0 = free,
         unify_uniq(Live, Real, detism_det, unique, Uniq1, Uniq),
-        Inst = any(Uniq, none),
+        Inst = any(Uniq, none_or_standard_func),
         Detism = detism_det
     ;
         Inst0 = free(T),
         % The following is a round-about way of doing this
         %   unify_uniq(Live, Real, detism_det, unique, Uniq0, Uniq),
-        %   Any = typed_any(Uniq, T).
+        %   TypedAny = typed_any(Uniq, T).
         % without the need for a `typed_any' inst.
-        Any = typed_inst(T, unify_inst(Live, Real, free, any(Uniq1, none))),
-        Inst = defined_inst(Any),
+        Any = any(Uniq1, none_or_standard_func),
+        TypedAny = typed_inst(T, unify_inst(Live, Real, free, Any)),
+        Inst = defined_inst(TypedAny),
         Detism = detism_det
     ;
         Inst0 = bound(Uniq0, _InstResults0, BoundInsts0),
@@ -1349,10 +1351,11 @@ make_any_inst(Inst0, Live, Uniq1, Real, Inst, Detism, !ModuleInfo) :-
     ;
         Inst0 = constrained_inst_vars(InstVars, SubInst0),
         abstractly_unify_constrained_inst_vars(Live, InstVars,
-            SubInst0, any(Uniq1, none), Real, Inst, Detism, !ModuleInfo)
+            SubInst0, any(Uniq1, none_or_standard_func), Real, Inst, Detism,
+            !ModuleInfo)
     ;
         Inst0 = abstract_inst(_, _),
-        Inst = any(shared, none),
+        Inst = any(shared, none_or_standard_func),
         Detism = detism_semi
     ;
         Inst0 = defined_inst(InstName),
@@ -1887,10 +1890,13 @@ inst_merge_4(InstA, InstB, MaybeType, Inst, !ModuleInfo) :-
         ( if ( Uniq = clobbered ; Uniq = mostly_clobbered ) then
             true
         else
+            % XXX We will lose any nonstandard higher-order info in
+            % BoundInstsB. We should at least check that there isn't any
+            % such info, as the result may be treated as standard.
             inst_results_bound_inst_list_is_ground_or_any(InstResultsB,
                 BoundInstsB, !.ModuleInfo)
         ),
-        Inst = any(Uniq, none)
+        Inst = any(Uniq, none_or_standard_func)
     ;
         InstA = any(UniqA, HOInstInfoA),
         InstB = ground(UniqB, HOInstInfoB),
@@ -1904,7 +1910,7 @@ inst_merge_4(InstA, InstB, MaybeType, Inst, !ModuleInfo) :-
         % We do not yet allow merge of any with free, except for
         % clobbered anys.
         ( Uniq = clobbered ; Uniq = mostly_clobbered ),
-        Inst = any(Uniq, none)
+        Inst = any(Uniq, none_or_standard_func)
     ;
         InstA = free,
         InstB = any(Uniq, HOInstInfo),
@@ -1921,10 +1927,13 @@ inst_merge_4(InstA, InstB, MaybeType, Inst, !ModuleInfo) :-
         ( if ( Uniq = clobbered ; Uniq = mostly_clobbered ) then
             true
         else
+            % XXX We will lose any nonstandard higher-order info in
+            % BoundInstsA. We should at least check that there isn't any
+            % such info, as the result may be treated as standard.
             inst_results_bound_inst_list_is_ground_or_any(InstResultsA,
                 BoundInstsA, !.ModuleInfo)
         ),
-        Inst = any(Uniq, none)
+        Inst = any(Uniq, none_or_standard_func)
     ;
         InstA = ground(UniqA, HOInstInfoA),
         InstB = any(UniqB, HOInstInfoB),
@@ -1938,7 +1947,7 @@ inst_merge_4(InstA, InstB, MaybeType, Inst, !ModuleInfo) :-
         % We do not yet allow merge of any with free, except for
         % clobbered anys.
         ( Uniq = clobbered ; Uniq = mostly_clobbered ),
-        Inst = any(Uniq, none)
+        Inst = any(Uniq, none_or_standard_func)
     ;
         InstA = free,
         InstB = free,
@@ -2008,12 +2017,12 @@ merge_ho_inst_info(HOInstInfoA, HOInstInfoB, HOInstInfo, !ModuleInfo) :-
             % don't allow the higher-order information to be lost.
             not pred_inst_info_is_nonstandard_func_mode(!.ModuleInfo, PredA),
             not pred_inst_info_is_nonstandard_func_mode(!.ModuleInfo, PredB),
-            HOInstInfo = none
+            HOInstInfo = none_or_standard_func
         )
     else
         not ho_inst_info_is_nonstandard_func_mode(!.ModuleInfo, HOInstInfoA),
         not ho_inst_info_is_nonstandard_func_mode(!.ModuleInfo, HOInstInfoB),
-        HOInstInfo = none
+        HOInstInfo = none_or_standard_func
     ).
 
     % merge_uniq_bound(UniqA, UniqB, BoundInstsB, ModuleInfo, Uniq) succeeds
@@ -2102,7 +2111,7 @@ inst_merge_bound_ground(UniqA, InstResultsA, BoundInstsA, UniqB,
             !.ModuleInfo)
     then
         merge_uniq_bound(UniqB, UniqA, BoundInstsA, !.ModuleInfo, Uniq),
-        Result = ground(Uniq, none)
+        Result = ground(Uniq, none_or_standard_func)
     else
         inst_results_bound_inst_list_is_ground_or_any(InstResultsA,
             BoundInstsA, !.ModuleInfo),
@@ -2129,7 +2138,7 @@ inst_merge_bound_ground(UniqA, InstResultsA, BoundInstsA, UniqB,
         ;
             MaybeType = no,
             merge_uniq_bound(UniqB, UniqA, BoundInstsA, !.ModuleInfo, Uniq),
-            Result = any(Uniq, none)
+            Result = any(Uniq, none_or_standard_func)
         )
     ).
 
diff --git a/compiler/instmap.m b/compiler/instmap.m
index 15b3060..7a379f9 100644
--- a/compiler/instmap.m
+++ b/compiler/instmap.m
@@ -452,7 +452,7 @@ instmap_delta_bind_no_var = InstMapDelta :-
     InstMapDelta = instmap_delta_from_assoc_list([]).
 
 instmap_delta_bind_var(Var) = InstMapDelta :-
-    InstMapDelta = instmap_delta_from_assoc_list([Var - ground(shared, none)]).
+    InstMapDelta = instmap_delta_from_assoc_list([pair_with_ground(Var)]).
 
 instmap_delta_bind_vars(Vars) = InstMapDelta :-
     VarsAndGround = ground_vars(Vars),
@@ -465,7 +465,7 @@ ground_vars(Vars) = VarsAndGround :-
 
 :- func pair_with_ground(prog_var) = pair(prog_var, mer_inst).
 
-pair_with_ground(Var) = Var - ground(shared, none).
+pair_with_ground(Var) = Var - ground(shared, none_or_standard_func).
 
 %-----------------------------------------------------------------------------%
 
diff --git a/compiler/make_goal.m b/compiler/make_goal.m
index 570b155..54ebc24 100644
--- a/compiler/make_goal.m
+++ b/compiler/make_goal.m
@@ -1,7 +1,7 @@
 %-----------------------------------------------------------------------------%
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
-% Copyright (C) 2014 The Mercury team.
+% Copyright (C) 2014-2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -202,7 +202,7 @@ create_atomic_complicated_unification(LHS, RHS, Context,
 %-----------------------------------------------------------------------------%
 
 make_simple_assign(X, Y, UnifyMainContext, UnifySubContext, Goal) :-
-    Ground = ground(shared, none),
+    Ground = ground(shared, none_or_standard_func),
     Mode = ((free -> Ground) - (Ground -> Ground)),
     Unification = assign(X, Y),
     UnifyContext = unify_context(UnifyMainContext, UnifySubContext),
@@ -212,7 +212,7 @@ make_simple_assign(X, Y, UnifyMainContext, UnifySubContext, Goal) :-
     Goal = hlds_goal(GoalExpr, GoalInfo).
 
 make_simple_test(X, Y, UnifyMainContext, UnifySubContext, Goal) :-
-    Ground = ground(shared, none),
+    Ground = ground(shared, none_or_standard_func),
     Mode = ((Ground -> Ground) - (Ground -> Ground)),
     Unification = simple_test(X, Y),
     UnifyContext = unify_context(UnifyMainContext, UnifySubContext),
diff --git a/compiler/mode_util.m b/compiler/mode_util.m
index e604f45..b5c65b1 100644
--- a/compiler/mode_util.m
+++ b/compiler/mode_util.m
@@ -434,7 +434,7 @@ get_single_arg_inst(ModuleInfo, Inst, ConsId, ArgInst) :-
         ArgInst = not_reached
     ;
         Inst = ground(Uniq, _PredInst),
-        ArgInst = ground(Uniq, none)
+        ArgInst = ground(Uniq, none_or_standard_func)
     ;
         Inst = bound(_Uniq, _InstResult, List),
         ( if get_single_arg_inst_in_bound_insts(List, ConsId, ArgInst0) then
@@ -451,7 +451,7 @@ get_single_arg_inst(ModuleInfo, Inst, ConsId, ArgInst) :-
         ArgInst = free   % XXX loses type info
     ;
         Inst = any(Uniq, _),
-        ArgInst = any(Uniq, none)
+        ArgInst = any(Uniq, none_or_standard_func)
     ;
         Inst = abstract_inst(_, _),
         unexpected($module, $pred, "abstract insts not supported")
@@ -585,7 +585,7 @@ inst_lookup(ModuleInfo, InstName, Inst) :-
         InstName = typed_ground(Uniq, Type),
         map.init(Subst),
         propagate_type_into_inst(ModuleInfo, Subst, Type,
-            ground(Uniq, none), Inst)
+            ground(Uniq, none_or_standard_func), Inst)
     ;
         InstName = typed_inst(Type, TypedInstName),
         inst_lookup(ModuleInfo, TypedInstName, Inst0),
@@ -695,7 +695,7 @@ propagate_ctor_info(ModuleInfo, Type, Constructors, Inst0, Inst) :-
         Inst0 = free(_),
         unexpected($module, $pred, "type info already present")
     ;
-        Inst0 = ground(Uniq, none),
+        Inst0 = ground(Uniq, none_or_standard_func),
         ( if
             type_is_higher_order_details(Type, _, pf_function, _, ArgTypes)
         then
@@ -718,7 +718,7 @@ propagate_ctor_info(ModuleInfo, Type, Constructors, Inst0, Inst) :-
             Inst = bound(Uniq, InstResults, BoundInsts)
         )
     ;
-        Inst0 = any(Uniq, none),
+        Inst0 = any(Uniq, none_or_standard_func),
         ( if
             type_is_higher_order_details(Type, _, pf_function, _, ArgTypes)
         then
@@ -810,7 +810,7 @@ propagate_ctor_info_lazily(ModuleInfo, Subst, Type0, Inst0, Inst) :-
         Inst0 = free(_),
         unexpected($module, $pred, "typeinfo already present")
     ;
-        Inst0 = ground(Uniq, none),
+        Inst0 = ground(Uniq, none_or_standard_func),
         apply_type_subst(Type0, Subst, Type),
         ( if
             type_is_higher_order_details(Type, _, pf_function, _, ArgTypes)
@@ -822,10 +822,10 @@ propagate_ctor_info_lazily(ModuleInfo, Subst, Type0, Inst0, Inst) :-
             % it is disabled since it unnecessarily complicates the insts.
             %
             % Inst = defined_inst(typed_ground(Uniq, Type))
-            Inst = ground(Uniq, none)
+            Inst = ground(Uniq, none_or_standard_func)
         )
     ;
-        Inst0 = any(Uniq, none),
+        Inst0 = any(Uniq, none_or_standard_func),
         apply_type_subst(Type0, Subst, Type),
         ( if
             type_is_higher_order_details(Type, _, pf_function, _, ArgTypes)
@@ -833,7 +833,7 @@ propagate_ctor_info_lazily(ModuleInfo, Subst, Type0, Inst0, Inst) :-
             default_higher_order_func_inst(ModuleInfo, ArgTypes, HOInstInfo),
             Inst = any(Uniq, higher_order(HOInstInfo))
         else
-            Inst = any(Uniq, none)
+            Inst = any(Uniq, none_or_standard_func)
         )
     ;
         Inst0 = ground(Uniq, higher_order(PredInstInfo0)),
@@ -917,8 +917,9 @@ propagate_ctor_info_lazily(ModuleInfo, Subst, Type0, Inst0, Inst) :-
     pred_inst_info::out) is det.
 
 default_higher_order_func_inst(ModuleInfo, PredArgTypes, PredInstInfo) :-
-    In = (ground(shared, none) -> ground(shared, none)),
-    Out = (free -> ground(shared, none)),
+    Ground = ground(shared, none_or_standard_func),
+    In = (Ground -> Ground),
+    Out = (free -> Ground),
     list.length(PredArgTypes, NumPredArgs),
     NumFuncArgs = NumPredArgs - 1,
     list.duplicate(NumFuncArgs, In, FuncArgModes),
@@ -932,12 +933,12 @@ default_higher_order_func_inst(ModuleInfo, PredArgTypes, PredInstInfo) :-
 constructors_to_bound_insts(ModuleInfo, Uniq, TypeCtor, Constructors,
         BoundInsts) :-
     constructors_to_bound_insts_loop_over_ctors(ModuleInfo, Uniq, TypeCtor,
-        Constructors, ground(Uniq, none), BoundInsts).
+        Constructors, ground(Uniq, none_or_standard_func), BoundInsts).
 
 constructors_to_bound_any_insts(ModuleInfo, Uniq, TypeCtor, Constructors,
         BoundInsts) :-
     constructors_to_bound_insts_loop_over_ctors(ModuleInfo, Uniq, TypeCtor,
-        Constructors, any(Uniq, none), BoundInsts).
+        Constructors, any(Uniq, none_or_standard_func), BoundInsts).
 
 :- pred constructors_to_bound_insts_loop_over_ctors(module_info::in,
     uniqueness::in, type_ctor::in, list(constructor)::in, mer_inst::in,
@@ -1794,7 +1795,7 @@ cons_id_to_shared_inst(ModuleInfo, ConsId, NumArgs) = MaybeInst :-
         ; ConsId = table_io_entry_desc(_)
         ; ConsId = deep_profiling_proc_layout(_)
         ),
-        MaybeInst = yes(ground(shared, none))
+        MaybeInst = yes(ground(shared, none_or_standard_func))
     ).
 
 %-----------------------------------------------------------------------------%
@@ -1863,13 +1864,13 @@ normalise_inst(ModuleInfo, Type, Inst0, NormalisedInst) :-
             ),
             not inst_contains_nonstandard_func_mode(ModuleInfo, Inst)
         then
-            NormalisedInst = ground(Uniq, none)
+            NormalisedInst = ground(Uniq, none_or_standard_func)
         else if
             inst_is_ground(ModuleInfo, Inst),
             not inst_is_clobbered(ModuleInfo, Inst),
             not inst_contains_nonstandard_func_mode(ModuleInfo, Inst)
         then
-            NormalisedInst = ground(shared, none)
+            NormalisedInst = ground(shared, none_or_standard_func)
         else
             % XXX We need to limit the potential size of insts here
             % in order to avoid infinite loops in mode inference.
diff --git a/compiler/modecheck_call.m b/compiler/modecheck_call.m
index 1585783..07c63dd 100644
--- a/compiler/modecheck_call.m
+++ b/compiler/modecheck_call.m
@@ -236,7 +236,7 @@ modecheck_higher_order_call(PredOrFunc, PredVar, Args0, Args, Modes, Det,
         ;
             % If PredVar has no higher-order inst information, but is
             % a function type, then assume the default function mode.
-            HOInstInfo = none,
+            HOInstInfo = none_or_standard_func,
             mode_info_get_var_types(!.ModeInfo, VarTypes),
             lookup_var_type(VarTypes, PredVar, Type),
             type_is_higher_order_details(Type, _, pf_function, _, ArgTypes),
diff --git a/compiler/modecheck_goal.m b/compiler/modecheck_goal.m
index 44e633c..3deb7e3 100644
--- a/compiler/modecheck_goal.m
+++ b/compiler/modecheck_goal.m
@@ -359,7 +359,7 @@ merge_disj_branches(NonLocals, LargeFlatConstructs, Disjuncts0, Disjuncts,
         LargeFlatConstructList =
             set_of_var.to_sorted_list(LargeFlatConstructs),
         list.map(
-            instmap_set_vars_same(ground(shared, none),
+            instmap_set_vars_same(ground(shared, none_or_standard_func),
                 LargeFlatConstructList),
             InstMaps0, InstMaps)
     ),
@@ -464,7 +464,7 @@ merge_switch_branches(NonLocals, LargeFlatConstructs, Cases0, Cases,
         LargeFlatConstructList =
             set_of_var.to_sorted_list(LargeFlatConstructs),
         list.map(
-            instmap_set_vars_same(ground(shared, none),
+            instmap_set_vars_same(ground(shared, none_or_standard_func),
                 LargeFlatConstructList),
             InstMaps0, InstMaps)
     ),
@@ -581,7 +581,8 @@ set_large_flat_constructs_to_ground_in_goal(LargeFlatConstructs,
             Reason = from_ground_term(TermVar, from_ground_term_construct),
             ( if set_of_var.member(LargeFlatConstructs, TermVar) then
                 InstMapDelta0 = goal_info_get_instmap_delta(GoalInfo0),
-                instmap_delta_set_var(TermVar, ground(shared, none),
+                instmap_delta_set_var(TermVar,
+                    ground(shared, none_or_standard_func),
                     InstMapDelta0, InstMapDelta),
                 goal_info_set_instmap_delta(InstMapDelta, GoalInfo0, GoalInfo),
 
@@ -623,7 +624,7 @@ set_large_flat_constructs_to_ground_in_goal(LargeFlatConstructs,
         InstMapDelta0 = goal_info_get_instmap_delta(GoalInfo0),
         instmap_delta_changed_vars(InstMapDelta0, ChangedVars),
         set_of_var.intersect(ChangedVars, LargeFlatConstructs, GroundVars),
-        instmap_delta_set_vars_same(ground(shared, none),
+        instmap_delta_set_vars_same(ground(shared, none_or_standard_func),
             set_of_var.to_sorted_list(GroundVars),
             InstMapDelta0, InstMapDelta),
         goal_info_set_instmap_delta(InstMapDelta, GoalInfo0, GoalInfo),
@@ -983,7 +984,7 @@ modecheck_goal_make_ground_term_unique(TermVar, SubGoal0, GoalInfo0, GoalExpr,
     % We could get a more accurate new inst for TermVar by replacing
     % all the "shared" functors in TermVarOldInst with "unique".
     % However, this should be good enough. XXX wangp, is this right?
-    TermVarUniqueInst = ground(unique, none),
+    TermVarUniqueInst = ground(unique, none_or_standard_func),
 
     instmap_set_var(CloneVar, TermVarOldInst, InstMap0, InstMap1),
     mode_info_set_instmap(InstMap1, !ModeInfo),
@@ -1149,7 +1150,7 @@ modecheck_specializable_ground_term(SubGoal, TermVar, TermVarInst,
 
             list.reverse([UnifyTermGoal | UnifyArgGoals], RevConj),
             MaybeGroundTermMode = yes(construct_ground_term(RevConj))
-        else if TermVarInst = ground(shared, none) then
+        else if TermVarInst = ground(shared, none_or_standard_func) then
             Conj = [UnifyTermGoal | UnifyArgGoals],
             MaybeGroundTermMode = yes(deconstruct_ground_term(Conj))
         else
diff --git a/compiler/modecheck_unify.m b/compiler/modecheck_unify.m
index eaabf18..f6343d6 100644
--- a/compiler/modecheck_unify.m
+++ b/compiler/modecheck_unify.m
@@ -414,7 +414,10 @@ modecheck_unification_rhs_lambda(X, LambdaGoal, Unification0, UnifyContext, _,
             ( pred(NonLocal::in) is semidet :-
                 lookup_var_type(NonLocalTypes, NonLocal, NonLocalType),
                 instmap_lookup_var(InstMap1, NonLocal, NonLocalInst),
-                not inst_matches_initial(NonLocalInst, any(shared, none),
+                % XXX should filter other higher-order any vars, not just
+                % functions with the standard mode.
+                not inst_matches_initial(NonLocalInst,
+                    any(shared, none_or_standard_func),
                     NonLocalType, ModuleInfo0)
             ), NonLocals1)
     ),
@@ -924,10 +927,10 @@ find_nondefault_mode_func_vars(ModeInfo, [ArgVar | ArgVars], BadArgVars) :-
 
 ho_inst_info_is_nondefault_mode_func(HoInstInfo, IsBad) :-
     (
-        HoInstInfo = none,
+        HoInstInfo = none_or_standard_func,
         % When you take a higher order value out of a term, we record
-        % `none' as its ho_inst_info. It should be ok to put such values
-        % back into another term.
+        % `none_or_standard_func' as its ho_inst_info. It should be ok to put
+        % such values back into another term.
         IsBad = no
     ;
         HoInstInfo = higher_order(PredInstInfo),
@@ -1361,7 +1364,8 @@ modecheck_complicated_unify(X, Y, Type, ModeOfX, ModeOfY, Det, UnifyContext,
     ;
         UnifyTypeInfoVars = [_ | _],
         list.length(UnifyTypeInfoVars, NumTypeInfoVars),
-        list.duplicate(NumTypeInfoVars, ground(shared, none), ExpectedInsts),
+        list.duplicate(NumTypeInfoVars, ground(shared, none_or_standard_func),
+            ExpectedInsts),
         mode_info_set_call_context(call_context_unify(UnifyContext),
             !ModeInfo),
         InitialArgNum = 0,
@@ -1647,7 +1651,7 @@ check_type_info_args_are_ground([ArgVar | ArgVars], VarTypes, UnifyContext,
     then
         mode_info_set_call_arg_context(1, !ModeInfo),
         modecheck_introduced_type_info_var_has_inst_no_exact_match(ArgVar,
-            ArgType, ground(shared, none), !ModeInfo),
+            ArgType, ground(shared, none_or_standard_func), !ModeInfo),
         check_type_info_args_are_ground(ArgVars, VarTypes, UnifyContext,
             !ModeInfo)
     else
@@ -1810,7 +1814,7 @@ try_bind_args(Inst, ArgVars, UnifyArgInsts, !ModeInfo) :-
         instmap.init_unreachable(InstMap),
         mode_info_set_instmap(InstMap, !ModeInfo)
     ;
-        Inst = ground(Uniq, none),
+        Inst = ground(Uniq, none_or_standard_func),
         ground_args(Uniq, ArgVars, UnifyArgInsts, !ModeInfo)
     ;
         Inst = bound(_Uniq, _InstResults, BoundInsts),
@@ -1842,7 +1846,8 @@ try_bind_args_2([Arg | Args], [Inst | Insts], [UnifyArgInst | UnifyArgInsts],
 
 ground_args(_Uniq, [], [], !ModeInfo).
 ground_args(Uniq, [Arg | Args], [UnifyArgInst | UnifyArgInsts], !ModeInfo) :-
-    modecheck_set_var_inst(Arg, ground(Uniq, none), UnifyArgInst, !ModeInfo),
+    Ground = ground(Uniq, none_or_standard_func),
+    modecheck_set_var_inst(Arg, Ground, UnifyArgInst, !ModeInfo),
     ground_args(Uniq, Args, UnifyArgInsts, !ModeInfo).
 
 %-----------------------------------------------------------------------------%
@@ -1871,11 +1876,11 @@ try_get_mode_of_args(Inst, ArgInsts, ArgModes) :-
         Inst = not_reached,
         mode_set_args(ArgInsts, not_reached, ArgModes)
     ;
-        Inst = any(Uniq, none),
-        mode_set_args(ArgInsts, any(Uniq, none), ArgModes)
+        Inst = any(Uniq, none_or_standard_func),
+        mode_set_args(ArgInsts, any(Uniq, none_or_standard_func), ArgModes)
     ;
-        Inst = ground(Uniq, none),
-        mode_set_args(ArgInsts, ground(Uniq, none), ArgModes)
+        Inst = ground(Uniq, none_or_standard_func),
+        mode_set_args(ArgInsts, ground(Uniq, none_or_standard_func), ArgModes)
     ;
         Inst = bound(_Uniq, _InstResults, BoundInsts),
         (
diff --git a/compiler/modecheck_util.m b/compiler/modecheck_util.m
index 9d93647..6953809 100644
--- a/compiler/modecheck_util.m
+++ b/compiler/modecheck_util.m
@@ -1127,7 +1127,7 @@ get_constrained_insts_in_inst(ModuleInfo, Inst, !Map, !Expansions) :-
         ; Inst = ground(_, HOInstInfo)
         ),
         (
-            HOInstInfo = none
+            HOInstInfo = none_or_standard_func
         ;
             HOInstInfo = higher_order(PredInstInfo),
             get_constrained_insts_in_ho_inst(ModuleInfo, PredInstInfo,
diff --git a/compiler/modes.m b/compiler/modes.m
index 7e865d9..3bb0f9b 100644
--- a/compiler/modes.m
+++ b/compiler/modes.m
@@ -1310,7 +1310,7 @@ maybe_clobber_insts([], [], []).
 maybe_clobber_insts([Inst0 | Insts0], [IsLive | IsLives], [Inst | Insts]) :-
     (
         IsLive = is_dead,
-        Inst = ground(clobbered, none)
+        Inst = ground(clobbered, none_or_standard_func)
     ;
         IsLive = is_live,
         Inst = Inst0
@@ -1502,11 +1502,13 @@ check_mode_of_main([Di, Uo], ModuleInfo) :-
     % manual specifies, rather than looking for a particular
     % abstract property.
     %
-    inst_expand(ModuleInfo, DiInitialInst, ground(unique, none)),
-    inst_expand(ModuleInfo, DiFinalInst, ground(clobbered, none)),
+    Unique = ground(unique, none_or_standard_func),
+    Clobbered = ground(clobbered, none_or_standard_func),
+    inst_expand(ModuleInfo, DiInitialInst, Unique),
+    inst_expand(ModuleInfo, DiFinalInst, Clobbered),
     inst_expand(ModuleInfo, UoInitialInst, Free),
     ( Free = free ; Free = free(_Type) ),
-    inst_expand(ModuleInfo, UoFinalInst, ground(unique, none)).
+    inst_expand(ModuleInfo, UoFinalInst, Unique).
 
 :- func report_eval_method_requires_ground_args(proc_info) = error_spec.
 
diff --git a/compiler/module_qual.m b/compiler/module_qual.m
index 513d90b..9fab837 100644
--- a/compiler/module_qual.m
+++ b/compiler/module_qual.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 1996-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -1367,8 +1368,8 @@ qualify_ho_inst_info(InInt, ErrorContext, HOInstInfo0, HOInstInfo,
         HOInstInfo = higher_order(pred_inst_info(PredOrFunc, Modes,
             MaybeArgRegs, Detism))
     ;
-        HOInstInfo0 = none,
-        HOInstInfo = none
+        HOInstInfo0 = none_or_standard_func,
+        HOInstInfo = none_or_standard_func
     ).
 
     % Find the unique inst_id that matches this inst, and qualify
diff --git a/compiler/par_loop_control.m b/compiler/par_loop_control.m
index a84a5c1..d2f9499 100644
--- a/compiler/par_loop_control.m
+++ b/compiler/par_loop_control.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 2011-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -641,7 +642,7 @@ create_inner_proc(RecParConjIds, OldPredProcId, OldProcInfo,
         % Now create the new proc_info structure.
         HeadVars = [LCVar | HeadVars0],
         ArgTypes = [loop_control_var_type | ArgTypes0],
-        Ground = ground(shared, none),
+        Ground = ground(shared, none_or_standard_func),
         In = (Ground -> Ground),
         ArgModes = [In | ArgModes0],
 
diff --git a/compiler/parse_tree_out_inst.m b/compiler/parse_tree_out_inst.m
index e49005a..5283183 100644
--- a/compiler/parse_tree_out_inst.m
+++ b/compiler/parse_tree_out_inst.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 1994-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -176,7 +177,7 @@ mercury_format_inst(Lang, InstInfo, Inst, !U) :-
             mercury_format_any_pred_inst_info(Lang, instvarset(InstInfo),
                 Uniq, PredInstInfo, !U)
         ;
-            HOInstInfo = none,
+            HOInstInfo = none_or_standard_func,
             mercury_format_any_uniqueness(Uniq, !U)
         )
     ;
@@ -198,7 +199,7 @@ mercury_format_inst(Lang, InstInfo, Inst, !U) :-
             mercury_format_ground_pred_inst_info(Lang, instvarset(InstInfo),
                 Uniq, PredInstInfo, !U)
         ;
-            HOInstInfo = none,
+            HOInstInfo = none_or_standard_func,
             mercury_format_uniqueness(Uniq, "ground", !U)
         )
     ;
diff --git a/compiler/pd_util.m b/compiler/pd_util.m
index e0e94fe..2a8509c 100644
--- a/compiler/pd_util.m
+++ b/compiler/pd_util.m
@@ -936,7 +936,7 @@ bound_inst_list_MSG(Xs, Ys, Expansions, ModuleInfo, Uniq, BoundInsts, Inst) :-
         ),
         \+ inst_contains_nonstandard_func_mode(ModuleInfo,
             bound(shared, inst_test_no_results, BoundInsts)),
-        Inst = ground(Uniq, none)
+        Inst = ground(Uniq, none_or_standard_func)
     ).
 
 %-----------------------------------------------------------------------------%
diff --git a/compiler/polymorphism.m b/compiler/polymorphism.m
index cdd8124..3dd93ec 100644
--- a/compiler/polymorphism.m
+++ b/compiler/polymorphism.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 1995-2012, 2014 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -3031,8 +3032,8 @@ construct_typeclass_info(Constraint, BaseVar, BaseConsId, ArgVarsMCAs,
         ConstConsId = typeclass_info_const(ConstNum),
         Unification = construct(TypeClassInfoVar, ConstConsId, [], [],
             construct_statically, cell_is_shared, no_construct_sub_info),
-        UnifyMode = (free -> ground(shared, none)) -
-            (ground(shared, none) -> ground(shared, none)),
+        Ground = ground(shared, none_or_standard_func),
+        UnifyMode = (free -> Ground) - (Ground -> Ground),
         % XXX The UnifyContext is wrong.
         UnifyContext = unify_context(umc_explicit, []),
         TypeClassInfoRHS = rhs_functor(ConstConsId, is_not_exist_constr, []),
@@ -3065,14 +3066,13 @@ construct_typeclass_info(Constraint, BaseVar, BaseConsId, ArgVarsMCAs,
         % Create the construction unification to initialize the variable.
         TypeClassInfoRHS =
             rhs_functor(ConsId, is_not_exist_constr, AllArgVars),
-        UniMode = (free - ground(shared, none) ->
-            ground(shared, none) - ground(shared, none)),
+        Ground = ground(shared, none_or_standard_func),
+        UniMode = ((free - Ground) -> (Ground - Ground)),
         list.length(AllArgVars, NumArgs),
         list.duplicate(NumArgs, UniMode, UniModes),
         Unification = construct(TypeClassInfoVar, ConsId, AllArgVars, UniModes,
             construct_dynamically, cell_is_unique, no_construct_sub_info),
-        UnifyMode = (free -> ground(shared, none)) -
-            (ground(shared, none) -> ground(shared, none)),
+        UnifyMode = (free -> Ground) - (Ground -> Ground),
         UnifyContext = unify_context(umc_explicit, []),
         % XXX The UnifyContext is wrong.
         GoalExpr = unify(TypeClassInfoVar, TypeClassInfoRHS, UnifyMode,
@@ -3082,7 +3082,7 @@ construct_typeclass_info(Constraint, BaseVar, BaseConsId, ArgVarsMCAs,
         goal_info_init(GoalInfo0),
         set_of_var.list_to_set([TypeClassInfoVar | AllArgVars], NonLocals),
         goal_info_set_nonlocals(NonLocals, GoalInfo0, GoalInfo1),
-        list.duplicate(NumArgs, ground(shared, none), ArgInsts),
+        list.duplicate(NumArgs, Ground, ArgInsts),
         % Note that we could perhaps be more accurate than `ground(shared)',
         % but it shouldn't make any difference.
         InstConsId = cell_inst_cons_id(typeclass_info_cell, NumArgs),
@@ -3476,8 +3476,8 @@ polymorphism_construct_type_info(Type, TypeCtor, TypeArgs, TypeCtorIsVarArity,
             Unification = construct(Var, type_info_const(ConstNum),
                 [], [], construct_statically, cell_is_shared,
                 no_construct_sub_info),
-            UnifyMode = (free -> ground(shared, none)) -
-                (ground(shared, none) -> ground(shared, none)),
+            Ground = ground(shared, none_or_standard_func),
+            UnifyMode = (free -> Ground) - (Ground -> Ground),
             UnifyContext = unify_context(umc_explicit, []),
             % XXX The UnifyContext is wrong.
             TypeInfoRHS = rhs_functor(type_info_const(ConstNum),
@@ -3629,14 +3629,13 @@ do_init_type_info_var(Type, Cell, ConsId, ArgVars, MaybePreferredVar,
     ),
 
     % Create the construction unification to initialize the variable.
-    UniMode = (free - ground(shared, none) ->
-        ground(shared, none) - ground(shared, none)),
+    Ground = ground(shared, none_or_standard_func),
+    UniMode = (free - Ground -> Ground - Ground),
     list.length(ArgVars, NumArgVars),
     list.duplicate(NumArgVars, UniMode, UniModes),
     Unification = construct(TypeInfoVar, ConsId, ArgVars, UniModes,
         construct_dynamically, cell_is_unique, no_construct_sub_info),
-    UnifyMode = (free -> ground(shared, none)) -
-        (ground(shared, none) -> ground(shared, none)),
+    UnifyMode = (free -> Ground) - (Ground -> Ground),
     UnifyContext = unify_context(umc_explicit, []),
     % XXX The UnifyContext is wrong.
     Unify = unify(TypeInfoVar, TypeInfoRHS, UnifyMode, Unification,
@@ -3644,7 +3643,7 @@ do_init_type_info_var(Type, Cell, ConsId, ArgVars, MaybePreferredVar,
 
     % Create a goal_info for the unification.
     set_of_var.list_to_set([TypeInfoVar | ArgVars], NonLocals),
-    list.duplicate(NumArgVars, ground(shared, none), ArgInsts),
+    list.duplicate(NumArgVars, Ground, ArgInsts),
     % Note that we could perhaps be more accurate than `ground(shared)',
     % but it shouldn't make any difference.
     InstConsId = cell_inst_cons_id(Cell, NumArgVars),
@@ -3681,8 +3680,8 @@ init_const_type_ctor_info_var_from_cons_id(Type, ConsId,
     TypeInfoRHS = rhs_functor(ConsId, is_not_exist_constr, []),
     Unification = construct(TypeCtorInfoVar, ConsId, [], [],
         construct_dynamically, cell_is_shared, no_construct_sub_info),
-    UnifyMode = (free -> ground(shared, none)) -
-        (ground(shared, none) -> ground(shared, none)),
+    Ground = ground(shared, none_or_standard_func),
+    UnifyMode = (free -> Ground) - (Ground -> Ground),
     UnifyContext = unify_context(umc_explicit, []),
     % XXX The UnifyContext is wrong.
     Unify = unify(TypeCtorInfoVar, TypeInfoRHS, UnifyMode,
@@ -4251,8 +4250,8 @@ materialize_base_typeclass_info_var(Constraint, ConsId, Var, Goals, !Info) :-
         RHS = rhs_functor(ConsId, is_not_exist_constr, []),
         Unification = construct(Var, ConsId, [], [],
             construct_dynamically, cell_is_shared, no_construct_sub_info),
-        UnifyMode = (free -> ground(shared, none)) -
-            (ground(shared, none) -> ground(shared, none)),
+        Ground = ground(shared, none_or_standard_func),
+        UnifyMode = (free -> Ground) - (Ground -> Ground),
         UnifyContext = unify_context(umc_explicit, []),
         % XXX The UnifyContext is wrong.
         Unify = unify(Var, RHS, UnifyMode, Unification, UnifyContext),
@@ -4290,8 +4289,8 @@ materialize_typeclass_info_var(Constraint, InstanceIdConstNum, Var, Goals,
         RHS = rhs_functor(ConsId, is_not_exist_constr, []),
         Unification = construct(Var, ConsId, [], [],
             construct_statically, cell_is_shared, no_construct_sub_info),
-        UnifyMode = (free -> ground(shared, none)) -
-            (ground(shared, none) -> ground(shared, none)),
+        Ground = ground(shared, none_or_standard_func),
+        UnifyMode = (free -> Ground) - (Ground -> Ground),
         UnifyContext = unify_context(umc_explicit, []),
         % XXX The UnifyContext is wrong.
         GoalExpr = unify(Var, RHS, UnifyMode, Unification, UnifyContext),
diff --git a/compiler/prog_data.m b/compiler/prog_data.m
index 6e9de55..5476585 100644
--- a/compiler/prog_data.m
+++ b/compiler/prog_data.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %---------------------------------------------------------------------------%
 % Copyright (C) 1996-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %---------------------------------------------------------------------------%
@@ -2131,8 +2132,9 @@ get_type_kind(kinded_type(_, Kind)) = Kind.
     --->    higher_order(pred_inst_info)
             % The inst is higher-order, and we have mode/determinism
             % information for the value.
-    ;       none.
-            % No extra information is available.
+    ;       none_or_standard_func.
+            % No extra information is available, or the inst is function
+            % with the standard mode.
 
     % higher-order predicate terms are given the inst
     %   `ground(shared, higher_order(PredInstInfo))' or
diff --git a/compiler/prog_io_util.m b/compiler/prog_io_util.m
index 4e0ad69..a700412 100644
--- a/compiler/prog_io_util.m
+++ b/compiler/prog_io_util.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 1996-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -897,28 +898,28 @@ is_known_inst_name_args(Name, Args, KnownInst) :-
             SimpleInst = free
         ;
             Name = "ground",
-            SimpleInst = ground(shared, none)
+            SimpleInst = ground(shared, none_or_standard_func)
         ;
             Name = "clobbered",
-            SimpleInst = ground(clobbered, none)
+            SimpleInst = ground(clobbered, none_or_standard_func)
         ;
             Name = "mostly_clobbered",
-            SimpleInst = ground(mostly_clobbered, none)
+            SimpleInst = ground(mostly_clobbered, none_or_standard_func)
         ;
             Name = "any",
-            SimpleInst = any(shared, none)
+            SimpleInst = any(shared, none_or_standard_func)
         ;
             Name = "unique_any",
-            SimpleInst = any(unique, none)
+            SimpleInst = any(unique, none_or_standard_func)
         ;
             Name = "mostly_unique_any",
-            SimpleInst = any(mostly_unique, none)
+            SimpleInst = any(mostly_unique, none_or_standard_func)
         ;
             Name = "clobbered_any",
-            SimpleInst = any(clobbered, none)
+            SimpleInst = any(clobbered, none_or_standard_func)
         ;
             Name = "mostly_clobbered_any",
-            SimpleInst = any(mostly_clobbered, none)
+            SimpleInst = any(mostly_clobbered, none_or_standard_func)
         ;
             Name = "not_reached",
             SimpleInst = not_reached
@@ -934,7 +935,7 @@ is_known_inst_name_args(Name, Args, KnownInst) :-
         Name = "unique",
         (
             Args = [],
-            KnownInst = known_inst_simple(ground(unique, none))
+            KnownInst = known_inst_simple(ground(unique, none_or_standard_func))
         ;
             Args = [Arg1],
             KnownInst = known_inst_compound(kcik_unique(Arg1))
@@ -946,7 +947,8 @@ is_known_inst_name_args(Name, Args, KnownInst) :-
         Name = "mostly_unique",
         (
             Args = [],
-            KnownInst = known_inst_simple(ground(mostly_unique, none))
+            KnownInst = known_inst_simple(
+                ground(mostly_unique, none_or_standard_func))
         ;
             Args = [Arg1],
             KnownInst = known_inst_compound(kcik_mostly_unique(Arg1))
diff --git a/compiler/prog_mode.m b/compiler/prog_mode.m
index 066c204..9ea2e64 100644
--- a/compiler/prog_mode.m
+++ b/compiler/prog_mode.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 2004-2006, 2008-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -204,9 +205,9 @@ unused_mode = make_std_mode("unused", []).
 in_any_mode = make_std_mode("in", [any_inst]).
 out_any_mode = make_std_mode("out", [any_inst]).
 
-ground_inst = ground(shared, none).
+ground_inst = ground(shared, none_or_standard_func).
 free_inst = free.
-any_inst = any(shared, none).
+any_inst = any(shared, none_or_standard_func).
 
 make_std_mode(Name, Args, make_std_mode(Name, Args)).
 
@@ -234,42 +235,42 @@ insts_to_mode(Initial, Final, Mode) :-
     ( if
         Initial = free
     then
-        ( if Final = ground(shared, none) then
+        ( if Final = ground(shared, none_or_standard_func) then
             make_std_mode("out", [], Mode)
-        else if Final = ground(unique, none) then
+        else if Final = ground(unique, none_or_standard_func) then
             make_std_mode("uo", [], Mode)
-        else if Final = ground(mostly_unique, none) then
+        else if Final = ground(mostly_unique, none_or_standard_func) then
             make_std_mode("muo", [], Mode)
         else
             make_std_mode("out", [Final], Mode)
         )
     else if
-        Initial = ground(shared, none),
-        Final = ground(shared, none)
+        Initial = ground(shared, none_or_standard_func),
+        Final = ground(shared, none_or_standard_func)
     then
         make_std_mode("in", [], Mode)
     else if
-        Initial = ground(unique, none),
-        Final = ground(clobbered, none)
+        Initial = ground(unique, none_or_standard_func),
+        Final = ground(clobbered, none_or_standard_func)
     then
         make_std_mode("di", [], Mode)
     else if
-        Initial = ground(mostly_unique, none),
-        Final = ground(mostly_clobbered, none)
+        Initial = ground(mostly_unique, none_or_standard_func),
+        Final = ground(mostly_clobbered, none_or_standard_func)
     then
         make_std_mode("mdi", [], Mode)
     else if
-        Initial = ground(unique, none),
-        Final = ground(unique, none)
+        Initial = ground(unique, none_or_standard_func),
+        Final = ground(unique, none_or_standard_func)
     then
         make_std_mode("ui", [], Mode)
     else if
-        Initial = ground(mostly_unique, none),
-        Final = ground(mostly_unique, none)
+        Initial = ground(mostly_unique, none_or_standard_func),
+        Final = ground(mostly_unique, none_or_standard_func)
     then
         make_std_mode("mui", [], Mode)
     else if
-        Final = ground(clobbered, none)
+        Final = ground(clobbered, none_or_standard_func)
     then
         make_std_mode("di", [Initial], Mode)
     else if Initial = Final then
@@ -459,7 +460,8 @@ bound_insts_apply_substitution(Subst,
 :- pred ho_inst_info_apply_substitution(inst_var_sub::in,
     ho_inst_info::in, ho_inst_info::out) is det.
 
-ho_inst_info_apply_substitution(_, none, none).
+ho_inst_info_apply_substitution(_,
+    none_or_standard_func, none_or_standard_func).
 ho_inst_info_apply_substitution(Subst, HOInstInfo0, HOInstInfo) :-
     HOInstInfo0 =
         higher_order(pred_inst_info(PredOrFunc, Modes0, MaybeArgRegs, Det)),
@@ -522,8 +524,8 @@ rename_apart_inst_vars_in_inst(Renaming, Inst0, Inst) :-
             HOInstInfo =
                 higher_order(pred_inst_info(PorF, Modes, MaybeArgRegs, Det))
         ;
-            HOInstInfo0 = none,
-            HOInstInfo = none
+            HOInstInfo0 = none_or_standard_func,
+            HOInstInfo = none_or_standard_func
         ),
         Inst = ground(Uniq, HOInstInfo)
     ;
@@ -535,8 +537,8 @@ rename_apart_inst_vars_in_inst(Renaming, Inst0, Inst) :-
             HOInstInfo =
                 higher_order(pred_inst_info(PorF, Modes, MaybeArgRegs, Det))
         ;
-            HOInstInfo0 = none,
-            HOInstInfo = none
+            HOInstInfo0 = none_or_standard_func,
+            HOInstInfo = none_or_standard_func
         ),
         Inst = any(Uniq, HOInstInfo)
     ;
@@ -753,7 +755,7 @@ get_arg_insts(Inst, ConsId, Arity, ArgInsts) :-
         list.duplicate(Arity, not_reached, ArgInsts)
     ;
         Inst = ground(Uniq, _PredInst),
-        list.duplicate(Arity, ground(Uniq, none), ArgInsts)
+        list.duplicate(Arity, ground(Uniq, none_or_standard_func), ArgInsts)
     ;
         Inst = bound(_Uniq, _InstResults, BoundInsts),
         ( if get_arg_insts_2(BoundInsts, ConsId, ArgInsts0) then
@@ -769,7 +771,7 @@ get_arg_insts(Inst, ConsId, Arity, ArgInsts) :-
         list.duplicate(Arity, free, ArgInsts)
     ;
         Inst = any(Uniq, _),
-        list.duplicate(Arity, any(Uniq, none), ArgInsts)
+        list.duplicate(Arity, any(Uniq, none_or_standard_func), ArgInsts)
     ).
 
 get_arg_insts_det(Inst, ConsId, Arity, ArgInsts) :-
@@ -921,8 +923,8 @@ strip_builtin_qualifiers_from_inst_name(Inst0, Inst) :-
 
 strip_builtin_qualifiers_from_ho_inst_info(HOInstInfo0, HOInstInfo) :-
     (
-        HOInstInfo0 = none,
-        HOInstInfo = none
+        HOInstInfo0 = none_or_standard_func,
+        HOInstInfo = none_or_standard_func
     ;
         HOInstInfo0 = higher_order(Pred0),
         Pred0 = pred_inst_info(PorF, Modes0, ArgRegs, Det),
@@ -956,8 +958,8 @@ constrain_inst_vars_in_inst(InstConstraints, Inst0, Inst) :-
         ( Inst0 = not_reached
         ; Inst0 = free
         ; Inst0 = free(_)
-        ; Inst0 = ground(_Uniq, none)
-        ; Inst0 = any(_Uniq, none)
+        ; Inst0 = ground(_Uniq, none_or_standard_func)
+        ; Inst0 = any(_Uniq, none_or_standard_func)
         ),
         Inst = Inst0
     ;
@@ -1018,7 +1020,7 @@ constrain_inst_vars_in_inst(InstConstraints, Inst0, Inst) :-
         ( if map.search(InstConstraints, Var, SubInstPrime) then
             SubInst = SubInstPrime
         else
-            SubInst = ground(shared, none)
+            SubInst = ground(shared, none_or_standard_func)
         ),
         Inst = constrained_inst_vars(set.make_singleton_set(Var), SubInst)
     ;
@@ -1142,7 +1144,7 @@ inst_var_constraints_are_consistent_in_inst(Inst, !Sub) :-
         ; Inst = any(_, HOInstInfo)
         ),
         (
-            HOInstInfo = none
+            HOInstInfo = none_or_standard_func
         ;
             HOInstInfo = higher_order(pred_inst_info(_, Modes, _, _)),
             inst_var_constraints_are_consistent_in_modes(Modes, !Sub)
diff --git a/compiler/purity.m b/compiler/purity.m
index 2ebfb8f..6943414 100644
--- a/compiler/purity.m
+++ b/compiler/purity.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 1997-2012,2014 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -1339,17 +1340,17 @@ wrap_inner_outer_goals(Outer, Goal0 - Inner, Goal, !Info) :-
     OuterToInnerPred = "stm_from_outer_to_inner",
     InnerToOuterPred = "stm_from_inner_to_outer",
     ModuleInfo = !.Info ^ pi_module_info,
+    Clobbered = ground(clobbered, none_or_standard_func),
+    Unique = ground(unique, none_or_standard_func),
     generate_simple_call(mercury_stm_builtin_module,
         OuterToInnerPred, pf_predicate, only_mode,
         detism_det, purity_pure, [OuterDI, InnerDI], [],
-        instmap_delta_from_assoc_list([OuterDI - ground(clobbered, none),
-            InnerDI - ground(unique, none)]),
+        instmap_delta_from_assoc_list([OuterDI - Clobbered, InnerDI - Unique]),
         ModuleInfo, Context, OuterToInnerGoal),
     generate_simple_call(mercury_stm_builtin_module,
         InnerToOuterPred, pf_predicate, only_mode,
         detism_det, purity_pure, [InnerUO, OuterUO], [],
-        instmap_delta_from_assoc_list([InnerUO - ground(clobbered, none),
-            OuterUO - ground(unique, none)]),
+        instmap_delta_from_assoc_list([InnerUO - Clobbered, OuterUO - Unique]),
         ModuleInfo, Context, InnerToOuterGoal),
 
     WrapExpr = conj(plain_conj, [OuterToInnerGoal, Goal0, InnerToOuterGoal]),
diff --git a/compiler/recompilation.usage.m b/compiler/recompilation.usage.m
index da3d6c1..2faf1c6 100644
--- a/compiler/recompilation.usage.m
+++ b/compiler/recompilation.usage.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 2001-2012 University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -1351,7 +1352,7 @@ find_items_used_by_inst(Inst, !Info) :-
             HOInstInfo = higher_order(pred_inst_info(_, Modes, _, _)),
             find_items_used_by_modes(Modes, !Info)
         ;
-            HOInstInfo = none
+            HOInstInfo = none_or_standard_func
         )
     ;
         Inst = bound(_, _, BoundInsts),
diff --git a/compiler/simplify_goal_call.m b/compiler/simplify_goal_call.m
index 4aff722..c78397a 100644
--- a/compiler/simplify_goal_call.m
+++ b/compiler/simplify_goal_call.m
@@ -575,7 +575,7 @@ simplify_inline_builtin_inequality(TI, X, Y, Inequality, Invert, GoalInfo,
             ( if inst_is_unique(ModuleInfo, YInst) then 3 else 0 )
         ),
 
-    Unique = ground(unique, none),
+    Unique = ground(unique, none_or_standard_func),
     ArgInsts = [CmpRes - Unique],
     BuiltinModule = mercury_public_builtin_module,
     goal_util.generate_simple_call(BuiltinModule, "compare", pf_predicate,
diff --git a/compiler/stm_expand.m b/compiler/stm_expand.m
index c595c6d..e84b1ac 100644
--- a/compiler/stm_expand.m
+++ b/compiler/stm_expand.m
@@ -891,8 +891,10 @@ template_if_exceptres_is_cons(RttiVar, ExceptVar, RollbackExceptCons,
     create_simple_call(mercury_univ_module, "type_to_univ", pf_predicate,
         mode_no(2), detism_semi, purity_pure,
         [RttiVar, UnivPayloadVar, ExceptVar], [],
-        instmap_delta_from_assoc_list([RttiVar - ground(shared, none),
-            ExceptVar - ground(shared, none), UnivPayloadVar - free]),
+        instmap_delta_from_assoc_list(
+            [RttiVar - ground(shared, none_or_standard_func),
+            ExceptVar - ground(shared, none_or_standard_func),
+            UnivPayloadVar - free]),
         UnivCall, !NewPredInfo),
     create_simple_call(mercury_public_builtin_module, "unify", pf_predicate,
         only_mode, detism_semi, purity_pure,
@@ -940,7 +942,8 @@ template_lock_and_validate(StmVar, UnlockAfterwards, ValidGoal, InvalidGoal,
     create_simple_call(mercury_stm_builtin_module, "stm_validate",
         pf_predicate, only_mode, detism_det, purity_impure,
         [StmVar, IsValidVar], [],
-        instmap_delta_from_assoc_list([StmVar - ground(unique, none),
+        instmap_delta_from_assoc_list(
+            [StmVar - ground(unique, none_or_standard_func),
             IsValidVar - free]),
         ValidCall, !NewPredInfo),
     create_switch_disjunction(IsValidVar,
@@ -984,7 +987,8 @@ template_lock_and_validate_many(StmVars, UnlockAfterwards, ValidGoal,
         create_simple_call(mercury_stm_builtin_module, "stm_validate",
             pf_predicate, only_mode, detism_det, purity_impure,
             [StmVarL, ValidResL], [],
-            instmap_delta_from_assoc_list([StmVarL - ground(unique, none),
+            instmap_delta_from_assoc_list(
+                [StmVarL - ground(unique, none_or_standard_func),
                 ValidResL - free]),
             ValidGoalL, NPI1, NPI)),
 
@@ -1058,7 +1062,8 @@ create_validate_exception_goal(StmVar, ExceptionVar, ReturnType, RecursiveCall,
     create_simple_call(mercury_stm_builtin_module,
         "stm_discard_transaction_log",
         pf_predicate, only_mode, detism_det, purity_impure, [StmVar], [],
-        instmap_delta_from_assoc_list([StmVar - ground(clobbered, none)]),
+        instmap_delta_from_assoc_list(
+            [StmVar - ground(clobbered, none_or_standard_func)]),
         DropStateCall, !NewPredInfo),
     create_plain_conj([DropStateCall, RecursiveCall], Goal_InvalidBranch),
     template_lock_and_validate(StmVar, yes, Goal_ValidBranch,
@@ -1085,7 +1090,8 @@ create_retry_handler_branch(StmVar, RecCall, Goal, !NewPredInfo) :-
     create_simple_call(mercury_stm_builtin_module,
         "stm_discard_transaction_log",
         pf_predicate, only_mode, detism_det, purity_impure, [StmVar], [],
-        instmap_delta_from_assoc_list([StmVar - ground(clobbered, none)]),
+        instmap_delta_from_assoc_list(
+            [StmVar - ground(clobbered, none_or_standard_func)]),
         DropStateCall, !NewPredInfo),
     create_plain_conj(LockAndValidateGoals ++ [DropStateCall, RecCall],
         Goal).
@@ -1110,7 +1116,8 @@ create_test_on_exception(ExceptVar, StmVar, ReturnType, RecCall, Goal,
     create_simple_call(mercury_stm_builtin_module,
         "stm_discard_transaction_log",
         pf_predicate, only_mode, detism_det, purity_impure, [StmVar], [],
-        instmap_delta_from_assoc_list([StmVar - ground(clobbered, none)]),
+        instmap_delta_from_assoc_list(
+            [StmVar - ground(clobbered, none_or_standard_func)]),
         DropStateGoal, !NewPredInfo),
 
     create_plain_conj([DropStateGoal, RecCall], TrueGoal),
@@ -1164,7 +1171,8 @@ create_rollback_handler_goal(AtomicGoalVars, ReturnType, StmVarDI, StmVarUO,
     create_simple_call(mercury_stm_builtin_module,
         "stm_create_transaction_log",
         pf_predicate, only_mode, detism_det, purity_impure, [StmVarDI], [],
-        instmap_delta_from_assoc_list([StmVarDI - ground(unique, none)]),
+        instmap_delta_from_assoc_list(
+            [StmVarDI - ground(unique, none_or_standard_func)]),
         Goal_StmCreate, !NewPredInfo),
 
     % TODO: Select mode based on determism of actual goal. 0 if determistic,
@@ -1175,11 +1183,11 @@ create_rollback_handler_goal(AtomicGoalVars, ReturnType, StmVarDI, StmVarUO,
         [RttiTypeVar, AtomicClosureVar, ReturnExceptVar, StmVarDI, StmVarUO],
         [],
         instmap_delta_from_assoc_list([
-            RttiTypeVar - ground(shared, none),
-            AtomicClosureVar - ground(shared, none),
-            ReturnExceptVar - ground(shared, none),
-            StmVarDI - ground(clobbered, none),
-            StmVarUO - ground(unique, none)]),
+            RttiTypeVar - ground(shared, none_or_standard_func),
+            AtomicClosureVar - ground(shared, none_or_standard_func),
+            ReturnExceptVar - ground(shared, none_or_standard_func),
+            StmVarDI - ground(clobbered, none_or_standard_func),
+            StmVarUO - ground(unique, none_or_standard_func)]),
         Goal_TryStm, !NewPredInfo),
 
     % For successfull execution, deconstruct and return true
@@ -1456,12 +1464,14 @@ create_post_wrapper_goal(AtomicGoalVars, AtomicGoal, ResultType, ResultVar,
         Goal_StmUnLock_Call, !NewPredInfo),
     create_simple_call(StmModuleName, "stm_validate", pf_predicate, only_mode,
         detism_det, purity_impure, [StmUO, IsValidVar], [],
-        instmap_delta_from_assoc_list([StmUO - ground(unique, none),
-            IsValidVar - ground(shared, none)]),
+        instmap_delta_from_assoc_list(
+            [StmUO - ground(unique, none_or_standard_func),
+            IsValidVar - ground(shared, none_or_standard_func)]),
         Goal_StmValidate_Call, !NewPredInfo),
     create_simple_call(StmModuleName, "stm_commit", pf_predicate, only_mode,
         detism_det, purity_impure, [StmUO], [],
-        instmap_delta_from_assoc_list([StmUO - ground(unique, none)]),
+        instmap_delta_from_assoc_list(
+            [StmUO - ground(unique, none_or_standard_func)]),
         Goal_StmCommit_Call, !NewPredInfo),
 
     make_type_info(stm_rollback_exception_type, TypeInfoVar,
@@ -1806,8 +1816,10 @@ create_or_else_end_branch(StmVars, OuterSTMDI, OuterSTMUO, ExceptionRttiVar,
                 "stm_merge_nested_logs",
                 pf_predicate, only_mode, detism_det, purity_impure,
                 [StmVar, ThreadSTMDI, ThreadSTMUO], [],
-                instmap_delta_from_assoc_list([StmVar - ground(unique, none),
-                    ThreadSTMDI - free, ThreadSTMUO - ground(unique, none)]),
+                instmap_delta_from_assoc_list(
+                    [StmVar - ground(unique, none_or_standard_func),
+                    ThreadSTMDI - free,
+                    ThreadSTMUO - ground(unique, none_or_standard_func)]),
                 ThisGoal, NPI0, NPI)
         ),
 
@@ -1894,7 +1906,8 @@ create_or_else_branch(AtomicGoalVars, ReturnType, OuterStmDIVar,
         "stm_create_nested_transaction_log",
         pf_predicate, only_mode, detism_det, purity_impure,
         [OuterStmDIVar, InnerSTM0Var], [],
-        instmap_delta_from_assoc_list([OuterStmDIVar - ground(unique, none),
+        instmap_delta_from_assoc_list(
+            [OuterStmDIVar - ground(unique, none_or_standard_func),
             InnerSTM0Var - free]),
         CreateNestedLogCall, !NewPredInfo),
 
@@ -1904,10 +1917,10 @@ create_or_else_branch(AtomicGoalVars, ReturnType, OuterStmDIVar,
             InnerSTM0Var, InnerSTMVar],
         [],
         instmap_delta_from_assoc_list([
-            RttiVar - ground(shared, none),
-            AtomicClosureVar - ground(shared, none),
+            RttiVar - ground(shared, none_or_standard_func),
+            AtomicClosureVar - ground(shared, none_or_standard_func),
             ReturnExceptVar - free,
-            InnerSTM0Var - ground(unique, none),
+            InnerSTM0Var - ground(unique, none_or_standard_func),
             InnerSTMVar - free]),
         TryStmCall, !NewPredInfo),
 
@@ -1917,8 +1930,10 @@ create_or_else_branch(AtomicGoalVars, ReturnType, OuterStmDIVar,
     create_simple_call(mercury_stm_builtin_module, "stm_merge_nested_logs",
         pf_predicate, only_mode, detism_det, purity_impure,
         [InnerSTMVar, OuterStmDIVar, OuterStmUOVar], [],
-        instmap_delta_from_assoc_list([InnerSTMVar - ground(unique, none),
-            OuterStmDIVar - ground(unique, none), OuterStmUOVar - free]),
+        instmap_delta_from_assoc_list(
+            [InnerSTMVar - ground(unique, none_or_standard_func),
+            OuterStmDIVar - ground(unique, none_or_standard_func),
+            OuterStmUOVar - free]),
         MergeNestedLogsCall, !NewPredInfo),
 
     create_plain_conj([DeconstructGoal, MergeNestedLogsCall], SuccessBranch),
@@ -1927,7 +1942,8 @@ create_or_else_branch(AtomicGoalVars, ReturnType, OuterStmDIVar,
     create_simple_call(mercury_stm_builtin_module,
         "stm_discard_transaction_log",
         pf_predicate, only_mode, detism_det, purity_impure, [InnerSTMVar], [],
-        instmap_delta_from_assoc_list([InnerSTMVar - ground(unique, none)]),
+        instmap_delta_from_assoc_list(
+            [InnerSTMVar - ground(unique, none_or_standard_func)]),
         DiscardCall, !NewPredInfo),
     create_simple_call(mercury_exception_module, "rethrow",
         pf_predicate, only_mode, detism_erroneous, purity_pure,
diff --git a/compiler/table_gen.m b/compiler/table_gen.m
index 9fe2936..73eadd9 100644
--- a/compiler/table_gen.m
+++ b/compiler/table_gen.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 1997-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -1404,8 +1405,8 @@ create_new_io_goal(OrigGoal, TableIoEntryKind, Unitize, TableIoStates,
         table_generate_call("table_io_copy_io_state", detism_det,
             [IoStateAssignFromVar, IoStateAssignToVar], purity_pure,
             instmap_delta_from_assoc_list([
-                IoStateAssignFromVar - ground(clobbered, none),
-                IoStateAssignToVar - ground(unique, none)]),
+                IoStateAssignFromVar - ground(clobbered, none_or_standard_func),
+                IoStateAssignToVar - ground(unique, none_or_standard_func)]),
             ModuleInfo, Context, IoStateAssignGoal),
         RestoreAnswerGoalExpr = conj(plain_conj,
             [RestoreAnswerGoal0, IoStateAssignGoal]),
diff --git a/compiler/try_expand.m b/compiler/try_expand.m
index 48fcaf9..d70da27 100644
--- a/compiler/try_expand.m
+++ b/compiler/try_expand.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 2009-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public Licence - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -931,7 +932,7 @@ make_output_tuple_inst_cast(TmpTupleVar, TupleVar, TupleArgInsts,
     % If all the arguments have inst `ground' then a unification is enough.
     (
         list.member(ArgInst, TupleArgInsts),
-        ArgInst \= ground(_, none)
+        ArgInst \= ground(_, none_or_standard_func)
     ->
         TupleArity = list.length(TupleArgInsts),
         TupleInst = bound(shared, inst_test_no_results, [
diff --git a/compiler/unify_proc.m b/compiler/unify_proc.m
index d278518..5fde691 100644
--- a/compiler/unify_proc.m
+++ b/compiler/unify_proc.m
@@ -597,7 +597,7 @@ generate_initialise_proc_body(_Type, TypeBody, X, Context, Clause, !Info) :-
         InitCall = plain_call(PredId, ModeId, [X0], not_builtin, no, InitPred),
         InitGoal = hlds_goal(InitCall, GoalInfo),
 
-        Any = any(shared, none),
+        Any = any(shared, none_or_standard_func),
         generate_cast_with_insts(equiv_type_cast, X0, X, Any, Any, Context,
             CastGoal),
         Goal = hlds_goal(conj(plain_conj, [InitGoal, CastGoal]), GoalInfo),
diff --git a/compiler/unused_imports.m b/compiler/unused_imports.m
index da78efc..8700bfd 100644
--- a/compiler/unused_imports.m
+++ b/compiler/unused_imports.m
@@ -2,6 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %-----------------------------------------------------------------------------%
 % Copyright (C) 2006-2012 The University of Melbourne.
+% Copyright (C) 2015 The Mercury team.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -841,7 +842,7 @@ ho_inst_info_used_modules(Visibility, HOInstInfo, !UsedModules) :-
         HOInstInfo = higher_order(pred_inst_info(_, Modes, _, _)),
         list.foldl(mer_mode_used_modules(Visibility), Modes, !UsedModules)
     ;
-        HOInstInfo = none
+        HOInstInfo = none_or_standard_func
     ).
 
 %-----------------------------------------------------------------------------%


More information about the reviews mailing list