[m-rev.] diff: --dump-hlds-pred-name

Zoltan Somogyi zs at csse.unimelb.edu.au
Fri Jun 29 19:46:48 AEST 2007


compiler/options.m:
	Add an accumulating option, --dump-hlds-pred-name, that allows you
	to specify the names of predicate and/or functions to be dumped.

doc/user_guide.texi:
	Document the new option.

compiler/hlds_out.m:
	Implement the new option.

	If either the new option or the old --dump-hlds-pred-id is specified,
	don't dump the type, inst etc tables, since the user won't be
	interested in them.

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/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.426
diff -u -b -r1.426 hlds_out.m
--- compiler/hlds_out.m	17 May 2007 03:52:43 -0000	1.426
+++ compiler/hlds_out.m	29 Jun 2007 06:31:29 -0000
@@ -640,7 +640,22 @@
     module_info_get_mode_table(Module, ModeTable),
     module_info_get_class_table(Module, ClassTable),
     module_info_get_instance_table(Module, InstanceTable),
+    module_info_get_globals(Module, Globals),
+    globals.lookup_accumulating_option(Globals, dump_hlds_pred_id,
+        DumpPredIdStrs),
+    globals.lookup_accumulating_option(Globals, dump_hlds_pred_name,
+        DumpPredNames),
     write_header(Indent, Module, !IO),
+    (
+        % If the user specifically requested one or more predicates and/or
+        % functions to be dumped, they won't be interested in the types,
+        % insts etc.
+        ( DumpPredIdStrs = [_ | _]
+        ; DumpPredNames = [_ | _]
+        )
+    ->
+        true
+    ;
     globals.io_lookup_string_option(dump_hlds_options, Verbose, !IO),
     ( string.contains_char(Verbose, 'I') ->
         write_imports(Indent, Imports, !IO)
@@ -664,6 +679,7 @@
         io.write_string("\n", !IO)
     ;
         true
+        )
     ),
     write_preds(Indent, Module, PredTable, !IO),
     write_footer(Indent, Module, !IO).
@@ -714,26 +730,35 @@
     globals.lookup_string_option(Globals, dump_hlds_options, Verbose),
     globals.lookup_accumulating_option(Globals, dump_hlds_pred_id,
         DumpPredIdStrs),
+    globals.lookup_accumulating_option(Globals, dump_hlds_pred_name,
+        DumpPredNames),
     pred_id_to_int(PredId, PredIdInt),
     map.lookup(PredTable, PredId, PredInfo),
     (
         % If the user requested one or more predicates/functions to be dumped,
-        % we dump them even if the condition of the nested if-then-else
-        % says it shouldn't be dumped, and we don't dump anything else.
-        DumpPredIdStrs = [_ | _],
+        % we dump them even if the condition of the nested if-then-else below
+        % would say they shouldn't be dumped, and we don't dump anything else.
+        ( DumpPredIdStrs = [_ | _]
+        ; DumpPredNames = [_ | _]
+        )
+    ->
+        (
         (
             some [DumpPredIdStr, DumpPredId] (
                 list.member(DumpPredIdStr, DumpPredIdStrs),
                 string.to_int(DumpPredIdStr, DumpPredId),
                 PredIdInt = DumpPredId
             )
+            ;
+                PredName = pred_info_name(PredInfo),
+                list.member(PredName, DumpPredNames)
+            )
         ->
             write_pred(Indent, ModuleInfo, PredId, PredInfo, !IO)
         ;
             true
         )
     ;
-        DumpPredIdStrs = [],
         (
             (
                 \+ string.contains_char(Verbose, 'I'),
Index: compiler/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.569
diff -u -b -r1.569 options.m
--- compiler/options.m	25 Jun 2007 00:58:12 -0000	1.569
+++ compiler/options.m	28 Jun 2007 08:31:01 -0000
@@ -219,6 +219,7 @@
     ;       dump_trace_counts
     ;       dump_hlds
     ;       dump_hlds_pred_id
+    ;       dump_hlds_pred_name
     ;       dump_hlds_alias
     ;       dump_hlds_options
     ;       dump_hlds_file_suffix
@@ -1016,6 +1017,7 @@
     dump_trace_counts                   -   accumulating([]),
     dump_hlds                           -   accumulating([]),
     dump_hlds_pred_id                   -   accumulating([]),
+    dump_hlds_pred_name                 -   accumulating([]),
     dump_hlds_alias                     -   string(""),
     dump_hlds_options                   -   string(""),
     dump_hlds_file_suffix               -   string(""),
@@ -1782,6 +1784,7 @@
 long_option("dump-hlds",            dump_hlds).
 long_option("hlds-dump",            dump_hlds).
 long_option("dump-hlds-pred-id",    dump_hlds_pred_id).
+long_option("dump-hlds-pred-name",  dump_hlds_pred_name).
 long_option("dump-hlds-alias",      dump_hlds_alias).
 long_option("dump-hlds-options",    dump_hlds_options).
 long_option("dump-hlds-file-suffix", dump_hlds_file_suffix).
@@ -3349,6 +3352,8 @@
         "--dump-hlds-pred-id <n>",
         "\tDump the HLDS only of the predicate/function with the given",
         "\tpred id.",
+        "--dump-hlds-pred-name <name>",
+        "\tDump the HLDS only of the predicate/function with the given name.",
 % This option is for developers only.
 %       "-D, --dump-hlds-alias <dump-alias>",
 %       "\tWith `--dump-hlds', include extra detail in the dump.",
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
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.530
diff -u -b -r1.530 user_guide.texi
--- doc/user_guide.texi	22 Jun 2007 08:31:12 -0000	1.530
+++ doc/user_guide.texi	28 Jun 2007 08:31:34 -0000
@@ -6785,6 +6785,13 @@
 May be given more than once.
 
 @sp 1
+ at item --dump-hlds-pred-name @var{name}
+ at findex --dump-hlds-pred-name
+With @samp{--dump-hlds}, restrict the output
+to the HLDS of the predicate or function with the specified name.
+May be given more than once.
+
+ at sp 1
 @item --dump-hlds-file-suffix
 @findex --dump-hlds-file-suffix
 Append the given suffix to the names of the files created by the
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
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/fixed
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_allegro
cvs diff: Diffing extras/graphics/mercury_allegro/examples
cvs diff: Diffing extras/graphics/mercury_allegro/samples
cvs diff: Diffing extras/graphics/mercury_allegro/samples/demo
cvs diff: Diffing extras/graphics/mercury_allegro/samples/mandel
cvs diff: Diffing extras/graphics/mercury_allegro/samples/pendulum2
cvs diff: Diffing extras/graphics/mercury_allegro/samples/speed
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/log4m
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/mopenssl
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/net
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/posix/samples
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/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/c_interface/standalone_c
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/solver_types
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: [09:43:28] waiting for uid20308's lock in /home/mercury/mercury1/repository/tests/invalid
cvs diff: [09:43:58] obtained lock in /home/mercury/mercury1/repository/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: [09:44:02] waiting for uid20308's lock in /home/mercury/mercury1/repository/tests/term
cvs diff: [09:44:32] obtained lock in /home/mercury/mercury1/repository/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