[m-dev.] for review: add opt_exported import_status

Peter Ross peter.ross at miscrit.be
Wed Feb 28 21:16:47 AEDT 2001


Hi,

For stayl to review.

I have only one issue with this change and that is the test
term/associative.m now fails because it no longer contains a
termination_info pragma about rewrite.  However rewrite only exists in
the implementation section, so should we have been outputting a
termination_info pragma in the first place?

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


Estimated hours taken: 1

Merge changes from the reuse branch to the main branch.
This change introduces a new import_status opt_exported.
A local predicate which appeared in a .opt file (even if it was only a
call to that predicate) needs to have its export status changed to
exported so that an entry point to that predicate is available.  This
can confuse the structure reuse analysis, so we added the new
import_status: opt_exported.

compiler/hlds_pred.m:
    Add opt_exported to the import_status, and adapt the predicates
    corresponding predicates.

compiler/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.
    
compiler/unused_args.m:
    When we check for pred_info_is_exported, also check for
    pred_info_is_opt_exported.

compiler/assertion.m:
compiler/hlds_out.m:
    Minor changes.

Index: compiler/assertion.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/assertion.m,v
retrieving revision 1.10
diff -u -r1.10 assertion.m
--- compiler/assertion.m	2000/12/11 04:52:23	1.10
+++ compiler/assertion.m	2001/02/28 10:00:25
@@ -838,6 +838,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: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.254
diff -u -r1.254 hlds_out.m
--- compiler/hlds_out.m	2001/01/17 01:41:52	1.254
+++ compiler/hlds_out.m	2001/02/28 10:00:32
@@ -2273,6 +2273,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: compiler/hlds_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.92
diff -u -r1.92 hlds_pred.m
--- compiler/hlds_pred.m	2001/01/17 01:41:55	1.92
+++ compiler/hlds_pred.m	2001/02/28 10:00:36
@@ -283,6 +283,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
@@ -633,6 +637,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.
@@ -800,6 +806,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).
@@ -815,6 +822,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).
@@ -1014,6 +1022,7 @@
 	pred_info_import_status(PredInfo, ImportStatus),
 	(
 		( ImportStatus = exported
+		; ImportStatus = opt_exported
 		; ImportStatus = exported_to_submodules
 		)
 	->
@@ -1026,6 +1035,7 @@
 		ProcIds = []
 	).
 
+
 pred_info_clauses_info(PredInfo, PredInfo^clauses_info).
 
 pred_info_set_clauses_info(PredInfo, X, PredInfo^clauses_info := X).
@@ -1071,6 +1081,10 @@
 	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),
 	ImportStatus = exported_to_submodules.
@@ -1082,6 +1096,8 @@
 procedure_is_exported(PredInfo, ProcId) :-
 	(
 		pred_info_is_exported(PredInfo)
+	;
+		pred_info_is_opt_exported(PredInfo)
 	;
 		pred_info_is_exported_to_submodules(PredInfo)
 	;
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.91
diff -u -r1.91 intermod.m
--- compiler/intermod.m	2001/01/24 13:18:13	1.91
+++ compiler/intermod.m	2001/02/28 10:00:38
@@ -1990,7 +1990,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: compiler/unused_args.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.70
diff -u -r1.70 unused_args.m
--- compiler/unused_args.m	2000/11/17 17:48:52	1.70
+++ compiler/unused_args.m	2001/02/28 10:00:48
@@ -1496,6 +1496,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