[m-rev.] for review: allow user suffixes for hlds dumps

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Apr 12 14:58:25 AEST 2007


Estimated hours taken: 0.5
Branches: main

Add a new option that optionally allows a user specified suffix to be
attached to the names of files generated by HLDS dumps.

This is useful for when comparing the HLDS dumps generated by different
compiler settings.

compiler/options.m:
doc/user_guide.texi:
 	Add and document a new option `--dump-hlds-file-suffix' that allows
 	the user to specify a suffix to be attached to name of each file
 	created by an HLDS dump.

compiler/mercury_compile.m:
 	Look up the value of `--dump-hlds-file-suffix' and include it in the
 	names of files generated by `--dump-hlds'.

Julien.

Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.431
diff -u -r1.431 mercury_compile.m
--- compiler/mercury_compile.m	4 Mar 2007 23:38:00 -0000	1.431
+++ compiler/mercury_compile.m	12 Apr 2007 04:56:13 -0000
@@ -4962,12 +4962,15 @@
      globals.lookup_accumulating_option(Globals, dump_hlds, DumpHLDSStages),
      globals.lookup_accumulating_option(Globals, dump_trace_counts,
          DumpTraceStages),
+    globals.lookup_string_option(Globals, dump_hlds_file_suffix,
+        UserFileSuffix),
      StageNumStr = stage_num_str(StageNum),
      ( should_dump_stage(StageNum, StageNumStr, StageName, DumpHLDSStages) ->
          module_info_get_name(HLDS, ModuleName),
          module_name_to_file_name(ModuleName, ".hlds_dump", yes, BaseFileName,
              !IO),
-        DumpFileName = BaseFileName ++ "." ++ StageNumStr ++ "-" ++ StageName,
+        DumpFileName = BaseFileName ++ "." ++ StageNumStr ++ "-" ++ StageName
+            ++ UserFileSuffix,
          (
              !.DumpInfo = prev_dumped_hlds(PrevDumpFileName, PrevHLDS),
              HLDS = PrevHLDS
@@ -4995,7 +4998,8 @@
          module_info_get_name(HLDS, ModuleName),
          module_name_to_file_name(ModuleName, ".trace_counts", yes,
              BaseFileName, !IO),
-        DumpFileName = BaseFileName ++ "." ++ StageNumStr ++ "-" ++ StageName,
+        DumpFileName = BaseFileName ++ "." ++ StageNumStr ++ "-" ++ StageName
+            ++ UserFileSuffix,
          write_out_trace_counts(DumpFileName, MaybeTraceCountsError, !IO),
          (
              MaybeTraceCountsError = no,
Index: compiler/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.552
diff -u -r1.552 options.m
--- compiler/options.m	5 Apr 2007 02:52:43 -0000	1.552
+++ compiler/options.m	12 Apr 2007 04:56:13 -0000
@@ -219,6 +219,7 @@
      ;       dump_hlds_pred_id
      ;       dump_hlds_alias
      ;       dump_hlds_options
+    ;       dump_hlds_file_suffix
      ;       dump_mlds
      ;       verbose_dump_mlds
      ;       mode_constraints
@@ -995,6 +996,7 @@
      dump_hlds_pred_id                   -   accumulating([]),
      dump_hlds_alias                     -   string(""),
      dump_hlds_options                   -   string(""),
+    dump_hlds_file_suffix               -   string(""),
      dump_mlds                           -   accumulating([]),
      verbose_dump_mlds                   -   accumulating([]),
      mode_constraints                    -   bool(no),
@@ -1741,6 +1743,7 @@
  long_option("dump-hlds-pred-id",    dump_hlds_pred_id).
  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).
  long_option("dump-mlds",            dump_mlds).
  long_option("mlds-dump",            dump_mlds).
  long_option("verbose-dump-mlds",    verbose_dump_mlds).
@@ -3283,6 +3286,9 @@
          "\tEach type of detail is included in the dump if its",
          "\tcorresponding letter occurs in the option argument",
          "\t(see the Mercury User's Guide for details).",
+        "--dump-hlds-file-suffix <suffix>",
+        "\tAppend the given suffix to the names of the files created by",
+        "\tthe `--dump-hlds' option",
          "--dump-mlds <stage number or name>",
          "\tDump the MLDS (medium level intermediate representation)",
          "\tafter the specified stage, as C code,",
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.515
diff -u -r1.515 user_guide.texi
--- doc/user_guide.texi	5 Apr 2007 02:52:44 -0000	1.515
+++ doc/user_guide.texi	12 Apr 2007 04:56:13 -0000
@@ -6676,6 +6676,12 @@
  May be given more than once.

  @sp 1
+ at item --dump-hlds-file-suffix
+ at findex --dump-hlds-file-suffix
+Append the given suffix to the names of the files created by the
+ at samp{--dump-hlds} option. 
+
+ at sp 1
  @item --dump-mlds @var{stage}
  @findex --dump-mlds
  Dump the MLDS (a C-like intermediate representation) after

--------------------------------------------------------------------------
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