mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-13 12:53:53 +00:00
Miscellaneous small changes.
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
%-----------------------------------------------------------------------------%
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -521,7 +521,7 @@ inst_matches_final_3(any(UniqA), any(UniqB), _, _) :-
|
||||
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 @@ inst_matches_final_3(bound(UniqA, ListA), any(UniqB), ModuleInfo, _) :-
|
||||
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,
|
||||
|
||||
@@ -1125,10 +1125,11 @@ modecheck_conj_list(Goals0, Goals) -->
|
||||
{ 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 @@ modecheck_conj_list(Goals0, Goals) -->
|
||||
{ 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 @@ modecheck_conj_list(Goals0, Goals) -->
|
||||
% 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 @@ modecheck_conj_list(Goals0, Goals) -->
|
||||
% (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)
|
||||
;
|
||||
|
||||
@@ -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".
|
||||
|
||||
@@ -563,6 +563,14 @@ simplify__goal_2(Goal0, GoalInfo0, Goal, GoalInfo, Info0, Info) :-
|
||||
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)
|
||||
->
|
||||
|
||||
@@ -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.
|
||||
|
||||
%-----------------------------------------------------------------------------%
|
||||
|
||||
|
||||
Reference in New Issue
Block a user