[m-dev.] diff: dependency restructuring change #4

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jul 13 00:07:25 AEST 1999


Estimated hours taken: 2

More changes to reduce the complexity of the intermodule dependencies.

compiler/module_qual.m:
	Some minor changes to avoid the need to import hlds*.m.
	This module acts on the parse tree, not the HLDS, so we
	shouldn't import hlds*.m here.

compiler/modules.m:
compiler/prog_io.m:
compiler/det_analysis.m:
	Delete some unnecessary imports.

compiler/equiv_type.m:
compiler/dependency_graph.m:
	Add some XXX comments about unwanted intermodule dependencies.

Workspace: /home/mercury0/fjh/mercury-other
Index: compiler/dependency_graph.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dependency_graph.m,v
retrieving revision 1.41
diff -u -r1.41 dependency_graph.m
--- dependency_graph.m	1999/06/30 17:12:18	1.41
+++ dependency_graph.m	1999/07/11 15:44:43
@@ -57,9 +57,16 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
+
 :- import_module hlds_goal, hlds_data, prog_data.
 :- import_module mode_util, globals, options, code_util, goal_util.
-:- import_module llds, llds_out, mercury_to_mercury.
+:- import_module mercury_to_mercury.
+
+% XXX we should not import llds here -- this should depend only on the HLDS,
+% not on the LLDS.  But the LLDS stuff is unfortunately needed for producing
+% the LLDS labels used for dependency_graph__write_prof_dependency_graph.
+:- import_module llds, llds_out.
+
 :- import_module term, varset.
 :- import_module int, bool, term, require, string.
 :- import_module map, multi_map, set, std_util.
Index: compiler/det_analysis.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/det_analysis.m,v
retrieving revision 1.140
diff -u -r1.140 det_analysis.m
--- det_analysis.m	1999/07/08 06:43:37	1.140
+++ det_analysis.m	1999/07/12 06:27:54
@@ -120,7 +120,7 @@
 
 :- implementation.
 
-:- import_module det_report, purity.
+:- import_module purity.
 :- import_module type_util, modecheck_call, mode_util, options, passes_aux.
 :- import_module hlds_out, mercury_to_mercury.
 :- import_module assoc_list, bool, map, set, require, term.
Index: compiler/equiv_type.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/equiv_type.m,v
retrieving revision 1.19
diff -u -r1.19 equiv_type.m
--- equiv_type.m	1999/04/23 01:02:38	1.19
+++ equiv_type.m	1999/07/11 15:50:04
@@ -37,7 +37,10 @@
 
 :- implementation.
 :- import_module assoc_list, bool, require, std_util, map, term, varset.
-:- import_module hlds_data, type_util, prog_data, prog_util, prog_out.
+:- import_module prog_data, prog_util, prog_out.
+
+% XXX we shouldn't import the HLDS here.
+:- import_module hlds_data, type_util.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
Index: compiler/module_qual.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/module_qual.m,v
retrieving revision 1.45
diff -u -r1.45 module_qual.m
--- module_qual.m	1999/07/09 01:15:34	1.45
+++ module_qual.m	1999/07/11 12:55:08
@@ -63,7 +63,7 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module hlds_data, hlds_module, hlds_pred, type_util, prog_out.
+:- import_module type_util, prog_out.
 :- import_module prog_util, mercury_to_mercury, modules, globals, options.
 :- import_module (inst), instmap.
 :- import_module int, map, require, set, std_util, string, term, varset.
@@ -117,6 +117,12 @@
 			need_qualifier	% must uses of the current item be 
 				% explicitly module qualified.
 	).
+
+	% We only need to keep track of what is exported and what isn't,
+	% so we use a simpler data type here than hlds_pred__import_status.
+:- type import_status
+	--->	exported
+	;	not_exported.
 		
 	% Pass over the item list collecting all defined type, mode and
 	% inst ids and the names of all modules imported in the interface.
@@ -208,17 +214,17 @@
 process_module_defn(interface, Info0, Info) :-
 	mq_info_set_import_status(Info0, exported, Info).
 process_module_defn(private_interface, Info0, Info) :-
