for review: Miscellaneous small changes

Andrew Bromage bromage at cs.mu.OZ.AU
Wed Mar 18 18:23:01 AEDT 1998


Estimated hours taken: 1.5

Miscellaneous small changes.

compiler/modes.m:
	Fix a couple of mode errors which were caught by the new mode
	checker: use of clobbered mode_infos.

compiler/simplify.m:
	Optimise away unifications of the form X = X.  (These can be
	created by excess assignment elimination.)

compiler/follow_vars.m:
compiler/hlds_goal.m:
compiler/inst_match.m:
compiler/prog_data.m:
compiler/store_alloc.m:
	Minor documentation fixes.


Index: follow_vars.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/follow_vars.m,v
retrieving revision 1.48
diff -u -r1.48 follow_vars.m
--- follow_vars.m	1998/03/03 17:34:17	1.48
+++ follow_vars.m	1998/03/18 01:56:03
@@ -19,9 +19,9 @@
 % to reflect where variables should be to make the setting up of the arguments
 % of the call as efficient as possible.
 
-% See notes/ALLOCATION for a description of the framework that this pass
-% operates within, and for a description of which goals have their follow_vars
-% field filled in.
+% See compiler/notes/allocation.html for a description of the framework that
+% this pass operates within, and for a description of which goals have their
+% follow_vars field filled in.
 
 %-----------------------------------------------------------------------------%
 
Index: hlds_goal.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_goal.m,v
retrieving revision 1.49
diff -u -r1.49 hlds_goal.m
--- hlds_goal.m	1998/03/03 17:34:29	1.49
+++ hlds_goal.m	1998/03/18 01:56:12
@@ -378,7 +378,7 @@
 	    ;	(impure)	% This goal is impure.  See hlds_pred.m.
 	    ;	(semipure).	% This goal is semipure.  See hlds_pred.m.
 
-	% see notes/ALLOCATION for what these alternatives mean
+	% see compiler/notes/allocation.html for what these alternatives mean
 :- type resume_point	--->	resume_point(set(var), resume_locs)
 			;	no_resume_point.
 
Index: inst_match.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/inst_match.m,v
retrieving revision 1.41
diff -u -r1.41 inst_match.m
--- inst_match.m	1998/03/03 17:34:39	1.41
+++ inst_match.m	1998/03/18 02:42:46
@@ -521,7 +521,7 @@
 inst_matches_final_3(free, any(Uniq), _, _) :-
 	% We do not yet allow `free' to match `any',
 	% unless the `any' is `clobbered_any' or `mostly_clobbered_any'.
-	% Amoung other things, changing this would break compare_inst
+	% Among other things, changing this would break compare_inst
 	% in modecheck_call.m.
 	( Uniq = clobbered ; Uniq = mostly_clobbered ).
 inst_matches_final_3(free, free, _, _).
@@ -529,7 +529,7 @@
 	unique_matches_final(UniqA, UniqB),
 	bound_inst_list_matches_uniq(ListA, UniqB, ModuleInfo),
 	% We do not yet allow `free' to match `any'.
