[m-rev.] diff: deforest.m cleanups

Zoltan Somogyi zs at csse.unimelb.edu.au
Mon Jul 31 13:59:27 AEST 2006


compiler/deforest.m:
	Minor style cleanups.

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/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/deforest.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/deforest.m,v
retrieving revision 1.66
diff -u -r1.66 deforest.m
--- compiler/deforest.m	27 Jul 2006 05:01:01 -0000	1.66
+++ compiler/deforest.m	27 Jul 2006 05:10:21 -0000
@@ -447,8 +447,8 @@
 
 propagate_conj_constraints([], _, RevGoals, Goals, !PDInfo, !IO) :-
     list.reverse(RevGoals, Goals).
-propagate_conj_constraints([Goal0 | Goals0],
-        NonLocals, RevGoals0, Goals, !PDInfo, !IO) :-
+propagate_conj_constraints([Goal0 | Goals0], NonLocals, RevGoals0, Goals,
+        !PDInfo, !IO) :-
     pd_info_get_module_info(!.PDInfo, ModuleInfo),
     (
         % constraint.m ensures that only constraints relevant
@@ -462,14 +462,14 @@
         ), Goals0, Constraints, Goals1),
         Constraints \= []
     ->
-        mdbcomp.prim_data.sym_name_to_string(SymName, SymNameString),
+        sym_name_to_string(SymName, SymNameString),
         pd_debug_message("propagating constraints into call to %s\n",
             [s(SymNameString)], !IO),
 
         get_sub_conj_nonlocals(NonLocals, RevGoals0, [],
             Goal0, Constraints, no, [], Goals1, ConjNonLocals),
-        call_call(ConjNonLocals, Goal0, Constraints, no,
-            MaybeGoal, !PDInfo, !IO),
+        call_call(ConjNonLocals, Goal0, Constraints, no, MaybeGoal,
+            !PDInfo, !IO),
         (
             MaybeGoal = yes(Goal),
             pd_info_set_rerun_det(yes, !PDInfo),
@@ -710,8 +710,8 @@
         Goals = [],
         Optimized0 = no
     ),
-    check_improvement(Optimized0, CostDelta0, SizeDelta0,
-        Optimized, !.PDInfo, !IO),
+    check_improvement(Optimized0, CostDelta0, SizeDelta0, Optimized,
+        !.PDInfo, !IO),
 
     % Clean up.
     pd_info_set_depth(Depth0, !PDInfo),
@@ -747,8 +747,7 @@
         pd_info_set_changed(yes, !PDInfo),
         pd_info_set_rerun_det(yes, !PDInfo)
     ),
-    pd_debug_message("finished deforestation at depth %i\n", [i(Depth0)],
-        !IO),
+    pd_debug_message("finished deforestation at depth %i\n", [i(Depth0)], !IO),
     pd_info_set_parents(Parents0, !PDInfo).
 
     % Check whether deforestation is legal and worthwhile.
@@ -905,8 +904,7 @@
     globals.io_lookup_int_option(deforestation_cost_factor, Factor, !IO),
     (
         Optimized0 = yes,
-        check_deforestation_improvement(Factor,
-            Improvement, SizeDifference)
+        check_deforestation_improvement(Factor, Improvement, SizeDifference)
     ->
         Optimized = yes,
         pd_debug_message("Enough improvement: cost(%i) size(%i)\n",
@@ -945,8 +943,8 @@
     list(hlds_goal)::in, maybe(hlds_goal)::in, maybe(hlds_goal)::out,
     pd_info::in, pd_info::out, io::di, io::uo) is det.
 
-call_call_2(ConjNonLocals, EarlierGoal, BetweenGoals,
-        MaybeLaterGoal, MaybeGoal, !PDInfo, !IO) :-
+call_call_2(ConjNonLocals, EarlierGoal, BetweenGoals, MaybeLaterGoal,
+        MaybeGoal, !PDInfo, !IO) :-
     create_conj(EarlierGoal, BetweenGoals, MaybeLaterGoal, ConjNonLocals,
         FoldGoal),
 
@@ -1022,9 +1020,8 @@
     %
 :- pred create_deforest_goal(hlds_goal::in, hlds_goals::in,
     maybe(hlds_goal)::in, hlds_goal::in, set(prog_var)::in, bool::in,
-    proc_pair::in, int::in, maybe(pred_proc_id)::in,
-    maybe(hlds_goal)::out, pd_info::in, pd_info::out,
-    io::di, io::uo) is det.
+    proc_pair::in, int::in, maybe(pred_proc_id)::in, maybe(hlds_goal)::out,
+    pd_info::in, pd_info::out, io::di, io::uo) is det.
 
 create_deforest_goal(EarlierGoal, BetweenGoals, MaybeLaterGoal,
         FoldGoal0, NonLocals, RunModes, ProcPair, Size,
@@ -1059,8 +1056,7 @@
             NumVars < VarsOpt
         )
     ->
-        % Create the goal for the new predicate,
-        % unfolding the first call.
+        % Create the goal for the new predicate, unfolding the first call.
 
         pd_info_get_instmap(!.PDInfo, InstMap0),
         pd_info_get_proc_info(!.PDInfo, ProcInfo0),
