diff: hlds_out.m

Erwan JAHIER jahier at cs.mu.OZ.AU
Wed Feb 4 13:02:07 AEDT 1998


I hope this is the last one...



Estimated hours taken: 10


compiler/hlds_out.m
    This diff  make a few things that were dumped in any
    hlds-stage optional. They can be recovered using the following
    field of -D output compiling option:
    'T' for type and typeclasses information.
    'M' for modes and instantiation information.
    'C' for clause information.
    'U' for unify predicates.


compiler/handle_options.m
    A small change to handle those new suboptions when compiling 
    with -Dall.  

 
doc/user_guide.texi
   update the documentation for T, M, U, C and P suboptions.






Index: hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.186
diff -u -r1.186 hlds_out.m
--- hlds_out.m  1998/02/02 04:50:11     1.186
+++ hlds_out.m  1998/02/03 10:44:00
@@ -1,3 +1,4 @@
+

%-----------------------------------------------------------------------------%
 % Copyright (C) 1994-1998 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
@@ -372,17 +373,28 @@
                module_info_modes(Module, ModeTable),
                module_info_classes(Module, ClassTable)
        },
-
-       hlds_out__write_header(Indent, Module),
-       io__write_string("\n"),
-       hlds_out__write_types(Indent, TypeTable),
-       io__write_string("\n"),
-       hlds_out__write_classes(Indent, ClassTable),
        io__write_string("\n"),
-       hlds_out__write_insts(Indent, InstTable),
-       io__write_string("\n"),
-       hlds_out__write_modes(Indent, ModeTable),
+       hlds_out__write_header(Indent, Module),
        io__write_string("\n"),
+
+       globals__io_lookup_string_option(verbose_dump_hlds, Verbose),
+       ( { string__contains_char(Verbose, 'T') } ->
+               hlds_out__write_types(Indent, TypeTable),
+               io__write_string("\n"),
+               hlds_out__write_classes(Indent, ClassTable),
+               io__write_string("\n")
+       ;
+               []
+       ),
+       ( { string__contains_char(Verbose, 'M') } ->
+               hlds_out__write_insts(Indent, InstTable),
+               io__write_string("\n"),
+               hlds_out__write_modes(Indent, ModeTable),
+               io__write_string("\n")
+       ;
+               io__write_string("\n")  
+       ),
+
        hlds_out__write_preds(Indent, Module, PredTable),
        io__write_string("\n"),
        hlds_out__write_footer(Indent, Module).
@@ -422,20 +434,30 @@
 :- mode hlds_out__write_preds_2(in, in, in, in, di, uo) is det.
 
 hlds_out__write_preds_2(Indent, ModuleInfo, PredIds0, PredTable) -->
