diff: hlds_out.m

Erwan JAHIER jahier at cs.mu.OZ.AU
Fri Feb 6 13:19:36 AEDT 1998


One more try ...


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.187
diff -u -r1.187 hlds_out.m
--- hlds_out.m	1998/02/05 05:10:37	1.187
+++ hlds_out.m	1998/02/06 01:13:31
@@ -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,26 @@
 		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,11 +432,14 @@
 :- 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
@@ -439,6 +452,18 @@
 		->
 			[]
 		;
+			% 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') },
+			{ pred_info_arity(PredInfo, Arity) },
+			{ Arity = 2 },
+			{ pred_info_name(PredInfo, PredName) },
+			{ PredName =  "__Unify__" }
+		->
+			[]
+		;
 			hlds_out__write_pred(Indent, ModuleInfo, PredId,
 				PredInfo)
 		),
@@ -466,42 +491,57 @@
 	{ 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.42
diff -u -r1.42 handle_options.m
--- handle_options.m	1998/02/03 08:18:20	1.42
+++ handle_options.m	1998/02/04 02:47:11
@@ -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.116
diff -u -r1.116 user_guide.texi
--- user_guide.texi	1998/01/29 13:41:18	1.116
+++ user_guide.texi	1998/02/04 00:11:55
@@ -1733,7 +1733,12 @@
 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