@@ -1148,8 +1144,7 @@
                 CurrPredId, CurrProcId, ModuleInfo, !IO),
             MaybeCallGoal = yes(CallGoal)
         ;
-            pd_debug_message("Generalisation produced mode errors\n", [],
-                !IO),
+            pd_debug_message("Generalisation produced mode errors\n", [], !IO),
             MaybeCallGoal = no
         ),
 
@@ -1171,8 +1166,8 @@
     map(prog_var, prog_var)::in, tsubst::in, hlds_goal::out,
     pd_info::in, pd_info::out) is det.
 
-create_call_goal(proc(PredId, ProcId), VersionInfo,
-        Renaming, TypeSubn, Goal, !PDInfo) :-
+create_call_goal(proc(PredId, ProcId), VersionInfo, Renaming, TypeSubn, Goal,
+        !PDInfo) :-
     OldArgs = VersionInfo ^ version_arg_vars,
     pd_info_get_module_info(!.PDInfo, ModuleInfo),
     module_info_pred_proc_info(ModuleInfo, PredId, ProcId,
@@ -1355,8 +1350,8 @@
     map(prog_var, prog_var)::in, instmap::in, instmap::out) is semidet.
 
 try_MSG(_, _, [], _, !InstMap).
-try_MSG(ModuleInfo, VersionInstMap, [VersionArg | VersionArgs],
-        Renaming, !InstMap) :-
+try_MSG(ModuleInfo, VersionInstMap, [VersionArg | VersionArgs], Renaming,
+        !InstMap) :-
     instmap.lookup_var(VersionInstMap, VersionArg, VersionInst),
     (
         map.search(Renaming, VersionArg, Arg),
@@ -1367,8 +1362,7 @@
     ;
         true
     ),
-    try_MSG(ModuleInfo, VersionInstMap, VersionArgs,
-        Renaming, !InstMap).
+    try_MSG(ModuleInfo, VersionInstMap, VersionArgs, Renaming, !InstMap).
 
 %-----------------------------------------------------------------------------%
 
@@ -1495,10 +1489,11 @@
 
     list.foldl(AddGoalNonLocals, [EarlierGoal | BetweenGoals],
         set.init, !:SubConjNonLocals),
-    ( MaybeLaterGoal = yes(LaterGoal) ->
+    (
+        MaybeLaterGoal = yes(LaterGoal),
         call(AddGoalNonLocals, LaterGoal, !SubConjNonLocals)
     ;
-        true
+        MaybeLaterGoal = no
     ),
     set.intersect(!.NonLocals, !SubConjNonLocals).
 
@@ -1563,9 +1558,10 @@
     hlds_goal::in, list(hlds_goal)::in) is semidet.
 
 can_move_goal_forward(ModuleInfo, FullyStrict, ThisGoal, Goals) :-
-    \+ (
-        list.member(LaterGoal, Goals),
-        \+ pd_can_reorder_goals(ModuleInfo, FullyStrict, ThisGoal, LaterGoal)
+    (
+        list.member(LaterGoal, Goals)
+    =>
+        pd_can_reorder_goals(ModuleInfo, FullyStrict, ThisGoal, LaterGoal)
     ).
 
     % Check all goals occurring earlier in the conjunction to see
@@ -1575,9 +1571,11 @@
     hlds_goal::in, list(hlds_goal)::in) is semidet.
 
 can_move_goal_backward(ModuleInfo, FullyStrict, ThisGoal, Goals) :-
-    \+ (
-        list.member(EarlierGoal, Goals),
-        \+ pd_can_reorder_goals(ModuleInfo, FullyStrict, EarlierGoal, ThisGoal)
+    (
+        list.member(EarlierGoal, Goals)
+    =>
+        pd_can_reorder_goals(ModuleInfo, FullyStrict,
+            EarlierGoal, ThisGoal)
     ).
 
 %-----------------------------------------------------------------------------%
@@ -1685,8 +1683,8 @@
     hlds_goal::in, set(prog_var)::in, int::in, set(int)::in,
     hlds_goal::out, pd_info::in, pd_info::out, io::di, io::uo) is det.
 
-append_goal(Goal0, BetweenGoals, GoalToAppend0,
-        NonLocals0, CurrBranch, Branches, Goal, !PDInfo, !IO) :-
+append_goal(Goal0, BetweenGoals, GoalToAppend0, NonLocals0,
+        CurrBranch, Branches, Goal, !PDInfo, !IO) :-
     ( set.member(CurrBranch, Branches) ->
         % Unfold the call.
         pd_info_get_instmap(!.PDInfo, InstMap0),
@@ -1838,10 +1836,10 @@
         Goal1 = _ - GoalInfo1,
         goal_info_get_nonlocals(GoalInfo1, NonLocals1),
         set.list_to_set(Args, NonLocals),
-        ( \+ set.equal(NonLocals1, NonLocals) ->
-            pd_util.requantify_goal(NonLocals, Goal1, Goal2, !PDInfo)
-        ;
+        ( set.equal(NonLocals1, NonLocals) ->
             Goal2 = Goal1
+        ;
+            pd_util.requantify_goal(NonLocals, Goal1, Goal2, !PDInfo)
         ),
 
         % Push the extra information from the call through the goal.
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
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/concurrency
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/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_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/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
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/odbc
cvs diff: Diffing extras/posix
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/stream
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/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
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 tests
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/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