[m-rev.] diff: minor clause_to_proc cleanup
Zoltan Somogyi
zs at cs.mu.OZ.AU
Mon Aug 8 19:37:33 AEST 2005
compiler/clause_to_proc.m:
Simplify some code, and make local a predicate that need not be
exported.
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/clause_to_proc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/clause_to_proc.m,v
retrieving revision 1.50
diff -u -b -r1.50 clause_to_proc.m
--- compiler/clause_to_proc.m 8 Aug 2005 02:57:09 -0000 1.50
+++ compiler/clause_to_proc.m 8 Aug 2005 07:46:29 -0000
@@ -33,8 +33,6 @@
:- pred copy_module_clauses_to_procs(list(pred_id)::in,
module_info::in, module_info::out) is det.
-:- pred copy_clauses_to_procs(pred_info::in, pred_info::out) is det.
-
:- pred copy_clauses_to_proc(proc_id::in, clauses_info::in,
proc_info::in, proc_info::out) is det.
@@ -116,28 +114,34 @@
).
copy_module_clauses_to_procs(PredIds, !ModuleInfo) :-
- module_info_preds(!.ModuleInfo, Preds0),
- copy_module_clauses_to_procs_2(PredIds, Preds0, Preds),
- module_info_set_preds(Preds, !ModuleInfo).
+ module_info_preds(!.ModuleInfo, PredTable0),
+ list__foldl(copy_pred_clauses_to_procs, PredIds, PredTable0, PredTable),
+ module_info_set_preds(PredTable, !ModuleInfo).
-:- pred copy_module_clauses_to_procs_2(list(pred_id)::in,
+ % For each mode of the given predicate, copy the clauses relevant
+ % to the mode and the current backend to the proc_info.
+ %
+ % This is not the only predicate in the compiler that does this task;
+ % the other is polymorphism__process_proc.
+ %
+:- pred copy_pred_clauses_to_procs(pred_id::in,
pred_table::in, pred_table::out) is det.
-copy_module_clauses_to_procs_2([], Preds, Preds).
-copy_module_clauses_to_procs_2([PredId | PredIds], Preds0, Preds) :-
- map__lookup(Preds0, PredId, PredInfo0),
+copy_pred_clauses_to_procs(PredId, !PredTable) :-
+ map__lookup(!.PredTable, PredId, PredInfo0),
(
% Don't process typeclass methods, because their proc_infos
% are generated already mode-correct.
pred_info_get_markers(PredInfo0, PredMarkers),
check_marker(PredMarkers, class_method)
->
- Preds1 = Preds0
+ true
;
copy_clauses_to_procs(PredInfo0, PredInfo),
- map__det_update(Preds0, PredId, PredInfo, Preds1)
- ),
- copy_module_clauses_to_procs_2(PredIds, Preds1, Preds).
+ map__det_update(!.PredTable, PredId, PredInfo, !:PredTable)
+ ).
+
+:- pred copy_clauses_to_procs(pred_info::in, pred_info::out) is det.
copy_clauses_to_procs(!PredInfo) :-
pred_info_procedures(!.PredInfo, Procs0),
@@ -149,12 +153,12 @@
:- pred copy_clauses_to_procs_2(list(proc_id)::in, clauses_info::in,
proc_table::in, proc_table::out) is det.
-copy_clauses_to_procs_2([], _, Procs, Procs).
-copy_clauses_to_procs_2([ProcId | ProcIds], ClausesInfo, Procs0, Procs) :-
- map__lookup(Procs0, ProcId, Proc0),
+copy_clauses_to_procs_2([], _, !Procs).
+copy_clauses_to_procs_2([ProcId | ProcIds], ClausesInfo, !Procs) :-
+ map__lookup(!.Procs, ProcId, Proc0),
copy_clauses_to_proc(ProcId, ClausesInfo, Proc0, Proc),
- map__det_update(Procs0, ProcId, Proc, Procs1),
- copy_clauses_to_procs_2(ProcIds, ClausesInfo, Procs1, Procs).
+ map__det_update(!.Procs, ProcId, Proc, !:Procs),
+ copy_clauses_to_procs_2(ProcIds, ClausesInfo, !Procs).
copy_clauses_to_proc(ProcId, ClausesInfo, !Proc) :-
ClausesInfo = clauses_info(VarSet0, _, _, VarTypes, HeadVars,
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
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/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/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/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/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
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: 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