-	mq_info_set_import_status(Info0, exported_to_submodules, Info).
+	mq_info_set_import_status(Info0, not_exported, Info).
 process_module_defn(implementation, Info0, Info) :-
-	mq_info_set_import_status(Info0, local, Info).
+	mq_info_set_import_status(Info0, not_exported, Info).
 process_module_defn(imported, Info0, Info) :-
-	mq_info_set_import_status(Info0, imported, Info1),
+	mq_info_set_import_status(Info0, not_exported, Info1),
 	mq_info_set_need_qual_flag(Info1, may_be_unqualified, Info).
 process_module_defn(used, Info0, Info) :-
-	mq_info_set_import_status(Info0, imported, Info1),
+	mq_info_set_import_status(Info0, not_exported, Info1),
 	mq_info_set_need_qual_flag(Info1, must_be_qualified, Info).
 process_module_defn(opt_imported, Info0, Info) :-
-	mq_info_set_import_status(Info0, opt_imported, Info1),
+	mq_info_set_import_status(Info0, not_exported, Info1),
 	mq_info_set_need_qual_flag(Info1, must_be_qualified, Info).
 process_module_defn(external(_), Info, Info).
 process_module_defn(end_module(_), Info, Info).
@@ -368,9 +374,9 @@
 update_import_status(interface, Info0, Info, yes) :-
 	mq_info_set_import_status(Info0, exported, Info).
 update_import_status(implementation, Info0, Info, yes) :-
-	mq_info_set_import_status(Info0, local, Info).
+	mq_info_set_import_status(Info0, not_exported, Info).
 update_import_status(private_interface, Info0, Info, yes) :-
-	mq_info_set_import_status(Info0, exported_to_submodules, Info).
+	mq_info_set_import_status(Info0, not_exported, Info).
 update_import_status(imported, Info, Info, no).
 update_import_status(used, Info, Info, no).
 update_import_status(external(_), Info, Info, yes).
@@ -1129,6 +1135,8 @@
 	% is_builtin_atomic_type(TypeId)
 	%	is true iff 'TypeId' is the type_id of a builtin atomic type
 
+:- type type_id == id.
+
 :- pred is_builtin_atomic_type(type_id).
 :- mode is_builtin_atomic_type(in) is semidet.
 
@@ -1167,8 +1175,9 @@
 	ErrorContext = type(unqualified("") - 0) - Context,
 	set__init(InterfaceModules0),
 	id_set_init(Empty),
-	Info0 = mq_info(Empty, Empty, Empty, Empty, InterfaceModules0, local, 0,
-		no, no, ReportErrors, ErrorContext, may_be_unqualified).
+	Info0 = mq_info(Empty, Empty, Empty, Empty, InterfaceModules0,
+		not_exported, 0, no, no, ReportErrors, ErrorContext,
+		may_be_unqualified).
 
 :- pred mq_info_get_types(mq_info::in, type_id_set::out) is det.
 :- pred mq_info_get_insts(mq_info::in, inst_id_set::out) is det.
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.99
diff -u -r1.99 modules.m
--- modules.m	1999/07/09 04:52:45	1.99
+++ modules.m	1999/07/11 13:08:22
@@ -480,7 +480,7 @@
 
 :- implementation.
 :- import_module llds_out, passes_aux, prog_out, prog_util, mercury_to_mercury.
-:- import_module prog_io_util, globals, options, intermod, module_qual.
+:- import_module prog_io_util, globals, options, module_qual.
 
 :- import_module string, set, map, term, varset, dir, library.
 :- import_module assoc_list, relation, char, require.
Index: compiler/prog_io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io.m,v
retrieving revision 1.182
diff -u -r1.182 prog_io.m
--- prog_io.m	1999/07/09 01:15:37	1.182
+++ prog_io.m	1999/07/11 16:15:41
@@ -186,7 +186,6 @@
 :- import_module prog_io_typeclass.
 :- import_module hlds_data, hlds_pred, prog_util, prog_out.
 :- import_module globals, options, (inst).
-:- import_module purity.
 
 :- import_module int, string, std_util, parser, term_io, dir, require.
 :- import_module assoc_list.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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