-	% Amoung other things, changing this would break compare_inst
+	% Among other things, changing this would break compare_inst
 	% in modecheck_call.m.
 	bound_inst_list_is_ground_or_any(ListA, ModuleInfo).
 inst_matches_final_3(bound(UniqA, ListA), bound(UniqB, ListB), ModuleInfo,
Index: modes.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/modes.m,v
retrieving revision 1.221
diff -u -r1.221 modes.m
--- modes.m	1998/03/03 17:35:23	1.221
+++ modes.m	1998/03/18 04:30:33
@@ -1125,10 +1125,11 @@
 	{ mode_info_get_errors(ModeInfo0, OldErrors) },
 	mode_info_set_errors([]),
 
-	{ mode_info_get_live_vars(ModeInfo0, LiveVars0) },
-	{ mode_info_get_delay_info(ModeInfo0, DelayInfo0) },
-	{ delay_info__enter_conj(DelayInfo0, DelayInfo1) },
-	mode_info_set_delay_info(DelayInfo1),
+	=(ModeInfo1),
+	{ mode_info_get_live_vars(ModeInfo1, LiveVars1) },
+	{ mode_info_get_delay_info(ModeInfo1, DelayInfo1) },
+	{ delay_info__enter_conj(DelayInfo1, DelayInfo2) },
+	mode_info_set_delay_info(DelayInfo2),
 	mode_info_add_goals_live_vars(Goals0),
 
 	modecheck_conj_list_2(Goals0, [], Goals, RevImpurityErrors),
@@ -1138,7 +1139,8 @@
 	{ list__append(OldErrors, NewErrors, Errors) },
 	mode_info_set_errors(Errors),
 
-	{ mode_info_get_delay_info(ModeInfo3, DelayInfo4) },
+	=(ModeInfo4),
+	{ mode_info_get_delay_info(ModeInfo4, DelayInfo4) },
 	{ delay_info__leave_conj(DelayInfo4, DelayedGoals, DelayInfo5) },
 	mode_info_set_delay_info(DelayInfo5),
 
@@ -1146,7 +1148,7 @@
 		% the variables in the delayed goals should not longer
 		% be considered live (the conjunction itself will
 		% delay, and its nonlocals will be made live)
-		mode_info_set_live_vars(LiveVars0)
+		mode_info_set_live_vars(LiveVars1)
 	;
 		[]
 	),
@@ -1157,10 +1159,10 @@
 		% (making sure we report the errors in the correct order)
 		%
 		{ list__reverse(RevImpurityErrors, ImpurityErrors) },
-		=(ModeInfo4),
-		{ mode_info_get_errors(ModeInfo4, Errors4) },
-		{ list__append(Errors4, ImpurityErrors, Errors5) },
-		mode_info_set_errors(Errors5)
+		=(ModeInfo5),
+		{ mode_info_get_errors(ModeInfo5, Errors5) },
+		{ list__append(Errors5, ImpurityErrors, Errors6) },
+		mode_info_set_errors(Errors6)
 	; { DelayedGoals = [delayed_goal(_DVars, Error, _DGoal)] } ->
 		mode_info_add_error(Error)
 	;
Index: prog_data.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/prog_data.m,v
retrieving revision 1.32
diff -u -r1.32 prog_data.m
--- prog_data.m	1998/03/03 17:35:40	1.32
+++ prog_data.m	1998/03/18 01:56:30
@@ -410,7 +410,7 @@
 
 	% Note: `is_live' records liveness in the sense used by
 	% mode analysis.  This is not the same thing as the notion of liveness
-	% used by code generation.  See compiler/notes/GLOSSARY.
+	% used by code generation.  See compiler/notes/glossary.html.
 :- type is_live		--->	live ; dead.
 
 	% Unifications of insts fall into two categories, "real" and "fake".
Index: simplify.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/simplify.m,v
retrieving revision 1.55
diff -u -r1.55 simplify.m
--- simplify.m	1998/03/03 17:35:58	1.55
+++ simplify.m	1998/03/18 03:31:21
@@ -563,6 +563,14 @@
 simplify__goal_2(Goal0, GoalInfo0, Goal, GoalInfo, Info0, Info) :-
 	Goal0 = unify(LT0, RT0, M, U0, C),
 	(
+		% A unification of the form X = X can safely be
+		% optimised away.
+
+		RT0 = var(LT0)
+	->
+		true_goal(Goal - GoalInfo),
+		Info = Info0
+	;
 		RT0 = lambda_goal(PredOrFunc, NonLocals, Vars, 
 			Modes, LambdaDeclaredDet, LambdaGoal0)
 	->
Index: store_alloc.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/store_alloc.m,v
retrieving revision 1.59
diff -u -r1.59 store_alloc.m
--- store_alloc.m	1998/02/12 01:17:46	1.59
+++ store_alloc.m	1998/03/18 01:56:43
@@ -17,8 +17,8 @@
 % If the appropriate option is set, the code calls the follow_vars module
 % to help guide its decisions.
 
-% See notes/ALLOCATION for a description of the framework that this pass
-% operates within.
+% See compiler/notes/allocation.html for a description of the framework that
+% this pass operates within.
 
 %-----------------------------------------------------------------------------%
 




More information about the developers mailing list