[m-dev.] opt_imported

Nancy Mazur Nancy.Mazur at cs.kuleuven.ac.be
Wed Sep 20 20:06:59 AEDT 2000


Hi,


===================================================================


Estimated hours taken: 2

Added a new kind of import_status: opt_exported. This new status
is used in order to distinguish a real exported predicate from a
local predicate appearing in the .opt files (used to be set to exported).
Also some beautifying minor changes.

hlds_pred.m:
	Added opt_exported as a new import_status. Adapted predicates
	testing the import_status, and checking for exported status. 
	New predicate: pred_info_is_opt_exported.
intermod.m:
	When the status of a local predicate is changed due to its presence
	in the .opt file, this status is now set to opt_exported instead
	of exported.

assertion.m:
hlds_out.m:
	Take into account opt_exported. 

make_hlds.m:
	Minor change: make output more intelligeble.

pa_run.m:
sr_run.m:
	Once pred_info corresponds to an exported predicate, simply
	select all the procids instead of the exported ones (was a
	useless operation).

unused_args.m:
	Where pred_info_is_exported, also check for opt_exported.


Index: assertion.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/assertion.m,v
retrieving revision 1.8
diff -u -r1.8 assertion.m
--- assertion.m	2000/08/09 07:46:16	1.8
+++ assertion.m	2000/09/20 08:42:20
@@ -836,6 +836,7 @@
 is_defined_in_implementation_section(abstract_imported, no).
 is_defined_in_implementation_section(pseudo_imported, no).
 is_defined_in_implementation_section(exported, no).
+is_defined_in_implementation_section(opt_exported, no).
 is_defined_in_implementation_section(pseudo_exported, no).
 
 %-----------------------------------------------------------------------------%
Index: hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.243.2.1
diff -u -r1.243.2.1 hlds_out.m
--- hlds_out.m	2000/09/19 10:01:27	1.243.2.1
+++ hlds_out.m	2000/09/20 08:42:32
@@ -2259,6 +2259,8 @@
 	io__write_string("local").
 hlds_out__write_import_status(exported) -->
 	io__write_string("exported").
+hlds_out__write_import_status(opt_exported) -->
+	io__write_string("opt_exported").
 hlds_out__write_import_status(abstract_exported) -->
 	io__write_string("abstract_exported").
 hlds_out__write_import_status(pseudo_exported) -->
Index: hlds_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.81.2.1
diff -u -r1.81.2.1 hlds_pred.m
--- hlds_pred.m	2000/09/19 10:01:30	1.81.2.1
+++ hlds_pred.m	2000/09/20 08:42:37
@@ -253,6 +253,10 @@
 				% for unification predicates (see comments in
 				% unify_proc.m)
 	;	exported	% defined in the interface of this module
+	;	opt_exported	% a local item for which the import-status
+				% has been changed due to its presence in
+				% the .opt files 
+				% (intermod__adjust_pred_import_status)
 	;	abstract_exported % describes a type with only an abstract
 				% declaration exported
 	;	pseudo_exported % the converse of pseudo_imported
@@ -566,6 +570,8 @@
 	% exported_to_submodules or pseudo_exported
 :- pred pred_info_is_exported(pred_info::in) is semidet.
 
+:- pred pred_info_is_opt_exported(pred_info::in) is semidet.
+
 :- pred pred_info_is_exported_to_submodules(pred_info::in) is semidet.
 
 :- pred pred_info_is_pseudo_exported(pred_info::in) is semidet.
@@ -724,6 +730,7 @@
 status_is_exported(pseudo_imported,		no).
 status_is_exported(opt_imported,		no).
 status_is_exported(exported,			yes).
+status_is_exported(opt_exported,		yes).
 status_is_exported(abstract_exported,		yes).
 status_is_exported(pseudo_exported,		yes).
 status_is_exported(exported_to_submodules,	yes).
@@ -738,6 +745,7 @@
 status_defined_in_this_module(pseudo_imported,		no).
 status_defined_in_this_module(opt_imported,		no).
 status_defined_in_this_module(exported,			yes).
+status_defined_in_this_module(opt_exported,		yes).
 status_defined_in_this_module(abstract_exported,	yes).
 status_defined_in_this_module(pseudo_exported,		yes).
 status_defined_in_this_module(exported_to_submodules,	yes).
@@ -748,6 +756,7 @@
 import_status_to_minimal_string(abstract_imported, "abstract_imported").
 import_status_to_minimal_string(pseudo_imported, "pseudo_imported").
 import_status_to_minimal_string(exported, "exported").
+import_status_to_minimal_string(opt_exported, "opt_exported").
 import_status_to_minimal_string(abstract_exported, "abstract_exported").
 import_status_to_minimal_string(pseudo_exported, "pseudo_exported").
 import_status_to_minimal_string(exported_to_submodules,
@@ -912,6 +921,7 @@
 	pred_info_import_status(PredInfo, ImportStatus),
 	(
 		( ImportStatus = exported
+		; ImportStatus = opt_exported
 		; ImportStatus = exported_to_submodules
 		)
 	->
@@ -924,6 +934,7 @@
 		ProcIds = []
 	).
 
+
 pred_info_clauses_info(PredInfo, PredInfo^clauses_info).
 
 pred_info_set_clauses_info(PredInfo, X, PredInfo^clauses_info := X).
@@ -965,6 +976,10 @@
 pred_info_is_exported(PredInfo) :-
 	pred_info_import_status(PredInfo, ImportStatus),
 	ImportStatus = exported.
+
+pred_info_is_opt_exported(PredInfo) :-
+	pred_info_import_status(PredInfo, ImportStatus),
+	ImportStatus = opt_exported.
 
 pred_info_is_exported_to_submodules(PredInfo) :-
 	pred_info_import_status(PredInfo, ImportStatus),
Index: intermod.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.83.2.1
diff -u -r1.83.2.1 intermod.m
--- intermod.m	2000/09/19 10:01:34	1.83.2.1
+++ intermod.m	2000/09/20 08:42:44
@@ -1956,7 +1956,7 @@
 		->
 			NewStatus = pseudo_exported
 		;
-			NewStatus = exported
+			NewStatus = opt_exported
 		),
 		pred_info_set_import_status(PredInfo0, NewStatus, PredInfo),
 		map__det_update(Preds0, PredId, PredInfo, Preds1)
