[m-rev.] diff: style improvements
Zoltan Somogyi
zs at csse.unimelb.edu.au
Tue Jan 4 13:33:44 AEDT 2011
Minor improvements, mostly programming style.
compiler/accumulator.m:
Replace pairs and integers with purpose-specific types.
Give some predicates and types unique and more meaningful names.
Put the arguments of some predicates into a more useful order.
Fix some apparant oversights that seem to be (so far untickled) bugs.
Mark them with XXXs in case they turn out not to be.
compiler/complexity.m:
compiler/hhf.m:
compiler/ssdebug.m:
Give some predicates unique and more meaningful names.
compiler/mercury_compile_middle_passes.m:
compiler/mode_constraints.m:
Conform to the changes above.
compiler/simplify.m:
Break up a huge predicate into meaningful pieces.
compiler/hlds_out_module.m:
Print out the user defined insts table if asked.
compiler/hlds_data.m:
Fix programming style.
Zoltan.
cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/extra
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/extra
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/doc
cvs diff: Diffing boehm_gc/libatomic_ops/src
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/armcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops/tests
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/m4
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/accumulator.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/accumulator.m,v
retrieving revision 1.81
diff -u -b -r1.81 accumulator.m
--- compiler/accumulator.m 15 Dec 2010 06:29:26 -0000 1.81
+++ compiler/accumulator.m 4 Jan 2011 02:20:07 -0000
@@ -155,7 +155,7 @@
% to the module_info. However, we may also encounter errors, which
% we will add to the list of error_specs in the univ accumulator.
%
-:- pred accumulator.process_proc(pred_proc_id::in, pred_info::in,
+:- pred accu_transform_proc(pred_proc_id::in, pred_info::in,
proc_info::in, proc_info::out, module_info::in, module_info::out,
univ::in, univ::out) is det.
@@ -210,40 +210,43 @@
; ite_base_rec
; ite_rec_base.
- % A goal is represented by two integers, the first integer
- % stores which conjunction the goal came from (base or
- % recursive), and the second stores the location of the goal in
- % the conjunction.
- %
-:- type goal_id == pair(int).
+ % An accu_goal_id represents a goal. The first field says which conjunction
+ % the goal came from (base or recursive), and the second gives the location
+ % of the goal in the conjunction.
+ %
+:- type accu_goal_id
+ ---> accu_goal_id(accu_case, int).
+
+:- type accu_case
+ ---> accu_base
+ ; accu_rec.
% The goal_store associates a goal with each goal_id.
%
-:- type goal_store == goal_store(goal_id).
+:- type accu_goal_store == goal_store(accu_goal_id).
% A substitution from the first variable name to the second.
%
-:- type subst == map(prog_var, prog_var).
+:- type accu_subst == map(prog_var, prog_var).
-:- type warning
- ---> warn(prog_context, pred_id, prog_var, prog_var).
- % Warn that two prog_vars in call to pred_id
- % at prog_context were swapped, which may cause
- % an efficiency problem.
+:- type accu_warning
+ ---> accu_warn(prog_context, pred_id, prog_var, prog_var).
+ % Warn that two prog_vars in call to pred_id at prog_context
+ % were swapped, which may cause an efficiency problem.
-:- type warnings == list(warning).
+:- type accu_warnings == list(accu_warning).
%-----------------------------------------------------------------------------%
-process_proc(proc(PredId, ProcId), PredInfo, !ProcInfo, !ModuleInfo,
+accu_transform_proc(proc(PredId, ProcId), PredInfo, !ProcInfo, !ModuleInfo,
!Cookie) :-
module_info_get_globals(!.ModuleInfo, Globals),
globals.lookup_bool_option(Globals,
optimize_constructor_last_call_accumulator, DoLCO),
globals.lookup_bool_option(Globals, fully_strict, FullyStrict),
(
- attempt_transform(ProcId, PredId, PredInfo, DoLCO, FullyStrict,
- !ProcInfo, !ModuleInfo, Warnings)
+ should_attempt_accu_transform(!ModuleInfo, PredId, ProcId, PredInfo,
+ !ProcInfo, FullyStrict, DoLCO, Warnings)
->
globals.lookup_bool_option(Globals, very_verbose, VeryVerbose),
(
@@ -320,19 +323,19 @@
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
-:- pred generate_warnings(module_info::in, prog_varset::in, list(warning)::in,
- list(error_msg)::out) is det.
+:- pred generate_warnings(module_info::in, prog_varset::in,
+ list(accu_warning)::in, list(error_msg)::out) is det.
generate_warnings(_, _, [], []).
generate_warnings(ModuleInfo, VarSet, [Warning | Warnings], [Msg | Msgs]) :-
generate_warning(ModuleInfo, VarSet, Warning, Msg),
generate_warnings(ModuleInfo, VarSet, Warnings, Msgs).
-:- pred generate_warning(module_info::in, prog_varset::in, warning::in,
+:- pred generate_warning(module_info::in, prog_varset::in, accu_warning::in,
error_msg::out) is det.
generate_warning(ModuleInfo, VarSet, Warning, Msg) :-
- Warning = warn(Context, PredId, VarA, VarB),
+ Warning = accu_warn(Context, PredId, VarA, VarB),
PredPieces = describe_one_pred_name(ModuleInfo, should_module_qualify,
PredId),
@@ -348,33 +351,34 @@
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
- % attempt_transform is only true iff the current
+ % should_attempt_accu_transform is only true iff the current
% proc has been transformed to call the newly created
% accumulator proc.
%
-:- pred attempt_transform(proc_id::in, pred_id::in, pred_info::in,
- bool::in, bool::in, proc_info::in, proc_info::out,
- module_info::in, module_info::out, warnings::out) is semidet.
+:- pred should_attempt_accu_transform(module_info::in, module_info::out,
+ pred_id::in, proc_id::in, pred_info::in, proc_info::in, proc_info::out,
+ bool::in, bool::in, accu_warnings::out) is semidet.
-attempt_transform(ProcId, PredId, PredInfo, DoLCO, FullyStrict,
- !ProcInfo, !ModuleInfo, Warnings) :-
+should_attempt_accu_transform(!ModuleInfo, PredId, ProcId, PredInfo,
+ !ProcInfo, FullyStrict, DoLCO, Warnings) :-
proc_info_get_goal(!.ProcInfo, Goal0),
proc_info_get_headvars(!.ProcInfo, HeadVars),
proc_info_get_initial_instmap(!.ProcInfo, !.ModuleInfo,
InitialInstMap),
- standardize(Goal0, Goal),
+ accu_standardize(Goal0, Goal),
identify_goal_type(PredId, ProcId, Goal, InitialInstMap,
TopLevel, Base, BaseInstMap, Rec, RecInstMap),
C = initialize_goal_store(Rec, RecInstMap, Base, BaseInstMap),
identify_recursive_calls(PredId, ProcId, C, RecCallIds),
M = list.length(Rec),
- attempt_transform_2(RecCallIds, C, M, Rec, HeadVars, InitialInstMap,
- TopLevel, DoLCO, FullyStrict, PredId, PredInfo,
- !ProcInfo, !ModuleInfo, Warnings).
- % attempt_transform_2 takes a list of locations of the recursive
- % calls, and attempts to introduce accumulator into each of the
+ should_attempt_accu_transform_2(!ModuleInfo, PredId, PredInfo, !ProcInfo,
+ HeadVars, InitialInstMap, TopLevel, FullyStrict, DoLCO,
+ RecCallIds, C, M, Rec, Warnings).
+
+ % should_attempt_accu_transform_2 takes a list of locations of the
+ % recursive calls, and attempts to introduce accumulator into each of the
% recursive calls, stopping at the first one that succeeds.
% This catches the following case, as selecting the first
% recursive call allows the second recursive call to be moved
@@ -384,33 +388,34 @@
% p(InB, OutB),
% list.append(OutB, OutA, Out)
%
-:- pred attempt_transform_2(list(goal_id)::in, goal_store::in, int::in,
- hlds_goals::in, prog_vars::in, instmap::in, top_level::in,
- bool::in, bool::in, pred_id::in, pred_info::in,
- proc_info::in, proc_info::out, module_info::in, module_info::out,
- warnings::out) is semidet.
-
-attempt_transform_2([Id | Ids], C, M, Rec, HeadVars, InitialInstMap, TopLevel,
- DoLCO, FullyStrict, PredId, PredInfo, !ProcInfo, !ModuleInfo,
- Warnings) :-
+:- pred should_attempt_accu_transform_2(module_info::in, module_info::out,
+ pred_id::in, pred_info::in, proc_info::in, proc_info::out,
+ prog_vars::in, instmap::in, top_level::in, bool::in, bool::in,
+ list(accu_goal_id)::in, accu_goal_store::in, int::in, list(hlds_goal)::in,
+ accu_warnings::out) is semidet.
+
+should_attempt_accu_transform_2(!ModuleInfo, PredId, PredInfo, !ProcInfo,
+ HeadVars, InitialInstMap, TopLevel, FullyStrict, DoLCO,
+ [Id | Ids], C, M, Rec, Warnings) :-
(
proc_info_get_vartypes(!.ProcInfo, VarTypes0),
- identify_out_and_out_prime(Id, Rec, HeadVars, InitialInstMap,
- VarTypes0, !.ModuleInfo, Out, OutPrime,
+ identify_out_and_out_prime(!.ModuleInfo, VarTypes0, InitialInstMap,
+ Id, Rec, HeadVars, Out, OutPrime,
HeadToCallSubst, CallToHeadSubst),
- stage1(Id, M, C, DoLCO, FullyStrict, VarTypes0, !.ModuleInfo, Sets),
- stage2(Id, C, Sets, OutPrime, Out, !.ModuleInfo, !.ProcInfo,
+ accu_stage1(!.ModuleInfo, VarTypes0, FullyStrict, DoLCO, Id, M, C,
+ Sets),
+ accu_stage2(!.ModuleInfo, !.ProcInfo, Id, C, Sets, OutPrime, Out,
VarSet, VarTypes, Accs, BaseCase, BasePairs, Substs, CS,
WarningsPrime),
- stage3(Id, Accs, VarSet, VarTypes, C, CS, Substs,
+ accu_stage3(Id, Accs, VarSet, VarTypes, C, CS, Substs,
HeadToCallSubst, CallToHeadSubst, BaseCase, BasePairs, Sets, Out,
TopLevel, PredId, PredInfo, !ProcInfo, !ModuleInfo)
->
Warnings = WarningsPrime
;
- attempt_transform_2(Ids, C, M, Rec, HeadVars, InitialInstMap,
- TopLevel, DoLCO, FullyStrict, PredId, PredInfo, !ProcInfo,
- !ModuleInfo, Warnings)
+ should_attempt_accu_transform_2(!ModuleInfo, PredId, PredInfo,
+ !ProcInfo, HeadVars, InitialInstMap, TopLevel, FullyStrict, DoLCO,
+ Ids, C, M, Rec, Warnings)
).
%-----------------------------------------------------------------------------%
@@ -419,16 +424,15 @@
% Transform the goal into a standard form that is amenable to
% introducing accumulators.
%
- % At the moment all this does is remove any extra disj/conj
- % wrappers around the top level goal.
+ % At the moment all this does is remove any extra disj/conj wrappers
+ % around the top level goal.
%
- % Future work is for this code to rearrange code with multiple
- % base and recursive cases into a single base and recursive
- % case.
+ % Future work is for this code to rearrange code with multiple base
+ % and recursive cases into a single base and recursive case.
%
-:- pred standardize(hlds_goal::in, hlds_goal::out) is det.
+:- pred accu_standardize(hlds_goal::in, hlds_goal::out) is det.
-standardize(Goal0, Goal) :-
+accu_standardize(Goal0, Goal) :-
(
Goal0 = hlds_goal(GoalExpr0, _),
(
@@ -437,7 +441,7 @@
GoalExpr0 = disj([Goal1])
)
->
- standardize(Goal1, Goal)
+ accu_standardize(Goal1, Goal)
;
Goal = Goal0
).
@@ -451,11 +455,11 @@
% transformation doesn't depend on what is in the base case.
%
:- pred identify_goal_type(pred_id::in, proc_id::in, hlds_goal::in,
- instmap::in, top_level::out, hlds_goals::out, instmap::out,
- hlds_goals::out, instmap::out) is semidet.
+ instmap::in, top_level::out, list(hlds_goal)::out, instmap::out,
+ list(hlds_goal)::out, instmap::out) is semidet.
-identify_goal_type(PredId, ProcId, Goal, InitialInstMap,
- Type, Base, BaseInstMap, Rec, RecInstMap) :-
+identify_goal_type(PredId, ProcId, Goal, InitialInstMap, Type,
+ Base, BaseInstMap, Rec, RecInstMap) :-
Goal = hlds_goal(GoalExpr, _GoalInfo),
(
GoalExpr = switch(_Var, _CanFail, Cases),
@@ -527,9 +531,9 @@
).
% is_recursive_case(Gs, Id) is true iff the list of goals, Gs,
- % contains a call to the procedure specified by Id, where the
- % call is located in a position that can be used by the
- % transformation (ie not hidden in a compound goal).
+ % contains a call to the procedure specified by Id, where the call
+ % is located in a position that can be used by the transformation
+ % (i.e. not hidden in a compound goal).
%
:- pred is_recursive_case(list(hlds_goal)::in, pred_proc_id::in) is semidet.
@@ -547,47 +551,49 @@
store_loc :: int,
% The location of the goal in the conjunction.
store_instmap :: instmap,
- store_goals :: goal_store
+ store_goals :: accu_goal_store
).
% Initialise the goal_store, which will hold the C_{a,b} goals.
%
-:- func initialize_goal_store(hlds_goals, instmap, hlds_goals, instmap)
- = goal_store.
+:- func initialize_goal_store(list(hlds_goal), instmap,
+ list(hlds_goal), instmap) = accu_goal_store.
initialize_goal_store(Rec, RecInstMap, Base, BaseInstMap) = C :-
goal_store_init(C0),
- list.foldl(store(rec), Rec, store_info(1, RecInstMap, C0),
- store_info(_, _, C1)),
- list.foldl(store(base), Base, store_info(1, BaseInstMap, C1),
- store_info(_, _, C)).
-
- % store(Id, G, SI0, SI) is true iff the goal G is stored inside
- % the goal_store (which is part of SI) with the correct
- % identifier and instmap associated with the goal.
- %
-:- pred store(int::in, hlds_goal::in, store_info::in, store_info::out) is det.
+ list.foldl3(accu_store(accu_rec), Rec,
+ 1, _, RecInstMap, _, C0, C1),
+ list.foldl3(accu_store(accu_base), Base,
+ 1, _, BaseInstMap, _, C1, C).
+
+:- pred accu_store(accu_case::in, hlds_goal::in,
+ int::in, int::out, instmap::in, instmap::out,
+ accu_goal_store::in, accu_goal_store::out) is det.
+
+accu_store(Case, Goal, !N, !InstMap, !GoalStore) :-
+ Id = accu_goal_id(Case, !.N),
+ goal_store_det_insert(Id, stored_goal(Goal, !.InstMap), !GoalStore),
-store(Identifier, Goal, store_info(N, IM0, GS0), store_info(N+1, IM, GS)) :-
+ !:N = !.N + 1,
Goal = hlds_goal(_, GoalInfo),
InstMapDelta = goal_info_get_instmap_delta(GoalInfo),
- instmap.apply_instmap_delta(IM0, InstMapDelta, IM),
- goal_store_det_insert(Identifier - N, stored_goal(Goal, IM0), GS0, GS).
+ instmap.apply_instmap_delta(!.InstMap, InstMapDelta, !:InstMap).
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
- % Determine the k's which are recursive calls
+ % Determine the k's which are recursive calls.
% Note that this doesn't find recursive calls which are `hidden'
- % in compound goals, this is not a problem as currently we can't
- % use these to do transformation.
+ % in compound goals, this is not a problem as currently we can't use
+ % these to do transformation.
+ %
:- pred identify_recursive_calls(pred_id::in, proc_id::in,
- goal_store::in, list(goal_id)::out) is det.
+ accu_goal_store::in, list(accu_goal_id)::out) is det.
identify_recursive_calls(PredId, ProcId, GoalStore, Ids) :-
P = (pred(Key::out) is nondet :-
goal_store_member(GoalStore, Key, stored_goal(Goal, _InstMap)),
- Key = rec - _,
+ Key = accu_goal_id(accu_rec, _),
Goal = hlds_goal(plain_call(PredId, ProcId, _, _, _, _), _)
),
solutions.solutions(P, Ids).
@@ -595,23 +601,23 @@
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
- % Determine the variables which are members of the sets Out and
- % Out', and initialize the substitutions between the two sets.
+ % Determine the variables which are members of the sets Out and Out',
+ % and initialize the substitutions between the two sets.
%
- % This is done by identifing those variables whose
- % instantiatedness change in the goals after the recursive call
- % and are headvars.
+ % This is done by identifing those variables whose instantiatedness change
+ % in the goals after the recursive call and are headvars.
%
% Note that we are only identifying the output variables which
- % will need to be accumulated, as there may be other output
- % variables which are produced prior to the recursive call.
+ % will need to be accumulated, as there may be other output variables
+ % which are produced prior to the recursive call.
%
-:- pred identify_out_and_out_prime(goal_id::in, hlds_goals::in, prog_vars::in,
- instmap::in, vartypes::in, module_info::in, prog_vars::out,
- prog_vars::out, subst::out, subst::out) is det.
-
-identify_out_and_out_prime(_N - K, Rec, HeadVars, InitialInstMap, VarTypes,
- ModuleInfo, Out, OutPrime, HeadToCallSubst, CallToHeadSubst) :-
+:- pred identify_out_and_out_prime(module_info::in, vartypes::in, instmap::in,
+ accu_goal_id::in, list(hlds_goal)::in, prog_vars::in, prog_vars::out,
+ prog_vars::out, accu_subst::out, accu_subst::out) is det.
+
+identify_out_and_out_prime(ModuleInfo, VarTypes, InitialInstMap, GoalId,
+ Rec, HeadVars, Out, OutPrime, HeadToCallSubst, CallToHeadSubst) :-
+ GoalId = accu_goal_id(_Case, K),
(
list.take(K, Rec, InitialGoals),
list.drop(K-1, Rec, FinalGoals),
@@ -643,7 +649,7 @@
list.map((pred(X-Y::in, Y-X::out) is det), HeadArg, ArgHead),
map.from_assoc_list(ArgHead, CallToHeadSubst)
;
- unexpected(this_file, "identify_out_and_out_prime")
+ unexpected($module, $pred, "test failed")
).
%-----------------------------------------------------------------------------%
@@ -654,29 +660,32 @@
% For the definition of what goes into each set, inspect the
% documentation for the functions named before, assoc, and so on.
%
-:- type sets
- ---> sets(
- before :: set(goal_id),
- assoc :: set(goal_id),
- construct_assoc :: set(goal_id),
- construct :: set(goal_id),
- update :: set(goal_id),
- reject :: set(goal_id)
- ).
-
- % Stage 1 is responsible for identifying which goals are
- % associative, which can be moved before the recursive call and
- % so on.
- %
-:- pred stage1(goal_id::in, int::in, goal_store::in, bool::in, bool::in,
- vartypes::in, module_info::in, sets::out) is semidet.
-
-stage1(N - K, M, GoalStore, DoLCO, FullyStrict, VarTypes, ModuleInfo, Sets) :-
- sets_init(Sets0),
- stage1_2(N - (K+1), K, M, GoalStore, FullyStrict, VarTypes, ModuleInfo,
- Sets0, Sets1),
- Sets1 = sets(Before, Assoc, ConstructAssoc, Construct, Update, Reject),
- Sets = sets(Before `set.union` set_upto(N, (K-1)), Assoc,
+:- type accu_sets
+ ---> accu_sets(
+ as_before :: set(accu_goal_id),
+ as_assoc :: set(accu_goal_id),
+ as_construct_assoc :: set(accu_goal_id),
+ as_construct :: set(accu_goal_id),
+ as_update :: set(accu_goal_id),
+ as_reject :: set(accu_goal_id)
+ ).
+
+ % Stage 1 is responsible for identifying which goals are associative,
+ % which can be moved before the recursive call and so on.
+ %
+:- pred accu_stage1(module_info::in, vartypes::in, bool::in, bool::in,
+ accu_goal_id::in, int::in, accu_goal_store::in, accu_sets::out) is semidet.
+
+accu_stage1(ModuleInfo, VarTypes, FullyStrict, DoLCO, GoalId, M, GoalStore,
+ Sets) :-
+ GoalId = accu_goal_id(Case, K),
+ NextGoalId = accu_goal_id(Case, K + 1),
+ accu_sets_init(Sets0),
+ accu_stage1_2(ModuleInfo, VarTypes, FullyStrict, NextGoalId, K, M,
+ GoalStore, Sets0, Sets1),
+ Sets1 = accu_sets(Before, Assoc,
+ ConstructAssoc, Construct, Update, Reject),
+ Sets = accu_sets(Before `set.union` set_upto(Case, K - 1), Assoc,
ConstructAssoc, Construct, Update, Reject),
% Continue the transformation only if the set reject is empty and
@@ -701,60 +710,63 @@
% For each goal after the recursive call decide which set
% the goal belongs to.
%
-:- pred stage1_2(goal_id::in, int::in, int::in, goal_store::in,
- bool::in, vartypes::in, module_info::in, sets::in, sets::out) is det.
-
-stage1_2(N - I, K, M, GoalStore, FullyStrict, VarTypes, ModuleInfo, !Sets) :-
+:- pred accu_stage1_2(module_info::in, vartypes::in, bool::in,
+ accu_goal_id::in, int::in, int::in, accu_goal_store::in,
+ accu_sets::in, accu_sets::out) is det.
+
+accu_stage1_2(ModuleInfo, VarTypes, FullyStrict, GoalId, K, M, GoalStore,
+ !Sets) :-
+ GoalId = accu_goal_id(Case, I),
+ NextGoalId = accu_goal_id(Case, I + 1),
( I > M ->
true
;
(
- before(N - I, K, GoalStore, !.Sets, FullyStrict, VarTypes,
- ModuleInfo)
+ accu_before(ModuleInfo, VarTypes, FullyStrict, GoalId, K,
+ GoalStore, !.Sets)
->
- !:Sets = !.Sets ^ before := set.insert(!.Sets ^ before, N - I),
- stage1_2(N - (I+1), K, M, GoalStore, FullyStrict, VarTypes,
- ModuleInfo, !Sets)
+ !Sets ^ as_before := set.insert(!.Sets ^ as_before, GoalId),
+ accu_stage1_2(ModuleInfo, VarTypes, FullyStrict, NextGoalId, K, M,
+ GoalStore, !Sets)
;
- assoc(N - I, K, GoalStore, !.Sets, FullyStrict, VarTypes,
- ModuleInfo)
+ accu_assoc(ModuleInfo, VarTypes, FullyStrict, GoalId, K,
+ GoalStore, !.Sets)
->
- !:Sets = !.Sets ^ assoc := set.insert(!.Sets ^ assoc, N - I),
- stage1_2(N - (I+1), K, M, GoalStore, FullyStrict, VarTypes,
- ModuleInfo, !Sets)
+ !Sets ^ as_assoc := set.insert(!.Sets ^ as_assoc, GoalId),
+ accu_stage1_2(ModuleInfo, VarTypes, FullyStrict, NextGoalId, K, M,
+ GoalStore, !Sets)
;
- construct(N - I, K, GoalStore, !.Sets, FullyStrict, VarTypes,
- ModuleInfo)
+ accu_construct(ModuleInfo, VarTypes, FullyStrict, GoalId, K,
+ GoalStore, !.Sets)
->
- !Sets ^ construct :=
- set.insert(!.Sets ^ construct, N - I),
- stage1_2(N - (I+1), K, M, GoalStore, FullyStrict, VarTypes,
- ModuleInfo, !Sets)
+ !Sets ^ as_construct := set.insert(!.Sets ^ as_construct, GoalId),
+ accu_stage1_2(ModuleInfo, VarTypes, FullyStrict, NextGoalId, K, M,
+ GoalStore, !Sets)
;
- construct_assoc(N - I, K, GoalStore, !.Sets, FullyStrict, VarTypes,
- ModuleInfo)
+ accu_construct_assoc(ModuleInfo, VarTypes, FullyStrict, GoalId, K,
+ GoalStore, !.Sets)
->
- !Sets ^ construct_assoc :=
- set.insert(!.Sets ^ construct_assoc, N-I),
- stage1_2(N - (I+1), K, M, GoalStore, FullyStrict, VarTypes,
- ModuleInfo, !Sets)
+ !Sets ^ as_construct_assoc :=
+ set.insert(!.Sets ^ as_construct_assoc, GoalId),
+ accu_stage1_2(ModuleInfo, VarTypes, FullyStrict, NextGoalId, K, M,
+ GoalStore, !Sets)
;
- update(N - I, K, GoalStore, !.Sets, FullyStrict, VarTypes,
- ModuleInfo)
+ accu_update(ModuleInfo, VarTypes, FullyStrict, GoalId, K,
+ GoalStore, !.Sets)
->
- !Sets ^ update := set.insert(!.Sets ^ update, N - I),
- stage1_2(N - (I+1), K, M, GoalStore, FullyStrict, VarTypes,
- ModuleInfo, !Sets)
+ !Sets ^ as_update := set.insert(!.Sets ^ as_update, GoalId),
+ accu_stage1_2(ModuleInfo, VarTypes, FullyStrict, NextGoalId, K, M,
+ GoalStore, !Sets)
;
- !Sets ^ reject := set.insert(!.Sets ^ reject, N - I)
+ !Sets ^ as_reject := set.insert(!.Sets ^ as_reject, GoalId)
)
).
%-----------------------------------------------------------------------------%
-:- pred sets_init(sets::out) is det.
+:- pred accu_sets_init(accu_sets::out) is det.
-sets_init(Sets) :-
+accu_sets_init(Sets) :-
set.init(EmptySet),
Before = EmptySet,
Assoc = EmptySet,
@@ -762,111 +774,125 @@
Construct = EmptySet,
Update = EmptySet,
Reject = EmptySet,
- Sets = sets(Before, Assoc, ConstructAssoc, Construct, Update, Reject).
+ Sets = accu_sets(Before, Assoc, ConstructAssoc, Construct, Update, Reject).
- % set_upto(N, K) returns the set {(N,1)...(N,K)}.
+ % set_upto(Case, K) returns the set
+ % {accu_goal_id(Case, 1) .. accu_goal_id(Case, K)}.
%
-:- func set_upto(int, int) = set(goal_id).
+:- func set_upto(accu_case, int) = set(accu_goal_id).
-set_upto(N, K) = Set :-
+set_upto(Case, K) = Set :-
( K =< 0 ->
set.init(Set)
;
- Set0 = set_upto(N, K-1),
- set.insert(Set0, pair(N, K), Set)
+ Set0 = set_upto(Case, K-1),
+ set.insert(Set0, accu_goal_id(Case, K), Set)
).
%-----------------------------------------------------------------------------%
- % A goal is a member of the before set iff the goal only depends on
- % goals which are before the recursive call or can be moved
- % before the recursive call (member of the before set).
+ % A goal is a member of the before set iff the goal only depends on goals
+ % which are before the recursive call or can be moved before the recursive
+ % call (member of the before set).
%
-:- pred before(goal_id::in, int::in, goal_store::in, sets::in,
- bool::in, vartypes::in, module_info::in) is semidet.
+:- pred accu_before(module_info::in, vartypes::in, bool::in,
+ accu_goal_id::in, int::in, accu_goal_store::in, accu_sets::in) is semidet.
-before(N - I, K, GoalStore, sets(Before, _, _, _, _, _),
- FullyStrict, VarTypes, ModuleInfo) :-
- goal_store_lookup(GoalStore, N - I, stored_goal(LaterGoal, LaterInstMap)),
+accu_before(ModuleInfo, VarTypes, FullyStrict, GoalId, K, GoalStore, Sets) :-
+ GoalId = accu_goal_id(Case, _I),
+ Before = Sets ^ as_before,
+ goal_store_lookup(GoalStore, GoalId, stored_goal(LaterGoal, LaterInstMap)),
(
- member_lessthan_goalid(GoalStore, N - I, N - J,
+ member_lessthan_goalid(GoalStore, GoalId, LessThanGoalId,
stored_goal(EarlierGoal, EarlierInstMap)),
not can_reorder_goals_old(ModuleInfo, VarTypes, FullyStrict,
EarlierInstMap, EarlierGoal, LaterInstMap, LaterGoal)
)
=>
(
- set.member(N - J, set_upto(N, K-1) `union` Before)
+ set.member(LessThanGoalId, set_upto(Case, K - 1) `union` Before)
).
- % A goal is a member of the assoc set iff the goal only depends
- % on goals upto and including the recursive call and goals which
- % can be moved before the recursive call (member of the before
- % set) AND the goal is associative.
+ % A goal is a member of the assoc set iff the goal only depends on goals
+ % upto and including the recursive call and goals which can be moved
+ % before the recursive call (member of the before set) AND the goal
+ % is associative.
%
-:- pred assoc(goal_id::in, int::in, goal_store::in, sets::in, bool::in,
- vartypes::in, module_info::in) is semidet.
+:- pred accu_assoc(module_info::in, vartypes::in, bool::in,
+ accu_goal_id::in, int::in, accu_goal_store::in, accu_sets::in) is semidet.
-assoc(N - I, K, GoalStore, sets(Before, _, _, _, _, _),
- FullyStrict, VarTypes, ModuleInfo) :-
- goal_store_lookup(GoalStore, N - I, stored_goal(LaterGoal, LaterInstMap)),
+accu_assoc(ModuleInfo, VarTypes, FullyStrict, GoalId, K, GoalStore, Sets) :-
+ GoalId = accu_goal_id(Case, _I),
+ Before = Sets ^ as_before,
+ goal_store_lookup(GoalStore, GoalId, stored_goal(LaterGoal, LaterInstMap)),
LaterGoal = hlds_goal(plain_call(PredId, _, Args, _, _, _), _),
- is_associative(PredId, ModuleInfo, Args, _),
+ accu_is_associative(ModuleInfo, PredId, Args, _),
(
- member_lessthan_goalid(GoalStore, N - I, _N - J,
+ % XXX LessThanGoalId was _N - J, not N - J: it ignored the case.
+ % See the cvs diff with the previous version.
+ member_lessthan_goalid(GoalStore, GoalId, LessThanGoalId,
stored_goal(EarlierGoal, EarlierInstMap)),
not can_reorder_goals_old(ModuleInfo, VarTypes, FullyStrict,
EarlierInstMap, EarlierGoal, LaterInstMap, LaterGoal)
)
=>
(
- set.member(N - J, set_upto(N, K) `union` Before)
+ set.member(LessThanGoalId, set_upto(Case, K) `union` Before)
).
% A goal is a member of the construct set iff the goal only depends
% on goals upto and including the recursive call and goals which
- % can be moved before the recursive call (member of the before
- % set) AND the goal is construction unification.
+ % can be moved before the recursive call (member of the before set)
+ % AND the goal is construction unification.
%
-:- pred construct(goal_id::in, int::in, goal_store::in, sets::in,
- bool::in, vartypes::in, module_info::in) is semidet.
+:- pred accu_construct(module_info::in, vartypes::in, bool::in,
+ accu_goal_id::in, int::in, accu_goal_store::in, accu_sets::in) is semidet.
-construct(N - I, K, GoalStore, sets(Before, _, _, Construct, _, _),
- FullyStrict, VarTypes, ModuleInfo) :-
- goal_store_lookup(GoalStore, N - I, stored_goal(LaterGoal, LaterInstMap)),
+accu_construct(ModuleInfo, VarTypes, FullyStrict, GoalId, K, GoalStore,
+ Sets) :-
+ GoalId = accu_goal_id(Case, _I),
+ Before = Sets ^ as_before,
+ Construct = Sets ^ as_construct,
+ goal_store_lookup(GoalStore, GoalId, stored_goal(LaterGoal, LaterInstMap)),
LaterGoal = hlds_goal(unify(_, _, _, Unify, _), _GoalInfo),
Unify = construct(_, _, _, _, _, _, _),
(
- member_lessthan_goalid(GoalStore, N - I, _N - J,
+ % XXX LessThanGoalId was _N - J, not N - J: it ignored the case.
+ % See the cvs diff with the previous version.
+ member_lessthan_goalid(GoalStore, GoalId, LessThanGoalId,
stored_goal(EarlierGoal, EarlierInstMap)),
not can_reorder_goals_old(ModuleInfo, VarTypes, FullyStrict,
EarlierInstMap, EarlierGoal, LaterInstMap, LaterGoal)
)
=>
(
- set.member(N - J, set_upto(N, K) `union` Before `union` Construct)
+ set.member(LessThanGoalId,
+ set_upto(Case, K) `union` Before `union` Construct)
).
- % A goal is a member of the construct_assoc set iff the goal
- % only depends on goals upto and including the recursive call
- % and goals which can be moved before the recursive call (member
- % of the before set) and goals which are associative AND the
- % goal is construction unification AND the there is only one
- % member of the assoc set which the construction unification
- % depends on AND the construction unification can be expressed
- % as a call to the member of the assoc set which the
- % construction unification depends on.
- %
-:- pred construct_assoc(goal_id::in, int::in, goal_store::in, sets::in,
- bool::in, vartypes::in, module_info::in) is semidet.
-
-construct_assoc(N - I, K, GoalStore, sets(Before, Assoc, ConstructAssoc,
- _, _, _), FullyStrict, VarTypes, ModuleInfo) :-
- goal_store_lookup(GoalStore, N - I, stored_goal(LaterGoal, LaterInstMap)),
+ % A goal is a member of the construct_assoc set iff the goal depends only
+ % on goals upto and including the recursive call and goals which can be
+ % moved before the recursive call (member of the before set) and goals
+ % which are associative AND the goal is construction unification AND
+ % there is only one member of the assoc set which the construction
+ % unification depends on AND the construction unification can be expressed
+ % as a call to the member of the assoc set which the construction
+ % unification depends on.
+ %
+:- pred accu_construct_assoc(module_info::in, vartypes::in, bool::in,
+ accu_goal_id::in, int::in, accu_goal_store::in, accu_sets::in) is semidet.
+
+accu_construct_assoc(ModuleInfo, VarTypes, FullyStrict,
+ GoalId, K, GoalStore, Sets) :-
+ GoalId = accu_goal_id(Case, _I),
+ Before = Sets ^ as_before,
+ Assoc = Sets ^ as_assoc,
+ ConstructAssoc = Sets ^ as_construct_assoc,
+ goal_store_lookup(GoalStore, GoalId, stored_goal(LaterGoal, LaterInstMap)),
LaterGoal = hlds_goal(unify(_, _, _, Unify, _), _GoalInfo),
Unify = construct(_, ConsId, _, _, _, _, _),
- goal_store_all_ancestors(GoalStore, N - I, VarTypes, ModuleInfo,
+ goal_store_all_ancestors(GoalStore, GoalId, VarTypes, ModuleInfo,
FullyStrict, Ancestors),
set.singleton_set(Assoc `intersect` Ancestors, AssocId),
@@ -874,17 +900,20 @@
stored_goal(AssocGoal, _AssocInstMap)),
AssocGoal = hlds_goal(plain_call(PredId, _, _, _, _, _), _),
- is_associative_construction(ConsId, PredId, ModuleInfo),
+ is_associative_construction(ModuleInfo, PredId, ConsId),
(
- member_lessthan_goalid(GoalStore, N - I, _N - J,
+ % XXX LessThanGoalId was _N - J, not N - J: it ignored the case.
+ % See the cvs diff with the previous version.
+ member_lessthan_goalid(GoalStore, GoalId, LessThanGoalId,
stored_goal(EarlierGoal, EarlierInstMap)),
not can_reorder_goals_old(ModuleInfo, VarTypes, FullyStrict,
EarlierInstMap, EarlierGoal, LaterInstMap, LaterGoal)
)
=>
(
- set.member(N - J, set_upto(N, K) `union` Before `union`
- Assoc `union` ConstructAssoc)
+ set.member(LessThanGoalId,
+ set_upto(Case, K) `union` Before `union` Assoc
+ `union` ConstructAssoc)
).
% A goal is a member of the update set iff the goal only depends
@@ -892,111 +921,115 @@
% can be moved before the recursive call (member of the before
% set) AND the goal updates some state.
%
-:- pred update(goal_id::in, int::in, goal_store::in, sets::in, bool::in,
- vartypes::in, module_info::in) is semidet.
+:- pred accu_update(module_info::in, vartypes::in, bool::in,
+ accu_goal_id::in, int::in, accu_goal_store::in, accu_sets::in) is semidet.
-update(N - I, K, GoalStore, sets(Before, _, _, _, _, _),
- FullyStrict, VarTypes, ModuleInfo) :-
- goal_store_lookup(GoalStore, N - I, stored_goal(LaterGoal, LaterInstMap)),
+accu_update(ModuleInfo, VarTypes, FullyStrict, GoalId, K, GoalStore, Sets) :-
+ GoalId = accu_goal_id(Case, _I),
+ Before = Sets ^ as_before,
+ goal_store_lookup(GoalStore, GoalId, stored_goal(LaterGoal, LaterInstMap)),
LaterGoal = hlds_goal(plain_call(PredId, _, Args, _, _, _), _),
- is_update(PredId, ModuleInfo, Args, _),
+ accu_is_update(ModuleInfo, PredId, Args, _),
(
- member_lessthan_goalid(GoalStore, N - I, _N - J,
+ % XXX LessThanGoalId was _N - J, not N - J: it ignored the case.
+ % See the cvs diff with the previous version.
+ member_lessthan_goalid(GoalStore, GoalId, LessThanGoalId,
stored_goal(EarlierGoal, EarlierInstMap)),
not can_reorder_goals_old(ModuleInfo, VarTypes, FullyStrict,
EarlierInstMap, EarlierGoal, LaterInstMap, LaterGoal)
)
=>
(
- set.member(N - J, set_upto(N, K) `union` Before)
+ set.member(LessThanGoalId, set_upto(Case, K) `union` Before)
).
- % member_lessthan_goalid(GS, IdA, IdB, GB) is true iff the
- % goal_id, IdB, and its associated goal, GB, is a member of the
- % goal_store, GS, and IdB is less than IdA.
+ % member_lessthan_goalid(GS, IdA, IdB, GB) is true iff the goal_id, IdB,
+ % and its associated goal, GB, is a member of the goal_store, GS,
+ % and IdB is less than IdA.
%
-:- pred member_lessthan_goalid(goal_store::in, goal_id::in,
- goal_id::out, stored_goal::out) is nondet.
+:- pred member_lessthan_goalid(accu_goal_store::in,
+ accu_goal_id::in, accu_goal_id::out, stored_goal::out) is nondet.
-member_lessthan_goalid(GoalStore, N - I, N - J, Goal) :-
- goal_store_member(GoalStore, N - J, Goal),
+member_lessthan_goalid(GoalStore, GoalId, LessThanGoalId, LessThanGoal) :-
+ goal_store_member(GoalStore, LessThanGoalId, LessThanGoal),
+ GoalId = accu_goal_id(Case, I),
+ LessThanGoalId = accu_goal_id(Case, J),
J < I.
%-----------------------------------------------------------------------------%
-:- type assoc
- ---> assoc(
+:- type accu_assoc
+ ---> accu_assoc(
set(prog_var), % the associative input args
prog_var, % the corresponding output arg
bool % is the predicate commutative?
).
- % If accumulator_is_associative is true, it returns the two
- % arguments which are associative and the variable which depends
- % on those two arguments, and an indicator of whether or not
- % the predicate is commutative.
+ % If accu_is_associative is true, it returns the two arguments which are
+ % associative and the variable which depends on those two arguments,
+ % and an indicator of whether or not the predicate is commutative.
%
-:- pred is_associative(pred_id::in, module_info::in, prog_vars::in, assoc::out)
- is semidet.
+:- pred accu_is_associative(module_info::in, pred_id::in, prog_vars::in,
+ accu_assoc::out) is semidet.
-is_associative(PredId, ModuleInfo, Args, Result) :-
+accu_is_associative(ModuleInfo, PredId, Args, Result) :-
module_info_pred_info(ModuleInfo, PredId, PredInfo),
pred_info_get_assertions(PredInfo, Assertions),
- associativity_assertion(set.to_sorted_list(Assertions), ModuleInfo,
+ associativity_assertion(ModuleInfo, set.to_sorted_list(Assertions),
Args, AssociativeVars, OutputVar),
(
- commutativity_assertion(set.to_sorted_list(Assertions),
- ModuleInfo, Args, _CommutativeVars)
+ commutativity_assertion(ModuleInfo, set.to_sorted_list(Assertions),
+ Args, _CommutativeVars)
->
IsCommutative = yes
;
IsCommutative = no
),
- Result = assoc(AssociativeVars, OutputVar, IsCommutative).
+ Result = accu_assoc(AssociativeVars, OutputVar, IsCommutative).
% Does there exist one (and only one) associativity assertion for the
- % current predicate.
+ % current predicate?
% The 'and only one condition' is required because we currently
- % don't handle the case of predicates which have individual
- % parts which are associative, because then we don't know which
- % variable is descended from which.
+ % do not handle the case of predicates which have individual parts
+ % which are associative, because then we do not know which variable
+ % is descended from which.
%
-:- pred associativity_assertion(list(assert_id)::in, module_info::in,
+:- pred associativity_assertion(module_info::in, list(assert_id)::in,
prog_vars::in, set(prog_var)::out, prog_var::out) is semidet.
-associativity_assertion([AssertId | AssertIds], ModuleInfo, Args0, VarAB,
+associativity_assertion(ModuleInfo, [AssertId | AssertIds], Args0, VarAB,
OutputVar) :-
(
assertion.is_associativity_assertion(ModuleInfo, AssertId,
Args0, VarA - VarB, OutputVar0)
->
- \+ associativity_assertion(AssertIds, ModuleInfo, Args0, _, _),
+ \+ associativity_assertion(ModuleInfo, AssertIds, Args0, _, _),
VarAB = set.list_to_set([VarA, VarB]),
OutputVar = OutputVar0
;
- associativity_assertion(AssertIds, ModuleInfo, Args0, VarAB, OutputVar)
+ associativity_assertion(ModuleInfo, AssertIds, Args0, VarAB, OutputVar)
).
% Does there exist one (and only one) commutativity assertion for the
- % current predicate.
+ % current predicate?
% The 'and only one condition' is required because we currently
- % don't handle the case of predicates which have individual
- % parts which are commutative, because then we don't know which
- % variable is descended from which.
+ % do not handle the case of predicates which have individual
+ % parts which are commutative, because then we do not know which variable
+ % is descended from which.
%
-:- pred commutativity_assertion(list(assert_id)::in, module_info::in,
+:- pred commutativity_assertion(module_info::in,list(assert_id)::in,
prog_vars::in, set(prog_var)::out) is semidet.
-commutativity_assertion([AssertId | AssertIds], ModuleInfo, Args0,
+commutativity_assertion(ModuleInfo, [AssertId | AssertIds], Args0,
PossibleStaticVars) :-
(
assertion.is_commutativity_assertion(ModuleInfo, AssertId,
Args0, StaticVarA - StaticVarB)
->
- \+ commutativity_assertion(AssertIds, ModuleInfo, Args0, _),
+ \+ commutativity_assertion(ModuleInfo, AssertIds, Args0, _),
PossibleStaticVars = set.list_to_set([StaticVarA, StaticVarB])
;
- commutativity_assertion(AssertIds, ModuleInfo, Args0,
+ commutativity_assertion(ModuleInfo, AssertIds, Args0,
PossibleStaticVars)
).
@@ -1004,23 +1037,20 @@
% Does the current predicate update some state?
%
-:- pred is_update(pred_id::in, module_info::in, prog_vars::in,
+:- pred accu_is_update(module_info::in, pred_id::in, prog_vars::in,
pair(prog_var)::out) is semidet.
-is_update(PredId, ModuleInfo, Args, ResultStateVars) :-
+accu_is_update(ModuleInfo, PredId, Args, ResultStateVars) :-
module_info_pred_info(ModuleInfo, PredId, PredInfo),
-
pred_info_get_assertions(PredInfo, Assertions),
-
list.filter_map(
(pred(AssertId::in, StateVars::out) is semidet :-
assertion.is_update_assertion(ModuleInfo, AssertId,
PredId, Args, StateVars)
),
set.to_sorted_list(Assertions), Result),
-
- % XXX maybe we should just match on the first result,
- % just in case there is duplicate promises.
+ % XXX Maybe we should just match on the first result,
+ % just in case there are duplicate promises.
Result = [ResultStateVars].
%-----------------------------------------------------------------------------%
@@ -1028,10 +1058,10 @@
% Can the construction unification be expressed as a call to the
% specified predicate.
%
-:- pred is_associative_construction(cons_id::in, pred_id::in,
- module_info::in) is semidet.
+:- pred is_associative_construction(module_info::in, pred_id::in, cons_id::in)
+ is semidet.
-is_associative_construction(ConsId, PredId, ModuleInfo) :-
+is_associative_construction(ModuleInfo, PredId, ConsId) :-
module_info_pred_info(ModuleInfo, PredId, PredInfo),
pred_info_get_assertions(PredInfo, Assertions),
list.filter(
@@ -1045,22 +1075,24 @@
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
-:- type substs
- ---> substs(
- acc_var_subst :: subst,
- rec_call_subst :: subst,
- assoc_call_subst :: subst,
- update_subst :: subst
+:- type accu_substs
+ ---> accu_substs(
+ acc_var_subst :: accu_subst,
+ rec_call_subst :: accu_subst,
+ assoc_call_subst :: accu_subst,
+ update_subst :: accu_subst
).
-:- type base
- ---> base(
- init_update :: set(goal_id),
+:- type accu_base
+ ---> accu_base(
% goals which initialize update
- init_assoc :: set(goal_id),
+ init_update :: set(accu_goal_id),
+
% goals which initialize assoc
- other :: set(goal_id)
+ init_assoc :: set(accu_goal_id),
+
% other goals
+ other :: set(accu_goal_id)
).
% Stage 2 is responsible for identifying the substitutions which
@@ -1073,21 +1105,22 @@
% variables used by the update goals and those used by the assoc
% goals and then all the rest.
%
-:- pred stage2(goal_id::in, goal_store::in, sets::in,
- prog_vars::in, prog_vars::in, module_info::in, proc_info::in,
- prog_varset::out, vartypes::out,
- prog_vars::out, base::out, list(pair(prog_var))::out,
- substs::out, goal_store::out, warnings::out) is semidet.
-
-stage2(N - K, GoalStore, Sets, OutPrime, Out, ModuleInfo, ProcInfo0,
- !:VarSet, !:VarTypes, Accs, BaseCase, BasePairs,
- !:Substs, CS, Warnings) :-
- Sets = sets(Before0, Assoc, ConstructAssoc, Construct, Update, _),
- Before = Before0 `union` set_upto(N, K-1),
-
- % Note Update set is not placed in the after set, as the
- % after set is used to determine the variables that need
- % to be accumulated for the associative calls.
+:- pred accu_stage2(module_info::in, proc_info::in,
+ accu_goal_id::in, accu_goal_store::in, accu_sets::in,
+ prog_vars::in, prog_vars::in, prog_varset::out, vartypes::out,
+ prog_vars::out, accu_base::out, list(pair(prog_var))::out,
+ accu_substs::out, accu_goal_store::out, accu_warnings::out) is semidet.
+
+accu_stage2(ModuleInfo, ProcInfo0, GoalId, GoalStore, Sets, OutPrime, Out,
+ !:VarSet, !:VarTypes, Accs, BaseCase, BasePairs, !:Substs,
+ CS, Warnings) :-
+ Sets = accu_sets(Before0, Assoc, ConstructAssoc, Construct, Update, _),
+ GoalId = accu_goal_id(Case, K),
+ Before = Before0 `union` set_upto(Case, K-1),
+
+ % Note Update set is not placed in the after set, as the after set is used
+ % to determine the variables that need to be accumulated for the
+ % associative calls.
After = Assoc `union` ConstructAssoc `union` Construct,
P = (pred(Id::in, Set0::in, Set::out) is det :-
@@ -1103,43 +1136,43 @@
proc_info_get_varset(ProcInfo0, !:VarSet),
proc_info_get_vartypes(ProcInfo0, !:VarTypes),
- substs_init(set.to_sorted_list(InitAccs), !VarSet, !VarTypes, !:Substs),
+ accu_substs_init(set.to_sorted_list(InitAccs), !VarSet, !VarTypes,
+ !:Substs),
set.list_to_set(OutPrime, OutPrimeSet),
- process_assoc_set(set.to_sorted_list(Assoc), GoalStore, OutPrimeSet,
- ModuleInfo, !Substs, !VarSet, !VarTypes, CS, Warnings),
+ accu_process_assoc_set(ModuleInfo, GoalStore, set.to_sorted_list(Assoc),
+ OutPrimeSet, !Substs, !VarSet, !VarTypes, CS, Warnings),
- process_update_set(set.to_sorted_list(Update), GoalStore, OutPrimeSet,
- ModuleInfo, !Substs, !VarSet, !VarTypes, UpdateOut, UpdateAccOut,
+ accu_process_update_set(ModuleInfo, GoalStore, set.to_sorted_list(Update),
+ OutPrimeSet, !Substs, !VarSet, !VarTypes, UpdateOut, UpdateAccOut,
BasePairs),
Accs = set.to_sorted_list(InitAccs) ++ UpdateAccOut,
- divide_base_case(UpdateOut, Out, GoalStore, !.VarTypes, ModuleInfo,
+ accu_divide_base_case(ModuleInfo, !.VarTypes, GoalStore, UpdateOut, Out,
UpdateBase, AssocBase, OtherBase),
- BaseCase = base(UpdateBase, AssocBase, OtherBase).
+ BaseCase = accu_base(UpdateBase, AssocBase, OtherBase).
%-----------------------------------------------------------------------------%
-:- pred substs_init(prog_vars::in, prog_varset::in, prog_varset::out,
- vartypes::in, vartypes::out, substs::out) is det.
+:- pred accu_substs_init(prog_vars::in, prog_varset::in, prog_varset::out,
+ vartypes::in, vartypes::out, accu_substs::out) is det.
-substs_init(InitAccs, !VarSet, !VarTypes, Substs) :-
+accu_substs_init(InitAccs, !VarSet, !VarTypes, Substs) :-
map.init(Subst),
acc_var_subst_init(InitAccs, !VarSet, !VarTypes, AccVarSubst),
RecCallSubst = Subst,
AssocCallSubst = Subst,
UpdateSubst = Subst,
- Substs = substs(AccVarSubst, RecCallSubst, AssocCallSubst,
+ Substs = accu_substs(AccVarSubst, RecCallSubst, AssocCallSubst,
UpdateSubst).
- % Initialise the acc_var_subst to be from Var to A_Var where
- % Var is a member of InitAccs and A_Var is a fresh variable of
- % the same type of Var.
+ % Initialise the acc_var_subst to be from Var to A_Var where Var is a
+ % member of InitAccs and A_Var is a fresh variable of the same type of Var.
%
:- pred acc_var_subst_init(prog_vars::in, prog_varset::in, prog_varset::out,
- vartypes::in, vartypes::out, subst::out) is det.
+ vartypes::in, vartypes::out, accu_subst::out) is det.
acc_var_subst_init([], !VarSet, !VarTypes, map.init).
acc_var_subst_init([Var | Vars], !VarSet, !VarTypes, Subst) :-
@@ -1163,28 +1196,29 @@
%-----------------------------------------------------------------------------%
- % For each member of the assoc set determine the substitutions
- % needed, and also check the efficiency of the procedure isn't
- % worsened by reordering the arguments to a call.
- %
-:- pred process_assoc_set(list(goal_id)::in, goal_store::in, set(prog_var)::in,
- module_info::in, substs::in, substs::out,
+ % For each member of the assoc set determine the substitutions needed,
+ % and also check the efficiency of the procedure isn't worsened
+ % by reordering the arguments to a call.
+ %
+:- pred accu_process_assoc_set(module_info::in, accu_goal_store::in,
+ list(accu_goal_id)::in, set(prog_var)::in,
+ accu_substs::in, accu_substs::out,
prog_varset::in, prog_varset::out, vartypes::in, vartypes::out,
- goal_store::out, warnings::out) is semidet.
+ accu_goal_store::out, accu_warnings::out) is semidet.
-process_assoc_set([], _GS, _OutPrime, _ModuleInfo, !Substs,
+accu_process_assoc_set(_ModuleInfo, _GS, [], _OutPrime, !Substs,
!VarSet, !VarTypes, CS, []) :-
goal_store_init(CS).
-process_assoc_set([Id | Ids], GS, OutPrime, ModuleInfo, !Substs,
+accu_process_assoc_set(ModuleInfo, GS, [Id | Ids], OutPrime, !Substs,
!VarSet, !VarTypes, CS, Warnings) :-
- !.Substs = substs(AccVarSubst, RecCallSubst0, AssocCallSubst0,
+ !.Substs = accu_substs(AccVarSubst, RecCallSubst0, AssocCallSubst0,
UpdateSubst),
lookup_call(GS, Id, stored_goal(Goal, InstMap)),
Goal = hlds_goal(plain_call(PredId, _, Args, _, _, _), GoalInfo),
- is_associative(PredId, ModuleInfo, Args, AssocInfo),
- AssocInfo = assoc(Vars, AssocOutput, IsCommutative),
+ accu_is_associative(ModuleInfo, PredId, Args, AssocInfo),
+ AssocInfo = accu_assoc(Vars, AssocOutput, IsCommutative),
set.singleton_set(Vars `intersect` OutPrime, DuringAssocVar),
set.singleton_set(Vars `difference` (Vars `intersect` OutPrime),
BeforeAssocVar),
@@ -1197,14 +1231,15 @@
map.det_insert(RecCallSubst0, DuringAssocVar, AssocOutput, RecCallSubst1),
map.det_insert(RecCallSubst1, BeforeAssocVar, NewAcc, RecCallSubst),
- !:Substs = substs(AccVarSubst, RecCallSubst, AssocCallSubst, UpdateSubst),
+ !:Substs = accu_substs(AccVarSubst, RecCallSubst, AssocCallSubst,
+ UpdateSubst),
% ONLY swap the order of the variables if the goal is
% associative and not commutative.
(
IsCommutative = yes,
CSGoal = stored_goal(Goal, InstMap),
- Warning = []
+ CurWarnings = []
;
IsCommutative = no,
@@ -1213,19 +1248,17 @@
ModuleName = pred_info_module(PredInfo),
PredName = pred_info_name(PredInfo),
Arity = pred_info_orig_arity(PredInfo),
- (
- has_heuristic(ModuleName, PredName, Arity)
- ->
+ ( accu_has_heuristic(ModuleName, PredName, Arity) ->
% Only do the transformation if the accumulator variable is
% *not* in a position where it will control the running time
% of the predicate.
- heuristic(ModuleName, PredName, Arity, Args,
+ accu_heuristic(ModuleName, PredName, Arity, Args,
PossibleDuringAssocVars),
set.member(DuringAssocVar, PossibleDuringAssocVars),
- Warning = []
+ CurWarnings = []
;
ProgContext = goal_info_get_context(GoalInfo),
- Warning = [warn(ProgContext, PredId, BeforeAssocVar,
+ CurWarnings = [accu_warn(ProgContext, PredId, BeforeAssocVar,
DuringAssocVar)]
),
% Swap the arguments.
@@ -1235,46 +1268,48 @@
CSGoal = stored_goal(SwappedGoal, InstMap)
),
- process_assoc_set(Ids, GS, OutPrime, ModuleInfo, !Substs,
+ accu_process_assoc_set(ModuleInfo, GS, Ids, OutPrime, !Substs,
!VarSet, !VarTypes, CS0, Warnings0),
goal_store_det_insert(Id, CSGoal, CS0, CS),
- list.append(Warnings0, Warning, Warnings).
+ Warnings = Warnings0 ++ CurWarnings.
-:- pred has_heuristic(module_name::in, string::in, arity::in) is semidet.
+:- pred accu_has_heuristic(module_name::in, string::in, arity::in) is semidet.
-has_heuristic(unqualified("list"), "append", 3).
+accu_has_heuristic(unqualified("list"), "append", 3).
- % heuristic returns the set of which head variables are
- % important in the running time of the predicate.
+ % heuristic returns the set of which head variables are important
+ % in the running time of the predicate.
%
-:- pred heuristic(module_name::in, string::in, arity::in, prog_vars::in,
+:- pred accu_heuristic(module_name::in, string::in, arity::in, prog_vars::in,
set(prog_var)::out) is semidet.
-heuristic(unqualified("list"), "append", 3, [_Typeinfo, A, _B, _C], Set) :-
+accu_heuristic(unqualified("list"), "append", 3, [_Typeinfo, A, _B, _C],
+ Set) :-
set.list_to_set([A], Set).
%-----------------------------------------------------------------------------%
- % For each member of the update set determine the substitutions
- % needed (creating the accumulator variables when needed).
- % Also associate with each Output variable which accumulator
- % variable to get the result from.
- %
-:- pred process_update_set(list(goal_id)::in, goal_store::in,
- set(prog_var)::in, module_info::in, substs::in, substs::out,
+ % For each member of the update set determine the substitutions needed
+ % (creating the accumulator variables when needed).
+ % Also associate with each Output variable which accumulator variable
+ % to get the result from.
+ %
+:- pred accu_process_update_set(module_info::in, accu_goal_store::in,
+ list(accu_goal_id)::in, set(prog_var)::in,
+ accu_substs::in, accu_substs::out,
prog_varset::in, prog_varset::out, vartypes::in, vartypes::out,
prog_vars::out, prog_vars::out, list(pair(prog_var))::out) is semidet.
-process_update_set([], _GS, _OutPrime, _ModuleInfo, !Substs,
+accu_process_update_set(_ModuleInfo, _GS, [], _OutPrime, !Substs,
!VarSet, !VarTypes, [], [], []).
-process_update_set([Id | Ids], GS, OutPrime, ModuleInfo, !Substs,
+accu_process_update_set(ModuleInfo, GS, [Id | Ids], OutPrime, !Substs,
!VarSet, !VarTypes, StateOutputVars, Accs, BasePairs) :-
- !.Substs = substs(AccVarSubst0, RecCallSubst0, AssocCallSubst,
+ !.Substs = accu_substs(AccVarSubst0, RecCallSubst0, AssocCallSubst,
UpdateSubst0),
lookup_call(GS, Id, stored_goal(Goal, _InstMap)),
Goal = hlds_goal(plain_call(PredId, _, Args, _, _, _), _GoalInfo),
- is_update(PredId, ModuleInfo, Args, StateVarA - StateVarB),
+ accu_is_update(ModuleInfo, PredId, Args, StateVarA - StateVarB),
( set.member(StateVarA, OutPrime) ->
StateInputVar = StateVarA,
@@ -1292,9 +1327,10 @@
map.det_insert(RecCallSubst0, StateInputVar, StateOutputVar,
RecCallSubst),
map.det_insert(AccVarSubst0, Acc, Acc0, AccVarSubst),
- !:Substs = substs(AccVarSubst, RecCallSubst, AssocCallSubst, UpdateSubst),
+ !:Substs = accu_substs(AccVarSubst, RecCallSubst, AssocCallSubst,
+ UpdateSubst),
- process_update_set(Ids, GS, OutPrime, ModuleInfo, !Substs,
+ accu_process_update_set(ModuleInfo, GS, Ids, OutPrime, !Substs,
!VarSet, !VarTypes, StateOutputVars0, Accs0, BasePairs0),
% Rather then concatenating to start of the list we concatenate to the end
@@ -1303,34 +1339,33 @@
% input variables will have their order swapped, so they must be in the
% inefficient order to start with)
- append(StateOutputVars0, [StateOutputVar], StateOutputVars),
- append(Accs0, [Acc], Accs),
- append(BasePairs0, [StateOutputVar - Acc0], BasePairs).
+ StateOutputVars = StateOutputVars0 ++ [StateOutputVar],
+ Accs = Accs0 ++ [Acc],
+ BasePairs = BasePairs0 ++ [StateOutputVar - Acc0].
%-----------------------------------------------------------------------------%
- % divide_base_case(UpdateOut, Out, U, A, O):
- %
- % is true iff given the output variables which are instantiated
- % by update goals, UpdateOut, and all the variables that need to
- % be accumulated, Out, divide the base case up into three sets,
- % those base case goals which initialize the variables used by
- % update calls, U, those which initialize variables used by
- % assoc calls, A, and the rest of the goals, O. Note that the
- % sets are not necessarily disjoint, as the result of a goal may
- % be used to initialize a variable in both U and A, so both U
- % and A will contain the same goal_id.
- %
-:- pred divide_base_case(prog_vars::in, prog_vars::in, goal_store::in,
- vartypes::in, module_info::in, set(goal_id)::out,
- set(goal_id)::out, set(goal_id)::out) is det.
+ % divide_base_case(UpdateOut, Out, U, A, O) is true iff given the output
+ % variables which are instantiated by update goals, UpdateOut, and all
+ % the variables that need to be accumulated, Out, divide the base case up
+ % into three sets, those base case goals which initialize the variables
+ % used by update calls, U, those which initialize variables used by
+ % assoc calls, A, and the rest of the goals, O. Note that the sets
+ % are not necessarily disjoint, as the result of a goal may be used
+ % to initialize a variable in both U and A, so both U and A will contain
+ % the same goal_id.
+ %
+:- pred accu_divide_base_case(module_info::in, vartypes::in,
+ accu_goal_store::in, prog_vars::in, prog_vars::in,
+ set(accu_goal_id)::out, set(accu_goal_id)::out, set(accu_goal_id)::out)
+ is det.
-divide_base_case(UpdateOut, Out, C, VarTypes, ModuleInfo,
+accu_divide_base_case(ModuleInfo, VarTypes, C, UpdateOut, Out,
UpdateBase, AssocBase, OtherBase) :-
list.delete_elems(Out, UpdateOut, AssocOut),
- list.map(related(C, VarTypes, ModuleInfo), UpdateOut, UpdateBaseList),
- list.map(related(C, VarTypes, ModuleInfo), AssocOut, AssocBaseList),
+ list.map(accu_related(ModuleInfo, VarTypes, C), UpdateOut, UpdateBaseList),
+ list.map(accu_related(ModuleInfo, VarTypes, C), AssocOut, AssocBaseList),
UpdateBase = set.power_union(set.list_to_set(UpdateBaseList)),
AssocBase = set.power_union(set.list_to_set(AssocBaseList)),
@@ -1347,19 +1382,19 @@
(base_case_ids_set(C) `intersect`
set.power_union(set.list_to_set(OtherBaseList))).
- % related(GS, MI, V, Ids):
+ % accu_related(ModuleInfo, VarTypes, GoalStore, Var, Related):
%
- % Return all the goal_ids, Ids, which are needed to initialize
- % the variable, V, from the goal store, GS.
+ % From GoalStore, return all the goal_ids, Related, which are needed
+ % to initialize Var.
%
-:- pred related(goal_store::in, vartypes::in, module_info::in, prog_var::in,
- set(goal_id)::out) is det.
+:- pred accu_related(module_info::in, vartypes::in, accu_goal_store::in,
+ prog_var::in, set(accu_goal_id)::out) is det.
-related(GS, VarTypes, ModuleInfo, Var, Related) :-
+accu_related(ModuleInfo, VarTypes, GoalStore, Var, Related) :-
solutions.solutions(
(pred(Key::out) is nondet :-
- goal_store_member(GS, Key, stored_goal(Goal, InstMap0)),
- Key = base - _,
+ goal_store_member(GoalStore, Key, stored_goal(Goal, InstMap0)),
+ Key = accu_goal_id(accu_base, _),
Goal = hlds_goal(_GoalExpr, GoalInfo),
InstMapDelta = goal_info_get_instmap_delta(GoalInfo),
apply_instmap_delta(InstMap0, InstMapDelta, InstMap),
@@ -1367,13 +1402,19 @@
ModuleInfo, ChangedVars),
set.singleton_set(ChangedVars, Var)
), Ids),
- ( Ids = [Id] ->
- goal_store_all_ancestors(GS, Id, VarTypes, ModuleInfo, no, Ancestors),
- list.filter((pred((base - _)::in) is semidet),
+ (
+ Ids = [],
+ unexpected($module, $pred, "no Id")
+ ;
+ Ids = [Id],
+ goal_store_all_ancestors(GoalStore, Id, VarTypes, ModuleInfo, no,
+ Ancestors),
+ list.filter((pred(accu_goal_id(accu_base, _)::in) is semidet),
set.to_sorted_list(set.insert(Ancestors, Id)), RelatedList),
Related = set.list_to_set(RelatedList)
;
- unexpected(this_file, "related")
+ Ids = [_, _ | _],
+ unexpected($module, $pred, "more than one Id")
).
%-----------------------------------------------------------------------------%
@@ -1383,7 +1424,7 @@
% Do a goal_store_lookup where the result is known to be a call.
%
-:- pred lookup_call(goal_store::in, goal_id::in,
+:- pred lookup_call(accu_goal_store::in, accu_goal_id::in,
stored_goal::out(plain_call_goal)) is det.
lookup_call(GoalStore, Id, stored_goal(Call, InstMap)) :-
@@ -1391,23 +1432,24 @@
( Goal = hlds_goal(plain_call(_, _, _, _, _, _), _) ->
Call = Goal
;
- unexpected(this_file, "lookup_call: not a call.")
+ unexpected($module, $pred, "not a call")
).
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
- % stage3 creates the accumulator version of the predicate using
+ % accu_stage3 creates the accumulator version of the predicate using
% the substitutions determined in stage2. It also redefines the
% original procedure to call the accumulator version of the procedure.
%
-:- pred stage3(goal_id::in, prog_vars::in, prog_varset::in, vartypes::in,
- goal_store::in, goal_store::in, substs::in, subst::in,
- subst::in, base::in, list(pair(prog_var))::in, sets::in,
+:- pred accu_stage3(accu_goal_id::in, prog_vars::in, prog_varset::in,
+ vartypes::in, accu_goal_store::in, accu_goal_store::in,
+ accu_substs::in, accu_subst::in, accu_subst::in,
+ accu_base::in, list(pair(prog_var))::in, accu_sets::in,
prog_vars::in, top_level::in, pred_id::in, pred_info::in,
proc_info::in, proc_info::out, module_info::in, module_info::out) is det.
-stage3(RecCallId, Accs, VarSet, VarTypes, C, CS, Substs,
+accu_stage3(RecCallId, Accs, VarSet, VarTypes, C, CS, Substs,
HeadToCallSubst, CallToHeadSubst, BaseCase, BasePairs, Sets, Out,
TopLevel, OrigPredId, OrigPredInfo, !OrigProcInfo, !ModuleInfo) :-
acc_proc_info(Accs, VarSet, VarTypes, Substs, !.OrigProcInfo,
@@ -1419,12 +1461,12 @@
module_info_get_predicate_table(!.ModuleInfo, PredTable0),
predicate_table_insert(AccPredInfo, AccPredId, PredTable0, PredTable),
module_info_set_predicate_table(PredTable, !ModuleInfo),
- create_goal(RecCallId, Accs, AccPredId, AccProcId, AccName, Substs,
+ accu_create_goal(RecCallId, Accs, AccPredId, AccProcId, AccName, Substs,
HeadToCallSubst, CallToHeadSubst, BaseCase, BasePairs, Sets, C, CS,
OrigBaseGoal, OrigRecGoal, AccBaseGoal, AccRecGoal),
proc_info_get_goal(!.OrigProcInfo, OrigGoal0),
- top_level(TopLevel, OrigGoal0, OrigBaseGoal, OrigRecGoal,
+ accu_top_level(TopLevel, OrigGoal0, OrigBaseGoal, OrigRecGoal,
AccBaseGoal, AccRecGoal, OrigGoal, AccGoal),
proc_info_set_goal(OrigGoal, !OrigProcInfo),
@@ -1439,7 +1481,8 @@
% Construct a proc_info for the introduced predicate.
%
:- pred acc_proc_info(prog_vars::in, prog_varset::in, vartypes::in,
- substs::in, proc_info::in, list(mer_type)::out, proc_info::out) is det.
+ accu_substs::in, proc_info::in, list(mer_type)::out, proc_info::out)
+ is det.
acc_proc_info(Accs0, VarSet, VarTypes, Substs, OrigProcInfo,
AccTypes, AccProcInfo) :-
@@ -1455,7 +1498,7 @@
proc_info_get_is_address_taken(OrigProcInfo, IsAddressTaken),
proc_info_get_var_name_remap(OrigProcInfo, VarNameRemap),
- Substs = substs(AccVarSubst, _RecCallSubst, _AssocCallSubst,
+ Substs = accu_substs(AccVarSubst, _RecCallSubst, _AssocCallSubst,
_UpdateSubst),
list.map(map.lookup(AccVarSubst), Accs0, Accs),
@@ -1525,12 +1568,14 @@
% and recursive cases of accumulator version (AccBaseGoal and
% AccRecGoal).
%
-:- pred create_goal(goal_id::in, prog_vars::in, pred_id::in, proc_id::in,
- sym_name::in, substs::in, subst::in, subst::in, base::in,
- list(pair(prog_var))::in, sets::in, goal_store::in, goal_store::in,
+:- pred accu_create_goal(accu_goal_id::in, prog_vars::in,
+ pred_id::in, proc_id::in, sym_name::in, accu_substs::in,
+ accu_subst::in, accu_subst::in, accu_base::in,
+ list(pair(prog_var))::in, accu_sets::in,
+ accu_goal_store::in, accu_goal_store::in,
hlds_goal::out, hlds_goal::out, hlds_goal::out, hlds_goal::out) is det.
-create_goal(RecCallId, Accs, AccPredId, AccProcId, AccName, Substs,
+accu_create_goal(RecCallId, Accs, AccPredId, AccProcId, AccName, Substs,
HeadToCallSubst, CallToHeadSubst, BaseIds, BasePairs,
Sets, C, CS, OrigBaseGoal, OrigRecGoal, AccBaseGoal, AccRecGoal) :-
lookup_call(C, RecCallId, stored_goal(OrigCall, _InstMap)),
@@ -1540,9 +1585,9 @@
create_acc_goal(Call, Substs, HeadToCallSubst, BaseIds, BasePairs,
Sets, C, CS, AccBaseGoal, AccRecGoal).
- % create_acc_call takes the original call and generates a call
- % to the accumulator version of the call, which can have the
- % substitutions applied to it easily.
+ % create_acc_call takes the original call and generates a call to the
+ % accumulator version of the call, which can have the substitutions
+ % applied to it easily.
%
:- func create_acc_call(hlds_goal::in(plain_call), prog_vars::in,
pred_id::in, proc_id::in, sym_name::in) = (hlds_goal::out(plain_call))
@@ -1557,54 +1602,59 @@
% Create the goals which are to replace the original predicate.
%
-:- pred create_orig_goal(hlds_goal::in, substs::in, subst::in,
- subst::in, base::in, sets::in, goal_store::in,
- hlds_goal::out, hlds_goal::out) is det.
+:- pred create_orig_goal(hlds_goal::in, accu_substs::in,
+ accu_subst::in, accu_subst::in, accu_base::in, accu_sets::in,
+ accu_goal_store::in, hlds_goal::out, hlds_goal::out) is det.
create_orig_goal(Call, Substs, HeadToCallSubst, CallToHeadSubst,
BaseIds, Sets, C, OrigBaseGoal, OrigRecGoal) :-
- Substs = substs(_AccVarSubst, _RecCallSubst, _AssocCallSubst, UpdateSubst),
+ Substs = accu_substs(_AccVarSubst, _RecCallSubst, _AssocCallSubst,
+ UpdateSubst),
- BaseIds = base(UpdateBase, _AssocBase, _OtherBase),
- Sets = sets(Before, _Assoc, _ConstructAssoc, _Construct, Update, _Reject),
+ BaseIds = accu_base(UpdateBase, _AssocBase, _OtherBase),
+ Before = Sets ^ as_before,
+ Update = Sets ^ as_update,
U = create_new_orig_recursive_goals(UpdateBase, Update,
HeadToCallSubst, UpdateSubst, C),
rename_some_vars_in_goal(CallToHeadSubst, Call, BaseCall),
- Cbefore = goal_list(set.to_sorted_list(Before), C),
- Uupdate = goal_list(set.to_sorted_list(UpdateBase) ++
+ Cbefore = accu_goal_list(set.to_sorted_list(Before), C),
+ Uupdate = accu_goal_list(set.to_sorted_list(UpdateBase) ++
set.to_sorted_list(Update), U),
- Cbase = goal_list(base_case_ids(C), C),
+ Cbase = accu_goal_list(base_case_ids(C), C),
calculate_goal_info(conj(plain_conj, Cbefore ++ Uupdate ++ [BaseCall]),
OrigRecGoal),
calculate_goal_info(conj(plain_conj, Cbase), OrigBaseGoal).
- % Create the goals which are to go in the new accumulator
- % version of the predicate.
+ % Create the goals which are to go in the new accumulator version
+ % of the predicate.
%
-:- pred create_acc_goal(hlds_goal::in, substs::in, subst::in, base::in,
- list(pair(prog_var))::in, sets::in, goal_store::in,
- goal_store::in, hlds_goal::out, hlds_goal::out) is det.
+:- pred create_acc_goal(hlds_goal::in, accu_substs::in, accu_subst::in,
+ accu_base::in, list(pair(prog_var))::in, accu_sets::in,
+ accu_goal_store::in, accu_goal_store::in,
+ hlds_goal::out, hlds_goal::out) is det.
create_acc_goal(Call, Substs, HeadToCallSubst, BaseIds, BasePairs, Sets,
C, CS, AccBaseGoal, AccRecGoal) :-
- Substs = substs(AccVarSubst, RecCallSubst, AssocCallSubst, UpdateSubst),
+ Substs = accu_substs(AccVarSubst, RecCallSubst, AssocCallSubst,
+ UpdateSubst),
- BaseIds = base(_UpdateBase, AssocBase, OtherBase),
- Sets = sets(Before, Assoc, ConstructAssoc, Construct, Update, _Reject),
+ BaseIds = accu_base(_UpdateBase, AssocBase, OtherBase),
+ Sets = accu_sets(Before, Assoc, ConstructAssoc, Construct, Update,
+ _Reject),
rename_some_vars_in_goal(RecCallSubst, Call, RecCall),
- Cbefore = goal_list(set.to_sorted_list(Before), C),
+ Cbefore = accu_goal_list(set.to_sorted_list(Before), C),
% Create the goals which will be used in the new recursive case.
R = create_new_recursive_goals(Assoc, Construct `union` ConstructAssoc,
Update, AssocCallSubst, AccVarSubst, UpdateSubst, C, CS),
- Rassoc = goal_list(set.to_sorted_list(Assoc), R),
- Rupdate = goal_list(set.to_sorted_list(Update), R),
- Rconstruct = goal_list(set.to_sorted_list(Construct `union`
+ Rassoc = accu_goal_list(set.to_sorted_list(Assoc), R),
+ Rupdate = accu_goal_list(set.to_sorted_list(Update), R),
+ Rconstruct = accu_goal_list(set.to_sorted_list(Construct `union`
ConstructAssoc), R),
% Create the goals which will be used in the new base case.
@@ -1613,7 +1663,7 @@
Bafter = set.to_sorted_list(Assoc `union`
Construct `union` ConstructAssoc),
- BaseCase = goal_list(set.to_sorted_list(AssocBase `union` OtherBase)
+ BaseCase = accu_goal_list(set.to_sorted_list(AssocBase `union` OtherBase)
++ Bafter, B),
list.map(acc_unification, BasePairs, UpdateBase),
@@ -1622,19 +1672,18 @@
++ [RecCall] ++ Rconstruct), AccRecGoal),
calculate_goal_info(conj(plain_conj, UpdateBase ++ BaseCase), AccBaseGoal).
- % Create the U set of goals (those that will be used in the
- % original recursive case) by renaming all the goals which are
- % used to initialize the update state variable using the
- % head_to_call followed by the update_subst, and rename all the
- % update goals using the update_subst.
+ % Create the U set of goals (those that will be used in the original
+ % recursive case) by renaming all the goals which are used to initialize
+ % the update state variable using the head_to_call followed by the
+ % update_subst, and rename all the update goals using the update_subst.
%
-:- func create_new_orig_recursive_goals(set(goal_id), set(goal_id),
- subst, subst, goal_store) = goal_store.
+:- func create_new_orig_recursive_goals(set(accu_goal_id), set(accu_goal_id),
+ accu_subst, accu_subst, accu_goal_store) = accu_goal_store.
create_new_orig_recursive_goals(UpdateBase, Update, HeadToCallSubst,
UpdateSubst, C)
- = rename(set.to_sorted_list(Update), UpdateSubst, C, Ubase) :-
- Ubase = rename(set.to_sorted_list(UpdateBase),
+ = accu_rename(set.to_sorted_list(Update), UpdateSubst, C, Ubase) :-
+ Ubase = accu_rename(set.to_sorted_list(UpdateBase),
chain_subst(HeadToCallSubst, UpdateSubst), C, goal_store_init).
% Create the R set of goals (those that will be used in the new
@@ -1642,27 +1691,27 @@
% using assoc_call_subst and all the members of (construct U
% construct_assoc) in C with acc_var_subst.
%
-:- func create_new_recursive_goals(set(goal_id), set(goal_id), set(goal_id),
- subst, subst, subst, goal_store, goal_store) = goal_store.
+:- func create_new_recursive_goals(set(accu_goal_id), set(accu_goal_id),
+ set(accu_goal_id), accu_subst, accu_subst, accu_subst,
+ accu_goal_store, accu_goal_store) = accu_goal_store.
create_new_recursive_goals(Assoc, Constructs, Update,
AssocCallSubst, AccVarSubst, UpdateSubst, C, CS)
- = rename(set.to_sorted_list(Constructs), AccVarSubst, C, RBase) :-
- RBase0 = rename(set.to_sorted_list(Assoc), AssocCallSubst, CS,
+ = accu_rename(set.to_sorted_list(Constructs), AccVarSubst, C, RBase) :-
+ RBase0 = accu_rename(set.to_sorted_list(Assoc), AssocCallSubst, CS,
goal_store_init),
- RBase = rename(set.to_sorted_list(Update), UpdateSubst, C, RBase0).
+ RBase = accu_rename(set.to_sorted_list(Update), UpdateSubst, C, RBase0).
- % Create the B set of goals (those that will be used in the new
- % base case) by renaming all the base case goals of C with
- % head_to_call and all the members of (assoc U construct U
- % construct_assoc) of C with acc_var_subst.
+ % Create the B set of goals (those that will be used in the new base case)
+ % by renaming all the base case goals of C with head_to_call and all the
+ % members of (assoc U construct U construct_assoc) of C with acc_var_subst.
%
-:- func create_new_base_goals(set(goal_id), goal_store, subst, subst)
- = goal_store.
+:- func create_new_base_goals(set(accu_goal_id), accu_goal_store,
+ accu_subst, accu_subst) = accu_goal_store.
create_new_base_goals(Ids, C, AccVarSubst, HeadToCallSubst)
- = rename(set.to_sorted_list(Ids), AccVarSubst, C, Bbase) :-
- Bbase = rename(base_case_ids(C), HeadToCallSubst, C, goal_store_init).
+ = accu_rename(set.to_sorted_list(Ids), AccVarSubst, C, Bbase) :-
+ Bbase = accu_rename(base_case_ids(C), HeadToCallSubst, C, goal_store_init).
% acc_unification(O-A, G):
%
@@ -1686,40 +1735,44 @@
% Given the top level structure of the goal create new version
% with new base and recursive cases plugged in.
%
-:- pred top_level(top_level::in, hlds_goal::in,
+:- pred accu_top_level(top_level::in, hlds_goal::in,
hlds_goal::in, hlds_goal::in, hlds_goal::in,
hlds_goal::in, hlds_goal::out, hlds_goal::out) is det.
-top_level(switch_base_rec, Goal, OrigBaseGoal, OrigRecGoal,
+accu_top_level(TopLevel, Goal, OrigBaseGoal, OrigRecGoal,
NewBaseGoal, NewRecGoal, OrigGoal, NewGoal) :-
(
+ TopLevel = switch_base_rec,
+ (
Goal = hlds_goal(switch(Var, CanFail, Cases0), GoalInfo),
Cases0 = [case(IdA, [], _), case(IdB, [], _)]
->
- OrigCases = [case(IdA, [], OrigBaseGoal), case(IdB, [], OrigRecGoal)],
+ OrigCases = [case(IdA, [], OrigBaseGoal),
+ case(IdB, [], OrigRecGoal)],
OrigGoal = hlds_goal(switch(Var, CanFail, OrigCases), GoalInfo),
NewCases = [case(IdA, [], NewBaseGoal), case(IdB, [], NewRecGoal)],
NewGoal = hlds_goal(switch(Var, CanFail, NewCases), GoalInfo)
;
- unexpected(this_file, "top_level: not the correct top level")
- ).
-top_level(switch_rec_base, Goal, OrigBaseGoal, OrigRecGoal,
- NewBaseGoal, NewRecGoal, OrigGoal, NewGoal) :-
+ unexpected($module, $pred, "not the correct top level")
+ )
+ ;
+ TopLevel = switch_rec_base,
(
Goal = hlds_goal(switch(Var, CanFail, Cases0), GoalInfo),
Cases0 = [case(IdA, [], _), case(IdB, [], _)]
->
- OrigCases = [case(IdA, [], OrigRecGoal), case(IdB, [], OrigBaseGoal)],
+ OrigCases = [case(IdA, [], OrigRecGoal),
+ case(IdB, [], OrigBaseGoal)],
OrigGoal = hlds_goal(switch(Var, CanFail, OrigCases), GoalInfo),
NewCases = [case(IdA, [], NewRecGoal), case(IdB, [], NewBaseGoal)],
NewGoal = hlds_goal(switch(Var, CanFail, NewCases), GoalInfo)
;
- unexpected(this_file, "top_level: not the correct top level")
- ).
-top_level(disj_base_rec, Goal, OrigBaseGoal,
- OrigRecGoal, NewBaseGoal, NewRecGoal, OrigGoal, NewGoal) :-
+ unexpected($module, $pred, "not the correct top level")
+ )
+ ;
+ TopLevel = disj_base_rec,
(
Goal = hlds_goal(disj(Goals), GoalInfo),
Goals = [_, _]
@@ -1730,10 +1783,10 @@
NewGoals = [NewBaseGoal, NewRecGoal],
NewGoal = hlds_goal(disj(NewGoals), GoalInfo)
;
- unexpected(this_file, "top_level: not the correct top level")
- ).
-top_level(disj_rec_base, Goal, OrigBaseGoal,
- OrigRecGoal, NewBaseGoal, NewRecGoal, OrigGoal, NewGoal) :-
+ unexpected($module, $pred, "not the correct top level")
+ )
+ ;
+ TopLevel = disj_rec_base,
(
Goal = hlds_goal(disj(Goals), GoalInfo),
Goals = [_, _]
@@ -1744,33 +1797,33 @@
NewGoals = [NewRecGoal, NewBaseGoal],
NewGoal = hlds_goal(disj(NewGoals), GoalInfo)
;
- unexpected(this_file, "top_level: not the correct top level")
- ).
-top_level(ite_base_rec, Goal, OrigBaseGoal,
- OrigRecGoal, NewBaseGoal, NewRecGoal, OrigGoal, NewGoal) :-
- ( Goal = hlds_goal(if_then_else(Vars, If, _, _), GoalInfo) ->
- OrigGoal = hlds_goal(if_then_else(Vars, If, OrigBaseGoal, OrigRecGoal),
- GoalInfo),
- NewGoal = hlds_goal(if_then_else(Vars, If, NewBaseGoal, NewRecGoal),
- GoalInfo)
+ unexpected($module, $pred, "not the correct top level")
+ )
;
- unexpected(this_file, "top_level: not the correct top level")
- ).
-top_level(ite_rec_base, Goal, OrigBaseGoal,
- OrigRecGoal, NewBaseGoal, NewRecGoal, OrigGoal, NewGoal) :-
- ( Goal = hlds_goal(if_then_else(Vars, If, _, _), GoalInfo) ->
- OrigGoal = hlds_goal(if_then_else(Vars, If, OrigRecGoal, OrigBaseGoal),
- GoalInfo),
- NewGoal = hlds_goal(if_then_else(Vars, If, NewRecGoal, NewBaseGoal),
- GoalInfo)
+ TopLevel = ite_base_rec,
+ ( Goal = hlds_goal(if_then_else(Vars, Cond, _, _), GoalInfo) ->
+ OrigGoal = hlds_goal(if_then_else(Vars, Cond,
+ OrigBaseGoal, OrigRecGoal), GoalInfo),
+ NewGoal = hlds_goal(if_then_else(Vars, Cond,
+ NewBaseGoal, NewRecGoal), GoalInfo)
;
- unexpected(this_file, "top_level: not the correct top level")
+ unexpected($module, $pred, "not the correct top level")
+ )
+ ;
+ TopLevel = ite_rec_base,
+ ( Goal = hlds_goal(if_then_else(Vars, Cond, _, _), GoalInfo) ->
+ OrigGoal = hlds_goal(if_then_else(Vars, Cond,
+ OrigRecGoal, OrigBaseGoal), GoalInfo),
+ NewGoal = hlds_goal(if_then_else(Vars, Cond,
+ NewRecGoal, NewBaseGoal), GoalInfo)
+ ;
+ unexpected($module, $pred, "not the correct top level")
+ )
).
%-----------------------------------------------------------------------------%
- % Place the accumulator version of the predicate in the
- % module_info structure.
+ % Place the accumulator version of the predicate in the HLDS.
%
:- pred update_accumulator_pred(pred_id::in, proc_id::in,
hlds_goal::in, module_info::in, module_info::out) is det.
@@ -1786,15 +1839,16 @@
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
- % rename(Ids, Subst, From, Initial):
+ % accu_rename(Ids, Subst, From, Initial):
%
% Return a goal_store, Final, which is the result of looking up each
% member of set of goal_ids, Ids, in the goal_store, From, applying
% the substitution and then storing the goal into the goal_store, Initial.
%
-:- func rename(list(goal_id), subst, goal_store, goal_store) = goal_store.
+:- func accu_rename(list(accu_goal_id), accu_subst,
+ accu_goal_store, accu_goal_store) = accu_goal_store.
-rename(Ids, Subst, From, Initial) = Final :-
+accu_rename(Ids, Subst, From, Initial) = Final :-
list.foldl(
(pred(Id::in, GS0::in, GS::out) is det :-
goal_store_lookup(From, Id, stored_goal(Goal0, InstMap)),
@@ -1804,25 +1858,25 @@
% Return all the goal_ids which belong in the base case.
%
-:- func base_case_ids(goal_store) = list(goal_id).
+:- func base_case_ids(accu_goal_store) = list(accu_goal_id).
base_case_ids(GS) = Base :-
solutions.solutions(
(pred(Key::out) is nondet :-
goal_store_member(GS, Key, _Goal),
- Key = base - _
+ Key = accu_goal_id(accu_base, _)
), Base).
-:- func base_case_ids_set(goal_store) = set(goal_id).
+:- func base_case_ids_set(accu_goal_store) = set(accu_goal_id).
base_case_ids_set(GS) = set.list_to_set(base_case_ids(GS)).
% Given a list of goal_ids, return the list of hlds_goals from
% the goal_store.
%
-:- func goal_list(list(goal_id), goal_store) = hlds_goals.
+:- func accu_goal_list(list(accu_goal_id), accu_goal_store) = list(hlds_goal).
-goal_list(Ids, GS) = Goals :-
+accu_goal_list(Ids, GS) = Goals :-
list.map(
(pred(Key::in, G::out) is det :-
goal_store_lookup(GS, Key, stored_goal(G, _))
@@ -1841,35 +1895,20 @@
goal_info_init(NonLocals, InstMapDelta, Detism, purity_pure, GoalInfo)
;
- unexpected(this_file, "calculate_goal_info: not a conj.")
+ unexpected($module, $pred, "not a conj")
).
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
- % The number which indicates the base case.
- %
-:- func base = int.
-
-base = 2.
-
- % The number which indicates the recursive case.
- %
-:- func rec = int.
-
-rec = 1.
-
-%-----------------------------------------------------------------------------%
-%-----------------------------------------------------------------------------%
-
-:- func reverse_subst(subst) = subst.
+:- func reverse_subst(accu_subst) = accu_subst.
reverse_subst(Subst0) = Subst :-
map.to_assoc_list(Subst0, List0),
assoc_list.reverse_members(List0, List),
map.from_assoc_list(List, Subst).
-:- func chain_subst(subst, subst) = subst.
+:- func chain_subst(accu_subst, accu_subst) = accu_subst.
chain_subst(AtoB, BtoC) = AtoC :-
map.keys(AtoB, Keys),
@@ -1890,11 +1929,5 @@
).
%-----------------------------------------------------------------------------%
-
-:- func this_file = string.
-
-this_file = "accumulator.m".
-
-%-----------------------------------------------------------------------------%
:- end_module accumulator.
%-----------------------------------------------------------------------------%
Index: compiler/complexity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/complexity.m,v
retrieving revision 1.39
diff -u -b -r1.39 complexity.m
--- compiler/complexity.m 30 Dec 2010 11:17:52 -0000 1.39
+++ compiler/complexity.m 3 Jan 2011 16:30:23 -0000
@@ -49,7 +49,7 @@
% Transform the given procedure if it is in the complexity map.
%
-:- pred process_proc_msg(int::in, complexity_proc_map::in,
+:- pred complexity_process_proc_msg(int::in, complexity_proc_map::in,
pred_proc_id::in, proc_info::in, proc_info::out,
module_info::in, module_info::out) is det.
@@ -157,8 +157,9 @@
%-----------------------------------------------------------------------------%
-process_proc_msg(NumProcs, ProcMap, proc(PredId, ProcId), !ProcInfo,
- !ModuleInfo) :-
+complexity_process_proc_msg(NumProcs, ProcMap, PredProcId,
+ !ProcInfo, !ModuleInfo) :-
+ PredProcId = proc(PredId, ProcId),
IsInMap = is_in_complexity_proc_map(ProcMap, !.ModuleInfo,
PredId, ProcId),
(
@@ -176,7 +177,7 @@
;
Verbose = no
),
- process_proc(NumProcs, ProcNum, FullName, PredId,
+ complexity_process_proc(NumProcs, ProcNum, FullName, PredId,
!ProcInfo, !ModuleInfo)
;
IsInMap = no
@@ -246,11 +247,12 @@
slot_var_name = "SlotVar".
-:- pred process_proc(int::in, int::in, string::in, pred_id::in,
+:- pred complexity_process_proc(int::in, int::in, string::in, pred_id::in,
proc_info::in, proc_info::out, module_info::in, module_info::out)
is det.
-process_proc(NumProcs, ProcNum, FullName, PredId, !ProcInfo, !ModuleInfo) :-
+complexity_process_proc(NumProcs, ProcNum, FullName, PredId,
+ !ProcInfo, !ModuleInfo) :-
proc_info_interface_determinism(!.ProcInfo, Detism),
determinism_to_code_model(Detism, CodeModel),
proc_info_get_headvars(!.ProcInfo, HeadVars),
Index: compiler/hhf.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hhf.m,v
retrieving revision 1.41
diff -u -b -r1.41 hhf.m
--- compiler/hhf.m 30 Dec 2010 11:17:54 -0000 1.41
+++ compiler/hhf.m 3 Jan 2011 16:27:34 -0000
@@ -30,10 +30,10 @@
%-----------------------------------------------------------------------------%
-:- pred process_pred(bool::in, pred_id::in, module_info::in,
+:- pred convert_pred_to_hhf(bool::in, pred_id::in, module_info::in,
module_info::out, io::di, io::uo) is det.
-:- pred process_clauses_info(bool::in, module_info::in,
+:- pred convert_clauses_info_to_hhf(bool::in, module_info::in,
clauses_info::in, clauses_info::out, inst_graph::out) is det.
%-----------------------------------------------------------------------------%
@@ -61,7 +61,7 @@
%-----------------------------------------------------------------------------%
-process_pred(Simple, PredId, !ModuleInfo, !IO) :-
+convert_pred_to_hhf(Simple, PredId, !ModuleInfo, !IO) :-
module_info_pred_info(!.ModuleInfo, PredId, PredInfo0),
( pred_info_is_imported(PredInfo0) ->
% AAA
@@ -83,7 +83,7 @@
PredId, !.ModuleInfo, !IO),
pred_info_get_clauses_info(PredInfo0, ClausesInfo0),
- process_clauses_info(Simple, !.ModuleInfo, ClausesInfo0,
+ convert_clauses_info_to_hhf(Simple, !.ModuleInfo, ClausesInfo0,
ClausesInfo, ImplementationInstGraph),
pred_info_set_clauses_info(ClausesInfo, PredInfo0, PredInfo1),
some [!IG] (
@@ -137,7 +137,7 @@
PredInfo = PredInfo2, % AAA
module_info_set_pred_info(PredId, PredInfo, !ModuleInfo).
-process_clauses_info(Simple, ModuleInfo, !ClausesInfo, InstGraph) :-
+convert_clauses_info_to_hhf(Simple, ModuleInfo, !ClausesInfo, InstGraph) :-
clauses_info_get_varset(!.ClausesInfo, VarSet0),
clauses_info_get_vartypes(!.ClausesInfo, VarTypes0),
inst_graph.init(VarTypes0 ^ keys, InstGraph0),
Index: compiler/hlds_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_data.m,v
retrieving revision 1.131
diff -u -b -r1.131 hlds_data.m
--- compiler/hlds_data.m 30 Dec 2010 11:17:54 -0000 1.131
+++ compiler/hlds_data.m 3 Jan 2011 16:27:43 -0000
@@ -860,15 +860,16 @@
:- type user_inst_table == user_inst_defns.
-inst_table_init(inst_table(UserInsts, UnifyInsts, MergeInsts, GroundInsts,
- AnyInsts, SharedInsts, NondetLiveInsts)) :-
+inst_table_init(InstTable) :-
map.init(UserInsts),
map.init(UnifyInsts),
map.init(MergeInsts),
map.init(GroundInsts),
map.init(SharedInsts),
map.init(AnyInsts),
- map.init(NondetLiveInsts).
+ map.init(NondetLiveInsts),
+ InstTable = inst_table(UserInsts, UnifyInsts, MergeInsts, GroundInsts,
+ AnyInsts, SharedInsts, NondetLiveInsts).
inst_table_get_user_insts(InstTable, InstTable ^ inst_table_user).
inst_table_get_unify_insts(InstTable, InstTable ^ inst_table_unify).
@@ -879,20 +880,20 @@
inst_table_get_mostly_uniq_insts(InstTable,
InstTable ^ inst_table_mostly_uniq).
-inst_table_set_user_insts(UserInsts, InstTable,
- InstTable ^ inst_table_user := UserInsts).
-inst_table_set_unify_insts(UnifyInsts, InstTable,
- InstTable ^ inst_table_unify := UnifyInsts).
-inst_table_set_merge_insts(MergeInsts, InstTable,
- InstTable ^ inst_table_merge := MergeInsts).
-inst_table_set_ground_insts(GroundInsts, InstTable,
- InstTable ^ inst_table_ground := GroundInsts).
-inst_table_set_any_insts(AnyInsts, InstTable,
- InstTable ^ inst_table_any := AnyInsts).
-inst_table_set_shared_insts(SharedInsts, InstTable,
- InstTable ^ inst_table_shared := SharedInsts).
-inst_table_set_mostly_uniq_insts(MostlyUniqInsts, InstTable,
- InstTable ^ inst_table_mostly_uniq := MostlyUniqInsts).
+inst_table_set_user_insts(UserInsts, !InstTable) :-
+ !InstTable ^ inst_table_user := UserInsts.
+inst_table_set_unify_insts(UnifyInsts, !InstTable) :-
+ !InstTable ^ inst_table_unify := UnifyInsts.
+inst_table_set_merge_insts(MergeInsts, !InstTable) :-
+ !InstTable ^ inst_table_merge := MergeInsts.
+inst_table_set_ground_insts(GroundInsts, !InstTable) :-
+ !InstTable ^ inst_table_ground := GroundInsts.
+inst_table_set_any_insts(AnyInsts, !InstTable) :-
+ !InstTable ^ inst_table_any := AnyInsts.
+inst_table_set_shared_insts(SharedInsts, !InstTable) :-
+ !InstTable ^ inst_table_shared := SharedInsts.
+inst_table_set_mostly_uniq_insts(MostlyUniqInsts, !InstTable) :-
+ !InstTable ^ inst_table_mostly_uniq := MostlyUniqInsts.
user_inst_table_get_inst_defns(UserInstDefns, UserInstDefns).
Index: compiler/hlds_out_module.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_out_module.m,v
retrieving revision 1.3
diff -u -b -r1.3 hlds_out_module.m
--- compiler/hlds_out_module.m 15 Dec 2010 06:29:38 -0000 1.3
+++ compiler/hlds_out_module.m 3 Jan 2011 16:28:47 -0000
@@ -60,6 +60,7 @@
:- import_module string.
:- import_module term.
:- import_module term_io.
+:- import_module varset.
%-----------------------------------------------------------------------------%
%
@@ -595,15 +596,61 @@
:- pred write_insts(int::in, inst_table::in, io::di, io::uo) is det.
-write_insts(Indent, _InstTable, !IO) :-
- % XXX fix this up.
+write_insts(Indent, InstTable, !IO) :-
write_indent(Indent, !IO),
io.write_string("%-------- Insts --------\n", !IO),
+
write_indent(Indent, !IO),
+ io.write_string("%-------- User defined insts --------\n", !IO),
+ inst_table_get_user_insts(InstTable, UserInstTable),
+ user_inst_table_get_inst_defns(UserInstTable, UserInstDefns),
+ map.to_assoc_list(UserInstDefns, UserInstPairs),
+ list.foldl(write_user_inst(Indent), UserInstPairs, !IO),
+
+ io.write_string("%-------- Other insts --------\n", !IO),
+ % XXX fix this up.
io.write_string("%%% Not yet implemented, sorry.\n", !IO).
- % io.write_string("% ", !IO).
- % io.print(InstTable, !IO),
- % io.nl(!IO).
+
+:- pred write_user_inst(int::in, pair(inst_id, hlds_inst_defn)::in,
+ io::di, io::uo) is det.
+
+write_user_inst(Indent, InstId - InstDefn, !IO) :-
+ InstId = inst_id(InstName, _InstArity),
+ write_indent(Indent, !IO),
+ io.format(":- inst %s:", [s(sym_name_to_string(InstName))], !IO),
+ InstDefn = hlds_inst_defn(InstVarSet, InstParams, InstBody,
+ _Context, _Status),
+ (
+ InstParams = []
+ ;
+ InstParams = [HeadInstParam | TailInstParams],
+ io.write_string("(", !IO),
+ write_inst_params(HeadInstParam, TailInstParams, InstVarSet, !IO),
+ io.write_string(")", !IO)
+ ),
+ (
+ InstBody = abstract_inst,
+ io.write_string(": is abstract\n", !IO)
+ ;
+ InstBody = eqv_inst(EqvInst),
+ io.write_string(":\n", !IO),
+ write_indent(Indent, !IO),
+ mercury_output_inst(EqvInst, InstVarSet, !IO)
+ ).
+
+:- pred write_inst_params(inst_var::in, list(inst_var)::in, inst_varset::in,
+ io::di, io::uo) is det.
+
+write_inst_params(InstVar, InstVars, InstVarSet, !IO) :-
+ varset.lookup_name(InstVarSet, InstVar, InstVarName),
+ io.write_string(InstVarName, !IO),
+ (
+ InstVars = []
+ ;
+ InstVars = [HeadInstVar | TailInstVars],
+ io.write_string(", ", !IO),
+ write_inst_params(HeadInstVar, TailInstVars, InstVarSet, !IO)
+ ).
%-----------------------------------------------------------------------------%
%
Index: compiler/mercury_compile_middle_passes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_compile_middle_passes.m,v
retrieving revision 1.11
diff -u -b -r1.11 mercury_compile_middle_passes.m
--- compiler/mercury_compile_middle_passes.m 30 Dec 2010 11:17:56 -0000 1.11
+++ compiler/mercury_compile_middle_passes.m 3 Jan 2011 16:24:02 -0000
@@ -856,7 +856,7 @@
->
maybe_write_string(Verbose,
"% Apply debugging source to source transformation ...\n", !IO),
- ssdebug.transform_module(!HLDS, !IO),
+ ssdebug_transform_module(!HLDS, !IO),
maybe_write_string(Verbose, "% done.\n", !IO),
maybe_report_stats(Stats, !IO)
;
@@ -899,7 +899,7 @@
"% Attempting to introduce accumulators...\n", !IO),
maybe_flush_output(Verbose, !IO),
type_to_univ([] : list(error_spec), Cookie0),
- Task0 = update_module_pred_cookie(accumulator.process_proc, Cookie0),
+ Task0 = update_module_pred_cookie(accu_transform_proc, Cookie0),
process_all_nonimported_procs_update(Task0, Task, !HLDS),
(
Task = update_module_pred_cookie(_, Cookie),
@@ -1373,7 +1373,7 @@
"% Applying complexity experiment transformation...\n", !IO),
maybe_flush_output(Verbose, !IO),
process_all_nonimported_procs(
- update_module(complexity.process_proc_msg(NumProcs, ProcMap)),
+ update_module(complexity_process_proc_msg(NumProcs, ProcMap)),
!HLDS),
maybe_write_string(Verbose, "% done.\n", !IO),
maybe_report_stats(Stats, !IO)
Index: compiler/mode_constraints.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mode_constraints.m,v
retrieving revision 1.58
diff -u -b -r1.58 mode_constraints.m
--- compiler/mode_constraints.m 30 Dec 2010 11:17:56 -0000 1.58
+++ compiler/mode_constraints.m 3 Jan 2011 16:31:44 -0000
@@ -119,7 +119,7 @@
(
New = no,
- list.foldl2(hhf.process_pred(Simple), PredIds, !ModuleInfo, !IO),
+ list.foldl2(convert_pred_to_hhf(Simple), PredIds, !ModuleInfo, !IO),
get_predicate_sccs(!ModuleInfo, SCCs),
% Stage 1: Process SCCs bottom-up to determine variable producers.
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.255
diff -u -b -r1.255 simplify.m
--- compiler/simplify.m 2 Jan 2011 14:37:58 -0000 1.255
+++ compiler/simplify.m 3 Jan 2011 16:51:38 -0000
@@ -382,28 +382,113 @@
simplify_proc_return_msgs(Simplifications, PredId, ProcId, !ModuleInfo,
!ProcInfo, _).
-:- func turn_off_common_struct_threshold = int.
-
-turn_off_common_struct_threshold = 1000.
-
simplify_proc_return_msgs(Simplifications0, PredId, ProcId, !ModuleInfo,
!ProcInfo, !:Specs) :-
+ simplify_proc_maybe_vary_parameters(!.ModuleInfo, PredId, !.ProcInfo,
+ Simplifications0, Simplifications),
+ module_info_pred_info(!.ModuleInfo, PredId, PredInfo0),
+ pred_info_get_markers(PredInfo0, Markers0),
+ ( check_marker(Markers0, marker_mode_check_clauses) ->
+ simplify_proc_maybe_mark_modecheck_clauses(!ProcInfo)
+ ;
+ true
+ ),
+
+ (
+ check_marker(Markers0, marker_has_format_call),
+ Simplifications ^ do_format_calls = yes
+ ->
+ % We must invoke analyze_and_optimize_format_calls before
+ % simplify_process_clause_body_goal, for two reasons.
+ %
+ % First, excess assignment optimization may delete some of the
+ % unifications that build the format strings or values,
+ % which means that the goal it generates may not contain the
+ % information that analyze_and_optimize_format_calls needs to avoid
+ % spurious messages about unknown format strings or values.
+ %
+ % Second, analyze_and_optimize_format_calls generates nested
+ % conjunctions, which simplify_process_clause_body_goal can eliminate.
+
+ simplify_proc_analyze_and_format_calls(!ModuleInfo, PredId, ProcId,
+ FormatSpecs, !ProcInfo)
+ ;
+ % Either there are no format calls to check, or we don't want to
+ % optimize them and would ignore the added messages anyway.
+ FormatSpecs = []
+ ),
+
proc_info_get_vartypes(!.ProcInfo, VarTypes0),
+ det_info_init(!.ModuleInfo, VarTypes0, PredId, ProcId,
+ pess_extra_vars_report, [], DetInfo0),
+ proc_info_get_initial_instmap(!.ProcInfo, !.ModuleInfo, InstMap0),
+ simplify_info_init(DetInfo0, Simplifications, InstMap0, !.ProcInfo, Info0),
+
+ proc_info_get_goal(!.ProcInfo, Goal0),
+ simplify_process_clause_body_goal(Goal0, Goal, Info0, Info),
+ proc_info_set_goal(Goal, !ProcInfo),
+
+ simplify_info_get_var_types(Info, VarTypes),
+ simplify_info_get_rtti_varmaps(Info, RttiVarMaps),
+ proc_info_set_vartypes(VarTypes, !ProcInfo),
+ proc_info_set_rtti_varmaps(RttiVarMaps, !ProcInfo),
+
+ simplify_info_get_varset(Info, VarSet0),
+ ( simplify_do_after_front_end(Info) ->
+ proc_info_get_var_name_remap(!.ProcInfo, VarNameRemap),
+ map.foldl(svvarset.name_var, VarNameRemap, VarSet0, VarSet),
+ proc_info_set_var_name_remap(map.init, !ProcInfo),
+ proc_info_set_varset(VarSet, !ProcInfo)
+ ;
+ true
+ ),
+
+ simplify_info_get_has_parallel_conj(Info, HasParallelConj),
+ proc_info_set_has_parallel_conj(HasParallelConj, !ProcInfo),
+
+ simplify_info_get_has_user_event(Info, HasUserEvent),
+ proc_info_set_has_user_event(HasUserEvent, !ProcInfo),
+
+ simplify_info_get_module_info(Info, !:ModuleInfo),
+ simplify_info_get_error_specs(Info, !:Specs),
+ !:Specs = FormatSpecs ++ !.Specs,
+
+ simplify_proc_maybe_warn_about_duplicates(!.ModuleInfo, PredId, !.ProcInfo,
+ !Specs),
+
+ pred_info_get_import_status(PredInfo0, Status),
+ IsDefinedHere = status_defined_in_this_module(Status),
+ (
+ IsDefinedHere = no,
+ % Don't generate any warnings or even errors if the predicate isn't
+ % defined here; any such messages will be generated when we compile
+ % the module the predicate comes from.
+ !:Specs = []
+ ;
+ IsDefinedHere = yes
+ ).
+
+:- pred simplify_proc_maybe_vary_parameters(module_info::in, pred_id::in,
+ proc_info::in, simplifications::in, simplifications::out) is det.
+
+simplify_proc_maybe_vary_parameters(ModuleInfo, PredId, ProcInfo,
+ !Simplifications) :-
+ proc_info_get_vartypes(ProcInfo, VarTypes0),
NumVars = map.count(VarTypes0),
( NumVars > turn_off_common_struct_threshold ->
% If we have too many variables, common_struct takes so long that
% either the compiler runs out of memory or the user runs out of
% patience. The fact that we would generate better code if the
% compilation finished is therefore of limited interest.
- Simplifications1 = Simplifications0 ^ do_common_struct := no
+ !Simplifications ^ do_common_struct := no
;
- Simplifications1 = Simplifications0
+ true
),
- module_info_get_globals(!.ModuleInfo, Globals),
+ module_info_get_globals(ModuleInfo, Globals),
globals.lookup_string_option(Globals, common_struct_preds,
CommonStructPreds),
( CommonStructPreds = "" ->
- Simplifications = Simplifications1
+ true
;
CommonStructPredIdStrs = string.split_at_char(',', CommonStructPreds),
(
@@ -411,56 +496,91 @@
CommonStructPredIdInts)
->
( list.member(pred_id_to_int(PredId), CommonStructPredIdInts) ->
- Simplifications = Simplifications1
+ true
;
- Simplifications = Simplifications1 ^ do_common_struct := no
+ !Simplifications ^ do_common_struct := no
)
;
- Simplifications = Simplifications1
+ true
+ )
+ ).
+
+:- func turn_off_common_struct_threshold = int.
+
+turn_off_common_struct_threshold = 1000.
+
+simplify_process_clause_body_goal(!Goal, !Info) :-
+ some [!Simplifications] (
+ simplify_info_get_simplifications(!.Info, !:Simplifications),
+ OriginalSimplifications = !.Simplifications,
+ simplify_info_get_instmap(!.Info, InstMap0),
+ (
+ ( simplify_do_common_struct(!.Info)
+ ; simplify_do_opt_duplicate_calls(!.Info)
)
+ ->
+ !Simplifications ^ do_do_once := no,
+ !Simplifications ^ do_excess_assign := no,
+ simplify_info_set_simplifications(!.Simplifications, !Info),
+
+ do_process_clause_body_goal(!Goal, !Info),
+
+ !:Simplifications = OriginalSimplifications,
+ !Simplifications ^ do_warn_simple_code := no,
+ !Simplifications ^ do_warn_duplicate_calls := no,
+ !Simplifications ^ do_common_struct := no,
+ !Simplifications ^ do_opt_duplicate_calls := no,
+ simplify_info_reinit(!.Simplifications, InstMap0, !Info)
+ ;
+ true
),
+ % On the second pass do excess assignment elimination and
+ % some cleaning up after the common structure pass.
+ do_process_clause_body_goal(!Goal, !Info),
+ simplify_info_get_found_contains_trace(!.Info, FoundContainsTrace),
+ (
+ FoundContainsTrace = no
+ ;
+ FoundContainsTrace = yes,
+ goal_contains_trace(!Goal, _)
+ )
+ ).
- module_info_pred_info(!.ModuleInfo, PredId, PredInfo0),
- pred_info_get_markers(PredInfo0, Markers0),
- pred_info_get_import_status(PredInfo0, Status),
+:- pred simplify_proc_maybe_mark_modecheck_clauses(
+ proc_info::in, proc_info::out) is det.
+
+simplify_proc_maybe_mark_modecheck_clauses(!ProcInfo) :-
proc_info_get_goal(!.ProcInfo, Goal0),
- (
- check_marker(Markers0, marker_mode_check_clauses),
Goal0 = hlds_goal(GoalExpr0, GoalInfo0),
+ (
( GoalExpr0 = disj(_)
; GoalExpr0 = switch(_, _, _)
)
->
goal_info_add_feature(feature_mode_check_clauses_goal,
- GoalInfo0, GoalInfo1),
- Goal1 = hlds_goal(GoalExpr0, GoalInfo1)
+ GoalInfo0, GoalInfo),
+ Goal = hlds_goal(GoalExpr0, GoalInfo),
+ proc_info_set_goal(Goal, !ProcInfo)
;
- Goal1 = Goal0
- ),
+ true
+ ).
- (
- check_marker(Markers0, marker_has_format_call),
- Simplifications ^ do_format_calls = yes
- ->
- % We must invoke analyze_and_optimize_format_calls before
- % simplify_process_clause_body_goal, for two reasons.
- %
- % First, excess assignment optimization may delete some of the
- % unifications that build the format strings or values,
- % which means that the goal it generates may not contain the
- % information that analyze_and_optimize_format_calls needs to avoid
- % spurious messages about unknown format strings or values.
- %
- % Second, analyze_and_optimize_format_calls generates nested
- % conjunctions, which simplify_process_clause_body_goal can eliminate.
+:- pred simplify_proc_analyze_and_format_calls(
+ module_info::in, module_info::out, pred_id::in, proc_id::in,
+ list(error_spec)::out, proc_info::in, proc_info::out) is det.
+
+simplify_proc_analyze_and_format_calls(!ModuleInfo, PredId, ProcId,
+ FormatSpecs, !ProcInfo) :-
+ proc_info_get_goal(!.ProcInfo, Goal0),
proc_info_get_varset(!.ProcInfo, VarSet0),
- analyze_and_optimize_format_calls(!.ModuleInfo, Goal1, MaybeGoal2,
- FormatSpecs, VarSet0, VarSet1, VarTypes0, VarTypes1),
+ proc_info_get_vartypes(!.ProcInfo, VarTypes0),
+ analyze_and_optimize_format_calls(!.ModuleInfo, Goal0, MaybeGoal,
+ FormatSpecs, VarSet0, VarSet, VarTypes0, VarTypes),
(
- MaybeGoal2 = yes(Goal2),
- proc_info_set_goal(Goal2, !ProcInfo),
- proc_info_set_varset(VarSet1, !ProcInfo),
- proc_info_set_vartypes(VarTypes1, !ProcInfo),
+ MaybeGoal = yes(Goal),
+ proc_info_set_goal(Goal, !ProcInfo),
+ proc_info_set_varset(VarSet, !ProcInfo),
+ proc_info_set_vartypes(VarTypes, !ProcInfo),
% The goals we replace format calls with are created with the
% correct nonlocals, but analyze_and_optimize_format_calls can
@@ -472,17 +592,12 @@
% the nonlocal fields of the original scopes. And since
% instmap_deltas are restricted to the goal's nonlocals,
% they need to be recomputed as well.
- requantify_proc_general(ordinary_nonlocals_maybe_lambda,
- !ProcInfo),
- recompute_instmap_delta_proc(
- do_not_recompute_atomic_instmap_deltas,
+ requantify_proc_general(ordinary_nonlocals_maybe_lambda, !ProcInfo),
+ recompute_instmap_delta_proc(do_not_recompute_atomic_instmap_deltas,
!ProcInfo, !ModuleInfo),
- proc_info_get_goal(!.ProcInfo, Goal3),
- proc_info_get_vartypes(!.ProcInfo, VarTypes3),
% Put the new proc_info back into !ModuleInfo, since some of the
- % following code could otherwise find obsolete information in
- % there.
+ % following code could otherwise find obsolete information in there.
% Remove the has_format_call marker from the pred_info before
% putting it back, since any optimizable format calls will already
@@ -490,65 +605,35 @@
% transformation that inserts calls to these predicates,
% there is no point in invoking find_format_call again later.
- module_info_get_preds(!.ModuleInfo, PredTable1),
- map.lookup(PredTable1, PredId, PredInfo1),
- pred_info_get_procedures(PredInfo1, ProcTable1),
- map.det_update(ProcTable1, ProcId, !.ProcInfo, ProcTable),
-
- pred_info_set_procedures(ProcTable, PredInfo1, PredInfo2),
- remove_marker(marker_has_format_call, Markers0, Markers),
- pred_info_set_markers(Markers, PredInfo2, PredInfo),
+ module_info_get_preds(!.ModuleInfo, PredTable0),
+ map.lookup(PredTable0, PredId, PredInfo0),
+ pred_info_get_procedures(PredInfo0, ProcTable0),
+ map.det_update(ProcTable0, ProcId, !.ProcInfo, ProcTable),
+ pred_info_set_procedures(ProcTable, PredInfo0, PredInfo1),
+
+ pred_info_get_markers(PredInfo1, Markers1),
+ remove_marker(marker_has_format_call, Markers1, Markers),
+ pred_info_set_markers(Markers, PredInfo1, PredInfo),
- map.det_update(PredTable1, PredId, PredInfo, PredTable),
+ map.det_update(PredTable0, PredId, PredInfo, PredTable),
module_info_set_preds(PredTable, !ModuleInfo)
;
- MaybeGoal2 = no,
- Markers = Markers0,
- Goal3 = Goal1,
- % Throw away VarTypes1.
- VarTypes3 = VarTypes0
- )
- ;
- % Either there are no format calls to check, or we don't want to
- % optimize them and would ignore the added messages anyway.
- Goal3 = Goal1,
- Markers = Markers0,
- FormatSpecs = [],
- VarTypes3 = VarTypes0
- ),
-
- det_info_init(!.ModuleInfo, VarTypes3, PredId, ProcId,
- pess_extra_vars_report, [], DetInfo0),
- proc_info_get_initial_instmap(!.ProcInfo, !.ModuleInfo, InstMap0),
- simplify_info_init(DetInfo0, Simplifications, InstMap0, !.ProcInfo, Info0),
-
- simplify_process_clause_body_goal(Goal3, Goal, Info0, Info),
-
- simplify_info_get_varset(Info, VarSet3),
- ( simplify_do_after_front_end(Info) ->
- proc_info_get_var_name_remap(!.ProcInfo, VarNameRemap),
- map.foldl(svvarset.name_var, VarNameRemap, VarSet3, VarSet),
- proc_info_set_var_name_remap(map.init, !ProcInfo)
- ;
- VarSet = VarSet3
- ),
- simplify_info_get_var_types(Info, VarTypes),
- simplify_info_get_rtti_varmaps(Info, RttiVarMaps),
- proc_info_set_varset(VarSet, !ProcInfo),
- proc_info_set_vartypes(VarTypes, !ProcInfo),
- proc_info_set_goal(Goal, !ProcInfo),
- proc_info_set_rtti_varmaps(RttiVarMaps, !ProcInfo),
-
- simplify_info_get_has_parallel_conj(Info, HasParallelConj),
- proc_info_set_has_parallel_conj(HasParallelConj, !ProcInfo),
+ MaybeGoal = no
+ % There should not be any updates to the varset and the vartypes,
+ % but even if there are, throw them away, since they apply to a version
+ % of the goal that we will not be using.
+ ).
- simplify_info_get_has_user_event(Info, HasUserEvent),
- proc_info_set_has_user_event(HasUserEvent, !ProcInfo),
+:- pred simplify_proc_maybe_warn_about_duplicates(module_info::in, pred_id::in,
+ proc_info::in, list(error_spec)::in, list(error_spec)::out) is det.
- simplify_info_get_module_info(Info, !:ModuleInfo),
- simplify_info_get_error_specs(Info, !:Specs),
- !:Specs = FormatSpecs ++ !.Specs,
+simplify_proc_maybe_warn_about_duplicates(ModuleInfo, PredId, ProcInfo,
+ !Specs) :-
+ module_info_pred_info(ModuleInfo, PredId, PredInfo),
+ pred_info_get_markers(PredInfo, Markers),
+ % The alternate goal by definition cannot be a call_foreign_proc.
+ proc_info_get_goal(ProcInfo, Goal),
Goal = hlds_goal(GoalExpr, GoalInfo),
(
GoalExpr = call_foreign_proc(Attributes, _, _, _, _, _, _),
@@ -590,54 +675,6 @@
)
;
true
- ),
-
- IsDefinedHere = status_defined_in_this_module(Status),
- (
- IsDefinedHere = no,
- % Don't generate any warnings or even errors if the predicate isn't
- % defined here; any such messages will be generated when we compile
- % the module the predicate comes from.
- !:Specs = []
- ;
- IsDefinedHere = yes
- ).
-
-simplify_process_clause_body_goal(!Goal, !Info) :-
- some [!Simplifications] (
- simplify_info_get_simplifications(!.Info, !:Simplifications),
- OriginalSimplifications = !.Simplifications,
- simplify_info_get_instmap(!.Info, InstMap0),
- (
- ( simplify_do_common_struct(!.Info)
- ; simplify_do_opt_duplicate_calls(!.Info)
- )
- ->
- !Simplifications ^ do_do_once := no,
- !Simplifications ^ do_excess_assign := no,
- simplify_info_set_simplifications(!.Simplifications, !Info),
-
- do_process_clause_body_goal(!Goal, !Info),
-
- !:Simplifications = OriginalSimplifications,
- !Simplifications ^ do_warn_simple_code := no,
- !Simplifications ^ do_warn_duplicate_calls := no,
- !Simplifications ^ do_common_struct := no,
- !Simplifications ^ do_opt_duplicate_calls := no,
- simplify_info_reinit(!.Simplifications, InstMap0, !Info)
- ;
- true
- ),
- % On the second pass do excess assignment elimination and
- % some cleaning up after the common structure pass.
- do_process_clause_body_goal(!Goal, !Info),
- simplify_info_get_found_contains_trace(!.Info, FoundContainsTrace),
- (
- FoundContainsTrace = no
- ;
- FoundContainsTrace = yes,
- goal_contains_trace(!Goal, _)
- )
).
:- pred do_process_clause_body_goal(hlds_goal::in, hlds_goal::out,
@@ -2405,20 +2442,19 @@
input_args_are_equiv(Args, HeadVars, ArgModes,
CommonInfo1, ModuleInfo1),
- % Don't warn if the input arguments' modes initial insts
- % contain `any' insts, since the arguments might have become
- % more constrained before the recursive call, in which case
- % the recursion might eventually terminate.
- %
- % XXX The following check will only warn if the inputs are
- % all fully ground; i.e. we won't warn in the case of
- % partially instantiated insts such as list_skel(free).
- % Still, it is better to miss warnings in that rare and
- % unsupported case rather than to issue spurious warnings
- % in cases involving `any' insts. We should only warn about
- % definite nontermination here, not possible nontermination;
- % warnings about possible nontermination should only be given
- % if the termination analysis pass is enabled.
+ % Don't warn if the input arguments' modes initial insts contain
+ % `any' insts, since the arguments might have become more constrained
+ % before the recursive call, in which case the recursion might
+ % eventually terminate.
+ %
+ % XXX The following check will only warn if the inputs are all fully
+ % ground; i.e. we won't warn in the case of partially instantiated
+ % insts such as list_skel(free). Still, it is better to miss warnings
+ % in that rare and unsupported case rather than to issue spurious
+ % warnings in cases involving `any' insts. We should only warn about
+ % definite nontermination here, not possible nontermination; warnings
+ % about possible nontermination should only be given % if the
+ % termination analysis pass is enabled.
all [ArgMode] (
(
list.member(ArgMode, ArgModes),
Index: compiler/ssdebug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ssdebug.m,v
retrieving revision 1.33
diff -u -b -r1.33 ssdebug.m
--- compiler/ssdebug.m 15 Dec 2010 06:30:02 -0000 1.33
+++ compiler/ssdebug.m 4 Jan 2011 00:36:34 -0000
@@ -183,7 +183,7 @@
:- import_module io.
-:- pred ssdebug.transform_module(module_info::in, module_info::out,
+:- pred ssdebug_transform_module(module_info::in, module_info::out,
io::di, io::uo) is det.
%-----------------------------------------------------------------------------%
@@ -221,51 +221,54 @@
%-----------------------------------------------------------------------------%
-ssdebug.transform_module(!ModuleInfo, !IO) :-
- ssdebug.first_pass(!ModuleInfo),
- process_all_nonimported_procs(update_module(ssdebug.process_proc),
+ssdebug_transform_module(!ModuleInfo, !IO) :-
+ ssdebug_first_pass(!ModuleInfo),
+ process_all_nonimported_procs(update_module(ssdebug_process_proc),
!ModuleInfo).
%-----------------------------------------------------------------------------%
%
-% Create proxies for standard library predicates and insert context updates
+% Create proxies for standard library predicates and insert context updates.
%
:- type proxy_map == map(pred_id, maybe(pred_id)).
-:- pred first_pass(module_info::in, module_info::out) is det.
+:- pred ssdebug_first_pass(module_info::in, module_info::out) is det.
-first_pass(!ModuleInfo) :-
+ssdebug_first_pass(!ModuleInfo) :-
module_info_get_valid_predids(PredIds, !ModuleInfo),
- list.foldl2(first_pass_in_pred, PredIds, map.init, _ProxyMap, !ModuleInfo).
+ list.foldl2(ssdebug_first_pass_in_pred, PredIds,
+ map.init, _ProxyMap, !ModuleInfo).
-:- pred first_pass_in_pred(pred_id::in, proxy_map::in, proxy_map::out,
+:- pred ssdebug_first_pass_in_pred(pred_id::in, proxy_map::in, proxy_map::out,
module_info::in, module_info::out) is det.
-first_pass_in_pred(PredId, !ProxyMap, !ModuleInfo) :-
+ssdebug_first_pass_in_pred(PredId, !ProxyMap, !ModuleInfo) :-
module_info_pred_info(!.ModuleInfo, PredId, PredInfo),
ProcIds = pred_info_all_non_imported_procids(PredInfo),
- list.foldl2(first_pass_in_proc(PredId), ProcIds, !ProxyMap, !ModuleInfo).
+ list.foldl2(ssdebug_first_pass_in_proc(PredId), ProcIds,
+ !ProxyMap, !ModuleInfo).
-:- pred first_pass_in_proc(pred_id::in, proc_id::in,
+:- pred ssdebug_first_pass_in_proc(pred_id::in, proc_id::in,
proxy_map::in, proxy_map::out, module_info::in, module_info::out) is det.
-first_pass_in_proc(PredId, ProcId, !ProxyMap, !ModuleInfo) :-
+ssdebug_first_pass_in_proc(PredId, ProcId, !ProxyMap, !ModuleInfo) :-
some [!ProcInfo] (
module_info_pred_proc_info(!.ModuleInfo, PredId, ProcId, PredInfo,
!:ProcInfo),
proc_info_get_goal(!.ProcInfo, Goal0),
- first_pass_in_goal(Goal0, Goal, !ProcInfo, !ProxyMap, !ModuleInfo),
+ ssdebug_first_pass_in_goal(Goal0, Goal, !ProcInfo, !ProxyMap,
+ !ModuleInfo),
proc_info_set_goal(Goal, !ProcInfo),
module_info_set_pred_proc_info(PredId, ProcId, PredInfo, !.ProcInfo,
!ModuleInfo)
).
-:- pred first_pass_in_goal(hlds_goal::in, hlds_goal::out,
+:- pred ssdebug_first_pass_in_goal(hlds_goal::in, hlds_goal::out,
proc_info::in, proc_info::out, proxy_map::in, proxy_map::out,
module_info::in, module_info::out) is det.
-first_pass_in_goal(!Goal, !ProcInfo, !ProxyMap, !ModuleInfo) :-
+ssdebug_first_pass_in_goal(!Goal, !ProcInfo, !ProxyMap, !ModuleInfo) :-
!.Goal = hlds_goal(GoalExpr0, GoalInfo0),
(
GoalExpr0 = unify(_, _, _, Unification0, _),
@@ -321,54 +324,57 @@
GoalExpr0 = call_foreign_proc(_, _, _, _, _, _, _)
;
GoalExpr0 = conj(ConjType, Goals0),
- list.map_foldl3(first_pass_in_goal, Goals0, Goals, !ProcInfo,
+ list.map_foldl3(ssdebug_first_pass_in_goal, Goals0, Goals, !ProcInfo,
!ProxyMap, !ModuleInfo),
GoalExpr = conj(ConjType, Goals),
!:Goal = hlds_goal(GoalExpr, GoalInfo0)
;
GoalExpr0 = disj(Goals0),
- list.map_foldl3(first_pass_in_goal, Goals0, Goals, !ProcInfo,
+ list.map_foldl3(ssdebug_first_pass_in_goal, Goals0, Goals, !ProcInfo,
!ProxyMap, !ModuleInfo),
GoalExpr = disj(Goals),
!:Goal = hlds_goal(GoalExpr, GoalInfo0)
;
GoalExpr0 = switch(Var, CanFail, Cases0),
- list.map_foldl3(first_pass_in_case, Cases0, Cases, !ProcInfo,
+ list.map_foldl3(ssdebug_first_pass_in_case, Cases0, Cases, !ProcInfo,
!ProxyMap, !ModuleInfo),
GoalExpr = switch(Var, CanFail, Cases),
!:Goal = hlds_goal(GoalExpr, GoalInfo0)
;
GoalExpr0 = negation(SubGoal0),
- first_pass_in_goal(SubGoal0, SubGoal, !ProcInfo, !ProxyMap,
+ ssdebug_first_pass_in_goal(SubGoal0, SubGoal, !ProcInfo, !ProxyMap,
!ModuleInfo),
GoalExpr = negation(SubGoal),
!:Goal = hlds_goal(GoalExpr, GoalInfo0)
;
GoalExpr0 = scope(Reason, SubGoal0),
- first_pass_in_goal(SubGoal0, SubGoal, !ProcInfo, !ProxyMap,
+ ssdebug_first_pass_in_goal(SubGoal0, SubGoal, !ProcInfo, !ProxyMap,
!ModuleInfo),
GoalExpr = scope(Reason, SubGoal),
!:Goal = hlds_goal(GoalExpr, GoalInfo0)
;
GoalExpr0 = if_then_else(Vars, Cond0, Then0, Else0),
- first_pass_in_goal(Cond0, Cond, !ProcInfo, !ProxyMap, !ModuleInfo),
- first_pass_in_goal(Then0, Then, !ProcInfo, !ProxyMap, !ModuleInfo),
- first_pass_in_goal(Else0, Else, !ProcInfo, !ProxyMap, !ModuleInfo),
+ ssdebug_first_pass_in_goal(Cond0, Cond, !ProcInfo, !ProxyMap,
+ !ModuleInfo),
+ ssdebug_first_pass_in_goal(Then0, Then, !ProcInfo, !ProxyMap,
+ !ModuleInfo),
+ ssdebug_first_pass_in_goal(Else0, Else, !ProcInfo, !ProxyMap,
+ !ModuleInfo),
GoalExpr = if_then_else(Vars, Cond, Then, Else),
!:Goal = hlds_goal(GoalExpr, GoalInfo0)
;
GoalExpr0 = shorthand(_),
% These should have been expanded out by now.
- unexpected(this_file, "create_proxies_in_goal: unexpected shorthand")
+ unexpected($module, $pred, "unexpected shorthand")
).
-:- pred first_pass_in_case(case::in, case::out,
+:- pred ssdebug_first_pass_in_case(case::in, case::out,
proc_info::in, proc_info::out,
proxy_map::in, proxy_map::out, module_info::in, module_info::out) is det.
-first_pass_in_case(Case0, Case, !ProcInfo, !ProxyMap, !ModuleInfo) :-
+ssdebug_first_pass_in_case(Case0, Case, !ProcInfo, !ProxyMap, !ModuleInfo) :-
Case0 = case(MainConsId, OtherConsIds, Goal0),
- first_pass_in_goal(Goal0, Goal, !ProcInfo, !ProxyMap, !ModuleInfo),
+ ssdebug_first_pass_in_goal(Goal0, Goal, !ProcInfo, !ProxyMap, !ModuleInfo),
Case = case(MainConsId, OtherConsIds, Goal).
% Look up the proxy for a predicate, creating one if appropriate.
@@ -400,7 +406,8 @@
pred_info_set_import_status(status_local, !PredInfo),
ProcIds = pred_info_procids(!.PredInfo),
- list.foldl2(create_proxy_proc(PredId), ProcIds, !PredInfo, !ModuleInfo),
+ list.foldl2(create_proxy_proc(PredId), ProcIds, !PredInfo,
+ !ModuleInfo),
% Change the name so that the proxy is not confused with the original.
Name = pred_info_name(!.PredInfo),
@@ -473,40 +480,42 @@
% The main transformation.
%
-:- pred process_proc(pred_proc_id::in, proc_info::in, proc_info::out,
+:- pred ssdebug_process_proc(pred_proc_id::in, proc_info::in, proc_info::out,
module_info::in, module_info::out) is det.
-process_proc(proc(PredId, ProcId), !ProcInfo, !ModuleInfo) :-
+ssdebug_process_proc(proc(PredId, ProcId), !ProcInfo, !ModuleInfo) :-
proc_info_get_argmodes(!.ProcInfo, ArgModes),
( check_arguments_modes(!.ModuleInfo, ArgModes) ->
% We have different transformations for procedures of different
% determinisms.
% XXX It might be possible to factor out the common code in the four
- % process_proc_* predicates.
+ % ssdebug_process_proc_* predicates.
proc_info_get_inferred_determinism(!.ProcInfo, Determinism),
(
( Determinism = detism_det
; Determinism = detism_cc_multi
),
- process_proc_det(PredId, ProcId, !ProcInfo, !ModuleInfo)
+ ssdebug_process_proc_det(PredId, ProcId, !ProcInfo, !ModuleInfo)
;
( Determinism = detism_semi
; Determinism = detism_cc_non
),
- process_proc_semi(PredId, ProcId, !ProcInfo, !ModuleInfo)
+ ssdebug_process_proc_semi(PredId, ProcId, !ProcInfo, !ModuleInfo)
;
( Determinism = detism_multi
; Determinism = detism_non
),
- process_proc_nondet(PredId, ProcId, !ProcInfo, !ModuleInfo)
+ ssdebug_process_proc_nondet(PredId, ProcId, !ProcInfo, !ModuleInfo)
;
Determinism = detism_erroneous,
- process_proc_erroneous(PredId, ProcId, !ProcInfo, !ModuleInfo)
+ ssdebug_process_proc_erroneous(PredId, ProcId, !ProcInfo,
+ !ModuleInfo)
;
Determinism = detism_failure,
- process_proc_failure(PredId, ProcId, !ProcInfo, !ModuleInfo)
+ ssdebug_process_proc_failure(PredId, ProcId, !ProcInfo,
+ !ModuleInfo)
)
;
% In the case of a mode which is not fully input or output, the
@@ -516,10 +525,10 @@
% Source-to-source transformation for a deterministic goal.
%
-:- pred process_proc_det(pred_id::in, proc_id::in,
+:- pred ssdebug_process_proc_det(pred_id::in, proc_id::in,
proc_info::in, proc_info::out, module_info::in, module_info::out) is det.
-process_proc_det(PredId, ProcId, !ProcInfo, !ModuleInfo) :-
+ssdebug_process_proc_det(PredId, ProcId, !ProcInfo, !ModuleInfo) :-
some [!PredInfo, !VarSet, !VarTypes] (
module_info_pred_info(!.ModuleInfo, PredId, !:PredInfo),
proc_info_get_goal(!.ProcInfo, OrigBodyGoal),
@@ -602,10 +611,10 @@
% Source-to-source transformation for a semidet goal.
%
-:- pred process_proc_semi(pred_id::in, proc_id::in,
+:- pred ssdebug_process_proc_semi(pred_id::in, proc_id::in,
proc_info::in, proc_info::out, module_info::in, module_info::out) is det.
-process_proc_semi(PredId, ProcId, !ProcInfo, !ModuleInfo) :-
+ssdebug_process_proc_semi(PredId, ProcId, !ProcInfo, !ModuleInfo) :-
some [!PredInfo, !VarSet, !VarTypes] (
module_info_pred_info(!.ModuleInfo, PredId, !:PredInfo),
proc_info_get_goal(!.ProcInfo, OrigBodyGoal),
@@ -684,7 +693,7 @@
RenamedBodyGoal, CondGoal)
;
Solns = at_most_zero,
- unexpected(this_file, "process_proc_semi: zero solutions")
+ unexpected($module, $pred, "zero solutions")
),
% Create the `then' branch.
@@ -724,10 +733,10 @@
% Source-to-source transformation for a nondeterministic procedure.
%
-:- pred process_proc_nondet(pred_id::in, proc_id::in,
+:- pred ssdebug_process_proc_nondet(pred_id::in, proc_id::in,
proc_info::in, proc_info::out, module_info::in, module_info::out) is det.
-process_proc_nondet(PredId, ProcId, !ProcInfo, !ModuleInfo) :-
+ssdebug_process_proc_nondet(PredId, ProcId, !ProcInfo, !ModuleInfo) :-
some [!PredInfo, !VarSet, !VarTypes] (
module_info_pred_info(!.ModuleInfo, PredId, !:PredInfo),
proc_info_get_goal(!.ProcInfo, OrigBodyGoal),
@@ -817,10 +826,10 @@
% Source-to-source transformation for a failure procedure.
%
-:- pred process_proc_failure(pred_id::in, proc_id::in,
+:- pred ssdebug_process_proc_failure(pred_id::in, proc_id::in,
proc_info::in, proc_info::out, module_info::in, module_info::out) is det.
-process_proc_failure(PredId, ProcId, !ProcInfo, !ModuleInfo) :-
+ssdebug_process_proc_failure(PredId, ProcId, !ProcInfo, !ModuleInfo) :-
some [!PredInfo, !VarSet, !VarTypes] (
module_info_pred_info(!.ModuleInfo, PredId, !:PredInfo),
proc_info_get_goal(!.ProcInfo, OrigBodyGoal),
@@ -878,10 +887,10 @@
% Source-to-source transformation for an erroneous procedure.
%
-:- pred process_proc_erroneous(pred_id::in, proc_id::in,
+:- pred ssdebug_process_proc_erroneous(pred_id::in, proc_id::in,
proc_info::in, proc_info::out, module_info::in, module_info::out) is det.
-process_proc_erroneous(PredId, ProcId, !ProcInfo, !ModuleInfo) :-
+ssdebug_process_proc_erroneous(PredId, ProcId, !ProcInfo, !ModuleInfo) :-
some [!PredInfo, !VarSet, !VarTypes] (
module_info_pred_info(!.ModuleInfo, PredId, !:PredInfo),
proc_info_get_goal(!.ProcInfo, OrigBodyGoal),
@@ -1255,7 +1264,7 @@
ListTypeCtor = type_ctor(qualified(mercury_list_module, "list"), 1),
construct_type(ListTypeCtor, [VarValueType], ListVarValueType).
- % Create the goal's argument description :
+ % Create the goal's argument description:
% -> unbound_head_var(Name, Pos) if it is an unbound argument
% -> bound_head_var(type_of_T, Name, Position, T) if it is a bound argument
%
@@ -1280,7 +1289,7 @@
svvarset.new_named_var("VarDesc", VarDesc, !VarSet),
( var_is_ground_in_instmap(!.ModuleInfo, InstMap, VarToInspect) ->
- % Update proc_varset and proc_vartypes, without this, the
+ % Update proc_varset and proc_vartypes; without this,
% polymorphism_make_type_info_var uses a prog_var which is
% already bound.
@@ -1342,11 +1351,5 @@
).
%-----------------------------------------------------------------------------%
-
-:- func this_file = string.
-
-this_file = "ssdebug.m".
-
-%-----------------------------------------------------------------------------%
:- end_module transform_hlds.ssdebug.
%-----------------------------------------------------------------------------%
cvs diff: Diffing compiler/notes
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/fixed
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_allegro
cvs diff: Diffing extras/graphics/mercury_allegro/examples
cvs diff: Diffing extras/graphics/mercury_allegro/samples
cvs diff: Diffing extras/graphics/mercury_allegro/samples/demo
cvs diff: Diffing extras/graphics/mercury_allegro/samples/mandel
cvs diff: Diffing extras/graphics/mercury_allegro/samples/pendulum2
cvs diff: Diffing extras/graphics/mercury_allegro/samples/speed
cvs diff: Diffing extras/graphics/mercury_cairo
cvs diff: Diffing extras/graphics/mercury_cairo/samples
cvs diff: Diffing extras/graphics/mercury_cairo/samples/data
cvs diff: Diffing extras/graphics/mercury_cairo/tutorial
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/log4m
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/monte
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/mopenssl
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/net
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/posix/samples
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/standalone_c
cvs diff: Diffing samples/concurrency
cvs diff: Diffing samples/concurrency/dining_philosophers
cvs diff: Diffing samples/concurrency/midimon
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/java_interface
cvs diff: Diffing samples/java_interface/java_calls_mercury
cvs diff: Diffing samples/java_interface/mercury_calls_java
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/solver_types
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing ssdb
cvs diff: Diffing tests
cvs diff: Diffing tests/analysis
cvs diff: Diffing tests/analysis/ctgc
cvs diff: Diffing tests/analysis/excp
cvs diff: Diffing tests/analysis/ext
cvs diff: Diffing tests/analysis/sharing
cvs diff: Diffing tests/analysis/table
cvs diff: Diffing tests/analysis/trail
cvs diff: Diffing tests/analysis/unused_args
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/stm
cvs diff: Diffing tests/stm/orig
cvs diff: Diffing tests/stm/orig/stm-compiler
cvs diff: Diffing tests/stm/orig/stm-compiler/test1
cvs diff: Diffing tests/stm/orig/stm-compiler/test10
cvs diff: Diffing tests/stm/orig/stm-compiler/test2
cvs diff: Diffing tests/stm/orig/stm-compiler/test3
cvs diff: Diffing tests/stm/orig/stm-compiler/test4
cvs diff: Diffing tests/stm/orig/stm-compiler/test5
cvs diff: Diffing tests/stm/orig/stm-compiler/test6
cvs diff: Diffing tests/stm/orig/stm-compiler/test7
cvs diff: Diffing tests/stm/orig/stm-compiler/test8
cvs diff: Diffing tests/stm/orig/stm-compiler/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/stmqueue
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test10
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test11
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test9
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list