+        globals__io_lookup_string_option(verbose_dump_hlds, Verbose),
        (
                { PredIds0 = [PredId|PredIds] }
        ->
                { map__lookup(PredTable, PredId, PredInfo) },
-               ( { pred_info_is_imported(PredInfo) } ->
+               (       
+                       { pred_info_is_imported(PredInfo) } 
+               ->
                        []
                ;
-                       % for pseudo-imported predicates (i.e.
unification
-                       % preds), only print them if we are using a
local
-                       % mode for them
                        { pred_info_is_pseudo_imported(PredInfo) },
-                       { pred_info_procids(PredInfo, ProcIds) },
-                       { hlds_pred__in_in_unification_proc_id(ProcId)
},
-                       { ProcIds = [ProcId] }
+                       (
+                               % We dump unification predicates if
suboption 'U' is on.
+                               % We don't really need that information
to understand how 
+                               % the program has been transformed.
+                               { string__contains_char(Verbose, 'U') }
+                       ;
+                               % For pseudo-imported predicates (i.e.
unification
+                               % preds), only print them if we are
using a local
+                               % mode for them.
+                               { pred_info_procids(PredInfo, ProcIds)
},
+                               {
hlds_pred__in_in_unification_proc_id(ProcId) },
+                               { ProcIds = [ProcId] }
+                       )
                ->
                        []
                ;
@@ -463,45 +485,59 @@
        { pred_info_get_markers(PredInfo, Markers) },
        { pred_info_get_is_pred_or_func(PredInfo, PredOrFunc) },
        { pred_info_get_class_context(PredInfo, ClassContext) },
-       { pred_info_get_purity(PredInfo, Purity) },
-       mercury_output_pred_type(TVarSet, qualified(Module, PredName), 
-                               ArgTypes, no, Purity, ClassContext,
Context),
-       { ClausesInfo = clauses_info(VarSet, _, VarTypes, HeadVars,
Clauses)
},
-       hlds_out__write_indent(Indent),
-       io__write_string("% pred id: "),
-       { pred_id_to_int(PredId, PredInt) },
-       io__write_int(PredInt),
-       io__write_string(", category: "),
-       hlds_out__write_pred_or_func(PredOrFunc),
-       io__write_string(", status: "),
-       hlds_out__write_import_status(ImportStatus),
-       io__write_string("\n"),
-       { markers_to_marker_list(Markers, MarkerList) },
-       ( { MarkerList = [] } ->
+
+       globals__io_lookup_string_option(verbose_dump_hlds, Verbose),
+       ( { string__contains_char(Verbose, 'C') } ->
+               % Information about predicates is dumped if 'C' 
+               % suboption is on.
+
+               mercury_output_pred_type(TVarSet, qualified(Module,
PredName), 
+                               ArgTypes, no, pure, ClassContext,
Context)
+       ;
                []
+       ),
+       { ClausesInfo = clauses_info(VarSet, _, VarTypes, HeadVars,
Clauses)
},
+       ( { string__contains_char(Verbose, 'C') } ->
+               hlds_out__write_indent(Indent),
+               io__write_string("% pred id: "),
+               { pred_id_to_int(PredId, PredInt) },
+               io__write_int(PredInt),
+               io__write_string(", category: "),
+               hlds_out__write_pred_or_func(PredOrFunc),
+               io__write_string(", status: "),
+               hlds_out__write_import_status(ImportStatus),
+               io__write_string("\n"),
+               { markers_to_marker_list(Markers, MarkerList) },
+               ( { MarkerList = [] } ->
+                       []
+               ;
+                       io__write_string("% markers:"),
+                       hlds_out__write_marker_list(MarkerList),
+                       io__write_string("\n")
+               )
        ;
-               io__write_string("% markers:"),
-               hlds_out__write_marker_list(MarkerList),
-               io__write_string("\n")
+               []
        ),
 
-       globals__io_lookup_string_option(verbose_dump_hlds, Verbose),
        ( { string__contains_char(Verbose, 'v') } ->
                { AppendVarnums = yes }
        ;
                { AppendVarnums = no }
        ),
-       hlds_out__write_var_types(Indent, VarSet, AppendVarnums,
-               VarTypes, TVarSet),
+       ( { string__contains_char(Verbose, 'C') } ->
+               hlds_out__write_var_types(Indent, VarSet, AppendVarnums,
+                       VarTypes, TVarSet),
 
                % Never write the clauses out verbosely -
                % disable the verbose_dump_hlds option before writing
them,
                % and restore its initial value afterwards
-       globals__io_set_option(verbose_dump_hlds, string("")),
-       hlds_out__write_clauses(Indent, ModuleInfo, PredId, VarSet,
-               AppendVarnums, HeadVars, PredOrFunc, Clauses, no),
-       globals__io_set_option(verbose_dump_hlds, string(Verbose)),
-
+               globals__io_set_option(verbose_dump_hlds, string("")),
+               hlds_out__write_clauses(Indent, ModuleInfo, PredId,
VarSet,
+                       AppendVarnums, HeadVars, PredOrFunc, Clauses,
no),
+               globals__io_set_option(verbose_dump_hlds,
string(Verbose))
+       ;
+               []
+       ),
        hlds_out__write_procs(Indent, AppendVarnums, ModuleInfo, PredId,
                ImportStatus, ProcTable),
        io__write_string("\n").



Index: handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.41
diff -u -r1.41 handle_options.m
--- handle_options.m    1998/01/25 05:05:30     1.41
+++ handle_options.m    1998/02/02 08:21:09
@@ -251,7 +251,7 @@
        globals__io_lookup_string_option(verbose_dump_hlds,
VerboseDump),
        ( { VerboseDump = "all" } ->
                globals__io_set_option(verbose_dump_hlds,
-                       string("abcdefghijklmnopqrstuvwxyz"))
+                      
string("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"))
        ;       
                []
        ),



Index: user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.115
diff -u -r1.115 user_guide.texi
--- user_guide.texi     1998/01/25 15:11:59     1.115
+++ user_guide.texi     1998/02/03 09:28:09
@@ -1719,7 +1719,13 @@
 s - store maps of goals,
 t - results of termination analysis,
 u - unification categories,
-v - variable numbers in variable names.
+v - variable numbers in variable names,
+T - type and typeclass information,
+M - mode and inst information,
+C - clause information,
+U - unify predicates,
+P - path information.
 The special argument value ``all''
 will cause the printing of all these fields.
 



-- 
R1.



More information about the developers mailing list