Index: make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.347.2.1
diff -u -r1.347.2.1 make_hlds.m
--- make_hlds.m	2000/09/19 10:01:40	1.347.2.1
+++ make_hlds.m	2000/09/20 08:43:10
@@ -1445,9 +1445,9 @@
 		% { module_info_incr_errors(Module0, Module) }
 	   )
 	;
-	   io__write_string("Error: no corresponding predicate found "),
+	   io__write_string("Error: no corresponding entry found for "),
 	   hlds_out__write_simple_call_id(PredOrFunc, SymName/Arity),
-	   io__write_string(" in `pragma pa_alias_info'.\n"),
+	   io__write_string(" with `pragma pa_alias_info'.\n"),
 	   { Module = Module0 },
 	   io__set_exit_status(1)
 	   % { module_info_incr_errors(Module0, Module) }
@@ -1522,9 +1522,9 @@
 		% { module_info_incr_errors(Module0, Module) }
 	   )
 	;
-	   io__write_string("Error: no corresponding predicate found "),
+	   io__write_string("Error: no corresponding entry found for "),
 	   hlds_out__write_simple_call_id(PredOrFunc, SymName/Arity),
-	   io__write_string(" in `pragma pa_alias_info'.\n"),
+	   io__write_string(" with `pragma sr_reuse_info'.\n"),
 	   { Module = Module0 },
 	   io__set_exit_status(1)
 	   % { module_info_incr_errors(Module0, Module) }
Index: pa_run.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/pa_run.m,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 pa_run.m
--- pa_run.m	2000/09/19 10:02:07	1.1.2.1
+++ pa_run.m	2000/09/20 08:43:23
@@ -197,12 +197,19 @@
 analyse_pred_proc( HLDS, PRED_PROC_ID , FPtable0, FPtable) -->
 	globals__io_lookup_bool_option(very_verbose,Verbose),
 
-	{ module_info_pred_proc_info( HLDS, PRED_PROC_ID,_PredInfo,ProcInfo) },
+	% { module_info_pred_proc_info( HLDS, PRED_PROC_ID,_PredInfo,ProcInfo) },
+	{ module_info_pred_proc_info( HLDS, PRED_PROC_ID,PredInfo,ProcInfo) },
+	{ pred_info_import_status( PredInfo, ImportStatus) },
+	{ import_status_to_minimal_string( ImportStatus, ImportStatusS) },
+
 	{ PRED_PROC_ID = proc(PredId, ProcId) },
 
 	{ pa_util__pa_fixpoint_table_which_run(FPtable0, Run) },
 	{ string__int_to_string(Run, SRun )},
-	{ string__append_list( ["% Alias analysing (run ",SRun,") "],
+	% { string__append_list( ["% Alias analysing (run ",SRun,") "],
+	%			Msg ) },
+	{ string__append_list( ["% Alias analysing (run ",SRun,") ",
+				" (", ImportStatusS, ") "],
 				Msg ) },
 	passes_aux__write_proc_progress_message( Msg, 
 				PredId, ProcId, HLDS ), 
@@ -572,7 +579,7 @@
 		->
 			[]
 		;
-			{ pred_info_exported_procids( PredInfo , ProcIds ) } ,
+			{ pred_info_procids(PredInfo, ProcIds) },
 			{ pred_info_procedures( PredInfo, ProcTable ) },
 			list__foldl( make_pa_interface_pred_proc( PredInfo, ProcTable),
 					ProcIds )
Index: sr_run.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_run.m,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 sr_run.m
--- sr_run.m	2000/09/19 10:02:14	1.1.2.1
+++ sr_run.m	2000/09/20 08:43:34
@@ -65,7 +65,7 @@
 		->
 			[]
 		;
-			{ pred_info_exported_procids( PredInfo , ProcIds ) } ,
+			{ pred_info_procids(PredInfo, ProcIds) },
 			{ pred_info_procedures( PredInfo, ProcTable ) },
 			list__foldl( 
 				write_pred_proc_sr_reuse_info( PredInfo, 
Index: unused_args.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.67
diff -u -r1.67 unused_args.m
--- unused_args.m	2000/09/07 01:47:00	1.67
+++ unused_args.m	2000/09/20 08:43:39
@@ -1480,6 +1480,7 @@
 write_unused_args_to_opt_file(yes(OptStream), PredInfo, ProcId, UnusedArgs) -->
 	(
 		( { pred_info_is_exported(PredInfo) }
+		; { pred_info_is_opt_exported(PredInfo) }
 		; { pred_info_is_exported_to_submodules(PredInfo) }
 		),
 		{ UnusedArgs \= [] }

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list