new diff: hlds_out.m

Erwan JAHIER jahier at cs.mu.OZ.AU
Mon Feb 2 19:55:59 AEDT 1998


Estimated hours taken: 6

compiler/hlds_out.m
    This diff  make a few stuffs that where dumped in any
    hlds-stage optional. They can be recovered with 'C' 
    'M' and 'U' field of -D output compiling option.
    'C' for clause information.
    'U' for '__unify__' predicates.
    'M' for type, classes, insts and modes information.

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




Index: hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.184
diff -u -r1.184 hlds_out.m
--- hlds_out.m	1998/01/27 04:37:00	1.184
+++ hlds_out.m	1998/02/02 08:52:48
@@ -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,24 @@
 		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, 'M') } ->
+		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),
+		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,6 +430,7 @@
 :- 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] }
 	->
@@ -433,9 +442,19 @@
 			% 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] }
+			( { string__contains_char(Verbose, 'U') } ->	    
+				% We don't really need that information 
+				% (i.e. unification preds) to
+				% understand how the program has been 
+				% transformed. So we dump it only if 
+				% suboption 'U' is on.
+
+				{ pred_info_procids(PredInfo, ProcIds) },
+				{ hlds_pred__in_in_unification_proc_id(ProcId) },
+				{ ProcIds = [ProcId] }
+			;
+				[]
+			)
 		->
 			[]
 		;
@@ -463,44 +482,64 @@
 	{ pred_info_get_markers(PredInfo, Markers) },
 	{ pred_info_get_is_pred_or_func(PredInfo, PredOrFunc) },
 	{ pred_info_get_class_context(PredInfo, ClassContext) },
-	mercury_output_pred_type(TVarSet, qualified(Module, PredName), 
-				ArgTypes, no, pure, 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 clauses 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),
+		
+	( { string__contains_char(Verbose, 'C') } ->	    
+		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").
@@ -2199,5 +2238,4 @@
 		hlds_out__write_indent(Indent1)
 	).
 
-%-----------------------------------------------------------------------------%

%-----------------------------------------------------------------------------%



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"))
 	;	
 		[]
 	),


-- 
R1.



More information about the developers mailing list