[m-rev.] diff: add wrapper type to ease hlds->hlds transformations
Adrian Pellas-Rice
apell at students.cs.mu.oz.au
Thu Apr 5 03:05:39 AEST 2001
Estimated hours taken: 4.5
Branches: main
compiler/hlds_goal.m
Create a new type, the `shorthand_goal_expr', for goals kinds that
are implemented by a (ordinary_hlds + shorthand) -> (ordinary_hlds)
transformation. At present, bi_implication is the only kind of
of goal that is implemented in this way.
Moved bi_implication functor from the type goal_expr to the new
shorthand_goal_expr type.
Added the functor shorthand to the goal_expr type.
compiler/*.m
Change switches on hlds_goal_expr that call error when they recognise
`bi_implication' from calling error when they recognise
`bi_implication' to calling error when they recognise `shorthand'.
For all predicates K that
a) switch on hlds_goal_expr and
b) perform non-trivial processing when they recognise
`bi_implication'
change K such that it now calls K_shorthand upon recognising the
functor `shorthand'. Define K_shorthand to switch on
shorthand_goal_expr, where the code for the `bi_implication' case
formerly contained in K is now contained in K_shorthand.
Workspace: /home/earth/apell/mercury2/mercury
Index: mercury/compiler/add_trail_ops.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/add_trail_ops.m,v
retrieving revision 1.2
diff -u -d -r1.2 add_trail_ops.m
--- mercury/compiler/add_trail_ops.m 2001/04/03 03:19:22 1.2
+++ mercury/compiler/add_trail_ops.m 2001/04/04 15:11:12
@@ -271,9 +271,9 @@
{ Goal = PragmaForeign - GoalInfo }
).
-goal_expr_add_trail_ops(bi_implication(_, _), _, _) -->
+goal_expr_add_trail_ops(shorthand(_), _, _) -->
% these should have been expanded out by now
- { error("goal_expr_add_trail_ops: unexpected bi_implication") }.
+ { error("goal_expr_add_trail_ops: unexpected shorthand") }.
:- pred conj_add_trail_ops(hlds_goals::in, hlds_goals::out,
trail_ops_info::in, trail_ops_info::out) is det.
Index: mercury/compiler/assertion.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/assertion.m,v
retrieving revision 1.12
diff -u -d -r1.12 assertion.m
--- mercury/compiler/assertion.m 2001/04/03 03:19:22 1.12
+++ mercury/compiler/assertion.m 2001/04/04 15:11:13
@@ -554,8 +554,18 @@
equal_vars(VarsA, VarsB, Subst0, Subst).
equal_goals(par_conj(GoalAs, _) - _, par_conj(GoalBs, _) - _, Subst0, Subst) :-
equal_goals_list(GoalAs, GoalBs, Subst0, Subst).
-equal_goals(bi_implication(LeftGoalA, RightGoalA) - _,
- bi_implication(LeftGoalB, RightGoalB) - _, Subst0, Subst) :-
+equal_goals(shorthand(ShorthandGoalA) - GoalInfoA,
+ shorthand(ShorthandGoalB) - GoalInfoB, Subst0, Subst) :-
+ equal_goals_shorthand(ShorthandGoalA - GoalInfoA,
+ ShorthandGoalB - GoalInfoB, Subst0, Subst).
+
+:- pred equal_goals_shorthand(pair(shorthand_goal_expr, hlds_goal_info)::in,
+ pair(shorthand_goal_expr, hlds_goal_info)::in, subst::in,
+ subst::out) is semidet.
+
+equal_goals_shorthand(bi_implication(LeftGoalA, RightGoalA) - GoalInfo,
+ bi_implication(LeftGoalB, RightGoalB) - GoalInfo, Subst0, Subst)
+ :-
equal_goals(LeftGoalA, LeftGoalB, Subst0, Subst1),
equal_goals(RightGoalA, RightGoalB, Subst1, Subst).
@@ -671,11 +681,26 @@
assertion__normalise_goal(Else0, Else).
assertion__normalise_goal(par_conj(Goal0s,B) - GI, par_conj(Goals,B) - GI) :-
assertion__normalise_goals(Goal0s, Goals).
-assertion__normalise_goal(bi_implication(LHS0, RHS0) - GI,
+assertion__normalise_goal(shorthand(ShortHandGoal0) - GI0,
+ shorthand(ShortHandGoal) - GI) :-
+ assertion__normalise_goal_shorthand(ShortHandGoal0 - GI0,
+ ShortHandGoal - GI).
+
+ % assertion__normalise_goal_shorthand
+ %
+ % Place a shorthand goal into a standard form. Currently
+ % all the code does is replace conj([G]) with G.
+ %
+:- pred assertion__normalise_goal_shorthand(
+ pair(shorthand_goal_expr, hlds_goal_info)::in,
+ pair(shorthand_goal_expr, hlds_goal_info)::out) is det.
+
+assertion__normalise_goal_shorthand(bi_implication(LHS0, RHS0) - GI,
bi_implication(LHS, RHS) - GI) :-
assertion__normalise_goal(LHS0, LHS),
assertion__normalise_goal(RHS0, RHS).
+
%-----------------------------------------------------------------------------%
:- pred assertion__normalise_conj(hlds_goals::in, hlds_goals::out) is det.
@@ -764,7 +789,16 @@
assertion__in_interface_check(par_conj(Goals,_) - _, PredInfo,
Module0, Module) -->
assertion__in_interface_check_list(Goals, PredInfo, Module0, Module).
-assertion__in_interface_check(bi_implication(LHS, RHS) - _, PredInfo,
+assertion__in_interface_check(shorthand(ShorthandGoal) - _GoalInfo, PredInfo,
+ Module0, Module) -->
+ assertion__in_interface_check_shorthand(ShorthandGoal,
+ PredInfo, Module0, Module).
+
+:- pred assertion__in_interface_check_shorthand(shorthand_goal_expr::in,
+ pred_info::in, module_info::in, module_info::out,
+ io__state::di, io__state::uo) is det.
+
+assertion__in_interface_check_shorthand(bi_implication(LHS, RHS), PredInfo,
Module0, Module) -->
assertion__in_interface_check(LHS, PredInfo, Module0, Module1),
assertion__in_interface_check(RHS, PredInfo, Module1, Module).
Index: mercury/compiler/bytecode_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode_gen.m,v
retrieving revision 1.60
diff -u -d -r1.60 bytecode_gen.m
--- mercury/compiler/bytecode_gen.m 2001/04/03 03:19:23 1.60
+++ mercury/compiler/bytecode_gen.m 2001/04/04 15:11:14
@@ -283,9 +283,9 @@
Code = node([not_supported]),
ByteInfo = ByteInfo0
;
- GoalExpr = bi_implication(_, _),
+ GoalExpr = shorthand(_),
% these should have been expanded out by now
- error("bytecode_gen__goal_expr: unexpected bi_implication")
+ error("bytecode_gen__goal_expr: unexpected shorthand")
).
%---------------------------------------------------------------------------%
Index: mercury/compiler/code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.95
diff -u -d -r1.95 code_gen.m
--- mercury/compiler/code_gen.m 2001/04/03 03:19:25 1.95
+++ mercury/compiler/code_gen.m 2001/04/04 15:11:15
@@ -1155,9 +1155,9 @@
;
{ error("code_gen__generate_goal_2: foreign code other than C unexpected") }
).
-code_gen__generate_goal_2(bi_implication(_, _), _, _, _) -->
+code_gen__generate_goal_2(shorthand(_), _, _, _) -->
% these should have been expanded out by now
- { error("code_gen__generate_goal_2: unexpected bi_implication") }.
+ { error("code_gen__generate_goal_2: unexpected shorthand") }.
%---------------------------------------------------------------------------%
Index: mercury/compiler/code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_util.m,v
retrieving revision 1.130
diff -u -d -r1.130 code_util.m
--- mercury/compiler/code_util.m 2001/04/03 03:19:26 1.130
+++ mercury/compiler/code_util.m 2001/04/04 15:11:15
@@ -500,13 +500,21 @@
;
code_util__goal_may_allocate_heap(E, May)
).
-code_util__goal_may_allocate_heap_2(bi_implication(G1, G2), May) :-
+code_util__goal_may_allocate_heap_2(shorthand(ShorthandGoal), May) :-
+ code_util__goal_may_allocate_heap_2_shorthand(ShorthandGoal, May).
+
+:- pred code_util__goal_may_allocate_heap_2_shorthand(shorthand_goal_expr::in,
+ bool::out) is det.
+
+code_util__goal_may_allocate_heap_2_shorthand(bi_implication(G1, G2), May) :-
( code_util__goal_may_allocate_heap(G1, yes) ->
May = yes
;
code_util__goal_may_allocate_heap(G2, May)
).
+
+
:- pred code_util__goal_list_may_allocate_heap(list(hlds_goal)::in, bool::out)
is det.
@@ -576,13 +584,21 @@
;
code_util__goal_may_alloc_temp_frame(E, May)
).
-code_util__goal_may_alloc_temp_frame_2(bi_implication(G1, G2), May) :-
+code_util__goal_may_alloc_temp_frame_2(shorthand(ShorthandGoal), May) :-
+ code_util__goal_may_alloc_temp_frame_2_shorthand(ShorthandGoal,May).
+
+:- pred code_util__goal_may_alloc_temp_frame_2_shorthand(
+ shorthand_goal_expr::in, bool::out) is det.
+
+code_util__goal_may_alloc_temp_frame_2_shorthand(bi_implication(G1, G2),
+ May) :-
( code_util__goal_may_alloc_temp_frame(G1, yes) ->
May = yes
;
code_util__goal_may_alloc_temp_frame(G2, May)
).
+
:- pred code_util__goal_list_may_alloc_temp_frame(list(hlds_goal)::in,
bool::out) is det.
@@ -842,10 +858,10 @@
CTMax is CMax + TMax,
int__min(CTMin, EMin, Min),
int__max(CTMax, EMax, Max).
-code_util__count_recursive_calls_2(bi_implication(_, _),
+code_util__count_recursive_calls_2(shorthand(_),
_, _, _, _) :-
% these should have been expanded out by now
- error("code_util__count_recursive_calls_2: unexpected bi_implication").
+ error("code_util__count_recursive_calls_2: unexpected shorthand").
:- pred code_util__count_recursive_calls_conj(list(hlds_goal),
pred_id, proc_id, int, int, int, int).
Index: mercury/compiler/cse_detection.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/cse_detection.m,v
retrieving revision 1.69
diff -u -d -r1.69 cse_detection.m
--- mercury/compiler/cse_detection.m 2001/04/03 03:19:28 1.69
+++ mercury/compiler/cse_detection.m 2001/04/04 15:11:16
@@ -285,9 +285,9 @@
detect_cse_in_ite(NonLocalsList, Vars, Cond0, Then0, Else0, GoalInfo,
SM, InstMap, CseInfo0, CseInfo, Redo, Goal).
-detect_cse_in_goal_2(bi_implication(_, _), _, _, _, _, _, _) :-
+detect_cse_in_goal_2(shorthand(_), _, _, _, _, _, _) :-
% these should have been expanded out by now
- error("detect_cse_in_goal_2: unexpected bi_implication").
+ error("detect_cse_in_goal_2: unexpected shorthand").
%-----------------------------------------------------------------------------%
Index: mercury/compiler/dead_proc_elim.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.64
diff -u -d -r1.64 dead_proc_elim.m
--- mercury/compiler/dead_proc_elim.m 2001/04/03 03:19:28 1.64
+++ mercury/compiler/dead_proc_elim.m 2001/04/04 15:11:16
@@ -510,9 +510,9 @@
Queue = Queue0,
Needed = Needed0
).
-dead_proc_elim__examine_expr(bi_implication(_,_), _, _, _, _, _) :-
+dead_proc_elim__examine_expr(shorthand(_), _, _, _, _, _) :-
% these should have been expanded out by now
- error("detect_cse_in_goal_2: unexpected bi_implication").
+ error("detect_cse_in_goal_2: unexpected shorthand").
%-----------------------------------------------------------------------------%
@@ -885,9 +885,9 @@
[].
pre_modecheck_examine_goal(unify(_, Rhs, _, _, _) - _) -->
pre_modecheck_examine_unify_rhs(Rhs).
-pre_modecheck_examine_goal(bi_implication(_, _) - _) -->
+pre_modecheck_examine_goal(shorthand(_) - _) -->
% these should have been expanded out by now
- { error("pre_modecheck_examine_goal: unexpected bi_implication") }.
+ { error("pre_modecheck_examine_goal: unexpected shorthand") }.
:- pred pre_modecheck_examine_unify_rhs(unify_rhs::in,
dead_pred_info::in, dead_pred_info::out) is det.
Index: mercury/compiler/deforest.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/deforest.m,v
retrieving revision 1.20
diff -u -d -r1.20 deforest.m
--- mercury/compiler/deforest.m 2001/04/03 03:19:28 1.20
+++ mercury/compiler/deforest.m 2001/04/04 15:11:17
@@ -220,9 +220,9 @@
deforest__goal(Goal, Goal) -->
{ Goal = unify(_, _, _, _, _) - _ }.
-deforest__goal(bi_implication(_, _) - _, _) -->
+deforest__goal(shorthand(_) - _, _) -->
% these should have been expanded out by now
- { error("deforest__goal: unexpected bi_implication") }.
+ { error("deforest__goal: unexpected shorthand") }.
%-----------------------------------------------------------------------------%
Index: mercury/compiler/dependency_graph.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dependency_graph.m,v
retrieving revision 1.52
diff -u -d -r1.52 dependency_graph.m
--- mercury/compiler/dependency_graph.m 2001/04/03 03:19:29 1.52
+++ mercury/compiler/dependency_graph.m 2001/04/04 15:11:17
@@ -350,8 +350,19 @@
dependency_graph__add_arcs_in_goal_2(
foreign_proc(_, _, _, _, _, _, _), _, DepGraph, DepGraph).
-dependency_graph__add_arcs_in_goal_2(bi_implication(LHS, RHS), Caller,
+dependency_graph__add_arcs_in_goal_2(shorthand(ShorthandGoal), Caller,
DepGraph0, DepGraph) :-
+ dependency_graph__add_arcs_in_goal_2_shorthand(ShorthandGoal, Caller,
+ DepGraph0, DepGraph).
+
+
+:- pred dependency_graph__add_arcs_in_goal_2_shorthand(shorthand_goal_expr,
+ relation_key, dependency_graph, dependency_graph).
+:- mode dependency_graph__add_arcs_in_goal_2_shorthand(in, in, in, out)
+ is det.
+
+dependency_graph__add_arcs_in_goal_2_shorthand(bi_implication(LHS, RHS),
+ Caller, DepGraph0, DepGraph) :-
dependency_graph__add_arcs_in_list([LHS, RHS], Caller,
DepGraph0, DepGraph).
@@ -739,9 +750,9 @@
Map, Map) --> [].
process_aditi_goal(_IsNeg, foreign_proc(_, _, _, _, _, _, _) - _,
Map, Map) --> [].
-process_aditi_goal(_, bi_implication(_, _) - _, _, _) -->
+process_aditi_goal(_, shorthand(_) - _, _, _) -->
% these should have been expanded out by now
- { error("process_aditi_goal: unexpected bi_implication") }.
+ { error("process_aditi_goal: unexpected shorthand") }.
%-----------------------------------------------------------------------------%
Index: mercury/compiler/det_analysis.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/det_analysis.m,v
retrieving revision 1.149
diff -u -d -r1.149 det_analysis.m
--- mercury/compiler/det_analysis.m 2001/04/03 03:19:30 1.149
+++ mercury/compiler/det_analysis.m 2001/04/04 15:11:17
@@ -677,9 +677,9 @@
Detism = erroneous
).
-det_infer_goal_2(bi_implication(_, _), _, _, _, _, _, _, _, _, _) :-
+det_infer_goal_2(shorthand(_), _, _, _, _, _, _, _, _, _) :-
% these should have been expanded out by now
- error("det_infer_goal_2: unexpected bi_implication").
+ error("det_infer_goal_2: unexpected shorthand").
%-----------------------------------------------------------------------------%
Index: mercury/compiler/det_report.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/det_report.m,v
retrieving revision 1.66
diff -u -d -r1.66 det_report.m
--- mercury/compiler/det_report.m 2001/04/03 03:19:31 1.66
+++ mercury/compiler/det_report.m 2001/04/04 15:11:18
@@ -655,9 +655,9 @@
% prog_out__write_context(Context),
% io__write_string(" for modes which don't succeed more than once.\n").
-det_diagnose_goal_2(bi_implication(_, _), _, _, _, _, _, _) -->
+det_diagnose_goal_2(shorthand(_), _, _, _, _, _, _) -->
% these should have been expanded out by now
- { error("det_diagnose_goal_2: unexpected bi_implication") }.
+ { error("det_diagnose_goal_2: unexpected shorthand") }.
%-----------------------------------------------------------------------------%
Index: mercury/compiler/dnf.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dnf.m,v
retrieving revision 1.43
diff -u -d -r1.43 dnf.m
--- mercury/compiler/dnf.m 2001/04/03 03:19:32 1.43
+++ mercury/compiler/dnf.m 2001/04/04 15:32:52
@@ -243,9 +243,9 @@
NewPredIds = NewPredIds0,
Goal = Goal0
;
- GoalExpr0 = bi_implication(_, _),
+ GoalExpr0 = shorthand(_),
% these should have been expanded out by now
- error("dnf__transform_goal: unexpected bi_implication")
+ error("dnf__transform_goal: unexpected shorthand")
).
%-----------------------------------------------------------------------------%
@@ -474,7 +474,17 @@
).
dnf__is_atomic_expr(_, _, _, if_then_else(_, _, _, _, _), no).
dnf__is_atomic_expr(_, _, _, foreign_proc(_, _, _, _, _, _, _), yes).
-dnf__is_atomic_expr(_, _, _, bi_implication(_, _), no).
+dnf__is_atomic_expr(MaybeNonAtomic, InNeg, InSome, shorthand(ShorthandGoal),
+ IsAtomic) :-
+ dnf__is_atomic_expr_shorthand(MaybeNonAtomic, InNeg, InSome,
+ ShorthandGoal, IsAtomic).
+
+
+:- pred dnf__is_atomic_expr_shorthand(maybe(set(pred_proc_id))::in, bool::in,
+ bool::in, shorthand_goal_expr::in, bool::out) is det.
+
+dnf__is_atomic_expr_shorthand(_, _, _, bi_implication(_,_), no).
+
:- pred dnf__free_of_nonatomic(hlds_goal::in,
set(pred_proc_id)::in) is semidet.
Index: mercury/compiler/excess.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/excess.m,v
retrieving revision 1.36
diff -u -d -r1.36 excess.m
--- mercury/compiler/excess.m 2001/04/03 03:19:33 1.36
+++ mercury/compiler/excess.m 2001/04/04 15:11:19
@@ -138,9 +138,9 @@
Goal = GoalExpr0 - GoalInfo0,
ElimVars = ElimVars0
;
- GoalExpr0 = bi_implication(_, _),
+ GoalExpr0 = shorthand(_),
% these should have been expanded out by now
- error("detect_cse_in_goal_2: unexpected bi_implication")
+ error("detect_cse_in_goal_2: unexpected shorthand")
).
%-----------------------------------------------------------------------------%
Index: mercury/compiler/follow_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/follow_code.m,v
retrieving revision 1.61
diff -u -d -r1.61 follow_code.m
--- mercury/compiler/follow_code.m 2001/04/03 03:19:34 1.61
+++ mercury/compiler/follow_code.m 2001/04/04 15:11:19
@@ -125,9 +125,9 @@
move_follow_code_in_goal_2(foreign_proc(A,B,C,D,E,F,G),
foreign_proc(A,B,C,D,E,F,G), _, R, R).
-move_follow_code_in_goal_2(bi_implication(_, _), _, _, _, _) :-
+move_follow_code_in_goal_2(shorthand(_), _, _, _, _) :-
% these should have been expanded out by now
- error("move_follow_code_in_goal_2: unexpected bi_implication").
+ error("move_follow_code_in_goal_2: unexpected shorthand").
%-----------------------------------------------------------------------------%
Index: mercury/compiler/follow_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/follow_vars.m,v
retrieving revision 1.61
diff -u -d -r1.61 follow_vars.m
--- mercury/compiler/follow_vars.m 2001/04/03 03:19:34 1.61
+++ mercury/compiler/follow_vars.m 2001/04/04 15:11:19
@@ -207,9 +207,9 @@
foreign_proc(A,B,C,D,E,F,G),
FollowVarsMap, NextNonReserved).
-find_follow_vars_in_goal_expr(bi_implication(_,_), _, _, _, _, _, _, _) :-
+find_follow_vars_in_goal_expr(shorthand(_), _, _, _, _, _, _, _) :-
% these should have been expanded out by now
- error("find_follow_vars_in_goal_2: unexpected bi_implication").
+ error("find_follow_vars_in_goal_2: unexpected shorthand").
find_follow_vars_in_goal_expr(
generic_call(GenericCall, Args, Modes, Det),
Index: mercury/compiler/goal_path.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/goal_path.m,v
retrieving revision 1.13
diff -u -d -r1.13 goal_path.m
--- mercury/compiler/goal_path.m 2001/04/03 03:19:35 1.13
+++ mercury/compiler/goal_path.m 2001/04/04 15:34:39
@@ -90,9 +90,9 @@
fill_expr_slots(unify(A,B,C,D,E), _, _, _, unify(A,B,C,D,E)).
fill_expr_slots(foreign_proc(A,B,C,D,E,F,G), _, _, _,
foreign_proc(A,B,C,D,E,F,G)).
-fill_expr_slots(bi_implication(_, _), _, _, _, _) :-
+fill_expr_slots(shorthand(_), _, _, _, _) :-
% these should have been expanded out by now
- error("fill_expr_slots: unexpected bi_implication").
+ error("fill_expr_slots: unexpected shorthand").
:- pred fill_conj_slots(list(hlds_goal)::in, goal_path::in, int::in,
slot_info::in, list(hlds_goal)::out) is det.
Index: mercury/compiler/goal_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/goal_util.m,v
retrieving revision 1.68
diff -u -d -r1.68 goal_util.m
--- mercury/compiler/goal_util.m 2001/04/03 03:19:35 1.68
+++ mercury/compiler/goal_util.m 2001/04/04 15:35:36
@@ -377,7 +377,17 @@
foreign_proc(A,B,C,Vars,E,F,G)) :-
goal_util__rename_var_list(Vars0, Must, Subn, Vars).
-goal_util__name_apart_2(bi_implication(LHS0, RHS0), Must, Subn,
+goal_util__name_apart_2(shorthand(ShorthandGoal0), Must, Subn,
+ shorthand(ShrothandGoal)) :-
+ goal_util__name_apart_2_shorthand(ShorthandGoal0, Must, Subn,
+ ShrothandGoal).
+
+
+:- pred goal_util__name_apart_2_shorthand(shorthand_goal_expr, bool,
+ map(prog_var, prog_var), shorthand_goal_expr).
+:- mode goal_util__name_apart_2_shorthand(in, in, in, out) is det.
+
+goal_util__name_apart_2_shorthand(bi_implication(LHS0, RHS0), Must, Subn,
bi_implication(LHS, RHS)) :-
goal_util__rename_vars_in_goal(LHS0, Must, Subn, LHS),
goal_util__rename_vars_in_goal(RHS0, Must, Subn, RHS).
@@ -614,10 +624,21 @@
Set0, Set) :-
set__insert_list(Set0, ArgVars, Set).
-goal_util__goal_vars_2(bi_implication(LHS - _, RHS - _), Set0, Set) :-
+goal_util__goal_vars_2(shorthand(ShorthandGoal), Set0, Set) :-
+ goal_util__goal_vars_2_shorthand(ShorthandGoal, Set0, Set).
+
+
+:- pred goal_util__goal_vars_2_shorthand(shorthand_goal_expr, set(prog_var),
+ set(prog_var)).
+:- mode goal_util__goal_vars_2_shorthand(in, in, out) is det.
+
+goal_util__goal_vars_2_shorthand(bi_implication(LHS - _, RHS - _), Set0,
+ Set) :-
goal_util__goal_vars_2(LHS, Set0, Set1),
goal_util__goal_vars_2(RHS, Set1, Set).
+
+
goal_util__goals_goal_vars([], Set, Set).
goal_util__goals_goal_vars([Goal - _ | Goals], Set0, Set) :-
goal_util__goal_vars_2(Goal, Set0, Set1),
@@ -755,7 +776,13 @@
goal_expr_size(generic_call(_, _, _, _), 1).
goal_expr_size(unify(_, _, _, _, _), 1).
goal_expr_size(foreign_proc(_, _, _, _, _, _, _), 1).
-goal_expr_size(bi_implication(LHS, RHS), Size) :-
+goal_expr_size(shorthand(ShorthandGoal), Size) :-
+ goal_expr_size_shorthand(ShorthandGoal, Size).
+
+:- pred goal_expr_size_shorthand(shorthand_goal_expr, int).
+:- mode goal_expr_size_shorthand(in, out) is det.
+
+goal_expr_size_shorthand(bi_implication(LHS, RHS), Size) :-
goal_size(LHS, Size1),
goal_size(RHS, Size2),
Size is Size1 + Size2 + 1.
Index: mercury/compiler/higher_order.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/higher_order.m,v
retrieving revision 1.84
diff -u -d -r1.84 higher_order.m
--- mercury/compiler/higher_order.m 2001/04/03 03:19:36 1.84
+++ mercury/compiler/higher_order.m 2001/04/04 15:11:21
@@ -506,9 +506,9 @@
{ Goal = unify(_, _, _, Unify, _) - _ },
check_unify(Unify).
-traverse_goal_2(bi_implication(_, _) - _, _) -->
+traverse_goal_2(shorthand(_) - _, _) -->
% these should have been expanded out by now
- { error("traverse_goal_2: unexpected bi_implication") }.
+ { error("traverse_goal_2: unexpected shorthand") }.
% To process a disjunction, we process each disjunct with the
% specialization information before the goal, then merge the
Index: mercury/compiler/hlds_goal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.86
diff -u -d -r1.86 hlds_goal.m
--- mercury/compiler/hlds_goal.m 2001/04/03 03:19:39 1.86
+++ mercury/compiler/hlds_goal.m 2001/04/04 15:23:31
@@ -191,23 +191,35 @@
% stored at the start of the parallel
% conjunction.
- % bi-implication (A <=> B)
+ % shorthand goals
%
- % These get eliminated by quantification.m,
- % so most passes of the compiler will just call error/1
- % if they occur.
+ % All shorthand goals are eliminated during or shortly after
+ % the construction of the hlds, so most passes of the compiler
+ % will just call error/1 if they occur.
+ ; shorthand(
+ shorthand_goal_expr
+ )
+ .
+
+
+
+ % Instances of these `shorthand' goals are implemented by a
+ % hlds --> hlds transformation that replaces them with
+ % equivalent non-shorthand goals.
+:- type shorthand_goal_expr
+ % bi-implication (A <=> B)
%
% Note that ordinary implications (A => B)
% and reverse implications (A <= B) are expanded
% out before we construct the HLDS. But we can't
% do that for bi-implications, because if expansion
% of bi-implications is done before implicit quantification,
- % then the quantification would be wrong.
-
- ; bi_implication(hlds_goal, hlds_goal)
-
+ % then the quantification would be wrong
+ ---> bi_implication(hlds_goal, hlds_goal)
.
+
+
%-----------------------------------------------------------------------------%
%
% Information for generic_calls
@@ -548,6 +560,8 @@
% Each pair represents the insts
% of the LHS and the RHS respectively
+
+
%-----------------------------------------------------------------------------%
%
% Information for all kinds of goals
@@ -1525,16 +1539,26 @@
GoalExpr = par_conj(Goals, _),
HasForeign = goal_list_has_foreign(Goals)
;
- GoalExpr = bi_implication(Goal2, Goal3),
- HasForeign =
- ( goal_has_foreign(Goal2) = yes
- -> yes
- ; goal_has_foreign(Goal3) = yes
- -> yes
- ; no
- )
+ GoalExpr = shorthand(ShorthandGoal),
+ HasForeign = goal_has_foreign_shorthand(ShorthandGoal)
+ ).
+
+
+ % Return yes if the shorthand goal contains any foreign code
+:- func goal_has_foreign_shorthand(shorthand_goal_expr) = bool.
+:- mode goal_has_foreign_shorthand(in) = out is det.
+
+goal_has_foreign_shorthand(bi_implication(Goal2, Goal3)) = HasForeign :-
+ HasForeign =
+ ( goal_has_foreign(Goal2) = yes
+ -> yes
+ ; goal_has_foreign(Goal3) = yes
+ -> yes
+ ; no
).
+
+
goal_list_has_foreign([]) = no.
goal_list_has_foreign([X | Xs]) =
( goal_has_foreign(X) = yes
@@ -1646,11 +1670,20 @@
Goal = unify(_, _, _, _, _).
set_goal_contexts_2(_, Goal, Goal) :-
Goal = foreign_proc(_, _, _, _, _, _, _).
-set_goal_contexts_2(Context, bi_implication(LHS0, RHS0),
+set_goal_contexts_2(Context, shorthand(ShorthandGoal0),
+ shorthand(ShorthandGoal)) :-
+ set_goal_contexts_2_shorthand(Context, ShorthandGoal0,
+ ShorthandGoal).
+
+:- pred set_goal_contexts_2_shorthand(prog_context, shorthand_goal_expr,
+ shorthand_goal_expr).
+:- mode set_goal_contexts_2_shorthand(in, in, out) is det.
+
+set_goal_contexts_2_shorthand(Context, bi_implication(LHS0, RHS0),
bi_implication(LHS, RHS)) :-
set_goal_contexts(Context, LHS0, LHS),
set_goal_contexts(Context, RHS0, RHS).
-
+
%-----------------------------------------------------------------------------%
create_atomic_unification(A, B, Context, UnifyMainContext, UnifySubContext,
Index: mercury/compiler/hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.257
diff -u -d -r1.257 hlds_out.m
--- mercury/compiler/hlds_out.m 2001/04/03 03:19:40 1.257
+++ mercury/compiler/hlds_out.m 2001/04/04 15:11:22
@@ -1621,8 +1621,19 @@
io__write_string(")"),
io__write_string(Follow).
-hlds_out__write_goal_2(bi_implication(LHS, RHS), ModuleInfo, VarSet,
+hlds_out__write_goal_2(shorthand(ShortHandGoal), ModuleInfo, VarSet,
AppendVarnums, Indent, Follow, TypeQual) -->
+ hlds_out__write_goal_2_shorthand(ShortHandGoal, ModuleInfo,
+ VarSet, AppendVarnums, Indent, Follow, TypeQual).
+
+
+:- pred hlds_out__write_goal_2_shorthand(shorthand_goal_expr, module_info,
+ prog_varset, bool, int, string, maybe_vartypes, io__state, io__state).
+:- mode hlds_out__write_goal_2_shorthand(in, in, in, in, in, in, in, di, uo)
+ is det.
+
+hlds_out__write_goal_2_shorthand(bi_implication(LHS, RHS), ModuleInfo,
+ VarSet, AppendVarnums, Indent, Follow, TypeQual) -->
hlds_out__write_indent(Indent),
io__write_string("( % bi-implication\n"),
{ Indent1 is Indent + 1 },
@@ -1635,6 +1646,8 @@
hlds_out__write_indent(Indent),
io__write_string(")"),
io__write_string(Follow).
+
+
:- pred hlds_out__write_varnum_list(list(prog_var), io__state, io__state).
:- mode hlds_out__write_varnum_list(in, di, uo) is det.
Index: mercury/compiler/inlining.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/inlining.m,v
retrieving revision 1.99
diff -u -d -r1.99 inlining.m
--- mercury/compiler/inlining.m 2001/04/03 03:19:43 1.99
+++ mercury/compiler/inlining.m 2001/04/04 15:11:23
@@ -634,9 +634,9 @@
foreign_proc(A, B, C, D, E, F, G) - GoalInfo,
foreign_proc(A, B, C, D, E, F, G) - GoalInfo) --> [].
-inlining__inlining_in_goal(bi_implication(_, _) - _, _) -->
+inlining__inlining_in_goal(shorthand(_) - _, _) -->
% these should have been expanded out by now
- { error("inlining__inlining_in_goal: unexpected bi_implication") }.
+ { error("inlining__inlining_in_goal: unexpected shorthand") }.
%-----------------------------------------------------------------------------%
Index: mercury/compiler/intermod.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.96
diff -u -d -r1.96 intermod.m
--- mercury/compiler/intermod.m 2001/04/03 03:19:44 1.96
+++ mercury/compiler/intermod.m 2001/04/04 15:11:24
@@ -506,9 +506,9 @@
intermod__traverse_goal(foreign_proc(A,B,C,D,E,F,G) - Info,
foreign_proc(A,B,C,D,E,F,G) - Info, yes) --> [].
-intermod__traverse_goal(bi_implication(_, _) - _, _, _) -->
+intermod__traverse_goal(shorthand(_) - _, _, _) -->
% these should have been expanded out by now
- { error("intermod__traverse_goal: unexpected bi_implication") }.
+ { error("intermod__traverse_goal: unexpected shorthand") }.
:- pred intermod__traverse_list_of_goals(hlds_goals::in, hlds_goals::out,
Index: mercury/compiler/lambda.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/lambda.m,v
retrieving revision 1.72
diff -u -d -r1.72 lambda.m
--- mercury/compiler/lambda.m 2001/04/03 03:19:46 1.72
+++ mercury/compiler/lambda.m 2001/04/04 15:11:24
@@ -279,9 +279,9 @@
lambda__process_goal_2(foreign_proc(A,B,C,D,E,F,G), GoalInfo,
foreign_proc(A,B,C,D,E,F,G) - GoalInfo) -->
[].
-lambda__process_goal_2(bi_implication(_, _), _, _) -->
+lambda__process_goal_2(shorthand(_), _, _) -->
% these should have been expanded out by now
- { error("lambda__process_goal_2: unexpected bi_implication") }.
+ { error("lambda__process_goal_2: unexpected shorthand") }.
:- pred lambda__process_goal_list(list(hlds_goal), list(hlds_goal),
lambda_info, lambda_info).
Index: mercury/compiler/lco.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/lco.m,v
retrieving revision 1.16
diff -u -d -r1.16 lco.m
--- mercury/compiler/lco.m 2001/04/03 03:19:46 1.16
+++ mercury/compiler/lco.m 2001/04/04 15:11:25
@@ -94,9 +94,9 @@
lco_in_goal_2(foreign_proc(A,B,C,D,E,F,G), _,
foreign_proc(A,B,C,D,E,F,G)).
-lco_in_goal_2(bi_implication(_, _), _, _) :-
+lco_in_goal_2(shorthand(_), _, _) :-
% these should have been expanded out by now
- error("lco_in_goal_2: unexpected bi_implication").
+ error("lco_in_goal_2: unexpected shorthand").
%-----------------------------------------------------------------------------%
Index: mercury/compiler/live_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/live_vars.m,v
retrieving revision 1.97
diff -u -d -r1.97 live_vars.m
--- mercury/compiler/live_vars.m 2001/04/03 03:19:47 1.97
+++ mercury/compiler/live_vars.m 2001/04/04 15:11:25
@@ -381,10 +381,10 @@
NondetLiveness, LiveSets)
).
-build_live_sets_in_goal_2(bi_implication(_, _), _, _, _, _, _, _, _, _, _)
+build_live_sets_in_goal_2(shorthand(_), _, _, _, _, _, _, _, _, _)
:-
% these should have been expanded out by now
- error("build_live_sets_in_goal_2: unexpected bi_implication").
+ error("build_live_sets_in_goal_2: unexpected shorthand").
%-----------------------------------------------------------------------------%
Index: mercury/compiler/liveness.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/liveness.m,v
retrieving revision 1.117
diff -u -d -r1.117 liveness.m
--- mercury/compiler/liveness.m 2001/04/03 03:19:48 1.117
+++ mercury/compiler/liveness.m 2001/04/04 15:11:25
@@ -400,8 +400,8 @@
_, _, _, _, _) :-
error("foreign_proc in detect_liveness_in_goal_2").
-detect_liveness_in_goal_2(bi_implication(_, _), _, _, _, _, _) :-
- error("bi_implication in detect_liveness_in_goal_2").
+detect_liveness_in_goal_2(shorthand(_), _, _, _, _, _) :-
+ error("shorthand in detect_liveness_in_goal_2").
%-----------------------------------------------------------------------------%
@@ -638,8 +638,8 @@
_, _, _, _, _, _) :-
error("foreign_proc in detect_deadness_in_goal_2").
-detect_deadness_in_goal_2(bi_implication(_, _), _, _, _, _, _, _) :-
- error("bi_implication in detect_deadness_in_goal_2").
+detect_deadness_in_goal_2(shorthand(_), _, _, _, _, _, _) :-
+ error("shorthand in detect_deadness_in_goal_2").
%-----------------------------------------------------------------------------%
@@ -886,8 +886,8 @@
update_liveness_goal(Goal, LiveInfo, Liveness0, Liveness).
update_liveness_expr(some(_, _, Goal), _, LiveInfo, Liveness0, Liveness) :-
update_liveness_goal(Goal, LiveInfo, Liveness0, Liveness).
-update_liveness_expr(bi_implication(_, _), _, _, _, _) :-
- error("update_liveness_expr: bi_implication").
+update_liveness_expr(shorthand(_), _, _, _, _) :-
+ error("update_liveness_expr: shorthand").
:- pred update_liveness_conj(list(hlds_goal)::in, live_info::in,
set(prog_var)::in, set(prog_var)::out) is det.
@@ -1096,8 +1096,8 @@
GoalInfo = GoalInfo0,
BornVars = BornVars0
;
- GoalExpr0 = bi_implication(_, _),
- error("delay_death_goal_expr: bi_implication")
+ GoalExpr0 = shorthand(_),
+ error("delay_death_goal_expr: shorthand")
).
:- pred delay_death_conj(list(hlds_goal)::in,
@@ -1344,9 +1344,9 @@
detect_resume_points_in_goal_2(foreign_proc(A,B,C,D,E,F,G), _,
Liveness, _, _, foreign_proc(A,B,C,D,E,F,G), Liveness).
-detect_resume_points_in_goal_2(bi_implication(_, _), _, _, _, _, _, _) :-
+detect_resume_points_in_goal_2(shorthand(_), _, _, _, _, _, _) :-
% these should have been expanded out by now
- error("detect_resume_points_in_goal_2: unexpected bi_implication").
+ error("detect_resume_points_in_goal_2: unexpected shorthand").
:- pred detect_resume_points_in_conj(list(hlds_goal)::in, set(prog_var)::in,
live_info::in, set(prog_var)::in,
Index: mercury/compiler/magic.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/magic.m,v
retrieving revision 1.26
diff -u -d -r1.26 magic.m
--- mercury/compiler/magic.m 2001/04/03 03:19:52 1.26
+++ mercury/compiler/magic.m 2001/04/04 15:11:27
@@ -1609,9 +1609,9 @@
{ HOMap = HOMap0 }
).
-magic__preprocess_goal_2(bi_implication(_, _) - _, _, _, _) -->
+magic__preprocess_goal_2(shorthand(_) - _, _, _, _) -->
% these should have been expanded out by now
- { error("magic__preprocess_goal_2: unexpected bi_implication") }.
+ { error("magic__preprocess_goal_2: unexpected shorthand") }.
% Introduce new variables and assignments to them for any
% duplicates in the list.
Index: mercury/compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.367
diff -u -d -r1.367 make_hlds.m
--- mercury/compiler/make_hlds.m 2001/04/03 03:19:52 1.367
+++ mercury/compiler/make_hlds.m 2001/04/04 15:11:27
@@ -4574,11 +4574,23 @@
warn_singletons_in_pragma_foreign_code(PragmaImpl, Lang,
ArgInfo, Context, PredCallId, MI).
-warn_singletons_in_goal_2(bi_implication(LHS, RHS), _GoalInfo, QuantVars,
+warn_singletons_in_goal_2(shorthand(ShorthandGoal), GoalInfo, QuantVars,
VarSet, PredCallId, MI) -->
+ warn_singletons_in_goal_2_shorthand(ShorthandGoal, GoalInfo,
+ QuantVars, VarSet, PredCallId, MI).
+
+
+:- pred warn_singletons_in_goal_2_shorthand(shorthand_goal_expr,
+ hlds_goal_info, set(prog_var), prog_varset, simple_call_id,
+ module_info, io__state, io__state).
+:- mode warn_singletons_in_goal_2_shorthand(in, in, in, in, in, in, di, uo)
+ is det.
+
+warn_singletons_in_goal_2_shorthand(bi_implication(LHS, RHS), _GoalInfo,
+ QuantVars, VarSet, PredCallId, MI) -->
warn_singletons_in_goal_list([LHS, RHS], QuantVars, VarSet,
PredCallId, MI).
-
+
:- pred warn_singletons_in_goal_list(list(hlds_goal), set(prog_var),
prog_varset, simple_call_id, module_info,
@@ -5314,7 +5326,7 @@
{ goal_info_init(GoalInfo) },
transform_goal(P0, VarSet0, Subst, P, VarSet1, Info0, Info1),
transform_goal(Q0, VarSet1, Subst, Q, VarSet, Info1, Info),
- { Goal = bi_implication(P, Q) - GoalInfo }.
+ { Goal = shorthand(bi_implication(P, Q)) - GoalInfo }.
transform_goal_2(call(Name, Args0, Purity), Context, VarSet0, Subst, Goal,
VarSet, Info0, Info) -->
Index: mercury/compiler/mark_static_terms.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mark_static_terms.m,v
retrieving revision 1.6
diff -u -d -r1.6 mark_static_terms.m
--- mercury/compiler/mark_static_terms.m 2001/04/03 03:19:56 1.6
+++ mercury/compiler/mark_static_terms.m 2001/04/04 15:11:27
@@ -106,9 +106,9 @@
goal_expr_mark_static_terms(foreign_proc(A,B,C,D,E,F,G),
foreign_proc(A,B,C,D,E,F,G), SI, SI).
-goal_expr_mark_static_terms(bi_implication(_, _), _, _, _) :-
+goal_expr_mark_static_terms(shorthand(_), _, _, _) :-
% these should have been expanded out by now
- error("fill_expr_slots: unexpected bi_implication").
+ error("fill_expr_slots: unexpected shorthand").
:- pred conj_mark_static_terms(hlds_goals::in, hlds_goals::out,
static_info::in, static_info::out) is det.
Index: mercury/compiler/ml_code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.79
diff -u -d -r1.79 ml_code_gen.m
--- mercury/compiler/ml_code_gen.m 2001/04/03 03:19:59 1.79
+++ mercury/compiler/ml_code_gen.m 2001/04/04 15:11:29
@@ -2039,9 +2039,9 @@
C_Code, OuterContext, MLDS_Decls, MLDS_Statements)
).
-ml_gen_goal_expr(bi_implication(_, _), _, _, _, _) -->
+ml_gen_goal_expr(shorthand(_), _, _, _, _) -->
% these should have been expanded out by now
- { error("ml_gen_goal_expr: unexpected bi_implication") }.
+ { error("ml_gen_goal_expr: unexpected shorthand") }.
:- pred ml_gen_nondet_pragma_c_code(code_model, pragma_foreign_proc_attributes,
pred_id, proc_id, list(prog_var),
Index: mercury/compiler/mode_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mode_util.m,v
retrieving revision 1.135
diff -u -d -r1.135 mode_util.m
--- mercury/compiler/mode_util.m 2001/04/03 03:20:01 1.135
+++ mercury/compiler/mode_util.m 2001/04/04 15:11:30
@@ -1399,9 +1399,9 @@
recompute_instmap_delta_call(PredId, ProcId,
Args, VarTypes, InstMap, InstMapDelta).
-recompute_instmap_delta_2(_, bi_implication(_, _), _, _, _, _, _) -->
+recompute_instmap_delta_2(_, shorthand(_), _, _, _, _, _) -->
% these should have been expanded out by now
- { error("recompute_instmap_delta_2: unexpected bi_implication") }.
+ { error("recompute_instmap_delta_2: unexpected shorthand") }.
%-----------------------------------------------------------------------------%
Index: mercury/compiler/modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.252
diff -u -d -r1.252 modes.m
--- mercury/compiler/modes.m 2001/04/03 03:20:04 1.252
+++ mercury/compiler/modes.m 2001/04/04 15:11:31
@@ -1291,9 +1291,9 @@
mode_info_unset_call_context,
mode_checkpoint(exit, "pragma_foreign_code").
-modecheck_goal_expr(bi_implication(_, _), _, _) -->
+modecheck_goal_expr(shorthand(_), _, _) -->
% these should have been expanded out by now
- { error("modecheck_goal_expr: unexpected bi_implication") }.
+ { error("modecheck_goal_expr: unexpected shorthand") }.
append_extra_goals(no_extra_goals, ExtraGoals, ExtraGoals).
append_extra_goals(extra_goals(BeforeGoals, AfterGoals),
Index: mercury/compiler/pd_cost.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pd_cost.m,v
retrieving revision 1.11
diff -u -d -r1.11 pd_cost.m
--- mercury/compiler/pd_cost.m 2001/04/03 03:20:10 1.11
+++ mercury/compiler/pd_cost.m 2001/04/04 15:11:32
@@ -104,9 +104,9 @@
pd_cost__reg_assign(AssignCost),
Cost is Cost1 + Cost2 + AssignCost * InputArgs.
-pd_cost__goal(bi_implication(_, _) - _, _) :-
+pd_cost__goal(shorthand(_) - _, _) :-
% these should have been expanded out by now
- error("pd_cost__goal: unexpected bi_implication").
+ error("pd_cost__goal: unexpected shorthand").
:- pred pd_cost__unify(set(prog_var)::in, unification::in, int::out) is det.
Index: mercury/compiler/polymorphism.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/polymorphism.m,v
retrieving revision 1.207
diff -u -d -r1.207 polymorphism.m
--- mercury/compiler/polymorphism.m 2001/04/03 03:20:11 1.207
+++ mercury/compiler/polymorphism.m 2001/04/04 15:11:33
@@ -1156,9 +1156,9 @@
polymorphism__process_goal(A0, A),
polymorphism__process_goal(B0, B),
polymorphism__process_goal(C0, C).
-polymorphism__process_goal_expr(bi_implication(_, _), _, _) -->
+polymorphism__process_goal_expr(shorthand(_), _, _) -->
% these should have been expanded out by now
- { error("polymorphism__process_goal_expr: unexpected bi_implication") }.
+ { error("polymorphism__process_goal_expr: unexpected shorthand") }.
% type_info_vars prepends a comma seperated list of variables
Index: mercury/compiler/prog_rep.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_rep.m,v
retrieving revision 1.6
diff -u -d -r1.6 prog_rep.m
--- mercury/compiler/prog_rep.m 2001/04/03 03:20:17 1.6
+++ mercury/compiler/prog_rep.m 2001/04/04 15:11:35
@@ -210,9 +210,9 @@
DetismRep, FilenameRep, LinenoRep, ChangedVarsRep),
Rep = atomic_goal_rep(DetismRep, FilenameRep, LinenoRep,
ChangedVarsRep, AtomicGoalRep).
-prog_rep__represent_goal_expr(bi_implication(_, _), _, _, _, _) :-
+prog_rep__represent_goal_expr(shorthand(_), _, _, _, _) :-
% these should have been expanded out by now
- error("prog_rep__represent_goal: unexpected bi_implication").
+ error("prog_rep__represent_goal: unexpected shorthand").
%---------------------------------------------------------------------------%
Index: mercury/compiler/purity.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/purity.m,v
retrieving revision 1.30
diff -u -d -r1.30 purity.m
--- mercury/compiler/purity.m 2001/04/03 03:20:17 1.30
+++ mercury/compiler/purity.m 2001/04/04 15:11:35
@@ -750,9 +750,9 @@
{ module_info_preds(ModuleInfo, Preds) },
{ map__lookup(Preds, PredId, CalledPredInfo) },
{ pred_info_get_purity(CalledPredInfo, Purity) }.
-compute_expr_purity(bi_implication(_, _), _, _, _, _) -->
+compute_expr_purity(shorthand(_), _, _, _, _) -->
% these should have been expanded out by now
- { error("compute_expr_purity: unexpected bi_implication") }.
+ { error("compute_expr_purity: unexpected shorthand") }.
:- pred check_higher_order_purity(hlds_goal_info, cons_id, prog_var,
Index: mercury/compiler/quantification.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/quantification.m,v
retrieving revision 1.79
diff -u -d -r1.79 quantification.m
--- mercury/compiler/quantification.m 2001/04/03 03:20:18 1.79
+++ mercury/compiler/quantification.m 2001/04/04 15:11:36
@@ -478,8 +478,18 @@
foreign_proc(A,B,C,Vars,E,F,G)) -->
implicitly_quantify_atomic_goal(Vars).
-implicitly_quantify_goal_2(bi_implication(LHS0, RHS0), Context, Goal) -->
+implicitly_quantify_goal_2(shorthand(ShorthandGoal), Context, Goal) -->
+ implicitly_quantify_goal_2_shorthand(ShorthandGoal,
+ Context, Goal).
+
+:- pred implicitly_quantify_goal_2_shorthand(shorthand_goal_expr::in,
+ prog_context::in, hlds_goal_expr::out,
+ quant_info::in, quant_info::out) is det.
+
+implicitly_quantify_goal_2_shorthand(bi_implication(LHS0, RHS0),
+ Context, Goal) -->
+
% get the initial values of various settings
quantification__get_quant_vars(QuantVars0),
quantification__get_outside(OutsideVars0),
@@ -570,6 +580,8 @@
{ Goal = conj([ForwardsImplication, ReverseImplication]) }.
+
+
:- pred implicitly_quantify_atomic_goal(list(prog_var), quant_info, quant_info).
:- mode implicitly_quantify_atomic_goal(in, in, out) is det.
@@ -989,10 +1001,24 @@
Set0, LambdaSet, Set, LambdaSet) :-
insert_list(Set0, ArgVars, Set).
-quantification__goal_vars_2(NonLocalsToRecompute, bi_implication(LHS, RHS),
+quantification__goal_vars_2(NonLocalsToRecompute, shorthand(ShorthandGoal),
Set0, LambdaSet0, Set, LambdaSet) :-
+ quantification__goal_vars_2_shorthand(NonLocalsToRecompute,
+ ShorthandGoal, Set0, LambdaSet0, Set, LambdaSet).
+
+
+:- pred quantification__goal_vars_2_shorthand(nonlocals_to_recompute,
+ shorthand_goal_expr, set_of_var, set_of_var, set_of_var,
+ set_of_var).
+:- mode quantification__goal_vars_2_shorthand(in, in, in, in, out, out)
+ is det.
+
+quantification__goal_vars_2_shorthand(NonLocalsToRecompute,
+ bi_implication(LHS, RHS), Set0, LambdaSet0, Set,
+ LambdaSet) :-
goal_list_vars_2(NonLocalsToRecompute, [LHS, RHS],
Set0, LambdaSet0, Set, LambdaSet).
+
:- pred quantification__unify_rhs_vars(nonlocals_to_recompute,
unify_rhs, maybe(cell_to_reuse), set_of_var, set_of_var,
Index: mercury/compiler/rl_exprn.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_exprn.m,v
retrieving revision 1.19
diff -u -d -r1.19 rl_exprn.m
--- mercury/compiler/rl_exprn.m 2001/04/03 03:20:19 1.19
+++ mercury/compiler/rl_exprn.m 2001/04/04 15:11:36
@@ -857,9 +857,9 @@
{ error("rl_exprn__goal: foreign_proc not yet implemented") }.
rl_exprn__goal(some(_, _, Goal) - _, Fail, Code) -->
rl_exprn__goal(Goal, Fail, Code).
-rl_exprn__goal(bi_implication(_, _) - _, _, _) -->
+rl_exprn__goal(shorthand(_) - _, _, _) -->
% these should have been expanded out by now
- { error("rl_exprn__goal: unexpected bi_implication") }.
+ { error("rl_exprn__goal: unexpected shorthand") }.
:- pred rl_exprn__cases(prog_var::in, list(case)::in, byte_tree::in,
byte_tree::in, byte_tree::out,
Index: mercury/compiler/saved_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/saved_vars.m,v
retrieving revision 1.30
diff -u -d -r1.30 saved_vars.m
--- mercury/compiler/saved_vars.m 2001/04/03 03:20:20 1.30
+++ mercury/compiler/saved_vars.m 2001/04/04 15:11:37
@@ -137,9 +137,9 @@
Goal = GoalExpr0 - GoalInfo0,
SlotInfo = SlotInfo0
;
- GoalExpr0 = bi_implication(_, _),
+ GoalExpr0 = shorthand(_),
% these should have been expanded out by now
- error("saved_vars_in_goal: unexpected bi_implication")
+ error("saved_vars_in_goal: unexpected shorthand")
).
%-----------------------------------------------------------------------------%
@@ -376,9 +376,9 @@
IsNonLocal, SlotInfo3, Goals1, SlotInfo),
Goals = [Goal1 | Goals1]
;
- Goal0Expr = bi_implication(_, _),
+ Goal0Expr = shorthand(_),
% these should have been expanded out by now
- error("saved_vars_delay_goal: unexpected bi_implication")
+ error("saved_vars_delay_goal: unexpected shorthand")
)
;
saved_vars_delay_goal(Goals0, Construct, Var, IsNonLocal,
Index: mercury/compiler/simplify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.95
diff -u -d -r1.95 simplify.m
--- mercury/compiler/simplify.m 2001/04/03 03:20:21 1.95
+++ mercury/compiler/simplify.m 2001/04/04 15:11:38
@@ -1157,9 +1157,9 @@
Goal = Goal0
).
-simplify__goal_2(bi_implication(_, _), _, _, _, _, _) :-
+simplify__goal_2(shorthand(_), _, _, _, _, _) :-
% these should have been expanded out by now
- error("simplify__goal_2: unexpected bi_implication").
+ error("simplify__goal_2: unexpected shorthand").
%-----------------------------------------------------------------------------%
Index: mercury/compiler/store_alloc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/store_alloc.m,v
retrieving revision 1.76
diff -u -d -r1.76 store_alloc.m
--- mercury/compiler/store_alloc.m 2001/04/03 03:20:22 1.76
+++ mercury/compiler/store_alloc.m 2001/04/04 15:11:38
@@ -210,9 +210,9 @@
store_alloc_in_goal_2(foreign_proc(A, B, C, D, E, F, G), Liveness,
_, _, _, foreign_proc(A, B, C, D, E, F, G), Liveness).
-store_alloc_in_goal_2(bi_implication(_, _), _, _, _, _, _, _) :-
+store_alloc_in_goal_2(shorthand(_), _, _, _, _, _, _) :-
% these should have been expanded out by now
- error("store_alloc_in_goal_2: unexpected bi_implication").
+ error("store_alloc_in_goal_2: unexpected shorthand").
%-----------------------------------------------------------------------------%
Index: mercury/compiler/stratify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stratify.m,v
retrieving revision 1.24
diff -u -d -r1.24 stratify.m
--- mercury/compiler/stratify.m 2001/04/03 03:20:23 1.24
+++ mercury/compiler/stratify.m 2001/04/04 15:11:39
@@ -213,9 +213,9 @@
first_order_check_goal(generic_call(_Var, _Vars, _Modes, _Det),
_GInfo, _Negated, _WholeScc, _ThisPredProcId,
_Error, Module, Module) --> [].
-first_order_check_goal(bi_implication(_, _), _, _, _, _, _, _, _) -->
+first_order_check_goal(shorthand(_), _, _, _, _, _, _, _) -->
% these should have been expanded out by now
- { error("first_order_check_goal: unexpected bi_implication") }.
+ { error("first_order_check_goal: unexpected shorthand") }.
:- pred first_order_check_goal_list(list(hlds_goal), bool,
list(pred_proc_id), pred_proc_id, bool, module_info,
@@ -381,9 +381,9 @@
;
{ Module = Module0 }
).
-higher_order_check_goal(bi_implication(_, _), _, _, _, _, _, _, _, _) -->
+higher_order_check_goal(shorthand(_), _, _, _, _, _, _, _, _) -->
% these should have been expanded out by now
- { error("higher_order_check_goal: unexpected bi_implication") }.
+ { error("higher_order_check_goal: unexpected shorthand") }.
:- pred higher_order_check_goal_list(list(hlds_goal), bool, set(pred_proc_id),
pred_proc_id, bool, bool, module_info, module_info,
@@ -825,9 +825,9 @@
check_goal1(foreign_proc(_Attrib, _CPred, _CProc, _, _, _, _),
Calls, Calls, HasAT, HasAT, CallsHO, CallsHO).
-check_goal1(bi_implication(_, _), _, _, _, _, _, _) :-
+check_goal1(shorthand(_), _, _, _, _, _, _) :-
% these should have been expanded out by now
- error("check_goal1: unexpected bi_implication").
+ error("check_goal1: unexpected shorthand").
:- pred check_goal_list(list(hlds_goal), set(pred_proc_id), set(pred_proc_id),
set(pred_proc_id), set(pred_proc_id), bool, bool).
@@ -915,9 +915,9 @@
get_called_procs(Goal, Calls0, Calls).
get_called_procs(foreign_proc(_Attrib, _CPred, _CProc,
_, _, _, _), Calls, Calls).
-get_called_procs(bi_implication(_, _), _, _) :-
+get_called_procs(shorthand(_), _, _) :-
% these should have been expanded out by now
- error("get_called_procs: unexpected bi_implication").
+ error("get_called_procs: unexpected shorthand").
:- pred check_goal_list(list(hlds_goal), list(pred_proc_id),
list(pred_proc_id)).
Index: mercury/compiler/switch_detection.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/switch_detection.m,v
retrieving revision 1.95
diff -u -d -r1.95 switch_detection.m
--- mercury/compiler/switch_detection.m 2001/04/03 03:20:24 1.95
+++ mercury/compiler/switch_detection.m 2001/04/04 15:42:24
@@ -216,9 +216,9 @@
detect_switches_in_goal_2(foreign_proc(A,B,C,D,E,F,G), _, _, _, _,
foreign_proc(A,B,C,D,E,F,G)).
-detect_switches_in_goal_2(bi_implication(_, _), _, _, _, _, _) :-
+detect_switches_in_goal_2(shorthand(_), _, _, _, _, _) :-
% these should have been expanded out by now
- error("detect_switches_in_goal_2: unexpected bi_implication").
+ error("detect_switches_in_goal_2: unexpected shorthand").
%-----------------------------------------------------------------------------%
Index: mercury/compiler/term_traversal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/term_traversal.m,v
retrieving revision 1.16
diff -u -d -r1.16 term_traversal.m
--- mercury/compiler/term_traversal.m 2001/04/03 03:20:26 1.16
+++ mercury/compiler/term_traversal.m 2001/04/04 15:11:40
@@ -288,9 +288,9 @@
Info = Info3
).
-traverse_goal_2(bi_implication(_, _), _, _, _, _) :-
+traverse_goal_2(shorthand(_), _, _, _, _) :-
% these should have been expanded out by now
- error("traverse_goal_2traverse_goal_2: unexpected bi_implication").
+ error("traverse_goal_2traverse_goal_2: unexpected shorthand").
%-----------------------------------------------------------------------------%
Index: mercury/compiler/typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.299
diff -u -d -r1.299 typecheck.m
--- mercury/compiler/typecheck.m 2001/04/03 03:20:28 1.299
+++ mercury/compiler/typecheck.m 2001/04/04 15:11:42
@@ -1087,7 +1087,17 @@
OrigTypeAssignSet) },
typecheck_call_pred_id(PredId, Args),
perform_context_reduction(OrigTypeAssignSet).
-typecheck_goal_2(bi_implication(LHS0, RHS0), bi_implication(LHS, RHS)) -->
+typecheck_goal_2(shorthand(ShorthandGoal0), shorthand(ShorthandGoal)) -->
+ typecheck_goal_2_shorthand(ShorthandGoal0, ShorthandGoal).
+
+
+:- pred typecheck_goal_2_shorthand(shorthand_goal_expr, shorthand_goal_expr,
+ typecheck_info, typecheck_info).
+:- mode typecheck_goal_2_shorthand(in, out, typecheck_info_di,
+ typecheck_info_uo) is det.
+
+typecheck_goal_2_shorthand(bi_implication(LHS0, RHS0),
+ bi_implication(LHS, RHS)) -->
checkpoint("<=>"),
typecheck_goal(LHS0, LHS),
typecheck_goal(RHS0, RHS).
Index: mercury/compiler/unique_modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unique_modes.m,v
retrieving revision 1.71
diff -u -d -r1.71 unique_modes.m
--- mercury/compiler/unique_modes.m 2001/04/03 03:20:32 1.71
+++ mercury/compiler/unique_modes.m 2001/04/04 15:11:43
@@ -521,9 +521,9 @@
mode_info_unset_call_context,
mode_checkpoint(exit, "foreign_proc").
-unique_modes__check_goal_2(bi_implication(_, _), _, _) -->
+unique_modes__check_goal_2(shorthand(_), _, _) -->
% these should have been expanded out by now
- { error("unique_modes__check_goal_2: unexpected bi_implication") }.
+ { error("unique_modes__check_goal_2: unexpected shorthand") }.
:- pred unique_modes__check_call(pred_id, proc_id, list(prog_var), proc_id,
mode_info, mode_info).
Index: mercury/compiler/unneeded_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unneeded_code.m,v
retrieving revision 1.8
diff -u -d -r1.8 unneeded_code.m
--- mercury/compiler/unneeded_code.m 2001/04/03 03:20:32 1.8
+++ mercury/compiler/unneeded_code.m 2001/04/04 15:11:43
@@ -707,8 +707,8 @@
GoalExpr = some(Vars, CanRemove, SomeGoal),
Goal = GoalExpr - GoalInfo0
;
- GoalExpr0 = bi_implication(_, _),
- error("bi-implication in unneeded_code__process_goal_internal")
+ GoalExpr0 = shorthand(_),
+ error("shorthand in unneeded_code__process_goal_internal")
).
%---------------------------------------------------------------------------%
@@ -1010,8 +1010,8 @@
GoalExpr = some(Vars, CanFail, SomeGoal),
Goal = GoalExpr - GoalInfo0
;
- GoalExpr0 = bi_implication(_, _),
- error("bi-implication in unneeded_code__refine_goal")
+ GoalExpr0 = shorthand(_),
+ error("shorthand in unneeded_code__refine_goal")
).
:- pred unneeded_code__refine_conj(list(hlds_goal)::in, refined_goal_map::in,
Index: mercury/compiler/unused_args.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.72
diff -u -d -r1.72 unused_args.m
--- mercury/compiler/unused_args.m 2001/04/03 03:20:33 1.72
+++ mercury/compiler/unused_args.m 2001/04/04 15:11:43
@@ -504,9 +504,9 @@
error("complicated unifications should only be var-var")
).
-traverse_goal(_, bi_implication(_, _), _, _) :-
+traverse_goal(_, shorthand(_), _, _) :-
% these should have been expanded out by now
- error("traverse_goal: unexpected bi_implication").
+ error("traverse_goal: unexpected shorthand").
% add PredProc - HeadVar as an alias for the same element of Args.
:- pred add_pred_call_arg_dep(pred_proc_id::in, list(prog_var)::in,
@@ -1277,9 +1277,9 @@
GoalExpr - GoalInfo, GoalExpr - GoalInfo) :-
GoalExpr = foreign_proc(_, _, _, _, _, _, _).
-fixup_goal_expr(_, _, _, _, bi_implication(_, _) - _, _) :-
+fixup_goal_expr(_, _, _, _, shorthand(_) - _, _) :-
% these should have been expanded out by now
- error("fixup_goal_expr: unexpected bi_implication").
+ error("fixup_goal_expr: unexpected shorthand").
% Remove useless unifications from a list of conjuncts.
:- pred fixup_conjuncts(module_info::in, list(prog_var)::in, proc_call_info::in,
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list