[m-rev.] for review: make compiler use sub-modules

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Mar 6 12:49:05 AEDT 2002


On 06-Mar-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> This is just for discussion.  I don't plan to commit this version.
> 
> Instead, I plan to get rid of the top-level `mc' module introduced
> in this diff, and instead create separate top-level modules for each
> of the major components (which are sub-modules of `mc' in this diff).
> I'll also clean up the long lines introduced in this diff.

Here's the version I plan to commit
(unless people strongly prefer the other one...).

I would like to commit this quickly, since it will have CVS conflicts
with just about every other change that people are making...

----------

Estimated hours taken: 60
Branches: main

Use sub-modules to structure the modules in the Mercury compiler directory.

The main aim of this change is to make the overall, high-level structure
of the compiler clearer, and to encourage better encapsulation of the
major components.

compiler/libs.m:
compiler/backend_libs.m:
compiler/parse_tree.m:
compiler/hlds.m:
compiler/check_hlds.m:
compiler/transform_hlds.m:
compiler/bytecode_backend.m:
compiler/aditi_backend.m:
compiler/ml_backend.m:
compiler/ll_backend.m:
compiler/top_level.m:
	New files.  One module for each of the major components of the
	Mercury compiler.  These modules contain (as separate sub-modules)
	all the other modules in the Mercury compiler, except gcc.m and
	mlds_to_gcc.m.

compiler/Mmakefile:
	Handle the fact that the top-level module is now `top_level',
	not `mercury_compile' (since `mercury_compile' is a sub-module
	of `top_level').

compiler/*.m:
compiler/*.pp:
	Module-qualify the module names in `:- module', `:- import_module',
	and `:- use_module' declarations.

compiler/base_type_info.m:
compiler/base_type_layout.m:
	Deleted these unused empty modules.

compiler/prog_data.m:
compiler/globals.m:
	Move the `foreign_language' type from prog_data to globals.

compiler/mlds.m:
compiler/ml_util.m:
compiler/mlds_to_il.m:
	Import `globals', for `foreign_language'.

Workspace: /home/ceres/fjh/ws-ceres3/mercury
Index: compiler/maybe_mlds_to_gcc.pp
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/maybe_mlds_to_gcc.pp,v
retrieving revision 1.4
diff -u -d -r1.4 maybe_mlds_to_gcc.pp
--- compiler/maybe_mlds_to_gcc.pp	10 May 2001 11:41:10 -0000	1.4
+++ compiler/maybe_mlds_to_gcc.pp	6 Mar 2002 01:25:15 -0000
@@ -14,10 +14,10 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module maybe_mlds_to_gcc.
+:- module ml_backend__maybe_mlds_to_gcc.
 :- interface.
 
-:- import_module mlds, bool.
+:- import_module ml_backend__mlds, bool.
 :- use_module io.
 
 :- type frontend_callback(T) == pred(T, io__state, io__state).
@@ -55,7 +55,7 @@
 
 #else
 
-:- import_module passes_aux.
+:- import_module hlds__passes_aux.
 :- import_module string.
 
 maybe_mlds_to_gcc__run_gcc_backend(_ModuleName, CallBack, CallBackOutput) -->
Index: compiler/rl_file.pp
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_file.pp,v
retrieving revision 1.2
diff -u -d -r1.2 rl_file.pp
--- compiler/rl_file.pp	14 Mar 2000 00:00:37 -0000	1.2
+++ compiler/rl_file.pp	6 Mar 2002 01:25:15 -0000
@@ -9,7 +9,7 @@
 % Definitions for the RLO file format.
 %
 %-----------------------------------------------------------------------------%
-:- module rl_file.
+:- module aditi_backend__rl_file.
 
 :- interface.
 
@@ -25,7 +25,7 @@
 		int::out, io__state::di, io__state::uo) is det. 
 
 #if INCLUDE_ADITI_OUTPUT	% See ../Mmake.common.in.
-:- import_module rl_code.
+:- import_module aditi_backend__rl_code.
 :- import_module assoc_list, list.
 
 	% Write a text representation of an RL file to the current
Index: rl_out.pp
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_out.pp,v
retrieving revision 1.17
diff -u -d -u -r1.17 rl_out.pp
--- rl_out.pp	8 Aug 2001 06:36:22 -0000	1.17
+++ rl_out.pp	6 Mar 2002 01:46:22 -0000
@@ -16,13 +16,14 @@
 % in rl_code.m using the alias branch mode checker.
 %
 %-----------------------------------------------------------------------------%
-:- module rl_out.
+:- module aditi_backend__rl_out.
 
 :- interface.
 
-:- import_module rl, rl_file, hlds_module.
+:- import_module aditi_backend__rl, aditi_backend__rl_file.
+:- import_module hlds__hlds_module.
 #if INCLUDE_ADITI_OUTPUT	% See ../Mmake.common.in.
-:- import_module rl_code, tree.
+:- import_module aditi_backend__rl_code, libs__tree.
 #else
 #endif
 
@@ -56,18 +57,22 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module code_util, hlds_data, hlds_pred, prog_data, prog_out.
-:- import_module llds, globals, options, tree, type_util, passes_aux.
-:- import_module rl_file, getopt, modules, prog_util, magic_util, hlds_goal.
-:- import_module code_aux, det_analysis, instmap.
+:- import_module ll_backend__code_util, hlds__hlds_data, hlds__hlds_pred.
+:- import_module parse_tree__prog_data, parse_tree__prog_out.
+:- import_module ll_backend__llds, libs__globals, libs__options, libs__tree.
+:- import_module check_hlds__type_util, hlds__passes_aux.
+:- import_module aditi_backend__rl_file, getopt, parse_tree__modules.
+:- import_module parse_tree__prog_util, aditi_backend__magic_util.
+:- import_module hlds__hlds_goal.
+:- import_module ll_backend__code_aux, check_hlds__det_analysis, hlds__instmap.
 
 #if INCLUDE_ADITI_OUTPUT	% See ../Mmake.common.in.
-:- import_module rl_exprn.
+:- import_module aditi_backend__rl_exprn.
 #else
 #endif
 
 :- import_module assoc_list, bool, char, int, map, multi_map, require, set.
-:- import_module string, term, tree, varset.
+:- import_module string, term, libs__tree, varset.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Mmakefile,v
retrieving revision 1.50
diff -u -d -r1.50 Mmakefile
--- compiler/Mmakefile	14 Jan 2002 04:59:34 -0000	1.50
+++ compiler/Mmakefile	5 Mar 2002 23:55:11 -0000
@@ -192,13 +192,16 @@
 #-----------------------------------------------------------------------------#
 
 # targets
-#
+
+# specify the name of the top-level module to build
+MC_PROG = top_level
+
 # mercury_compile
 
 .PHONY: depend
-depend:		mercury_compile.depend
+depend:		$(MC_PROG).depend
 
-mercury_compile.depend: regenerate_preprocessed_files
+$(MC_PROG).depend: regenerate_preprocessed_files
 
 .PHONY: all
 all:		mercury
@@ -209,6 +212,24 @@
 .PHONY: libmmc
 libmmc:		libmercury_compile.a mercury_compile_init.$O
 
+# The executable was previous known as `mercury_compile',
+# but now we generate it as `mc'.  For compatibility with
+# various existing code, we make links to the old names.
+
+LN = ln
+
+mercury_compile: $(MC_PROG)
+	rm -f mercury_compile$(EXT_FOR_EXE)
+	$(LN) $(MC_PROG) mercury_compile$(EXT_FOR_EXE)
+
+libmercury_compile.a: lib$(MC_PROG).a
+	rm -f libmercury_compile.a
+	$(LN) lib$(MC_PROG).a libmercury_compile.a
+
+mercury_compile_init.$O: $(MC_PROG)_init.$O
+	rm -f mercury_compile_init.$O
+	$(LN) $(MC_PROG)_init.$O mercury_compile_init.$O
+
 #-----------------------------------------------------------------------------#
 
 # The GCC back-end stuff is conditionally compiled out of maybe_mlds_to_gcc.m.
@@ -235,47 +256,47 @@
 # Add some additional dependencies, so that Mmake knows to remake the
 # compiler if one of the libraries changes.
 
-mercury_compile: ../main.$O
-mercury_compile: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
-mercury_compile: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
-mercury_compile: $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
-mercury_compile: $(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A
+$(MC_PROG): ../main.$O
+$(MC_PROG): $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
+$(MC_PROG): $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
+$(MC_PROG): $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
+$(MC_PROG): $(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A
 # Should also depend on $(BOEHM_GC_DIR)/libgc(_prof).$A, but only
 # if in .gc(.prof) grade; GNU make does not support dynamic dependencies,
 # so just leave it out.
-mercury_compile: $(GCC_MAIN_LIBS)
+$(MC_PROG): $(GCC_MAIN_LIBS)
 
-mercury_compile_init.c: $(UTIL_DIR)/mkinit
+$(MC_PROG)_init.c: $(UTIL_DIR)/mkinit
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: check
-check		: mercury_compile.check
+check		: $(MC_PROG).check
 
 .PHONY: ints 
-ints		: mercury_compile.ints
+ints		: $(MC_PROG).ints
 
 #-----------------------------------------------------------------------------#
 
-tags		: $(mercury_compile.ms) $(LIBRARY_DIR)/*.m
-	$(MTAGS) $(MTAGSFLAGS) $(mercury_compile.ms) $(LIBRARY_DIR)/*.m
+tags		: $(PREPROCESSED_M_FILES) *.m $(LIBRARY_DIR)/*.m
+	$(MTAGS) $(MTAGSFLAGS) *.m $(LIBRARY_DIR)/*.m
 
-mercury_compile.stats : source_stats.awk $(mercury_compile.ms)
+$(MC_PROG).stats : source_stats.awk $($(MC_PROG).ms)
 	awk -f `vpath_find source_stats.awk` \
-		`vpath_find $(mercury_compile.ms)` > $@
+		`vpath_find $($(MC_PROG).ms)` > $@
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: dates
 dates		:
-	touch $(mercury_compile.dates)
+	touch $($(MC_PROG).dates)
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: os cs ss
-os: $(mercury_compile.os) $(os_subdir)mercury_compile_init.$O
-cs: $(mercury_compile.cs) $(cs_subdir)mercury_compile_init.c
-ss: $(mercury_compile.ss)
+os: $($(MC_PROG).os) $(os_subdir)$(MC_PROG)_init.$O
+cs: $($(MC_PROG).cs) $(cs_subdir)$(MC_PROG)_init.c
+ss: $($(MC_PROG).ss)
 
 #-----------------------------------------------------------------------------#
 
@@ -283,7 +304,7 @@
 	rm -f ../main.$O $(PREPROCESSED_M_FILES) $(PP_DATE_FILES)
 
 realclean_local:
-	rm -f tags mercury_compile.stats
+	rm -f tags $(MC_PROG).stats
 
 #-----------------------------------------------------------------------------#
 #-----------------------------------------------------------------------------#
Index: compiler/accumulator.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/accumulator.m,v
retrieving revision 1.18
diff -u -d -r1.18 accumulator.m
--- compiler/accumulator.m	13 Oct 2000 13:55:13 -0000	1.18
+++ compiler/accumulator.m	6 Mar 2002 00:53:48 -0000
@@ -125,11 +125,11 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module accumulator.
+:- module transform_hlds__accumulator.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, io.
+:- import_module hlds__hlds_module, hlds__hlds_pred, io.
 
 :- pred accumulator__process_proc(pred_id::in, proc_id::in, proc_info::in,
 		proc_info::out, module_info::in, module_info::out,
@@ -140,10 +140,14 @@
 
 :- implementation.
 
-:- import_module (assertion), error_util, goal_store, goal_util, globals.
-:- import_module hlds_data, hlds_goal, hlds_out, (inst).
-:- import_module inst_match, instmap, mode_util, options.
-:- import_module prog_data, prog_util, quantification.
+:- import_module (hlds__assertion), hlds__error_util.
+:- import_module transform_hlds__goal_store, hlds__goal_util, libs__globals.
+:- import_module hlds__hlds_data, hlds__hlds_goal, hlds__hlds_out.
+:- import_module (parse_tree__inst).
+:- import_module check_hlds__inst_match, hlds__instmap, check_hlds__mode_util.
+:- import_module libs__options.
+:- import_module parse_tree__prog_data, parse_tree__prog_util.
+:- import_module hlds__quantification.
 
 :- import_module assoc_list, bool, int, list, map, multi_map.
 :- import_module require, set, std_util, string, term, varset.
Index: compiler/add_heap_ops.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/add_heap_ops.m,v
retrieving revision 1.3
diff -u -d -r1.3 add_heap_ops.m
--- compiler/add_heap_ops.m	5 Feb 2002 09:14:45 -0000	1.3
+++ compiler/add_heap_ops.m	6 Mar 2002 00:53:48 -0000
@@ -27,9 +27,9 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module add_heap_ops.
+:- module ml_backend__add_heap_ops.
 :- interface.
-:- import_module hlds_pred, hlds_module.
+:- import_module hlds__hlds_pred, hlds__hlds_module.
 
 :- pred add_heap_ops(proc_info::in, module_info::in, proc_info::out) is det.
 
@@ -37,10 +37,13 @@
 
 :- implementation.
 
-:- import_module prog_data, prog_util, (inst).
-:- import_module hlds_goal, hlds_data.
-:- import_module goal_util, quantification, modules, type_util.
-:- import_module instmap, code_model, code_util.
+:- import_module parse_tree__prog_data, parse_tree__prog_util.
+:- import_module (parse_tree__inst).
+:- import_module hlds__hlds_goal, hlds__hlds_data.
+:- import_module hlds__goal_util, hlds__quantification, parse_tree__modules.
+:- import_module check_hlds__type_util.
+:- import_module hlds__instmap, backend_libs__code_model.
+:- import_module ll_backend__code_util.
 
 :- import_module bool, string.
 :- import_module assoc_list, list, map, set, varset, std_util, require, term.
Index: compiler/add_trail_ops.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/add_trail_ops.m,v
retrieving revision 1.6
diff -u -d -r1.6 add_trail_ops.m
--- compiler/add_trail_ops.m	26 Nov 2001 09:30:55 -0000	1.6
+++ compiler/add_trail_ops.m	6 Mar 2002 00:53:48 -0000
@@ -27,9 +27,9 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module add_trail_ops.
+:- module ml_backend__add_trail_ops.
 :- interface.
-:- import_module hlds_pred, hlds_module.
+:- import_module hlds__hlds_pred, hlds__hlds_module.
 
 :- pred add_trail_ops(proc_info::in, module_info::in, proc_info::out) is det.
 
@@ -37,10 +37,12 @@
 
 :- implementation.
 
-:- import_module prog_data, prog_util, (inst).
-:- import_module hlds_goal, hlds_data.
-:- import_module goal_util, quantification, modules, type_util.
-:- import_module code_model, instmap.
+:- import_module parse_tree__prog_data, parse_tree__prog_util.
+:- import_module (parse_tree__inst).
+:- import_module hlds__hlds_goal, hlds__hlds_data.
+:- import_module hlds__goal_util, hlds__quantification, parse_tree__modules.
+:- import_module check_hlds__type_util.
+:- import_module backend_libs__code_model, hlds__instmap.
 
 :- import_module bool, string.
 :- import_module assoc_list, list, map, set, varset, std_util, require, term.
Index: compiler/aditi_backend.m
===================================================================
RCS file: compiler/aditi_backend.m
diff -N compiler/aditi_backend.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ compiler/aditi_backend.m	6 Mar 2002 00:06:05 -0000
@@ -0,0 +1,62 @@
+%-----------------------------------------------------------------------------%
+%
+% The Aditi back-end
+%
+:- module aditi_backend.
+:- interface.
+:- import_module transform_hlds, check_hlds. % are these needed?
+:- import_module hlds, parse_tree, libs.
+
+%:- import_module aditi_hlds, aditi_codegen, aditi_rl_out.
+
+%
+% Phase 4-rl: Aditi-related HLDS transformations
+%
+%:- module aditi_hlds.
+%   :- interface.
+   :- include_module dnf.
+   :- include_module magic, magic_util.
+   :- include_module context.
+%:- end_module aditi_hlds.
+
+%
+% The Aditi-RL type itself.
+%
+:- include_module rl.
+:- include_module rl_dump.
+
+%
+% Phase 5-rl: The Aditi RL code generator
+%
+%:- module aditi_codegen.
+%   :- interface.
+   :- include_module rl_gen.
+   :- include_module rl_info.
+   :- include_module rl_relops.
+%:- end_module aditi_codegen.
+
+%
+% Phase 6-rl: Low-level (RL -> RL) optimizations
+%
+:- include_module rl_opt.
+   :- include_module rl_block, rl_analyse, rl_liveness, rl_loop, rl_block_opt.
+   :- include_module rl_key, rl_sort, rl_stream.
+
+%
+% Phase 7-rl: Emit RL bytecodes.
+%
+%:- module aditi_rl_out.
+   :- include_module rl_out, rl_exprn, rl_code, rl_file.
+%:- end_module aditi_rl_out.
+       
+%-----------------------------------------------------------------------------%
+
+:- implementation.
+	% aditi_backend__rl_exprn uses ll_backend__llds
+	% and backend_libs__builtin_ops.
+:- import_module ll_backend.
+:- import_module backend_libs.
+
+:- end_module aditi_backend.
+
+%-----------------------------------------------------------------------------%
Index: compiler/arg_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/arg_info.m,v
retrieving revision 1.35
diff -u -d -r1.35 arg_info.m
--- compiler/arg_info.m	23 Nov 2000 04:32:26 -0000	1.35
+++ compiler/arg_info.m	6 Mar 2002 00:53:48 -0000
@@ -15,9 +15,10 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module arg_info.
+:- module ll_backend__arg_info.
 :- interface. 
-:- import_module prog_data, hlds_module, hlds_pred, code_model, llds.
+:- import_module parse_tree__prog_data, hlds__hlds_module, hlds__hlds_pred.
+:- import_module backend_libs__code_model, ll_backend__llds.
 :- import_module list, assoc_list.
 
 	% Annotate every non-aditi procedure in the module with information
@@ -64,7 +65,7 @@
 
 :- implementation.
 
-:- import_module code_util, mode_util.
+:- import_module ll_backend__code_util, check_hlds__mode_util.
 :- import_module std_util, map, int, require.
 
 %-----------------------------------------------------------------------------%
Index: compiler/assertion.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/assertion.m,v
retrieving revision 1.15
diff -u -d -r1.15 assertion.m
--- compiler/assertion.m	22 Feb 2002 01:20:39 -0000	1.15
+++ compiler/assertion.m	6 Mar 2002 00:53:48 -0000
@@ -14,11 +14,12 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module (assertion).
+:- module (hlds__assertion).
 
 :- interface.
 
-:- import_module hlds_data, hlds_goal, hlds_module, hlds_pred, prog_data.
+:- import_module hlds__hlds_data, hlds__hlds_goal, hlds__hlds_module.
+:- import_module hlds__hlds_pred, parse_tree__prog_data.
 :- import_module io, std_util.
 
 	%
@@ -139,8 +140,9 @@
 
 :- implementation.
 
-:- import_module globals, goal_util, hlds_out.
-:- import_module options, prog_out, prog_util, type_util.
+:- import_module libs__globals, hlds__goal_util, hlds__hlds_out.
+:- import_module libs__options, parse_tree__prog_out, parse_tree__prog_util.
+:- import_module check_hlds__type_util.
 :- import_module assoc_list, bool, list, map, require, set, std_util.
 
 :- type subst == map(prog_var, prog_var).
Index: compiler/atsort.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/atsort.m,v
retrieving revision 1.11
diff -u -d -r1.11 atsort.m
--- compiler/atsort.m	23 Jan 1998 12:56:12 -0000	1.11
+++ compiler/atsort.m	5 Mar 2002 23:53:16 -0000
@@ -11,7 +11,7 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module atsort.
+:- module libs__atsort.
 
 :- interface.
 :- import_module map, list.
Index: compiler/backend_libs.m
===================================================================
RCS file: compiler/backend_libs.m
diff -N compiler/backend_libs.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ compiler/backend_libs.m	6 Mar 2002 00:21:49 -0000
@@ -0,0 +1,29 @@
+%-----------------------------------------------------------------------------%
+%
+% Back-end libraries.
+%
+% This package contains utility modules that are each used by
+% several different back-ends.
+%
+:- module backend_libs.
+:- interface.
+:- import_module transform_hlds, check_hlds. % are these needed?
+:- import_module hlds, parse_tree, libs.
+
+% modules that provide functionality used by several different back-ends
+:- include_module builtin_ops.
+:- include_module bytecode_data.
+:- include_module c_util.
+:- include_module code_model.
+:- include_module switch_util.
+:- include_module rtti, type_ctor_info, pseudo_type_info, base_typeclass_info.
+:- include_module foreign, export.
+
+%-----------------------------------------------------------------------------%
+
+:- implementation.
+:- import_module ll_backend. % XXX for llds_out__name_mangle.
+
+:- end_module backend_libs.
+
+%-----------------------------------------------------------------------------%
Index: compiler/base_type_info.m
===================================================================
RCS file: compiler/base_type_info.m
diff -N compiler/base_type_info.m
--- compiler/base_type_info.m	10 Mar 2000 13:37:38 -0000	1.33
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,9 +0,0 @@
-%---------------------------------------------------------------------------%
-% Copyright (C) 1996-2000 The University of Melbourne.
-% This file may only be copied under the terms of the GNU General
-% Public License - see the file COPYING in the Mercury distribution.
-%---------------------------------------------------------------------------%
-%
-% This file is no longer used. Its contents have migrated to type_ctor_info.m.
-%
-%---------------------------------------------------------------------------%
Index: compiler/base_type_layout.m
===================================================================
RCS file: compiler/base_type_layout.m
diff -N compiler/base_type_layout.m
--- compiler/base_type_layout.m	10 Mar 2000 13:37:38 -0000	1.55
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-%---------------------------------------------------------------------------%
-% Copyright (C) 1996-2000 The University of Melbourne.
-% This file may only be copied under the terms of the GNU General
-% Public License - see the file COPYING in the Mercury distribution.
-%---------------------------------------------------------------------------%
-%
-% This file is no longer used. Its contents have migrated to
-% pseudo_type_info.m and type_ctor_info.m.
-%
-%---------------------------------------------------------------------------%
Index: compiler/base_typeclass_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/base_typeclass_info.m,v
retrieving revision 1.20
diff -u -d -r1.20 base_typeclass_info.m
--- compiler/base_typeclass_info.m	1 Nov 2000 05:11:49 -0000	1.20
+++ compiler/base_typeclass_info.m	6 Mar 2002 00:53:48 -0000
@@ -16,11 +16,12 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module base_typeclass_info.
+:- module backend_libs__base_typeclass_info.
 
 :- interface.
 
-:- import_module hlds_module, list, rtti, prog_data.
+:- import_module hlds__hlds_module, list, backend_libs__rtti.
+:- import_module parse_tree__prog_data.
 
 :- pred base_typeclass_info__generate_rtti(module_info, list(rtti_data)).
 :- mode base_typeclass_info__generate_rtti(in, out) is det.
@@ -33,11 +34,11 @@
 
 :- implementation.
 
-:- import_module prog_io, prog_out.
-:- import_module hlds_data, hlds_pred, hlds_out.
-:- import_module code_util, globals, options, term.
+:- import_module parse_tree__prog_io, parse_tree__prog_out.
+:- import_module hlds__hlds_data, hlds__hlds_pred, hlds__hlds_out.
+:- import_module ll_backend__code_util, libs__globals, libs__options, term.
 :- import_module bool, string, map, std_util, require, assoc_list.
-:- import_module type_util, int.
+:- import_module check_hlds__type_util, int.
 
 %---------------------------------------------------------------------------%
 
Index: compiler/basic_block.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/basic_block.m,v
retrieving revision 1.12
diff -u -d -r1.12 basic_block.m
--- compiler/basic_block.m	24 Apr 2001 03:58:50 -0000	1.12
+++ compiler/basic_block.m	5 Mar 2002 23:53:16 -0000
@@ -13,11 +13,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module basic_block.
+:- module ll_backend__basic_block.
 
 :- interface.
 
-:- import_module llds.
+:- import_module ll_backend__llds.
 :- import_module list, map, std_util, counter.
 
 :- type block_map	==	map(label, block_info).
@@ -50,7 +50,7 @@
 
 :- implementation.
 
-:- import_module opt_util.
+:- import_module ll_backend__opt_util.
 :- import_module bool, int, require.
 
 create_basic_blocks(Instrs0, Comments, ProcLabel, C0, C,
Index: compiler/builtin_ops.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/builtin_ops.m,v
retrieving revision 1.10
diff -u -d -r1.10 builtin_ops.m
--- compiler/builtin_ops.m	3 Nov 2001 17:34:55 -0000	1.10
+++ compiler/builtin_ops.m	5 Mar 2002 23:53:32 -0000
@@ -14,9 +14,9 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module builtin_ops.
+:- module backend_libs__builtin_ops.
 :- interface.
-:- import_module prog_data, hlds_pred.
+:- import_module parse_tree__prog_data, hlds__hlds_pred.
 :- import_module list.
 
 
Index: compiler/bytecode.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode.m,v
retrieving revision 1.48
diff -u -d -r1.48 bytecode.m
--- compiler/bytecode.m	8 Jul 2001 16:40:04 -0000	1.48
+++ compiler/bytecode.m	6 Mar 2002 00:53:48 -0000
@@ -10,11 +10,12 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module bytecode.
+:- module bytecode_backend__bytecode.
 
 :- interface.
 
-:- import_module hlds_data, prog_data, tree, builtin_ops.
+:- import_module hlds__hlds_data, parse_tree__prog_data, libs__tree.
+:- import_module backend_libs__builtin_ops.
 :- import_module char, list, std_util, io.
 
 :- type byte_tree	==	tree(list(byte_code)).
@@ -137,7 +138,8 @@
 
 :- implementation.
 
-:- import_module bytecode_data, hlds_pred, prog_out, c_util.
+:- import_module backend_libs__bytecode_data, hlds__hlds_pred.
+:- import_module parse_tree__prog_out, backend_libs__c_util.
 :- import_module library, int, string, require.
 
 :- pred bytecode__version(int::out) is det.
Index: compiler/bytecode_backend.m
===================================================================
RCS file: compiler/bytecode_backend.m
diff -N compiler/bytecode_backend.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ compiler/bytecode_backend.m	6 Mar 2002 00:08:17 -0000
@@ -0,0 +1,22 @@
+%-----------------------------------------------------------------------------%
+%
+% Phase 5-bc: The bytecode generator
+%
+:- module bytecode_backend.
+:- interface.
+:- import_module transform_hlds, check_hlds. % are these needed?
+:- import_module hlds, parse_tree, libs, backend_libs.
+
+%-----------------------------------------------------------------------------%
+
+:- include_module bytecode, bytecode_gen.
+
+%-----------------------------------------------------------------------------%
+
+:- implementation.
+	% bytecode_gen uses ll_backend__call_gen.m
+:- import_module ll_backend.
+
+:- end_module bytecode_backend.
+
+%-----------------------------------------------------------------------------%
Index: compiler/bytecode_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode_data.m,v
retrieving revision 1.7
diff -u -d -r1.7 bytecode_data.m
--- compiler/bytecode_data.m	16 Oct 2000 01:33:30 -0000	1.7
+++ compiler/bytecode_data.m	5 Mar 2002 23:53:16 -0000
@@ -14,7 +14,7 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module bytecode_data.
+:- module backend_libs__bytecode_data.
 
 :- interface.
 
Index: compiler/bytecode_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode_gen.m,v
retrieving revision 1.66
diff -u -d -r1.66 bytecode_gen.m
--- compiler/bytecode_gen.m	20 Feb 2002 03:13:51 -0000	1.66
+++ compiler/bytecode_gen.m	6 Mar 2002 00:53:48 -0000
@@ -11,11 +11,11 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module bytecode_gen.
+:- module bytecode_backend__bytecode_gen.
 
 :- interface.
 
-:- import_module hlds_module, bytecode.
+:- import_module hlds__hlds_module, bytecode_backend__bytecode.
 :- import_module io, list.
 
 :- pred bytecode_gen__module(module_info::in, list(byte_code)::out,
@@ -36,15 +36,17 @@
 % in call_gen.m that we use here into arg_info.m, and to then rework
 % arg_info.m so that it didn't depend on the LLDS.
 
-:- import_module arg_info, call_gen. % XXX for arg passing convention
-:- import_module code_util.	% XXX for cons_id_to_tag
+:- import_module ll_backend__arg_info.
+:- import_module ll_backend__call_gen. % XXX for arg passing convention
+:- import_module ll_backend__code_util.	% XXX for cons_id_to_tag
 
-:- import_module prog_data.
-:- import_module hlds_pred, hlds_goal, hlds_data.
-:- import_module type_util, mode_util, goal_util.
-:- import_module builtin_ops, code_model, passes_aux, error_util.
-:- import_module globals, tree.
-:- import_module prog_out.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_pred, hlds__hlds_goal, hlds__hlds_data.
+:- import_module check_hlds__type_util, check_hlds__mode_util, hlds__goal_util.
+:- import_module backend_libs__builtin_ops, backend_libs__code_model.
+:- import_module hlds__passes_aux, hlds__error_util.
+:- import_module libs__globals, libs__tree.
+:- import_module parse_tree__prog_out.
 
 :- import_module bool, int, string, list, assoc_list, set, map, varset.
 :- import_module std_util, require, term.
Index: compiler/c_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/c_util.m,v
retrieving revision 1.9
diff -u -d -r1.9 c_util.m
--- compiler/c_util.m	13 Mar 2001 12:40:07 -0000	1.9
+++ compiler/c_util.m	5 Mar 2002 23:53:32 -0000
@@ -13,10 +13,10 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module c_util.
+:- module backend_libs__c_util.
 :- interface.
 :- import_module io, char, string, int.
-:- import_module builtin_ops.
+:- import_module backend_libs__builtin_ops.
 
 %-----------------------------------------------------------------------------%
 
@@ -107,7 +107,7 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
-:- import_module globals, options.
+:- import_module libs__globals, libs__options.
 :- import_module list, bool.
 
 %-----------------------------------------------------------------------------%
Index: compiler/call_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/call_gen.m,v
retrieving revision 1.149
diff -u -d -r1.149 call_gen.m
--- compiler/call_gen.m	24 May 2001 05:10:05 -0000	1.149
+++ compiler/call_gen.m	6 Mar 2002 00:53:48 -0000
@@ -14,11 +14,12 @@
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
 
-:- module call_gen.
+:- module ll_backend__call_gen.
 
 :- interface.
 
-:- import_module prog_data, hlds_pred, hlds_goal, code_model, llds, code_info.
+:- import_module parse_tree__prog_data, hlds__hlds_pred, hlds__hlds_goal.
+:- import_module backend_libs__code_model, ll_backend__llds, ll_backend__code_info.
 :- import_module list, assoc_list.
 
 :- pred call_gen__generate_call(code_model::in, pred_id::in, proc_id::in,
@@ -53,14 +54,16 @@
 
 :- implementation.
 
-:- import_module hlds_module, hlds_data.
-:- import_module polymorphism, type_util, mode_util, unify_proc, instmap.
-:- import_module builtin_ops.
-:- import_module arg_info, code_util, trace.
-:- import_module rl.
-:- import_module globals, options.
+:- import_module hlds__hlds_module, hlds__hlds_data.
+:- import_module check_hlds__polymorphism, check_hlds__type_util.
+:- import_module check_hlds__mode_util, check_hlds__unify_proc, hlds__instmap.
+:- import_module backend_libs__builtin_ops.
+:- import_module ll_backend__arg_info, ll_backend__code_util.
+:- import_module ll_backend__trace.
+:- import_module aditi_backend__rl.
+:- import_module libs__globals, libs__options.
 
-:- import_module std_util, bool, int, tree, map, set.
+:- import_module std_util, bool, int, libs__tree, map, set.
 :- import_module varset, require, string.
 
 %---------------------------------------------------------------------------%
Index: compiler/check_hlds.m
===================================================================
RCS file: compiler/check_hlds.m
diff -N compiler/check_hlds.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ compiler/check_hlds.m	6 Mar 2002 00:05:12 -0000
@@ -0,0 +1,54 @@
+%-----------------------------------------------------------------------------%
+%
+% Phase 3: Semantic analysis and error checking
+%	(the "front end" HLDS pass).
+%
+
+:- module check_hlds.
+:- interface.
+:- import_module hlds, parse_tree, libs.
+:- import_module backend_libs. % for base_typeclass_info, etc.
+%:- import_module check_hlds__type_analysis, check_hlds__mode_analysis.
+
+%-----------------------------------------------------------------------------%
+
+% Type checking
+%:- module type_analysis.
+    :- include_module check_typeclass, typecheck, purity, post_typecheck.
+    :- include_module type_util.
+%:- end_module type_analysis.
+
+% Polymorphism transformation.
+:- include_module polymorphism.
+:- include_module clause_to_proc.
+
+% Mode analysis
+%:- module mode_analysis.
+   :- include_module modes, modecheck_unify, modecheck_call.
+   :- include_module mode_info, delay_info, inst_match.
+   :- include_module inst_util, mode_errors, mode_util, mode_debug.
+   :- include_module unique_modes.
+   :- include_module unify_proc.
+%:- end_module mode_analysis.
+
+% Indexing and determinism analysis
+:- include_module switch_detection, cse_detection, det_analysis.
+:- include_module det_report, det_util.
+
+% Stratification.
+:- include_module stratify.
+
+% Warnings about simple code
+:- include_module simplify, common.
+
+:- include_module goal_path.
+
+%-----------------------------------------------------------------------------%
+          
+:- implementation.
+:- import_module transform_hlds. % for pd_cost, etc.
+:- import_module ll_backend. % XXX for code_util, code_aux
+
+:- end_module check_hlds.
+
+%-----------------------------------------------------------------------------%
Index: compiler/check_typeclass.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/check_typeclass.m,v
retrieving revision 1.45
diff -u -d -r1.45 check_typeclass.m
--- compiler/check_typeclass.m	19 Sep 2001 01:12:31 -0000	1.45
+++ compiler/check_typeclass.m	6 Mar 2002 00:53:48 -0000
@@ -44,12 +44,12 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module check_typeclass.
+:- module check_hlds__check_typeclass.
 
 
 :- interface.
 
-:- import_module hlds_module, make_hlds.
+:- import_module hlds__hlds_module, hlds__make_hlds.
 :- import_module bool, io.
 
 :- pred check_typeclass__check_instance_decls(module_info, qual_info,
@@ -59,12 +59,15 @@
 
 :- implementation.
 
-:- import_module prog_data, prog_out, prog_util.
-:- import_module hlds_pred, hlds_data, hlds_goal, hlds_out.
-:- import_module type_util, typecheck, mode_util, inst_match.
-:- import_module base_typeclass_info.
-:- import_module mercury_to_mercury, error_util.
-:- import_module globals, options. 
+:- import_module parse_tree__prog_data, parse_tree__prog_out.
+:- import_module parse_tree__prog_util.
+:- import_module hlds__hlds_pred, hlds__hlds_data, hlds__hlds_goal.
+:- import_module hlds__hlds_out.
+:- import_module check_hlds__type_util, check_hlds__typecheck.
+:- import_module check_hlds__mode_util, check_hlds__inst_match.
+:- import_module backend_libs__base_typeclass_info.
+:- import_module parse_tree__mercury_to_mercury, hlds__error_util.
+:- import_module libs__globals, libs__options. 
 
 :- import_module int, string.
 :- import_module list, assoc_list, map, set, term, varset.
Index: compiler/clause_to_proc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/clause_to_proc.m,v
retrieving revision 1.31
diff -u -d -r1.31 clause_to_proc.m
--- compiler/clause_to_proc.m	31 Jul 2001 14:29:29 -0000	1.31
+++ compiler/clause_to_proc.m	6 Mar 2002 00:53:48 -0000
@@ -4,11 +4,11 @@
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
 
-:- module clause_to_proc.
+:- module check_hlds__clause_to_proc.
 
 :- interface.
 
-:- import_module hlds_pred, hlds_module.
+:- import_module hlds__hlds_pred, hlds__hlds_module.
 :- import_module list, std_util.
 
 	% In the hlds, we initially record the clauses for a predicate
@@ -48,8 +48,9 @@
 
 :- implementation.
 
-:- import_module hlds_goal, hlds_data, prog_data, mode_util, make_hlds, purity.
-:- import_module globals.
+:- import_module hlds__hlds_goal, hlds__hlds_data, parse_tree__prog_data.
+:- import_module check_hlds__mode_util, hlds__make_hlds, check_hlds__purity.
+:- import_module libs__globals.
 :- import_module bool, int, set, map, varset.
 
 maybe_add_default_func_modes([], Preds, Preds).
Index: compiler/code_aux.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_aux.m,v
retrieving revision 1.62
diff -u -d -r1.62 code_aux.m
--- compiler/code_aux.m	3 Apr 2001 03:19:24 -0000	1.62
+++ compiler/code_aux.m	6 Mar 2002 00:53:48 -0000
@@ -11,11 +11,12 @@
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
 
-:- module code_aux.
+:- module ll_backend__code_aux.
 
 :- interface.
 
-:- import_module code_info, hlds_module, hlds_goal, prog_data.
+:- import_module ll_backend__code_info, hlds__hlds_module, hlds__hlds_goal.
+:- import_module parse_tree__prog_data.
 :- import_module bool.
 
 	% code_aux__contains_only_builtins(G) is true if G is a leaf procedure,
@@ -65,7 +66,8 @@
 
 :- implementation.
 
-:- import_module hlds_pred, llds, llds_out, varset, type_util, term_util.
+:- import_module hlds__hlds_pred, ll_backend__llds, ll_backend__llds_out.
+:- import_module varset, check_hlds__type_util, transform_hlds__term_util.
 :- import_module string, set, std_util, assoc_list, require.
 :- import_module list, map.
 
Index: compiler/code_exprn.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_exprn.m,v
retrieving revision 1.63
diff -u -d -r1.63 code_exprn.m
--- compiler/code_exprn.m	12 Sep 2000 00:13:30 -0000	1.63
+++ compiler/code_exprn.m	6 Mar 2002 00:53:48 -0000
@@ -32,11 +32,12 @@
 %------------------------------------------------------------------------------%
 %------------------------------------------------------------------------------%
 
-:- module code_exprn.
+:- module ll_backend__code_exprn.
 
 :- interface.
 
-:- import_module prog_data, hlds_goal, llds, options.
+:- import_module parse_tree__prog_data, hlds__hlds_goal, ll_backend__llds.
+:- import_module libs__options.
 :- import_module map, set, list, assoc_list.
 
 :- type exprn_info.
@@ -254,7 +255,8 @@
 
 :- implementation.
 
-:- import_module code_util, exprn_aux, tree, varset, term.
+:- import_module ll_backend__code_util, ll_backend__exprn_aux, libs__tree.
+:- import_module varset, term.
 :- import_module bool, bag, require, int, string, std_util.
 
 :- type var_stat	--->	evaled(set(rval))
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.99
diff -u -d -r1.99 code_gen.m
--- compiler/code_gen.m	20 Feb 2002 03:13:52 -0000	1.99
+++ compiler/code_gen.m	6 Mar 2002 00:53:48 -0000
@@ -26,13 +26,13 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module code_gen.
+:- module ll_backend__code_gen.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, hlds_goal.
-:- import_module code_model.
-:- import_module llds, code_info.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_goal.
+:- import_module backend_libs__code_model.
+:- import_module ll_backend__llds, ll_backend__code_info.
 
 :- import_module list, io, counter.
 
@@ -63,24 +63,32 @@
 :- implementation.
 
 % Parse tree modules
-:- import_module prog_data, prog_out, prog_util.
+:- import_module parse_tree__prog_data, parse_tree__prog_out.
+:- import_module parse_tree__prog_util.
 
 % HLDS modules
-:- import_module hlds_out, instmap, type_util, mode_util, goal_util.
+:- import_module hlds__hlds_out, hlds__instmap, check_hlds__type_util.
+:- import_module check_hlds__mode_util, hlds__goal_util.
 
 % LLDS code generator modules.
-:- import_module call_gen, unify_gen, ite_gen, switch_gen, disj_gen.
-:- import_module par_conj_gen, pragma_c_gen, commit_gen.
-:- import_module continuation_info, trace, trace_params.
-:- import_module code_aux, code_util, middle_rec, llds_out.
+:- import_module ll_backend__call_gen, ll_backend__unify_gen.
+:- import_module ll_backend__ite_gen, ll_backend__switch_gen, ll_backend__disj_gen.
+:- import_module ll_backend__par_conj_gen, ll_backend__pragma_c_gen.
+:- import_module ll_backend__commit_gen.
+:- import_module ll_backend__continuation_info, ll_backend__trace.
+:- import_module libs__trace_params.
+:- import_module ll_backend__code_aux, ll_backend__code_util.
+:- import_module ll_backend__middle_rec, ll_backend__llds_out.
 
 % Misc compiler modules
-:- import_module builtin_ops, passes_aux, rtti.
-:- import_module globals, options.
+:- import_module backend_libs__builtin_ops, hlds__passes_aux.
+:- import_module backend_libs__rtti.
+:- import_module libs__globals, libs__options.
 
 % Standard library modules
 :- import_module bool, char, int, string.
-:- import_module map, assoc_list, set, term, tree, std_util, require, varset.
+:- import_module map, assoc_list, set, term, libs__tree, std_util, require.
+:- import_module varset.
 
 %---------------------------------------------------------------------------%
 
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.264
diff -u -d -r1.264 code_info.m
--- compiler/code_info.m	24 Apr 2001 03:58:51 -0000	1.264
+++ compiler/code_info.m	6 Mar 2002 00:53:48 -0000
@@ -25,25 +25,28 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module code_info.
+:- module ll_backend__code_info.
 
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_module, hlds_pred, hlds_goal, hlds_data, instmap.
-:- import_module code_model.
-:- import_module llds, continuation_info, trace.
-:- import_module globals.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_goal.
+:- import_module hlds__hlds_data, hlds__instmap.
+:- import_module backend_libs__code_model.
+:- import_module ll_backend__llds, ll_backend__continuation_info.
+:- import_module ll_backend__trace.
+:- import_module libs__globals.
 
 :- import_module bool, set, list, map, std_util, assoc_list, counter.
 
 :- implementation.
 
-:- import_module prog_out.
-:- import_module type_util, mode_util.
-:- import_module arg_info, code_util, code_exprn, exprn_aux, var_locn.
-:- import_module trace_params, llds_out.
-:- import_module options, tree.
+:- import_module parse_tree__prog_out.
+:- import_module check_hlds__type_util, check_hlds__mode_util.
+:- import_module ll_backend__arg_info, ll_backend__code_util.
+:- import_module ll_backend__code_exprn, ll_backend__exprn_aux, ll_backend__var_locn.
+:- import_module libs__trace_params, ll_backend__llds_out.
+:- import_module libs__options, libs__tree.
 
 :- import_module term, varset.
 :- import_module set, stack.
Index: compiler/code_model.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_model.m,v
retrieving revision 1.1
diff -u -d -r1.1 code_model.m
--- compiler/code_model.m	23 Nov 2000 04:32:17 -0000	1.1
+++ compiler/code_model.m	5 Mar 2002 23:53:32 -0000
@@ -4,7 +4,7 @@
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
 
-:- module code_model.
+:- module backend_libs__code_model.
 
 % This module defines the `code_model' data type, and associated procedures.
 % The `code_model' type is a simplified version of the `determinism' type
@@ -20,8 +20,8 @@
 %-----------------------------------------------------------------------------%
 
 :- interface.
-:- import_module prog_data.
-:- import_module hlds_pred, hlds_goal.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_pred, hlds__hlds_goal.
 
 :- type code_model
 	--->	model_det		% functional & total
Index: compiler/code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_util.m,v
retrieving revision 1.134
diff -u -d -r1.134 code_util.m
--- compiler/code_util.m	20 Feb 2002 03:13:53 -0000	1.134
+++ compiler/code_util.m	6 Mar 2002 00:53:48 -0000
@@ -13,12 +13,13 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module code_util.
+:- module ll_backend__code_util.
 
 :- interface.
 
-:- import_module prog_data, hlds_module, hlds_pred, hlds_goal, hlds_data.
-:- import_module rtti, llds.
+:- import_module parse_tree__prog_data, hlds__hlds_module, hlds__hlds_pred.
+:- import_module hlds__hlds_goal, hlds__hlds_data.
+:- import_module backend_libs__rtti, ll_backend__llds.
 
 :- import_module bool, list, std_util.
 
@@ -188,7 +189,8 @@
 
 :- implementation.
 
-:- import_module prog_util, type_util, special_pred, builtin_ops, code_model.
+:- import_module parse_tree__prog_util, check_hlds__type_util.
+:- import_module hlds__special_pred, backend_libs__builtin_ops, backend_libs__code_model.
 
 :- import_module char, int, string, set, map, term, varset.
 :- import_module require, std_util, assoc_list.
Index: compiler/commit_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/commit_gen.m,v
retrieving revision 1.2
diff -u -d -r1.2 commit_gen.m
--- compiler/commit_gen.m	23 Nov 2000 04:32:33 -0000	1.2
+++ compiler/commit_gen.m	6 Mar 2002 00:53:48 -0000
@@ -12,18 +12,19 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module commit_gen.
+:- module ll_backend__commit_gen.
 
 :- interface.
 
-:- import_module hlds_goal, code_model, llds, code_info.
+:- import_module hlds__hlds_goal, backend_libs__code_model, ll_backend__llds.
+:- import_module ll_backend__code_info.
 
 :- pred commit_gen__generate_commit(code_model::in, hlds_goal::in,
 	code_tree::out, code_info::in, code_info::out) is det.
 
 :- implementation.
 
-:- import_module code_gen, tree.
+:- import_module ll_backend__code_gen, libs__tree.
 :- import_module std_util, require.
 
 commit_gen__generate_commit(OuterCodeModel, Goal, Code) -->
Index: compiler/common.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/common.m,v
retrieving revision 1.60
diff -u -d -r1.60 common.m
--- compiler/common.m	6 Dec 2001 10:16:39 -0000	1.60
+++ compiler/common.m	6 Mar 2002 00:53:48 -0000
@@ -26,10 +26,11 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module common.
+:- module check_hlds__common.
 :- interface.
 
-:- import_module hlds_pred, hlds_goal, prog_data, simplify.
+:- import_module hlds__hlds_pred, hlds__hlds_goal, parse_tree__prog_data.
+:- import_module check_hlds__simplify.
 :- import_module list.
 
 	% If we find a deconstruction or a construction we cannot optimize,
@@ -80,9 +81,12 @@
 
 :- implementation.
 
-:- import_module quantification, mode_util, type_util, prog_util.
-:- import_module det_util, det_report, globals, options, inst_match, instmap.
-:- import_module hlds_data, hlds_module, (inst), pd_cost, term.
+:- import_module hlds__quantification, check_hlds__mode_util.
+:- import_module check_hlds__type_util, parse_tree__prog_util.
+:- import_module check_hlds__det_util, check_hlds__det_report, libs__globals.
+:- import_module libs__options, check_hlds__inst_match, hlds__instmap.
+:- import_module hlds__hlds_data, hlds__hlds_module, (parse_tree__inst).
+:- import_module transform_hlds__pd_cost, term.
 :- import_module bool, map, set, eqvclass, require, std_util, string.
 
 :- type structure
Index: compiler/const_prop.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/const_prop.m,v
retrieving revision 1.13
diff -u -d -r1.13 const_prop.m
--- compiler/const_prop.m	3 Nov 2001 17:34:55 -0000	1.13
+++ compiler/const_prop.m	6 Mar 2002 00:53:48 -0000
@@ -15,11 +15,12 @@
 % 
 %------------------------------------------------------------------------------%
 
-:- module const_prop.
+:- module transform_hlds__const_prop.
 
 :- interface.
 
-:- import_module hlds_module, hlds_goal, hlds_pred, prog_data, instmap.
+:- import_module hlds__hlds_module, hlds__hlds_goal, hlds__hlds_pred.
+:- import_module parse_tree__prog_data, hlds__instmap.
 :- import_module list.
 
 :- pred evaluate_builtin(pred_id, proc_id, list(prog_var), hlds_goal_info,
@@ -31,12 +32,16 @@
 
 :- implementation.
 
-:- import_module code_aux, det_analysis, follow_code, goal_util.
-:- import_module hlds_goal, hlds_data, instmap, inst_match.
-:- import_module globals, options, passes_aux, prog_data, mode_util, type_util.
-:- import_module code_util, quantification, modes.
+:- import_module ll_backend__code_aux, check_hlds__det_analysis.
+:- import_module ll_backend__follow_code, hlds__goal_util.
+:- import_module hlds__hlds_goal, hlds__hlds_data, hlds__instmap.
+:- import_module check_hlds__inst_match.
+:- import_module libs__globals, libs__options, hlds__passes_aux.
+:- import_module parse_tree__prog_data, check_hlds__mode_util, check_hlds__type_util.
+:- import_module ll_backend__code_util, hlds__quantification.
+:- import_module check_hlds__modes.
 :- import_module bool, list, int, float, map, require.
-:- import_module (inst), hlds_out, std_util.
+:- import_module (parse_tree__inst), hlds__hlds_out, std_util.
 
 %------------------------------------------------------------------------------%
 
Index: compiler/constraint.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/constraint.m,v
retrieving revision 1.46
diff -u -d -r1.46 constraint.m
--- compiler/constraint.m	20 Aug 2001 17:43:08 -0000	1.46
+++ compiler/constraint.m	6 Mar 2002 00:53:48 -0000
@@ -13,11 +13,12 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module constraint.
+:- module transform_hlds__constraint.
 
 :- interface.
 
-:- import_module hlds_goal, hlds_module, instmap, prog_data.
+:- import_module hlds__hlds_goal, hlds__hlds_module, hlds__instmap.
+:- import_module parse_tree__prog_data.
 :- import_module bool, map.
 
 :- type constraint_info.
@@ -44,9 +45,11 @@
 
 :- implementation.
 
-:- import_module goal_util, hlds_pred, hlds_module, hlds_data.
-:- import_module mode_util, passes_aux, code_aux, inst_match, purity.
-:- import_module options, globals.
+:- import_module hlds__goal_util, hlds__hlds_pred, hlds__hlds_module.
+:- import_module hlds__hlds_data.
+:- import_module check_hlds__mode_util, hlds__passes_aux.
+:- import_module ll_backend__code_aux, check_hlds__inst_match, check_hlds__purity.
+:- import_module libs__options, libs__globals.
 
 :- import_module assoc_list, list, require, set, std_util.
 :- import_module string, term, varset.
Index: compiler/context.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/context.m,v
retrieving revision 1.4
diff -u -d -r1.4 context.m
--- compiler/context.m	2 May 2001 17:34:32 -0000	1.4
+++ compiler/context.m	6 Mar 2002 00:53:48 -0000
@@ -26,11 +26,12 @@
 %
 % See David Kemp's PhD thesis (available from http://www.cs.mu.oz.au/~kemp).
 %-----------------------------------------------------------------------------%
-:- module context.
+:- module aditi_backend__context.
 
 :- interface.
 
-:- import_module hlds_goal, hlds_pred, magic_util, prog_data.
+:- import_module hlds__hlds_goal, hlds__hlds_pred, aditi_backend__magic_util.
+:- import_module parse_tree__prog_data.
 :- import_module list.
 
 	% context__process_disjuncts(OrigPredProcId, Inputs, Outputs,
@@ -47,8 +48,9 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module hlds_data, hlds_module, (inst), instmap.
-:- import_module goal_util.
+:- import_module hlds__hlds_data, hlds__hlds_module, (parse_tree__inst).
+:- import_module hlds__instmap.
+:- import_module hlds__goal_util.
 :- import_module assoc_list, bool, map, require, set, std_util, term, varset.
 
 context__process_disjuncts(OldPredProcId, Inputs, Outputs,
Index: compiler/continuation_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/continuation_info.m,v
retrieving revision 1.39
diff -u -d -r1.39 continuation_info.m
--- compiler/continuation_info.m	20 Feb 2002 03:13:54 -0000	1.39
+++ compiler/continuation_info.m	6 Mar 2002 00:53:48 -0000
@@ -47,12 +47,14 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module continuation_info.
+:- module ll_backend__continuation_info.
 
 :- interface.
 
-:- import_module llds, hlds_module, hlds_pred, hlds_goal, prog_data.
-:- import_module (inst), instmap, trace, rtti, globals.
+:- import_module ll_backend__llds, hlds__hlds_module, hlds__hlds_pred.
+:- import_module hlds__hlds_goal, parse_tree__prog_data.
+:- import_module (parse_tree__inst), hlds__instmap, ll_backend__trace.
+:- import_module backend_libs__rtti, libs__globals.
 :- import_module bool, std_util, list, assoc_list, set, map.
 
 	%
@@ -318,7 +320,8 @@
 
 :- implementation.
 
-:- import_module hlds_goal, code_util, type_util, inst_match, options.
+:- import_module hlds__hlds_goal, ll_backend__code_util.
+:- import_module check_hlds__type_util, check_hlds__inst_match, libs__options.
 :- import_module string, require, term, varset.
 
 %-----------------------------------------------------------------------------%
Index: compiler/cse_detection.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/cse_detection.m,v
retrieving revision 1.70
diff -u -d -r1.70 cse_detection.m
--- compiler/cse_detection.m	7 Apr 2001 14:04:33 -0000	1.70
+++ compiler/cse_detection.m	6 Mar 2002 00:53:48 -0000
@@ -14,11 +14,11 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module cse_detection.
+:- module check_hlds__cse_detection.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, io.
+:- import_module hlds__hlds_module, hlds__hlds_pred, io.
 
 :- pred detect_cse(module_info::in, module_info::out,
 	io__state::di, io__state::uo) is det.
@@ -32,10 +32,13 @@
 
 :- implementation.
 
-:- import_module hlds_goal, hlds_data, options, globals, goal_util, hlds_out.
-:- import_module type_util, modes, mode_util, quantification, instmap.
-:- import_module prog_data, switch_detection, det_util, inst_match.
-:- import_module switch_detection, term, varset.
+:- import_module hlds__hlds_goal, hlds__hlds_data, libs__options.
+:- import_module libs__globals, hlds__goal_util, hlds__hlds_out.
+:- import_module check_hlds__type_util, check_hlds__modes.
+:- import_module check_hlds__mode_util, hlds__quantification, hlds__instmap.
+:- import_module parse_tree__prog_data, check_hlds__switch_detection.
+:- import_module check_hlds__det_util, check_hlds__inst_match.
+:- import_module check_hlds__switch_detection, term, varset.
 
 :- import_module int, bool, list, assoc_list, map, multi_map.
 :- import_module set, std_util, require.
Index: compiler/dead_proc_elim.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.68
diff -u -d -r1.68 dead_proc_elim.m
--- compiler/dead_proc_elim.m	22 Feb 2002 01:20:39 -0000	1.68
+++ compiler/dead_proc_elim.m	6 Mar 2002 00:53:48 -0000
@@ -14,11 +14,11 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module dead_proc_elim.
+:- module transform_hlds__dead_proc_elim.
 
 :- interface.
 
-:- import_module prog_data, hlds_module, hlds_pred.
+:- import_module parse_tree__prog_data, hlds__hlds_module, hlds__hlds_pred.
 :- import_module map, std_util, io.
 
 :- pred dead_proc_elim(module_info, module_info, io__state, io__state).
@@ -50,8 +50,10 @@
 
 :- implementation.
 
-:- import_module hlds_goal, hlds_data, prog_util, llds.
-:- import_module passes_aux, globals, options, code_util.
+:- import_module hlds__hlds_goal, hlds__hlds_data, parse_tree__prog_util.
+:- import_module ll_backend__llds.
+:- import_module hlds__passes_aux, libs__globals, libs__options.
+:- import_module ll_backend__code_util.
 
 :- import_module int, string, list, set, queue, bool, require.
 
Index: compiler/deep_profiling.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/deep_profiling.m,v
retrieving revision 1.6
diff -u -d -r1.6 deep_profiling.m
--- compiler/deep_profiling.m	26 Feb 2002 02:52:25 -0000	1.6
+++ compiler/deep_profiling.m	6 Mar 2002 00:53:48 -0000
@@ -12,11 +12,11 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module deep_profiling.
+:- module ll_backend__deep_profiling.
 
 :- interface.
 
-:- import_module hlds_module, layout.
+:- import_module hlds__hlds_module, ll_backend__layout.
 :- import_module io, list.
 
 :- pred apply_deep_profiling_transformation(module_info::in, module_info::out,
@@ -26,10 +26,13 @@
 
 :- implementation.
 
-:- import_module (inst), instmap, hlds_data, hlds_pred, hlds_goal, prog_data.
-:- import_module code_model, code_util, prog_util, type_util, mode_util.
-:- import_module quantification, dependency_graph, rtti, trace.
-:- import_module options, globals.
+:- import_module (parse_tree__inst), hlds__instmap, hlds__hlds_data.
+:- import_module hlds__hlds_pred, hlds__hlds_goal, parse_tree__prog_data.
+:- import_module backend_libs__code_model, ll_backend__code_util.
+:- import_module parse_tree__prog_util, check_hlds__type_util, check_hlds__mode_util.
+:- import_module hlds__quantification, transform_hlds__dependency_graph.
+:- import_module backend_libs__rtti, ll_backend__trace.
+:- import_module libs__options, libs__globals.
 :- import_module bool, int, list, assoc_list, map, require, set.
 :- import_module std_util, string, term, varset, counter.
 
Index: compiler/deforest.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/deforest.m,v
retrieving revision 1.24
diff -u -d -r1.24 deforest.m
--- compiler/deforest.m	11 Aug 2001 14:09:37 -0000	1.24
+++ compiler/deforest.m	6 Mar 2002 00:53:48 -0000
@@ -29,11 +29,11 @@
 % <http://www.cs.mu.oz.au/research/mercury/information/papers/stayl_hons.ps.gz>
 %
 %-----------------------------------------------------------------------------%
-:- module deforest.
+:- module transform_hlds__deforest.
 
 :- interface.
 
-:- import_module hlds_module.
+:- import_module hlds__hlds_module.
 :- import_module io.
 
 :- pred deforestation(module_info::in, module_info::out,
@@ -43,13 +43,20 @@
 
 :- implementation.
 
-:- import_module pd_cost, pd_debug, pd_info, pd_term, pd_util.
-:- import_module hlds_pred, hlds_goal, inlining, passes_aux.
-:- import_module (inst), instmap, inst_match, simplify.
-:- import_module dependency_graph, hlds_data, det_analysis, globals.
-:- import_module mode_util, goal_util, prog_data, prog_util, purity.
-:- import_module modes, mode_info, unique_modes, options, hlds_out.
-:- import_module prog_out, quantification, det_report.
+:- import_module transform_hlds__pd_cost, transform_hlds__pd_debug.
+:- import_module transform_hlds__pd_info, transform_hlds__pd_term, transform_hlds__pd_util.
+:- import_module hlds__hlds_pred, hlds__hlds_goal, transform_hlds__inlining.
+:- import_module hlds__passes_aux.
+:- import_module (parse_tree__inst), hlds__instmap, check_hlds__inst_match.
+:- import_module check_hlds__simplify.
+:- import_module transform_hlds__dependency_graph, hlds__hlds_data.
+:- import_module check_hlds__det_analysis, libs__globals.
+:- import_module check_hlds__mode_util, hlds__goal_util.
+:- import_module parse_tree__prog_data, parse_tree__prog_util, check_hlds__purity.
+:- import_module check_hlds__modes, check_hlds__mode_info.
+:- import_module check_hlds__unique_modes, libs__options, hlds__hlds_out.
+:- import_module parse_tree__prog_out, hlds__quantification.
+:- import_module check_hlds__det_report.
 
 :- import_module assoc_list, bool, getopt, int, list, map, require.
 :- import_module set, std_util, string, term, varset.
Index: compiler/delay_construct.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/delay_construct.m,v
retrieving revision 1.1
diff -u -d -r1.1 delay_construct.m
--- compiler/delay_construct.m	24 Apr 2001 03:39:36 -0000	1.1
+++ compiler/delay_construct.m	6 Mar 2002 00:53:48 -0000
@@ -23,11 +23,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module delay_construct.
+:- module transform_hlds__delay_construct.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred.
+:- import_module hlds__hlds_module, hlds__hlds_pred.
 :- import_module io.
 
 :- pred delay_construct_proc(pred_id::in, proc_id::in, module_info::in,
@@ -37,8 +37,9 @@
 
 :- implementation.
 
-:- import_module prog_data, hlds_data, hlds_goal, passes_aux, globals.
-:- import_module instmap, inst_match.
+:- import_module parse_tree__prog_data, hlds__hlds_data, hlds__hlds_goal.
+:- import_module hlds__passes_aux, libs__globals.
+:- import_module hlds__instmap, check_hlds__inst_match.
 :- import_module bool, list, set, std_util, require.
 
 %-----------------------------------------------------------------------------%
Index: compiler/delay_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/delay_info.m,v
retrieving revision 1.17
diff -u -d -r1.17 delay_info.m
--- compiler/delay_info.m	20 Nov 1998 04:07:19 -0000	1.17
+++ compiler/delay_info.m	6 Mar 2002 00:53:48 -0000
@@ -16,11 +16,12 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module delay_info.
+:- module check_hlds__delay_info.
 
 :- interface.
 
-:- import_module hlds_goal, prog_data, mode_errors.
+:- import_module hlds__hlds_goal, parse_tree__prog_data.
+:- import_module check_hlds__mode_errors.
 :- import_module list.
 
 %-----------------------------------------------------------------------------%
@@ -90,7 +91,7 @@
 
 :- implementation.
 :- import_module int, stack, set, map, require, std_util.
-:- import_module mode_errors.	% for the mode_error_info and delay_info
+:- import_module check_hlds__mode_errors.	% for the mode_error_info and delay_info
 				% types.
 
 	% The delay_info structure is a tangled web of substructures
Index: compiler/delay_slot.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/delay_slot.m,v
retrieving revision 1.7
diff -u -d -r1.7 delay_slot.m
--- compiler/delay_slot.m	20 Jul 1998 10:00:33 -0000	1.7
+++ compiler/delay_slot.m	5 Mar 2002 23:53:16 -0000
@@ -44,11 +44,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module delay_slot.
+:- module ll_backend__delay_slot.
 
 :- interface.
 
-:- import_module llds, list.
+:- import_module ll_backend__llds, list.
 
 	% Delay the construction of det stack frames as long as possible,
 	% in order to avoid the construction in as many cases as possible.
Index: compiler/dense_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dense_switch.m,v
retrieving revision 1.40
diff -u -d -r1.40 dense_switch.m
--- compiler/dense_switch.m	20 Jan 2001 15:42:42 -0000	1.40
+++ compiler/dense_switch.m	6 Mar 2002 00:53:48 -0000
@@ -12,13 +12,14 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module dense_switch.
+:- module ll_backend__dense_switch.
 
 :- interface.
 
-:- import_module prog_data, hlds_data, hlds_goal, code_model.
-:- import_module switch_util, type_util.
-:- import_module llds, code_info.
+:- import_module parse_tree__prog_data, hlds__hlds_data, hlds__hlds_goal.
+:- import_module backend_libs__code_model.
+:- import_module backend_libs__switch_util, check_hlds__type_util.
+:- import_module ll_backend__llds, ll_backend__code_info.
 
 	% Should this switch be implemented as a dense jump table?
 	% If so, we return the starting and ending values for the table,
@@ -51,9 +52,10 @@
 
 :- implementation.
 
-:- import_module builtin_ops, hlds_module, code_gen, trace.
+:- import_module backend_libs__builtin_ops, hlds__hlds_module.
+:- import_module ll_backend__code_gen, ll_backend__trace.
 
-:- import_module char, map, tree, int, std_util, require, list.
+:- import_module char, map, libs__tree, int, std_util, require, list.
 
 dense_switch__is_dense_switch(CaseVar, TaggedCases, CanFail0, ReqDensity,
 		FirstVal, LastVal, CanFail) -->
Index: compiler/dependency_graph.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dependency_graph.m,v
retrieving revision 1.55
diff -u -d -r1.55 dependency_graph.m
--- compiler/dependency_graph.m	20 Feb 2002 03:13:55 -0000	1.55
+++ compiler/dependency_graph.m	6 Mar 2002 00:53:49 -0000
@@ -4,7 +4,7 @@
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
 
-:- module dependency_graph.
+:- module transform_hlds__dependency_graph.
 % Main author: bromage, conway, stayl.
 
 % The dependency_graph records which procedures depend on which other
@@ -20,7 +20,7 @@
 %-----------------------------------------------------------------------------%
 
 :- interface.
-:- import_module hlds_module, hlds_pred.
+:- import_module hlds__hlds_module, hlds__hlds_pred.
 :- import_module bool, list, io.
 
 	% Ensure that the module_info contains a version of the
@@ -98,14 +98,15 @@
 
 :- implementation.
 
-:- import_module hlds_goal, hlds_data, prog_data.
-:- import_module mode_util, globals, options, code_util, goal_util.
-:- import_module mercury_to_mercury.
+:- import_module hlds__hlds_goal, hlds__hlds_data, parse_tree__prog_data.
+:- import_module check_hlds__mode_util, libs__globals, libs__options.
+:- import_module ll_backend__code_util, hlds__goal_util.
+:- import_module parse_tree__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 ll_backend__llds, ll_backend__llds_out.
 
 :- import_module term, varset.
 :- import_module int, bool, term, require, string.
Index: compiler/det_analysis.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/det_analysis.m,v
retrieving revision 1.152
diff -u -d -r1.152 det_analysis.m
--- compiler/det_analysis.m	26 Feb 2002 02:52:25 -0000	1.152
+++ compiler/det_analysis.m	6 Mar 2002 00:53:49 -0000
@@ -48,13 +48,14 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module det_analysis.
+:- module check_hlds__det_analysis.
 
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_goal, hlds_module, hlds_pred, hlds_data, instmap.
-:- import_module det_report, det_util, globals.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_goal, hlds__hlds_module, hlds__hlds_pred.
+:- import_module hlds__hlds_data, hlds__instmap.
+:- import_module check_hlds__det_report, check_hlds__det_util, libs__globals.
 :- import_module list, std_util, io.
 
 	% Perform determinism inference for local predicates with no
@@ -120,9 +121,10 @@
 
 :- implementation.
 
-:- import_module purity.
-:- import_module type_util, modecheck_call, mode_util, options, passes_aux.
-:- import_module hlds_out, mercury_to_mercury.
+:- import_module check_hlds__purity.
+:- import_module check_hlds__type_util, check_hlds__modecheck_call.
+:- import_module check_hlds__mode_util, libs__options, hlds__passes_aux.
+:- import_module hlds__hlds_out, parse_tree__mercury_to_mercury.
 :- import_module assoc_list, bool, map, set, require, term.
 
 %-----------------------------------------------------------------------------%
Index: compiler/det_report.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/det_report.m,v
retrieving revision 1.69
diff -u -d -r1.69 det_report.m
--- compiler/det_report.m	11 Feb 2002 09:59:09 -0000	1.69
+++ compiler/det_report.m	6 Mar 2002 00:53:49 -0000
@@ -10,13 +10,13 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module det_report.
+:- module check_hlds__det_report.
 
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_module, hlds_pred, hlds_goal.
-:- import_module det_util.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_goal.
+:- import_module check_hlds__det_util.
 
 :- import_module io, list.
 
@@ -135,11 +135,12 @@
 
 :- implementation.
 
-:- import_module prog_out. 
-:- import_module hlds_data, type_util, mode_util, inst_match.
-:- import_module hlds_out, mercury_to_mercury.
-:- import_module code_util, passes_aux.
-:- import_module globals, options.
+:- import_module parse_tree__prog_out. 
+:- import_module hlds__hlds_data, check_hlds__type_util.
+:- import_module check_hlds__mode_util, check_hlds__inst_match.
+:- import_module hlds__hlds_out, parse_tree__mercury_to_mercury.
+:- import_module ll_backend__code_util, hlds__passes_aux.
+:- import_module libs__globals, libs__options.
 
 :- import_module assoc_list, bool, int, map, set, std_util, require, string.
 :- import_module getopt, term, varset.
Index: compiler/det_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/det_util.m,v
retrieving revision 1.20
diff -u -d -r1.20 det_util.m
--- compiler/det_util.m	13 Dec 2000 00:00:18 -0000	1.20
+++ compiler/det_util.m	6 Mar 2002 00:53:49 -0000
@@ -12,12 +12,13 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module det_util.
+:- module check_hlds__det_util.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, hlds_goal, hlds_data, globals.
-:- import_module instmap, prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_goal.
+:- import_module hlds__hlds_data, libs__globals.
+:- import_module hlds__instmap, parse_tree__prog_data.
 :- import_module bool, set, list.
 
 :- type maybe_changed	--->	changed ; unchanged.
@@ -96,7 +97,8 @@
 
 :- implementation.
 
-:- import_module inst_match, mode_util, type_util, options, term.
+:- import_module check_hlds__inst_match, check_hlds__mode_util.
+:- import_module check_hlds__type_util, libs__options, term.
 :- import_module map, require, std_util.
 
 update_instmap(_Goal0 - GoalInfo0, InstMap0, InstMap) :-
Index: compiler/disj_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/disj_gen.m,v
retrieving revision 1.73
diff -u -d -r1.73 disj_gen.m
--- compiler/disj_gen.m	23 Nov 2000 04:32:34 -0000	1.73
+++ compiler/disj_gen.m	6 Mar 2002 00:53:49 -0000
@@ -13,11 +13,12 @@
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
 
-:- module disj_gen.
+:- module ll_backend__disj_gen.
 
 :- interface.
 
-:- import_module hlds_goal, code_model, llds, code_info.
+:- import_module hlds__hlds_goal, backend_libs__code_model, ll_backend__llds.
+:- import_module ll_backend__code_info.
 :- import_module list.
 
 :- pred disj_gen__generate_disj(code_model::in, list(hlds_goal)::in,
@@ -27,10 +28,11 @@
 
 :- implementation.
 
-:- import_module prog_data, hlds_data, code_gen, code_util, trace.
-:- import_module options, globals, tree.
+:- import_module parse_tree__prog_data, hlds__hlds_data, ll_backend__code_gen.
+:- import_module ll_backend__code_util, ll_backend__trace.
+:- import_module libs__options, libs__globals, libs__tree.
 
-:- import_module bool, set, tree, map, std_util, term, require.
+:- import_module bool, set, libs__tree, map, std_util, term, require.
 
 disj_gen__generate_disj(CodeModel, Goals, StoreMap, Code) -->
 	(
Index: compiler/dnf.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dnf.m,v
retrieving revision 1.45
diff -u -d -r1.45 dnf.m
--- compiler/dnf.m	24 May 2001 05:45:37 -0000	1.45
+++ compiler/dnf.m	6 Mar 2002 00:53:49 -0000
@@ -41,11 +41,11 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module dnf.
+:- module aditi_backend__dnf.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred.
+:- import_module hlds__hlds_module, hlds__hlds_pred.
 :- import_module set, list, bool, std_util.
 
 :- pred dnf__transform_module(module_info::in, bool::in,
@@ -60,8 +60,10 @@
 
 :- implementation.
 
-:- import_module code_aux, code_util, hlds_goal, hlds_data, prog_data, instmap.
-:- import_module dependency_graph, det_analysis, mode_util.
+:- import_module ll_backend__code_aux, ll_backend__code_util, hlds__hlds_goal.
+:- import_module hlds__hlds_data, parse_tree__prog_data, hlds__instmap.
+:- import_module transform_hlds__dependency_graph, check_hlds__det_analysis.
+:- import_module check_hlds__mode_util.
 :- import_module require, map, list, string, int, bool, std_util, term, varset.
 
 	% Traverse the module structure.
Index: compiler/dupelim.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dupelim.m,v
retrieving revision 1.51
diff -u -d -r1.51 dupelim.m
--- compiler/dupelim.m	21 Feb 2002 05:16:29 -0000	1.51
+++ compiler/dupelim.m	5 Mar 2002 23:53:33 -0000
@@ -39,11 +39,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module dupelim.
+:- module ll_backend__dupelim.
 
 :- interface.
 
-:- import_module llds.
+:- import_module ll_backend__llds.
 :- import_module list, counter.
 
 :- pred dupelim_main(list(instruction)::in, proc_label::in,
@@ -53,7 +53,7 @@
 
 :- implementation.
 
-:- import_module basic_block, opt_util.
+:- import_module ll_backend__basic_block, ll_backend__opt_util.
 :- import_module bool, std_util, assoc_list, set, map, require.
 
 	% A std_map maps a list of standardized instructions to the list
Index: compiler/equiv_type.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/equiv_type.m,v
retrieving revision 1.27
diff -u -d -r1.27 equiv_type.m
--- compiler/equiv_type.m	26 Feb 2002 02:45:36 -0000	1.27
+++ compiler/equiv_type.m	6 Mar 2002 00:53:49 -0000
@@ -9,10 +9,10 @@
 
 % main author: fjh
 
-:- module equiv_type.
+:- module parse_tree__equiv_type.
 :- interface.
 :- import_module bool, list, io, std_util.
-:- import_module recompilation, prog_data.
+:- import_module hlds__recompilation, parse_tree__prog_data.
 
 %-----------------------------------------------------------------------------%
 
@@ -49,10 +49,11 @@
 
 :- implementation.
 :- import_module assoc_list, bool, require, std_util, map, set, term, varset.
-:- import_module prog_data, prog_util, prog_out.
+:- import_module parse_tree__prog_data, parse_tree__prog_util.
+:- import_module parse_tree__prog_out.
 
 % XXX we shouldn't import the HLDS here.
-:- import_module hlds_data, type_util.
+:- import_module hlds__hlds_data, check_hlds__type_util.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
Index: compiler/error_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/error_util.m,v
retrieving revision 1.16
diff -u -d -r1.16 error_util.m
--- compiler/error_util.m	22 Feb 2002 01:20:40 -0000	1.16
+++ compiler/error_util.m	6 Mar 2002 00:53:49 -0000
@@ -12,11 +12,11 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module error_util.
+:- module hlds__error_util.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred, parse_tree__prog_data.
 :- import_module assoc_list, char, io, list, std_util.
 
 	% Given a context, a starting indentation level and a list of words,
@@ -132,7 +132,8 @@
 
 :- implementation.
 
-:- import_module prog_out, prog_util, globals, options.
+:- import_module parse_tree__prog_out, parse_tree__prog_util, libs__globals.
+:- import_module libs__options.
 :- import_module bool, io, list, term, char, string, int, require.
 
 error_util__list_to_pieces([], []).
Index: compiler/export.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/export.m,v
retrieving revision 1.51
diff -u -d -r1.51 export.m
--- compiler/export.m	18 Feb 2002 07:00:50 -0000	1.51
+++ compiler/export.m	6 Mar 2002 00:53:49 -0000
@@ -14,11 +14,12 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module export.
+:- module backend_libs__export.
 
 :- interface.
 
-:- import_module prog_data, hlds_module, foreign.
+:- import_module parse_tree__prog_data, hlds__hlds_module.
+:- import_module backend_libs__foreign.
 :- import_module io.
 
 	% From the module_info, get a list of foreign_export_decls,
@@ -65,12 +66,13 @@
 
 :- implementation.
 
-:- import_module foreign.
-:- import_module modules.
-:- import_module hlds_pred, type_util.
-:- import_module code_model.
-:- import_module code_gen, code_util, llds_out.
-:- import_module globals, options.
+:- import_module backend_libs__foreign.
+:- import_module parse_tree__modules.
+:- import_module hlds__hlds_pred, check_hlds__type_util.
+:- import_module backend_libs__code_model.
+:- import_module ll_backend__code_gen, ll_backend__code_util.
+:- import_module ll_backend__llds_out.
+:- import_module libs__globals, libs__options.
 
 :- import_module term, varset.
 :- import_module library, map, int, string, std_util, assoc_list, require.
Index: compiler/exprn_aux.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/exprn_aux.m,v
retrieving revision 1.41
diff -u -d -r1.41 exprn_aux.m
--- compiler/exprn_aux.m	24 Apr 2001 03:58:55 -0000	1.41
+++ compiler/exprn_aux.m	5 Mar 2002 23:53:33 -0000
@@ -4,11 +4,11 @@
 % Public License - see the file COPYING in the Mercury distribution.
 %------------------------------------------------------------------------------%
 
-:- module exprn_aux.
+:- module ll_backend__exprn_aux.
 
 :- interface.
 
-:- import_module llds, options, prog_data.
+:- import_module ll_backend__llds, libs__options, parse_tree__prog_data.
 :- import_module list, std_util, bool, assoc_list.
 
 :- type exprn_opts
@@ -102,7 +102,7 @@
 
 :- implementation.
 
-:- import_module options.
+:- import_module libs__options.
 :- import_module int, set, require, getopt.
 
 exprn_aux__init_exprn_opts(Options, ExprnOpts) :-
Index: compiler/fact_table.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/fact_table.m,v
retrieving revision 1.41
diff -u -d -r1.41 fact_table.m
--- compiler/fact_table.m	18 Feb 2002 07:00:50 -0000	1.41
+++ compiler/fact_table.m	6 Mar 2002 00:53:49 -0000
@@ -45,12 +45,12 @@
 % floats.
 
 
-:- module fact_table.
+:- module ll_backend__fact_table.
 
 :- interface.
 
 :- import_module io, list.
-:- import_module prog_data, hlds_pred, hlds_module.
+:- import_module parse_tree__prog_data, hlds__hlds_pred, hlds__hlds_module.
 
 	% compile the fact table into a separate .c file.
 	% fact_table_compile_facts(PredName, Arity, FileName, PredInfo0, 
@@ -92,15 +92,18 @@
 :- import_module parser, term, term_io.
 
 % Parse tree modules
-:- import_module prog_util, prog_io, prog_out, modules.
+:- import_module parse_tree__prog_util, parse_tree__prog_io.
+:- import_module parse_tree__prog_out, parse_tree__modules.
 % HLDS modules
-:- import_module hlds_out, hlds_data, mode_util, inst_match.
+:- import_module hlds__hlds_out, hlds__hlds_data, check_hlds__mode_util.
+:- import_module check_hlds__inst_match.
 % LLDS back-end modules
-:- import_module arg_info, llds, llds_out, code_util, export, foreign.
+:- import_module ll_backend__arg_info, ll_backend__llds, ll_backend__llds_out.
+:- import_module ll_backend__code_util, backend_libs__export, backend_libs__foreign.
 % Modules shared between different back-ends.
-:- import_module passes_aux, code_model.
+:- import_module hlds__passes_aux, backend_libs__code_model.
 % Misc
-:- import_module globals, options.
+:- import_module libs__globals, libs__options.
 
 :- type fact_result
 	--->	ok ; error.
Index: compiler/follow_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/follow_code.m,v
retrieving revision 1.62
diff -u -d -r1.62 follow_code.m
--- compiler/follow_code.m	7 Apr 2001 14:04:36 -0000	1.62
+++ compiler/follow_code.m	6 Mar 2002 00:53:49 -0000
@@ -9,11 +9,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module follow_code.
+:- module ll_backend__follow_code.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, hlds_goal.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_goal.
 :- import_module list.
 
 :- pred move_follow_code_in_proc(pred_info::in, proc_info::in, proc_info::out,
@@ -28,8 +28,10 @@
 
 :- implementation.
 
-:- import_module hlds_data, goal_util, mode_util, prog_data.
-:- import_module globals, options, det_analysis, quantification.
+:- import_module hlds__hlds_data, hlds__goal_util, check_hlds__mode_util.
+:- import_module parse_tree__prog_data.
+:- import_module libs__globals, libs__options, check_hlds__det_analysis.
+:- import_module hlds__quantification.
 :- import_module bool, map, set, term, std_util, require.
 
 %-----------------------------------------------------------------------------%
Index: compiler/follow_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/follow_vars.m,v
retrieving revision 1.62
diff -u -d -r1.62 follow_vars.m
--- compiler/follow_vars.m	7 Apr 2001 14:04:37 -0000	1.62
+++ compiler/follow_vars.m	6 Mar 2002 00:53:49 -0000
@@ -24,11 +24,12 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module follow_vars.
+:- module ll_backend__follow_vars.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, hlds_goal, prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_goal.
+:- import_module parse_tree__prog_data.
 :- import_module map.
 
 :- pred find_final_follow_vars(proc_info::in, follow_vars_map::out, int::out)
@@ -43,11 +44,12 @@
 
 :- implementation.
 
-:- import_module prog_data.
-:- import_module hlds_data, quantification, mode_util.
-:- import_module code_model.
-:- import_module llds, call_gen, code_util, arg_info.
-:- import_module globals.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_data, hlds__quantification, check_hlds__mode_util.
+:- import_module backend_libs__code_model.
+:- import_module ll_backend__llds, ll_backend__call_gen.
+:- import_module ll_backend__code_util, ll_backend__arg_info.
+:- import_module libs__globals.
 
 :- import_module bool, int, list, assoc_list, map, set, std_util, require.
 
Index: compiler/foreign.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/foreign.m,v
retrieving revision 1.10
diff -u -d -r1.10 foreign.m
--- compiler/foreign.m	16 Jan 2002 01:13:18 -0000	1.10
+++ compiler/foreign.m	6 Mar 2002 00:53:49 -0000
@@ -14,12 +14,12 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module foreign.
+:- module backend_libs__foreign.
 
 :- interface.
 
-:- import_module prog_data, globals.
-:- import_module hlds_module, hlds_pred.
+:- import_module parse_tree__prog_data, libs__globals.
+:- import_module hlds__hlds_module, hlds__hlds_pred.
 
 :- import_module bool, list, string, term.
 
@@ -172,9 +172,10 @@
 :- import_module list, map, assoc_list, std_util, string, varset, int, term.
 :- import_module require.
 
-:- import_module hlds_pred, hlds_module, type_util, mode_util, error_util.
-:- import_module hlds_data, prog_out.
-:- import_module code_model, globals.
+:- import_module hlds__hlds_pred, hlds__hlds_module, check_hlds__type_util.
+:- import_module check_hlds__mode_util, hlds__error_util.
+:- import_module hlds__hlds_data, parse_tree__prog_out.
+:- import_module backend_libs__code_model, libs__globals.
 
 	% Currently we don't use the globals to compare foreign language
 	% interfaces, but if we added appropriate options we might want
Index: compiler/frameopt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/frameopt.m,v
retrieving revision 1.79
diff -u -d -r1.79 frameopt.m
--- compiler/frameopt.m	24 Apr 2001 03:58:55 -0000	1.79
+++ compiler/frameopt.m	6 Mar 2002 00:53:49 -0000
@@ -84,11 +84,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module frameopt.
+:- module ll_backend__frameopt.
 
 :- interface.
 
-:- import_module llds.
+:- import_module ll_backend__llds.
 :- import_module bool, list, counter.
 
 	% The first bool output says whether we performed any modifications.
@@ -104,7 +104,8 @@
 
 :- implementation.
 
-:- import_module livemap, prog_data, opt_util, code_util, opt_debug.
+:- import_module ll_backend__livemap, parse_tree__prog_data.
+:- import_module ll_backend__opt_util, ll_backend__code_util, ll_backend__opt_debug.
 :- import_module int, string, require, std_util, assoc_list, set, map, queue.
 
 frameopt_main(Instrs0, ProcLabel, C0, C, Instrs, Mod, Jumps) :-
Index: compiler/globals.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/globals.m,v
retrieving revision 1.48
diff -u -d -r1.48 globals.m
--- compiler/globals.m	19 Feb 2002 06:21:43 -0000	1.48
+++ compiler/globals.m	5 Mar 2002 23:53:33 -0000
@@ -4,7 +4,7 @@
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
 
-:- module globals.
+:- module libs__globals.
 
 % Main author: fjh.
 
@@ -16,7 +16,7 @@
 %-----------------------------------------------------------------------------%
 
 :- interface.
-:- import_module options, trace_params, prog_data.
+:- import_module libs__options, libs__trace_params.
 :- import_module bool, getopt, list, io, std_util.
 
 :- type globals.
@@ -32,6 +32,15 @@
 			% `tree' data structure.
 			% (Work in progress.)
 
+:- type foreign_language
+	--->	c
+% 	;	cplusplus
+ 	;	csharp
+ 	;	managed_cplusplus
+% 	;	java
+ 	;	il
+	.
+
 	% The GC method specifies how we do garbage collection.
 	% This is only relevant for the C and asm back-ends;
 	% when compiling to IL or Java, where the target language
@@ -194,7 +203,7 @@
 
 :- implementation.
 
-:- import_module exprn_aux.
+:- import_module ll_backend__exprn_aux.
 :- import_module map, std_util, require, string.
 
 convert_target(String, Target) :-
Index: compiler/goal_path.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/goal_path.m,v
retrieving revision 1.14
diff -u -d -r1.14 goal_path.m
--- compiler/goal_path.m	7 Apr 2001 14:04:37 -0000	1.14
+++ compiler/goal_path.m	6 Mar 2002 00:53:49 -0000
@@ -9,18 +9,19 @@
 
 % Main author: zs.
 
-:- module goal_path.
+:- module check_hlds__goal_path.
 
 :- interface.
 
-:- import_module hlds_pred, hlds_module.
+:- import_module hlds__hlds_pred, hlds__hlds_module.
 
 :- pred goal_path__fill_slots(proc_info::in, module_info::in, proc_info::out)
 	is det.
 
 :- implementation.
 
-:- import_module prog_data, hlds_data, hlds_goal, type_util.
+:- import_module parse_tree__prog_data, hlds__hlds_data, hlds__hlds_goal.
+:- import_module check_hlds__type_util.
 :- import_module char, int, list, map, std_util, require.
 
 :- type slot_info
Index: compiler/goal_store.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/goal_store.m,v
retrieving revision 1.2
diff -u -d -r1.2 goal_store.m
--- compiler/goal_store.m	13 Oct 2000 13:55:21 -0000	1.2
+++ compiler/goal_store.m	6 Mar 2002 00:53:49 -0000
@@ -14,11 +14,12 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module goal_store.
+:- module transform_hlds__goal_store.
 
 :- interface.
 
-:- import_module hlds_goal, hlds_module, hlds_pred, instmap.
+:- import_module hlds__hlds_goal, hlds__hlds_module, hlds__hlds_pred.
+:- import_module hlds__instmap.
 :- import_module bool, set, std_util.
 
 %-----------------------------------------------------------------------------%
@@ -44,7 +45,7 @@
 
 :- implementation.
 
-:- import_module goal_util.
+:- import_module hlds__goal_util.
 :- import_module int, list, map, require.
 
 :- type goal_store(T) == map__map(T, goal).
Index: compiler/goal_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/goal_util.m,v
retrieving revision 1.73
diff -u -d -r1.73 goal_util.m
--- compiler/goal_util.m	22 Feb 2002 01:20:40 -0000	1.73
+++ compiler/goal_util.m	6 Mar 2002 00:53:49 -0000
@@ -11,11 +11,12 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module goal_util.
+:- module hlds__goal_util.
 :- interface.
 
-:- import_module hlds_data, hlds_goal, hlds_module, hlds_pred.
-:- import_module (inst), instmap, prog_data.
+:- import_module hlds__hlds_data, hlds__hlds_goal, hlds__hlds_module.
+:- import_module hlds__hlds_pred.
+:- import_module (parse_tree__inst), hlds__instmap, parse_tree__prog_data.
 :- import_module assoc_list, bool, list, set, map, term, std_util.
 
 % The predicates rename_var* take a structure and a mapping from var -> var
@@ -228,8 +229,10 @@
 
 :- implementation.
 
-:- import_module hlds_data, mode_util, code_aux, prog_data, purity.
-:- import_module code_aux, det_analysis, inst_match, type_util, (inst).
+:- import_module hlds__hlds_data, check_hlds__mode_util, ll_backend__code_aux.
+:- import_module parse_tree__prog_data, check_hlds__purity.
+:- import_module ll_backend__code_aux, check_hlds__det_analysis.
+:- import_module check_hlds__inst_match, check_hlds__type_util, (parse_tree__inst).
 
 :- import_module int, string, require, varset.
 
Index: compiler/graph_colour.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/graph_colour.m,v
retrieving revision 1.10
diff -u -d -r1.10 graph_colour.m
--- compiler/graph_colour.m	23 Jan 1998 12:56:32 -0000	1.10
+++ compiler/graph_colour.m	5 Mar 2002 23:53:17 -0000
@@ -17,7 +17,7 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module graph_colour.
+:- module libs__graph_colour.
 
 :- interface.
 
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.134
diff -u -d -r1.134 handle_options.m
--- compiler/handle_options.m	23 Feb 2002 07:30:45 -0000	1.134
+++ compiler/handle_options.m	6 Mar 2002 00:53:49 -0000
@@ -14,11 +14,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module handle_options.
+:- module libs__handle_options.
 
 :- interface.
 :- import_module list, bool, std_util, io.
-:- import_module globals, options.
+:- import_module libs__globals, libs__options.
 
 :- pred handle_options(maybe(string), list(string), bool, io__state, io__state).
 :- mode handle_options(out, out, out, di, uo) is det.
@@ -45,8 +45,9 @@
 
 :- implementation.
 
-:- import_module options, globals, prog_io_util, trace_params, unify_proc.
-:- import_module prog_data, foreign.
+:- import_module libs__options, libs__globals, parse_tree__prog_io_util.
+:- import_module libs__trace_params, check_hlds__unify_proc.
+:- import_module parse_tree__prog_data, backend_libs__foreign.
 :- import_module char, dir, int, string, map, set, getopt, library.
 
 handle_options(MaybeError, Args, Link) -->
Index: compiler/higher_order.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/higher_order.m,v
retrieving revision 1.93
diff -u -d -r1.93 higher_order.m
--- compiler/higher_order.m	20 Feb 2002 03:13:57 -0000	1.93
+++ compiler/higher_order.m	6 Mar 2002 00:53:49 -0000
@@ -4,7 +4,7 @@
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
 %
-:- module higher_order.
+:- module transform_hlds__higher_order.
 % Main author: stayl
 %
 % Specializes calls to higher order or polymorphic predicates where the value
@@ -25,7 +25,7 @@
 
 :- interface.
 
-:- import_module hlds_module.
+:- import_module hlds__hlds_module.
 :- import_module io.
 
 :- pred specialize_higher_order(module_info::in, module_info::out,
@@ -35,11 +35,15 @@
 
 :- implementation.
 
-:- import_module hlds_pred, hlds_goal, hlds_data, instmap, (inst).
-:- import_module code_util, globals, mode_util, goal_util.
-:- import_module type_util, options, prog_data, prog_out, quantification.
-:- import_module mercury_to_mercury, inlining, polymorphism, prog_util.
-:- import_module special_pred, unify_proc, passes_aux.
+:- import_module hlds__hlds_pred, hlds__hlds_goal, hlds__hlds_data.
+:- import_module hlds__instmap, (parse_tree__inst).
+:- import_module ll_backend__code_util, libs__globals, check_hlds__mode_util.
+:- import_module hlds__goal_util.
+:- import_module check_hlds__type_util, libs__options, parse_tree__prog_data.
+:- import_module parse_tree__prog_out, hlds__quantification.
+:- import_module parse_tree__mercury_to_mercury, transform_hlds__inlining.
+:- import_module check_hlds__polymorphism, parse_tree__prog_util.
+:- import_module hlds__special_pred, check_hlds__unify_proc, hlds__passes_aux.
 
 :- import_module assoc_list, bool, char, int, list, map, require, set.
 :- import_module std_util, string, varset, term.
Index: compiler/hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds.m,v
retrieving revision 1.205
diff -u -d -r1.205 hlds.m
--- compiler/hlds.m	27 Jul 1997 15:00:26 -0000	1.205
+++ compiler/hlds.m	6 Mar 2002 00:22:55 -0000
@@ -1,19 +1,54 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1993-1996 The University of Melbourne.
-% This file may only be copied under the terms of the GNU General
-% Public License - see the file COPYING in the Mercury distribution.
+%
+% Phase 2: build the HLDS.
+%	This phase also includes quite a bit of error checking
+%	and a tiny bit of semantic analysis (quantification).
+%
+
+:- module hlds.
+:- interface.
+:- import_module parse_tree, libs.
+:- import_module check_hlds. % needed for unify_proc__unify_proc_id,
+				 % etc.
+:- import_module transform_hlds. % needed for term_util, etc.
+:- import_module backend_libs. % XXX needed for rtti, foreign, etc.
+:- import_module ll_backend. % XXX needed for `llds__lval',
+				 % which is used in various annotations
+				 % in the HLDS (stack_slots, follow_vars, etc.)
+
 %-----------------------------------------------------------------------------%
 
-% HLDS - The High-Level Data Structure.
+% The HLDS data structure itself
+:- include_module hlds_data, hlds_goal, hlds_pred, hlds_module.
+:- include_module instmap.
+:- include_module (assertion), special_pred.
 
-% Main authors: fjh, conway.
+% Modules for creating the HLDS
+:- include_module make_hlds, make_tags.
+:- include_module quantification.
 
-% This file used to contain the data types for the high-level data structure.
-% The definitions have now been split into several files:
-%
-%	hlds_data
-%	hlds_goal
-%	hlds_pred
-%	hlds_module
+% Modules for pretty-printing it.
+:- include_module hlds_out.
 
-:- module hlds.
+% Miscellaneous utilities.
+:- include_module passes_aux, error_util.
+:- include_module goal_util. % XXX goal_util imports code_aux.m
+:- include_module hlds_code_util.	% XXX currently code_util.m
+
+%:- module smart_recompilation.
+    :- include_module recompilation.
+    :- include_module recompilation_check.
+    :- include_module recompilation_usage.
+    :- include_module recompilation_version.
+    :- include_module timestamp.
+%:- module smart_recompilation.
+
+%-----------------------------------------------------------------------------%
+
+:- implementation.
+:- import_module aditi_backend. % XXX for rl__get_entry_proc_name,
+				    % which is used by hlds_out.m to dump
+				    % aditi_call goals.
+:- end_module hlds.
+
+%-----------------------------------------------------------------------------%
Index: compiler/hlds_code_util.m
===================================================================
RCS file: compiler/hlds_code_util.m
diff -N compiler/hlds_code_util.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ compiler/hlds_code_util.m	5 Mar 2002 23:53:17 -0000
@@ -0,0 +1,7 @@
+:- module hlds__hlds_code_util.
+:- interface.
+
+% XXX some of the stuff from code_util.m should be moved here.
+
+:- type hlds_code_util ---> suppress_warning_about_nothing_exported.
+
Index: compiler/hlds_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_data.m,v
retrieving revision 1.66
diff -u -d -r1.66 hlds_data.m
--- compiler/hlds_data.m	26 Feb 2002 02:45:36 -0000	1.66
+++ compiler/hlds_data.m	6 Mar 2002 00:53:49 -0000
@@ -9,11 +9,12 @@
 
 % Main authors: fjh, conway.
 
-:- module hlds_data.
+:- module hlds__hlds_data.
 
 :- interface.
 
-:- import_module hlds_pred, prog_data, (inst), rtti.
+:- import_module hlds__hlds_pred, parse_tree__prog_data, (parse_tree__inst).
+:- import_module backend_libs__rtti.
 :- import_module bool, list, map, std_util, term.
 
 %-----------------------------------------------------------------------------%
@@ -165,7 +166,7 @@
 
 :- implementation.
 
-:- import_module prog_util, varset.
+:- import_module parse_tree__prog_util, varset.
 :- import_module require.
 
 cons_id_and_args_to_term(int_const(Int), [], Term) :-
Index: compiler/hlds_goal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.93
diff -u -d -r1.93 hlds_goal.m
--- compiler/hlds_goal.m	26 Feb 2002 02:52:26 -0000	1.93
+++ compiler/hlds_goal.m	6 Mar 2002 00:53:49 -0000
@@ -8,12 +8,13 @@
 
 % Main authors: fjh, conway.
 
-:- module hlds_goal.
+:- module hlds__hlds_goal.
 
 :- interface.
 
-:- import_module hlds_data, hlds_pred, prog_data, (inst), instmap.
-:- import_module llds.	% XXX needed for `lval'
+:- import_module hlds__hlds_data, hlds__hlds_pred, parse_tree__prog_data.
+:- import_module (parse_tree__inst), hlds__instmap.
+:- import_module ll_backend__llds.	% XXX needed for `lval'
 :- import_module bool, char, list, set, map, std_util.
 
 %-----------------------------------------------------------------------------%
@@ -1158,7 +1159,8 @@
 
 :- implementation.
 
-:- import_module det_analysis, prog_util, type_util.
+:- import_module check_hlds__det_analysis, parse_tree__prog_util.
+:- import_module check_hlds__type_util.
 :- import_module require, string, term, varset.
 
 %-----------------------------------------------------------------------------%
Index: compiler/hlds_module.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_module.m,v
retrieving revision 1.71
diff -u -d -r1.71 hlds_module.m
--- compiler/hlds_module.m	22 Feb 2002 01:20:41 -0000	1.71
+++ compiler/hlds_module.m	6 Mar 2002 00:53:49 -0000
@@ -17,19 +17,21 @@
 
 % Main authors: fjh, conway.
 
-:- module hlds_module.
+:- module hlds__hlds_module.
 
 :- interface.
 
-:- import_module prog_data, module_qual, recompilation.
-:- import_module hlds_pred, hlds_data, unify_proc, special_pred.
-:- import_module globals, foreign.
+:- import_module parse_tree__prog_data, parse_tree__module_qual.
+:- import_module hlds__recompilation.
+:- import_module hlds__hlds_pred, hlds__hlds_data, check_hlds__unify_proc.
+:- import_module hlds__special_pred.
+:- import_module libs__globals, backend_libs__foreign.
 :- import_module relation, map, std_util, list, set, multi_map, counter.
 
 :- implementation.
 
-:- import_module hlds_out, prog_out, prog_util.
-:- import_module typecheck, modules.
+:- import_module hlds__hlds_out, parse_tree__prog_out, parse_tree__prog_util.
+:- import_module check_hlds__typecheck, parse_tree__modules.
 :- import_module bool, require, int, string.
 
 %-----------------------------------------------------------------------------%
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.276
diff -u -d -r1.276 hlds_out.m
--- compiler/hlds_out.m	27 Feb 2002 17:41:06 -0000	1.276
+++ compiler/hlds_out.m	6 Mar 2002 00:53:49 -0000
@@ -28,14 +28,15 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module hlds_out.
+:- module hlds__hlds_out.
 
 :- interface.
 
 % Parse tree modules
-:- import_module prog_data, (inst).
+:- import_module parse_tree__prog_data, (parse_tree__inst).
 % HLDS modules
-:- import_module hlds_module, hlds_pred, hlds_goal, hlds_data, instmap.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_goal.
+:- import_module hlds__hlds_data, hlds__instmap.
 
 :- import_module io, bool, list, term.
 
@@ -256,20 +257,24 @@
 :- implementation.
 
 % Parse tree modules.
-:- import_module prog_out, prog_util, (inst).
+:- import_module parse_tree__prog_out, parse_tree__prog_util.
+:- import_module (parse_tree__inst).
 
 % HLDS modules.
-:- import_module mercury_to_mercury, purity, special_pred, instmap.
-:- import_module termination, term_errors, check_typeclass, rtti.
+:- import_module parse_tree__mercury_to_mercury, check_hlds__purity.
+:- import_module hlds__special_pred, hlds__instmap.
+:- import_module transform_hlds__termination, transform_hlds__term_errors.
+:- import_module check_hlds__check_typeclass, backend_libs__rtti.
 
 % RL back-end modules (XXX should avoid using those here).
-:- import_module rl.
+:- import_module aditi_backend__rl.
 
 % LLDS back-end modules (XXX should avoid using those here).
-:- import_module code_util, llds, llds_out, trace.
+:- import_module ll_backend__code_util, ll_backend__llds.
+:- import_module ll_backend__llds_out, ll_backend__trace.
 
 % Misc
-:- import_module globals, options, foreign.
+:- import_module libs__globals, libs__options, backend_libs__foreign.
 
 % Standard library modules
 :- import_module int, string, set, assoc_list, map, multi_map.
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.104
diff -u -d -r1.104 hlds_pred.m
--- compiler/hlds_pred.m	5 Mar 2002 10:59:16 -0000	1.104
+++ compiler/hlds_pred.m	6 Mar 2002 00:53:49 -0000
@@ -9,28 +9,30 @@
 
 % Main authors: fjh, conway.
 
-:- module hlds_pred.
+:- module hlds__hlds_pred.
 
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_data, hlds_goal, hlds_module, instmap, term_util.
-:- import_module mode_errors.
-:- import_module globals.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_data, hlds__hlds_goal, hlds__hlds_module.
+:- import_module hlds__instmap, transform_hlds__term_util.
+:- import_module check_hlds__mode_errors.
+:- import_module libs__globals.
 
 :- import_module bool, list, set, map, std_util, term, varset.
 
 :- implementation.
 
 % Parse tree modules.
-:- import_module prog_util.
+:- import_module parse_tree__prog_util.
 
 % HLDS modules.
-:- import_module code_aux, goal_util, make_hlds.
-:- import_module inst_match, mode_util, type_util.
+:- import_module ll_backend__code_aux, hlds__goal_util, hlds__make_hlds.
+:- import_module check_hlds__inst_match, check_hlds__mode_util.
+:- import_module check_hlds__type_util.
 
 % Misc
-:- import_module options.
+:- import_module libs__options.
 
 % Standard library modules.
 :- import_module int, string, require, assoc_list.
@@ -1840,7 +1842,7 @@
 :- pred proc_info_is_valid_mode(proc_info::in) is semidet.
 
 :- implementation.
-:- import_module mode_errors.
+:- import_module check_hlds__mode_errors.
 
 :- type proc_info
 	--->	procedure(
@@ -2749,7 +2751,7 @@
 
 :- implementation.
 
-:- import_module det_analysis.
+:- import_module check_hlds__det_analysis.
 
 valid_determinism_for_eval_method(eval_normal, _).
 valid_determinism_for_eval_method(eval_loop_check, _).
Index: compiler/il_peephole.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/il_peephole.m,v
retrieving revision 1.6
diff -u -d -r1.6 il_peephole.m
--- compiler/il_peephole.m	24 Aug 2001 11:57:59 -0000	1.6
+++ compiler/il_peephole.m	5 Mar 2002 23:53:17 -0000
@@ -30,12 +30,12 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module il_peephole.
+:- module ml_backend__il_peephole.
 
 :- interface.
 
 :- import_module list.
-:- import_module ilasm.
+:- import_module ml_backend__ilasm.
 
 	% Peephole optimize a list of instructions.
 
@@ -47,7 +47,7 @@
 :- type instrs == list(instr).
 
 :- import_module assoc_list, bool, map, string, std_util, int.
-:- import_module ilds, require.
+:- import_module ml_backend__ilds, require.
 
 	% We zip down to the end of the instruction list, and start attempting
 	% to optimize instruction sequences. As long as we can continue
Index: compiler/ilasm.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ilasm.m,v
retrieving revision 1.32
diff -u -d -r1.32 ilasm.m
--- compiler/ilasm.m	24 Jan 2002 06:43:34 -0000	1.32
+++ compiler/ilasm.m	5 Mar 2002 23:53:33 -0000
@@ -20,12 +20,12 @@
 %	    (events, properties, etc).
 %	[ ] Fix up all the XXXs.
 
-:- module ilasm.
+:- module ml_backend__ilasm.
 
 :- interface.
 
 :- import_module io, list, term, std_util, bool, integer.
-:- import_module ilds.
+:- import_module ml_backend__ilds.
 
 :- pred ilasm__output(
 	list(decl)::in, io__state::di, io__state::uo) is det.
@@ -273,7 +273,7 @@
 
 :- import_module char, string, pprint, getopt.
 :- import_module require, int, term_io, varset, bool.
-:- import_module globals, options, error_util.
+:- import_module libs__globals, libs__options, hlds__error_util.
 
 
 	% Some versions of the IL assembler enforce a rule that if you output 
Index: compiler/ilds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ilds.m,v
retrieving revision 1.14
diff -u -d -r1.14 ilds.m
--- compiler/ilds.m	13 Feb 2002 01:39:54 -0000	1.14
+++ compiler/ilds.m	5 Mar 2002 23:53:17 -0000
@@ -17,7 +17,7 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module ilds.
+:- module ml_backend__ilds.
 
 :- interface.
 
@@ -387,7 +387,7 @@
 :- implementation.
 
 :- import_module int, require.
-:- import_module error_util.
+:- import_module hlds__error_util.
 
 get_class_suffix(structured_name(_, OuterClassFullName, NestedClass))
 		= SuffixName :-
Index: compiler/inlining.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/inlining.m,v
retrieving revision 1.104
diff -u -d -r1.104 inlining.m
--- compiler/inlining.m	16 Dec 2001 08:11:08 -0000	1.104
+++ compiler/inlining.m	6 Mar 2002 00:53:49 -0000
@@ -6,7 +6,7 @@
 
 % Main author: conway.
 
-:- module inlining.
+:- module transform_hlds__inlining.
 
 	% This module inlines
 	%
@@ -83,7 +83,8 @@
 
 :- interface.
 
-:- import_module hlds_goal, hlds_module, hlds_pred, prog_data.
+:- import_module hlds__hlds_goal, hlds__hlds_module, hlds__hlds_pred.
+:- import_module parse_tree__prog_data.
 :- import_module bool, io, list, map.
 
 :- pred inlining(module_info, module_info, io__state, io__state).
@@ -147,15 +148,17 @@
 :- implementation.
 
 % Parse tree modules
-:- import_module prog_data.
+:- import_module parse_tree__prog_data.
 
 % HLDS modules
-:- import_module hlds_data, type_util, mode_util, goal_util, det_analysis.
-:- import_module quantification, code_aux, dead_proc_elim, dependency_graph.
-:- import_module passes_aux, purity.
+:- import_module hlds__hlds_data, check_hlds__type_util.
+:- import_module check_hlds__mode_util, hlds__goal_util, check_hlds__det_analysis.
+:- import_module hlds__quantification, ll_backend__code_aux.
+:- import_module transform_hlds__dead_proc_elim, transform_hlds__dependency_graph.
+:- import_module hlds__passes_aux, check_hlds__purity.
 
 % Misc
-:- import_module globals, options.
+:- import_module libs__globals, libs__options.
 
 % Standard library modules
 :- import_module int, list, assoc_list, set, std_util, require.
Index: compiler/inst.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/inst.m,v
retrieving revision 1.7
diff -u -d -r1.7 inst.m
--- compiler/inst.m	13 Oct 2000 13:55:28 -0000	1.7
+++ compiler/inst.m	5 Mar 2002 23:53:33 -0000
@@ -9,7 +9,7 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module (inst).
+:- module (parse_tree__inst).
 :- interface.
 
 % This module should NOT import hlds*.m.  Any types which are needed in
@@ -22,7 +22,7 @@
 %     of the `cons_id' type, and so we could define a new type
 %     `abstract_cons_id' and use that here instead of `cons_id'.
 
-:- import_module prog_data, hlds_data.
+:- import_module parse_tree__prog_data, hlds__hlds_data.
 :- import_module list, map.
 
 %-----------------------------------------------------------------------------%
Index: compiler/inst_match.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/inst_match.m,v
retrieving revision 1.48
diff -u -d -r1.48 inst_match.m
--- compiler/inst_match.m	12 Oct 2001 05:23:41 -0000	1.48
+++ compiler/inst_match.m	6 Mar 2002 00:53:49 -0000
@@ -35,11 +35,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module inst_match.
+:- module check_hlds__inst_match.
 
 :- interface.
 
-:- import_module hlds_module, prog_data, (inst).
+:- import_module hlds__hlds_module, parse_tree__prog_data, (parse_tree__inst).
 :- import_module list.
 
 %-----------------------------------------------------------------------------%
@@ -265,7 +265,8 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
-:- import_module hlds_data, mode_util, prog_data, inst_util, type_util.
+:- import_module hlds__hlds_data, check_hlds__mode_util.
+:- import_module parse_tree__prog_data, check_hlds__inst_util, check_hlds__type_util.
 :- import_module list, set, map, term, std_util, require, bool.
 
 inst_matches_initial(InstA, InstB, Type, ModuleInfo) :-
Index: compiler/inst_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/inst_util.m,v
retrieving revision 1.18
diff -u -d -r1.18 inst_util.m
--- compiler/inst_util.m	12 Oct 2001 05:23:42 -0000	1.18
+++ compiler/inst_util.m	6 Mar 2002 00:53:49 -0000
@@ -38,10 +38,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module inst_util.
+:- module check_hlds__inst_util.
 :- interface.
 
-:- import_module hlds_module, hlds_data, prog_data, (inst).
+:- import_module hlds__hlds_module, hlds__hlds_data, parse_tree__prog_data.
+:- import_module (parse_tree__inst).
 :- import_module list, std_util.
 
 :- pred abstractly_unify_inst(is_live, inst, inst, unify_is_real, module_info,
@@ -129,7 +130,8 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
-:- import_module hlds_data, inst_match, mode_util, det_analysis, type_util.
+:- import_module hlds__hlds_data, check_hlds__inst_match.
+:- import_module check_hlds__mode_util, check_hlds__det_analysis, check_hlds__type_util.
 :- import_module bool, std_util, require, map, list, set, int.
 
 	% Abstractly unify two insts.
Index: compiler/instmap.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/instmap.m,v
retrieving revision 1.28
diff -u -d -r1.28 instmap.m
--- compiler/instmap.m	13 Sep 2001 23:18:12 -0000	1.28
+++ compiler/instmap.m	6 Mar 2002 00:53:49 -0000
@@ -15,12 +15,13 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module instmap.
+:- module hlds__instmap.
 
 :- interface.
 
-:- import_module hlds_module, prog_data, mode_info, (inst), mode_errors.
-:- import_module hlds_data, hlds_pred.
+:- import_module hlds__hlds_module, parse_tree__prog_data.
+:- import_module check_hlds__mode_info, (parse_tree__inst), check_hlds__mode_errors.
+:- import_module hlds__hlds_data, hlds__hlds_pred.
 
 :- import_module map, bool, set, list, assoc_list, std_util.
 
@@ -306,8 +307,9 @@
 
 :- implementation.
 
-:- import_module mode_util, inst_match, prog_data, goal_util, type_util.
-:- import_module hlds_data, inst_util.
+:- import_module check_hlds__mode_util, check_hlds__inst_match.
+:- import_module parse_tree__prog_data, hlds__goal_util, check_hlds__type_util.
+:- import_module hlds__hlds_data, check_hlds__inst_util.
 
 :- import_module std_util, require, string, term.
 
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.113
diff -u -d -r1.113 intermod.m
--- compiler/intermod.m	26 Feb 2002 02:45:39 -0000	1.113
+++ compiler/intermod.m	6 Mar 2002 00:53:49 -0000
@@ -31,14 +31,15 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module intermod.
+:- module transform_hlds__intermod.
 
 %-----------------------------------------------------------------------------%
 
 :- interface.
 
 :- import_module io, bool.
-:- import_module hlds_module, modules, prog_io, prog_data.
+:- import_module hlds__hlds_module, parse_tree__modules, parse_tree__prog_io.
+:- import_module parse_tree__prog_data.
 
 :- pred intermod__write_optfile(module_info, module_info,
 				io__state, io__state).
@@ -86,11 +87,16 @@
 :- import_module assoc_list, dir, getopt, int, list, map, multi_map, require.
 :- import_module set, std_util, string, term, varset.
 
-:- import_module code_util, globals, goal_util, term, varset.
-:- import_module hlds_data, hlds_goal, hlds_pred, hlds_out, inlining, llds.
-:- import_module mercury_to_mercury, mode_util, modules.
-:- import_module options, passes_aux, prog_data, prog_io, prog_out, prog_util.
-:- import_module special_pred, typecheck, type_util, instmap, (inst), foreign.
+:- import_module ll_backend__code_util, libs__globals, hlds__goal_util, term.
+:- import_module varset.
+:- import_module hlds__hlds_data, hlds__hlds_goal, hlds__hlds_pred.
+:- import_module hlds__hlds_out, transform_hlds__inlining, ll_backend__llds.
+:- import_module parse_tree__mercury_to_mercury, check_hlds__mode_util.
+:- import_module parse_tree__modules.
+:- import_module libs__options, hlds__passes_aux, parse_tree__prog_data.
+:- import_module parse_tree__prog_io, parse_tree__prog_out, parse_tree__prog_util.
+:- import_module hlds__special_pred, check_hlds__typecheck.
+:- import_module check_hlds__type_util, hlds__instmap, (parse_tree__inst), backend_libs__foreign.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/ite_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ite_gen.m,v
retrieving revision 1.65
diff -u -d -r1.65 ite_gen.m
--- compiler/ite_gen.m	23 Nov 2000 04:32:37 -0000	1.65
+++ compiler/ite_gen.m	6 Mar 2002 00:53:49 -0000
@@ -14,11 +14,12 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module ite_gen.
+:- module ll_backend__ite_gen.
 
 :- interface.
 
-:- import_module hlds_goal, code_model, llds, code_info.
+:- import_module hlds__hlds_goal, backend_libs__code_model, ll_backend__llds.
+:- import_module ll_backend__code_info.
 
 :- pred ite_gen__generate_ite(code_model::in, hlds_goal::in, hlds_goal::in,
 	hlds_goal::in, store_map::in, code_tree::out,
@@ -31,8 +32,9 @@
 
 :- implementation.
 
-:- import_module prog_data, tree, builtin_ops.
-:- import_module code_gen, code_util, trace, options, globals, instmap.
+:- import_module parse_tree__prog_data, libs__tree, backend_libs__builtin_ops.
+:- import_module ll_backend__code_gen, ll_backend__code_util.
+:- import_module ll_backend__trace, libs__options, libs__globals, hlds__instmap.
 
 :- import_module bool, set, term, list, map, std_util, require.
 
Index: compiler/java_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/java_util.m,v
retrieving revision 1.5
diff -u -d -r1.5 java_util.m
--- compiler/java_util.m	8 Feb 2002 00:41:24 -0000	1.5
+++ compiler/java_util.m	5 Mar 2002 23:53:17 -0000
@@ -13,10 +13,10 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module java_util.
+:- module ml_backend__java_util.
 :- interface.
 :- import_module string.
-:- import_module builtin_ops.
+:- import_module backend_libs__builtin_ops.
 
 %-----------------------------------------------------------------------------%
 
@@ -72,7 +72,7 @@
 
 :- implementation.
 :- import_module list.
-:- import_module error_util.
+:- import_module hlds__error_util.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/jumpopt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/jumpopt.m,v
retrieving revision 1.60
diff -u -d -r1.60 jumpopt.m
--- compiler/jumpopt.m	18 Feb 2002 07:00:51 -0000	1.60
+++ compiler/jumpopt.m	6 Mar 2002 00:53:49 -0000
@@ -10,11 +10,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module jumpopt.
+:- module ll_backend__jumpopt.
 
 :- interface.
 
-:- import_module llds, trace_params.
+:- import_module ll_backend__llds, libs__trace_params.
 :- import_module list, set, bool, counter.
 
 	% Take an instruction list and optimize jumps. This includes jumps
@@ -49,7 +49,8 @@
 
 :- implementation.
 
-:- import_module builtin_ops, code_util, opt_util.
+:- import_module backend_libs__builtin_ops, ll_backend__code_util.
+:- import_module ll_backend__opt_util.
 :- import_module int, std_util, map, string, require.
 
 % We first build up a bunch of tables giving information about labels.
Index: compiler/labelopt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/labelopt.m,v
retrieving revision 1.20
diff -u -d -r1.20 labelopt.m
--- compiler/labelopt.m	12 Mar 1999 05:53:27 -0000	1.20
+++ compiler/labelopt.m	5 Mar 2002 23:53:17 -0000
@@ -10,12 +10,12 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module labelopt.
+:- module ll_backend__labelopt.
 
 :- interface.
 
 :- import_module bool, list, set.
-:- import_module llds.
+:- import_module ll_backend__llds.
 
 	% Build up a set showing which labels are branched to,
 	% then traverse the instruction list removing unnecessary labels.
@@ -36,7 +36,7 @@
 
 :- implementation.
 
-:- import_module opt_util.
+:- import_module ll_backend__opt_util.
 :- import_module std_util.
 
 labelopt_main(Instrs0, Final, LayoutLabelSet, Instrs, Mod) :-
Index: compiler/lambda.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/lambda.m,v
retrieving revision 1.75
diff -u -d -r1.75 lambda.m
--- compiler/lambda.m	5 Mar 2002 10:59:18 -0000	1.75
+++ compiler/lambda.m	6 Mar 2002 00:53:49 -0000
@@ -65,11 +65,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module (lambda).
+:- module (transform_hlds__lambda).
 
 :- interface. 
 
-:- import_module hlds_module, hlds_pred.
+:- import_module hlds__hlds_module, hlds__hlds_pred.
 
 :- pred lambda__process_module(module_info, module_info).
 :- mode lambda__process_module(in, out) is det.
@@ -82,15 +82,16 @@
 
 :- implementation.
 
-:- import_module code_model. % XXX for some back-end dependent optimizations
+:- import_module backend_libs__code_model. % XXX for some back-end dependent optimizations
 
 % Parse tree modules
-:- import_module prog_data, prog_util.
+:- import_module parse_tree__prog_data, parse_tree__prog_util.
 % HLDS modules
-:- import_module hlds_goal, hlds_data, quantification.
-:- import_module type_util, goal_util, mode_util, inst_match.
+:- import_module hlds__hlds_goal, hlds__hlds_data, hlds__quantification.
+:- import_module check_hlds__type_util, hlds__goal_util.
+:- import_module check_hlds__mode_util, check_hlds__inst_match.
 % Misc
-:- import_module globals, options.
+:- import_module libs__globals, libs__options.
 
 % Standard library modules
 :- import_module list, map, set.
Index: compiler/layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/layout.m,v
retrieving revision 1.4
diff -u -d -r1.4 layout.m
--- compiler/layout.m	20 Feb 2002 03:14:06 -0000	1.4
+++ compiler/layout.m	6 Mar 2002 00:53:49 -0000
@@ -28,11 +28,12 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module layout.
+:- module ll_backend__layout.
 
 :- interface.
 
-:- import_module prog_data, trace_params, llds, rtti, hlds_goal.
+:- import_module parse_tree__prog_data, libs__trace_params, ll_backend__llds.
+:- import_module backend_libs__rtti, hlds__hlds_goal.
 :- import_module bool, std_util, list, assoc_list.
 
 :- type layout_data
Index: compiler/layout_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/layout_out.m,v
retrieving revision 1.7
diff -u -d -r1.7 layout_out.m
--- compiler/layout_out.m	20 Feb 2002 03:14:06 -0000	1.7
+++ compiler/layout_out.m	6 Mar 2002 00:53:49 -0000
@@ -17,11 +17,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module layout_out.
+:- module ll_backend__layout_out.
 
 :- interface.
 
-:- import_module layout, llds, llds_out.
+:- import_module ll_backend__layout, ll_backend__llds, ll_backend__llds_out.
 :- import_module bool, io.
 
 	% Given a Mercury representation of a layout structure, output its
@@ -77,8 +77,9 @@
 
 :- implementation.
 
-:- import_module prog_data, prog_out, hlds_pred, trace_params, c_util.
-:- import_module rtti, trace, code_util.
+:- import_module parse_tree__prog_data, parse_tree__prog_out, hlds__hlds_pred.
+:- import_module libs__trace_params, backend_libs__c_util.
+:- import_module backend_libs__rtti, ll_backend__trace, ll_backend__code_util.
 :- import_module int, char, string, require, std_util, list.
 
 output_layout_data_defn(label_layout_data(Label, ProcLayoutAddr,
Index: compiler/lco.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/lco.m,v
retrieving revision 1.17
diff -u -d -r1.17 lco.m
--- compiler/lco.m	7 Apr 2001 14:04:43 -0000	1.17
+++ compiler/lco.m	5 Mar 2002 23:53:34 -0000
@@ -11,11 +11,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module lco.
+:- module transform_hlds__lco.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred.
+:- import_module hlds__hlds_module, hlds__hlds_pred.
 :- import_module io.
 
 :- pred lco_modulo_constructors(pred_id, proc_id, module_info,
@@ -27,7 +27,7 @@
 
 :- implementation.
 
-:- import_module hlds_goal, passes_aux, hlds_out.
+:- import_module hlds__hlds_goal, hlds__passes_aux, hlds__hlds_out.
 :- import_module list, require, std_util.
 
 %-----------------------------------------------------------------------------%
Index: compiler/libs.m
===================================================================
RCS file: compiler/libs.m
diff -N compiler/libs.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ compiler/libs.m	6 Mar 2002 00:03:45 -0000
@@ -0,0 +1,19 @@
+%-----------------------------------------------------------------------------%
+%
+% This package contains general utilities that are used by other packages.
+%
+
+:- module libs.
+:- interface.
+:- import_module ll_backend. % XXX trace_params depends on llds__trace_port.
+
+% option handling
+:- include_module globals, options, handle_options, trace_params.
+
+% generic algorithms and data structures that are not
+% quite useful enough to go in the standard library
+:- include_module tree, graph_colour, atsort.
+
+:- end_module libs.
+
+%-----------------------------------------------------------------------------%
Index: compiler/live_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/live_vars.m,v
retrieving revision 1.98
diff -u -d -r1.98 live_vars.m
--- compiler/live_vars.m	7 Apr 2001 14:04:43 -0000	1.98
+++ compiler/live_vars.m	6 Mar 2002 00:53:49 -0000
@@ -19,11 +19,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module live_vars.
+:- module ll_backend__live_vars.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred.
+:- import_module hlds__hlds_module, hlds__hlds_pred.
 
 :- pred allocate_stack_slots_in_proc(proc_info::in, pred_id::in,
 	module_info::in, proc_info::out) is det.
@@ -34,20 +34,22 @@
 :- implementation.
 
 % Parse tree modules
-:- import_module prog_data.
+:- import_module parse_tree__prog_data.
 
 % HLDS modules
-:- import_module hlds_goal, hlds_data, mode_util, instmap, code_aux.
-:- import_module liveness.
+:- import_module hlds__hlds_goal, hlds__hlds_data, check_hlds__mode_util.
+:- import_module hlds__instmap, ll_backend__code_aux.
+:- import_module ll_backend__liveness.
 
 % Modules shared between different back-ends.
-:- import_module code_model.
+:- import_module backend_libs__code_model.
 
 % LLDS modules
-:- import_module llds, arg_info, trace_params, trace.
+:- import_module ll_backend__llds, ll_backend__arg_info, libs__trace_params.
+:- import_module ll_backend__trace.
 
 % Misc
-:- import_module globals, options, graph_colour.
+:- import_module libs__globals, libs__options, libs__graph_colour.
 
 
 % Standard library modules
Index: compiler/livemap.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/livemap.m,v
retrieving revision 1.51
diff -u -d -r1.51 livemap.m
--- compiler/livemap.m	24 Apr 2001 03:58:56 -0000	1.51
+++ compiler/livemap.m	5 Mar 2002 23:53:17 -0000
@@ -12,12 +12,12 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module livemap.
+:- module ll_backend__livemap.
 
 :- interface.
 
 :- import_module list, set, map, std_util.
-:- import_module llds.
+:- import_module ll_backend__llds.
 
 :- type livemap		==	map(label, lvalset).
 :- type lvalset		==	set(lval).
@@ -31,7 +31,7 @@
 
 :- implementation.
 
-:- import_module opt_util.
+:- import_module ll_backend__opt_util.
 :- import_module require, string, bool.
 
 %-----------------------------------------------------------------------------%
Index: compiler/liveness.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/liveness.m,v
retrieving revision 1.118
diff -u -d -r1.118 liveness.m
--- compiler/liveness.m	7 Apr 2001 14:04:44 -0000	1.118
+++ compiler/liveness.m	6 Mar 2002 00:53:49 -0000
@@ -151,11 +151,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module liveness.
+:- module ll_backend__liveness.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred, parse_tree__prog_data.
 :- import_module set, io.
 
 	% Add liveness annotations to the goal of the procedure.
@@ -176,16 +176,18 @@
 :- implementation.
 
 % Parse tree modules
-:- import_module prog_util, (inst).
+:- import_module parse_tree__prog_util, (parse_tree__inst).
 % HLDS modules
-:- import_module hlds_goal, hlds_data, hlds_out, instmap, mode_util.
-:- import_module quantification, polymorphism.
+:- import_module hlds__hlds_goal, hlds__hlds_data, hlds__hlds_out.
+:- import_module hlds__instmap, check_hlds__mode_util.
+:- import_module hlds__quantification, check_hlds__polymorphism.
 % Modules shared between different back-ends.
-:- import_module code_model, passes_aux.
+:- import_module backend_libs__code_model, hlds__passes_aux.
 % LLDS modules
-:- import_module llds, code_util, trace_params, trace.
+:- import_module ll_backend__llds, ll_backend__code_util, libs__trace_params.
+:- import_module ll_backend__trace.
 % Misc
-:- import_module globals, options.
+:- import_module libs__globals, libs__options.
 
 % Standard library modules
 :- import_module bool, string, map, std_util, list, assoc_list, require.
Index: compiler/ll_backend.m
===================================================================
RCS file: compiler/ll_backend.m
diff -N compiler/ll_backend.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ compiler/ll_backend.m	6 Mar 2002 00:53:49 -0000
@@ -0,0 +1,85 @@
+%-----------------------------------------------------------------------------%
+%
+% Phase 5c: The low-level code generator
+%
+:- module ll_backend.
+:- interface.
+:- import_module transform_hlds, check_hlds. % are these needed?
+:- import_module hlds, parse_tree, libs, backend_libs.
+:- import_module aditi_backend. % XXX for rl_file, used in llds_out.
+
+%-----------------------------------------------------------------------------%
+
+% Pre-passes to transform or annotate the HLDS
+% (XXX these are not listed in right order)
+:- include_module saved_vars.	% transform
+:- include_module arg_info.		% annotate
+:- include_module liveness.		% annotate
+:- include_module live_vars.		% annotate
+:- include_module follow_code.	% transform
+:- include_module follow_vars.	% annotate
+:- include_module store_alloc.	% annotate
+:- include_module deep_profiling. % transform
+
+% The llds data structure itself
+:- include_module llds.
+:- include_module code_util. % XXX
+
+% The HLDS->LLDS code generator.
+:- include_module code_gen.
+   :- include_module ite_gen, call_gen, disj_gen, unify_gen, commit_gen.
+   :- include_module switch_gen.
+      :- include_module dense_switch.
+      :- include_module lookup_switch.
+      :- include_module string_switch.
+      :- include_module tag_switch.
+   :- include_module pragma_c_gen, par_conj_gen.
+   :- include_module middle_rec.
+   :- include_module trace.
+
+   :- include_module code_info.
+   :- include_module code_exprn.
+   :- include_module exprn_aux.
+   :- include_module code_aux. % XXX
+   :- include_module continuation_info.
+   :- include_module var_locn.
+
+% An alternative HLDS->LLDS code generator for fact tables.
+:- include_module fact_table.
+
+%:- module llds_rtti.
+   :- include_module ll_pseudo_type_info.
+   :- include_module layout.
+   :- include_module stack_layout, prog_rep.
+   :- include_module static_term.
+%:- end_module llds_rtti.
+
+% LLDS->LLDS optimization passes.
+:- include_module optimize.
+   :- include_module jumpopt, dupelim, frameopt, delay_slot, labelopt.
+:- include_module peephole.
+   :- include_module wrap_blocks, use_local_vars.
+%   :- include_module value_number.
+%      :- include_module vn_block.
+%      :- include_module vn_cost.
+%      :- include_module vn_debug.
+%      :- include_module vn_filter.
+%      :- include_module vn_flush.
+%      :- include_module vn_order.
+%      :- include_module vn_temploc.
+%      :- include_module vn_util.
+%      :- include_module vn_verify.
+%      :- include_module vn_type.
+%      :- include_module vn_table.
+   :- include_module llds_common.
+   :- include_module livemap, basic_block, opt_util, opt_debug.
+                
+% The LLDS->C output phase.
+:- include_module transform_llds.
+:- include_module llds_out.
+:- include_module layout_out.
+:- include_module rtti_out.
+  
+:- end_module ll_backend.
+
+%-----------------------------------------------------------------------------%
Index: compiler/ll_pseudo_type_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ll_pseudo_type_info.m,v
retrieving revision 1.2
diff -u -d -r1.2 ll_pseudo_type_info.m
--- compiler/ll_pseudo_type_info.m	11 Aug 2000 08:19:06 -0000	1.2
+++ compiler/ll_pseudo_type_info.m	5 Mar 2002 23:53:34 -0000
@@ -19,11 +19,11 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module ll_pseudo_type_info.
+:- module ll_backend__ll_pseudo_type_info.
 
 :- interface.
 
-:- import_module prog_data, llds.
+:- import_module parse_tree__prog_data, ll_backend__llds.
 :- import_module counter.
 
 	% ll_pseudo_type_info__construct_typed_pseudo_type_info(Type,
@@ -57,7 +57,7 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
-:- import_module pseudo_type_info, rtti.
+:- import_module backend_libs__pseudo_type_info, backend_libs__rtti.
 :- import_module std_util, list, bool, int.
 
 ll_pseudo_type_info__construct_llds_pseudo_type_info(Type, NumUnivQTvars,
Index: compiler/llds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds.m,v
retrieving revision 1.280
diff -u -d -r1.280 llds.m
--- compiler/llds.m	6 Nov 2001 15:20:46 -0000	1.280
+++ compiler/llds.m	6 Mar 2002 00:53:49 -0000
@@ -12,14 +12,15 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module llds.
+:- module ll_backend__llds.
 
 :- interface.
 
-:- import_module prog_data, (inst).
-:- import_module hlds_pred, hlds_goal, hlds_data.
-:- import_module foreign, code_model, rtti, layout, builtin_ops.
-:- import_module tree.
+:- import_module parse_tree__prog_data, (parse_tree__inst).
+:- import_module hlds__hlds_pred, hlds__hlds_goal, hlds__hlds_data.
+:- import_module backend_libs__foreign, backend_libs__code_model.
+:- import_module backend_libs__rtti, ll_backend__layout, backend_libs__builtin_ops.
+:- import_module libs__tree.
 
 :- import_module bool, assoc_list, list, map, set, std_util, counter, term.
 
@@ -41,7 +42,7 @@
 
 %-----------------------------------------------------------------------------%
 
-:- import_module continuation_info.
+:- import_module ll_backend__continuation_info.
 
 :- type global_data.
 
Index: compiler/llds_common.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_common.m,v
retrieving revision 1.40
diff -u -d -r1.40 llds_common.m
--- compiler/llds_common.m	20 Feb 2002 03:14:06 -0000	1.40
+++ compiler/llds_common.m	5 Mar 2002 23:53:34 -0000
@@ -16,12 +16,12 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module llds_common.
+:- module ll_backend__llds_common.
 
 :- interface.
 
-:- import_module llds.
-:- import_module prog_data. % for module_name
+:- import_module ll_backend__llds.
+:- import_module parse_tree__prog_data. % for module_name
 :- import_module list.
 
 :- pred llds_common(list(c_procedure)::in, list(comp_gen_c_data)::in,
@@ -30,7 +30,7 @@
 
 :- implementation.
 
-:- import_module rtti, layout, llds_out.
+:- import_module backend_libs__rtti, ll_backend__layout, ll_backend__llds_out.
 :- import_module bool, int, assoc_list, map, std_util, require.
 
 :- type cell_info
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.186
diff -u -d -r1.186 llds_out.m
--- compiler/llds_out.m	20 Feb 2002 03:14:07 -0000	1.186
+++ compiler/llds_out.m	6 Mar 2002 00:53:49 -0000
@@ -13,12 +13,13 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module llds_out.
+:- module ll_backend__llds_out.
 
 :- interface.
 
-:- import_module llds, builtin_ops, prog_data, hlds_data, rl_file.
-:- import_module globals.
+:- import_module ll_backend__llds, backend_libs__builtin_ops.
+:- import_module parse_tree__prog_data, hlds__hlds_data, aditi_backend__rl_file.
+:- import_module libs__globals.
 :- import_module bool, std_util, list, map, io.
 
 	% Given a 'c_file' structure, output the LLDS code inside it
@@ -260,10 +261,13 @@
 
 :- implementation.
 
-:- import_module rtti, rtti_out, layout, layout_out, options, trace_params.
-:- import_module exprn_aux, prog_util, prog_out, hlds_pred.
-:- import_module export, mercury_to_mercury, modules, passes_aux.
-:- import_module c_util, foreign.
+:- import_module backend_libs__rtti, ll_backend__rtti_out, ll_backend__layout.
+:- import_module ll_backend__layout_out, libs__options, libs__trace_params.
+:- import_module ll_backend__exprn_aux, parse_tree__prog_util.
+:- import_module parse_tree__prog_out, hlds__hlds_pred.
+:- import_module backend_libs__export, parse_tree__mercury_to_mercury.
+:- import_module parse_tree__modules, hlds__passes_aux.
+:- import_module backend_libs__c_util, backend_libs__foreign.
 
 :- import_module int, char, string, std_util.
 :- import_module set, bintree_set, assoc_list, require.
Index: compiler/lookup_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/lookup_switch.m,v
retrieving revision 1.42
diff -u -d -r1.42 lookup_switch.m
--- compiler/lookup_switch.m	20 Jan 2001 15:42:46 -0000	1.42
+++ compiler/lookup_switch.m	6 Mar 2002 00:53:49 -0000
@@ -37,14 +37,14 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module lookup_switch.
+:- module ll_backend__lookup_switch.
 
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_goal, hlds_data, switch_util.
-:- import_module code_model.
-:- import_module llds, code_info.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_goal, hlds__hlds_data, backend_libs__switch_util.
+:- import_module backend_libs__code_model.
+:- import_module ll_backend__llds, ll_backend__code_info.
 
 :- import_module std_util, map, set, list.
 
@@ -69,11 +69,12 @@
 
 :- implementation.
 
-:- import_module prog_data.
-:- import_module type_util, mode_util, instmap.
-:- import_module builtin_ops.
-:- import_module dense_switch, code_gen, exprn_aux.
-:- import_module globals, options, tree.
+:- import_module parse_tree__prog_data.
+:- import_module check_hlds__type_util, check_hlds__mode_util, hlds__instmap.
+:- import_module backend_libs__builtin_ops.
+:- import_module ll_backend__dense_switch, ll_backend__code_gen.
+:- import_module ll_backend__exprn_aux.
+:- import_module libs__globals, libs__options, libs__tree.
 
 :- import_module int, require, bool, assoc_list.
 
Index: compiler/lp.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/lp.m,v
retrieving revision 1.4
diff -u -d -r1.4 lp.m
--- compiler/lp.m	18 Nov 2000 08:50:43 -0000	1.4
+++ compiler/lp.m	5 Mar 2002 23:53:18 -0000
@@ -28,7 +28,7 @@
 % introduce new variables as part of the solving algorithm.
 %
 %------------------------------------------------------------------------------%
-:- module lp.
+:- module transform_hlds__lp.
 
 :- interface.
 
Index: compiler/magic.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/magic.m,v
retrieving revision 1.28
diff -u -d -r1.28 magic.m
--- compiler/magic.m	20 Feb 2002 03:14:10 -0000	1.28
+++ compiler/magic.m	6 Mar 2002 00:53:50 -0000
@@ -158,11 +158,11 @@
 % not need to handle them.
 % 
 %-----------------------------------------------------------------------------%
-:- module magic.
+:- module aditi_backend__magic.
 
 :- interface.
 
-:- import_module hlds_module.
+:- import_module hlds__hlds_module.
 :- import_module io.
 
 :- pred magic__process_module(module_info, module_info, io__state, io__state).
@@ -171,14 +171,18 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module magic_util, context.
-:- import_module dependency_graph, hlds_pred, hlds_goal, hlds_data, prog_data.
-:- import_module passes_aux, mode_util, (inst), instmap, rl_gen, rl.
-:- import_module globals, options, hlds_out, prog_out, goal_util, type_util.
-:- import_module polymorphism, quantification, saved_vars, dead_proc_elim.
+:- import_module aditi_backend__magic_util, aditi_backend__context.
+:- import_module transform_hlds__dependency_graph, hlds__hlds_pred.
+:- import_module hlds__hlds_goal, hlds__hlds_data, parse_tree__prog_data.
+:- import_module hlds__passes_aux, check_hlds__mode_util, (parse_tree__inst).
+:- import_module hlds__instmap, aditi_backend__rl_gen, aditi_backend__rl.
+:- import_module libs__globals, libs__options, hlds__hlds_out.
+:- import_module parse_tree__prog_out, hlds__goal_util, check_hlds__type_util.
+:- import_module check_hlds__polymorphism, hlds__quantification.
+:- import_module ll_backend__saved_vars, transform_hlds__dead_proc_elim.
 
 :- import_module int, list, map, require, set, std_util, string, term, varset.
-:- import_module assoc_list, bool, simplify.
+:- import_module assoc_list, bool, check_hlds__simplify.
 
 magic__process_module(ModuleInfo0, ModuleInfo) -->
 
Index: compiler/magic_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/magic_util.m,v
retrieving revision 1.18
diff -u -d -r1.18 magic_util.m
--- compiler/magic_util.m	26 Feb 2002 02:45:40 -0000	1.18
+++ compiler/magic_util.m	6 Mar 2002 00:53:50 -0000
@@ -10,11 +10,12 @@
 %
 % Note: this module contains multiple interface sections.
 %-----------------------------------------------------------------------------%
-:- module magic_util.
+:- module aditi_backend__magic_util.
 
 :- interface.
 
-:- import_module hlds_goal, hlds_module, hlds_pred, prog_data.
+:- import_module hlds__hlds_goal, hlds__hlds_module, hlds__hlds_pred.
+:- import_module parse_tree__prog_data.
 :- import_module bool, io, list, map, set, std_util.
 
 	% Check that the argument types and modes are legal for
@@ -117,9 +118,11 @@
 
 :- implementation.
 
-:- import_module hlds_data, code_util, type_util, mode_util, inst_match.
-:- import_module instmap, goal_util, prog_out, hlds_out, error_util, prog_util.
-:- import_module (inst), polymorphism.
+:- import_module hlds__hlds_data, ll_backend__code_util.
+:- import_module check_hlds__type_util, check_hlds__mode_util, check_hlds__inst_match.
+:- import_module hlds__instmap, hlds__goal_util, parse_tree__prog_out.
+:- import_module hlds__hlds_out, hlds__error_util, parse_tree__prog_util.
+:- import_module (parse_tree__inst), check_hlds__polymorphism.
 
 :- import_module assoc_list, int, require, string, term, varset.
 
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.401
diff -u -d -r1.401 make_hlds.m
--- compiler/make_hlds.m	26 Feb 2002 02:45:41 -0000	1.401
+++ compiler/make_hlds.m	6 Mar 2002 00:53:50 -0000
@@ -19,11 +19,13 @@
 
 % WISHLIST - we should handle explicit module quantification
 
-:- module make_hlds.
+:- module hlds__make_hlds.
 :- interface.
 
-:- import_module prog_data, hlds_data, hlds_module, hlds_pred.
-:- import_module equiv_type, module_qual, special_pred.
+:- import_module parse_tree__prog_data, hlds__hlds_data, hlds__hlds_module.
+:- import_module hlds__hlds_pred.
+:- import_module parse_tree__equiv_type, parse_tree__module_qual.
+:- import_module hlds__special_pred.
 
 :- import_module io, std_util, list, bool.
 
@@ -95,15 +97,21 @@
 
 :- implementation.
 
-:- import_module hlds_goal.
-:- import_module prog_io, prog_io_goal, prog_io_dcg, prog_io_util, prog_out.
-:- import_module modules, module_qual, prog_util, options, hlds_out, typecheck.
-:- import_module make_tags, quantification, (inst), globals.
-:- import_module code_util, unify_proc, type_util, mode_util, mode_errors.
-:- import_module mercury_to_mercury, passes_aux, clause_to_proc, inst_match.
-:- import_module fact_table, purity, goal_util, term_util, export, llds.
-:- import_module error_util, foreign.
-:- import_module recompilation.
+:- import_module hlds__hlds_goal.
+:- import_module parse_tree__prog_io, parse_tree__prog_io_goal.
+:- import_module parse_tree__prog_io_dcg, parse_tree__prog_io_util, parse_tree__prog_out.
+:- import_module parse_tree__modules, parse_tree__module_qual.
+:- import_module parse_tree__prog_util, libs__options, hlds__hlds_out, check_hlds__typecheck.
+:- import_module hlds__make_tags, hlds__quantification, (parse_tree__inst).
+:- import_module libs__globals.
+:- import_module ll_backend__code_util, check_hlds__unify_proc.
+:- import_module check_hlds__type_util, check_hlds__mode_util, check_hlds__mode_errors.
+:- import_module parse_tree__mercury_to_mercury, hlds__passes_aux.
+:- import_module check_hlds__clause_to_proc, check_hlds__inst_match.
+:- import_module ll_backend__fact_table, check_hlds__purity, hlds__goal_util.
+:- import_module transform_hlds__term_util, backend_libs__export, ll_backend__llds.
+:- import_module hlds__error_util, backend_libs__foreign.
+:- import_module hlds__recompilation.
 
 :- import_module string, char, int, set, bintree, map, multi_map, require.
 :- import_module bag, term, varset, getopt, assoc_list, term_io.
Index: compiler/make_tags.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_tags.m,v
retrieving revision 1.35
diff -u -d -r1.35 make_tags.m
--- compiler/make_tags.m	31 Oct 2001 16:58:08 -0000	1.35
+++ compiler/make_tags.m	6 Mar 2002 00:53:50 -0000
@@ -48,10 +48,10 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module make_tags.
+:- module hlds__make_tags.
 :- interface.
 
-:- import_module prog_data, hlds_data, globals.
+:- import_module parse_tree__prog_data, hlds__hlds_data, libs__globals.
 :- import_module bool, list.
 
 % assign_constructor_tags(Constructors, TypeId, Globals, TagValues, IsEnum):
@@ -69,7 +69,8 @@
 
 :- implementation.
 
-:- import_module prog_util, type_util, error_util, globals, options.
+:- import_module parse_tree__prog_util, check_hlds__type_util.
+:- import_module hlds__error_util, libs__globals, libs__options.
 :- import_module int, map, std_util, require.
 
 %-----------------------------------------------------------------------------%
Index: compiler/mark_static_terms.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mark_static_terms.m,v
retrieving revision 1.7
diff -u -d -r1.7 mark_static_terms.m
--- compiler/mark_static_terms.m	7 Apr 2001 14:04:49 -0000	1.7
+++ compiler/mark_static_terms.m	5 Mar 2002 23:53:34 -0000
@@ -14,11 +14,11 @@
 
 % Main author: fjh.
 
-:- module mark_static_terms.
+:- module ml_backend__mark_static_terms.
 
 :- interface.
 
-:- import_module hlds_pred, hlds_module.
+:- import_module hlds__hlds_pred, hlds__hlds_module.
 
 :- pred mark_static_terms(proc_info::in, module_info::in, proc_info::out)
 	is det.
@@ -26,7 +26,7 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
-:- import_module prog_data, hlds_goal, hlds_data.
+:- import_module parse_tree__prog_data, hlds__hlds_goal, hlds__hlds_data.
 :- import_module map, list, bool.
 
 %
@@ -36,7 +36,7 @@
 %
 :- type static_info == map(prog_var, static_cons).
 
-:- import_module hlds_goal.
+:- import_module hlds__hlds_goal.
 :- import_module int, list, std_util, require.
 
 mark_static_terms(Proc0, _ModuleInfo, Proc) :-
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.237
diff -u -d -r1.237 mercury_compile.m
--- compiler/mercury_compile.m	3 Mar 2002 13:43:44 -0000	1.237
+++ compiler/mercury_compile.m	6 Mar 2002 00:53:50 -0000
@@ -13,7 +13,7 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module mercury_compile.
+:- module top_level__mercury_compile.
 :- interface.
 :- import_module io.
 
@@ -29,54 +29,71 @@
 	%
 
 	% semantic analysis
-:- import_module handle_options, prog_io, prog_out, modules, module_qual.
-:- import_module equiv_type, make_hlds, typecheck, purity, polymorphism, modes.
-:- import_module switch_detection, cse_detection, det_analysis, unique_modes.
-:- import_module stratify, simplify.
+:- import_module libs__handle_options, parse_tree__prog_io.
+:- import_module parse_tree__prog_out, parse_tree__modules, parse_tree__module_qual.
+:- import_module parse_tree__equiv_type, hlds__make_hlds.
+:- import_module check_hlds__typecheck, check_hlds__purity, check_hlds__polymorphism, check_hlds__modes.
+:- import_module check_hlds__switch_detection, check_hlds__cse_detection.
+:- import_module check_hlds__det_analysis, check_hlds__unique_modes.
+:- import_module check_hlds__stratify, check_hlds__simplify.
 :- import_module pprint.
 
 	% high-level HLDS transformations
-:- import_module check_typeclass, intermod, trans_opt, table_gen, (lambda).
-:- import_module type_ctor_info, termination, higher_order, accumulator.
-:- import_module inlining, deforest, dnf, magic, dead_proc_elim.
-:- import_module delay_construct, unused_args, unneeded_code, lco.
-:- import_module deep_profiling.
+:- import_module check_hlds__check_typeclass, transform_hlds__intermod.
+:- import_module transform_hlds__trans_opt, transform_hlds__table_gen, (transform_hlds__lambda).
+:- import_module backend_libs__type_ctor_info, transform_hlds__termination.
+:- import_module transform_hlds__higher_order, transform_hlds__accumulator.
+:- import_module transform_hlds__inlining, transform_hlds__deforest.
+:- import_module aditi_backend__dnf, aditi_backend__magic, transform_hlds__dead_proc_elim.
+:- import_module transform_hlds__delay_construct, transform_hlds__unused_args.
+:- import_module transform_hlds__unneeded_code, transform_hlds__lco.
+:- import_module ll_backend__deep_profiling.
 
 	% the LLDS back-end
-:- import_module saved_vars, liveness.
-:- import_module follow_code, live_vars, arg_info, store_alloc, goal_path.
-:- import_module code_gen, optimize, foreign, export.
-:- import_module base_typeclass_info.
-:- import_module llds_common, transform_llds, llds_out.
-:- import_module continuation_info, stack_layout.
+:- import_module ll_backend__saved_vars, ll_backend__liveness.
+:- import_module ll_backend__follow_code, ll_backend__live_vars.
+:- import_module ll_backend__arg_info, ll_backend__store_alloc, check_hlds__goal_path.
+:- import_module ll_backend__code_gen, ll_backend__optimize.
+:- import_module backend_libs__foreign, backend_libs__export.
+:- import_module backend_libs__base_typeclass_info.
+:- import_module ll_backend__llds_common, ll_backend__transform_llds.
+:- import_module ll_backend__llds_out.
+:- import_module ll_backend__continuation_info, ll_backend__stack_layout.
 
 	% the Aditi-RL back-end
-:- import_module rl_gen, rl_opt, rl_out.
+:- import_module aditi_backend__rl_gen, aditi_backend__rl_opt.
+:- import_module aditi_backend__rl_out.
 
 	% the bytecode back-end
-:- import_module bytecode_gen, bytecode.
+:- import_module bytecode_backend__bytecode_gen, bytecode_backend__bytecode.
 
 	% the MLDS back-end
-:- import_module add_trail_ops, add_heap_ops.	% HLDS -> HLDS
-:- import_module mark_static_terms.		% HLDS -> HLDS
-:- import_module mlds.				% MLDS data structure
-:- import_module ml_code_gen, rtti_to_mlds.	% HLDS/RTTI -> MLDS
-:- import_module ml_elim_nested.		% MLDS -> MLDS
-:- import_module ml_tailcall.			% MLDS -> MLDS
-:- import_module ml_optimize.			% MLDS -> MLDS
-:- import_module mlds_to_c.			% MLDS -> C
-:- import_module mlds_to_java.			% MLDS -> Java
-:- import_module mlds_to_ilasm.			% MLDS -> IL assembler
-:- import_module maybe_mlds_to_gcc.		% MLDS -> GCC back-end
-:- import_module ml_util.			% MLDS utility predicates 
+:- import_module ml_backend__add_trail_ops.
+:- import_module ml_backend__add_heap_ops.	% HLDS -> HLDS
+:- import_module ml_backend__mark_static_terms.		% HLDS -> HLDS
+:- import_module ml_backend__mlds.				% MLDS data structure
+:- import_module ml_backend__ml_code_gen.
+:- import_module ml_backend__rtti_to_mlds.	% HLDS/RTTI -> MLDS
+:- import_module ml_backend__ml_elim_nested.		% MLDS -> MLDS
+:- import_module ml_backend__ml_tailcall.			% MLDS -> MLDS
+:- import_module ml_backend__ml_optimize.			% MLDS -> MLDS
+:- import_module ml_backend__mlds_to_c.			% MLDS -> C
+:- import_module ml_backend__mlds_to_java.			% MLDS -> Java
+:- import_module ml_backend__mlds_to_ilasm.			% MLDS -> IL assembler
+:- import_module ml_backend__maybe_mlds_to_gcc.		% MLDS -> GCC back-end
+:- import_module ml_backend__ml_util.			% MLDS utility predicates 
 
 	% miscellaneous compiler modules
-:- import_module prog_data, hlds_module, hlds_pred, hlds_out, llds, rl.
-:- import_module mercury_to_mercury, hlds_data.
-:- import_module layout, dependency_graph, prog_util, rl_dump, rl_file.
-:- import_module options, globals, trace_params, passes_aux.
-:- import_module recompilation, recompilation_usage, recompilation_check.
-:- import_module timestamp.
+:- import_module parse_tree__prog_data, hlds__hlds_module, hlds__hlds_pred.
+:- import_module hlds__hlds_out, ll_backend__llds, aditi_backend__rl.
+:- import_module parse_tree__mercury_to_mercury, hlds__hlds_data.
+:- import_module ll_backend__layout, transform_hlds__dependency_graph.
+:- import_module parse_tree__prog_util, aditi_backend__rl_dump, aditi_backend__rl_file.
+:- import_module libs__options, libs__globals, libs__trace_params.
+:- import_module hlds__passes_aux.
+:- import_module hlds__recompilation, hlds__recompilation_usage.
+:- import_module hlds__recompilation_check.
+:- import_module hlds__timestamp.
 
 	% library modules
 :- import_module int, list, map, set, std_util, dir, require, string, bool.
@@ -3149,13 +3166,16 @@
 		{ Include = foreign_decl_code(c, IncludeString, Context) }
 	;
 		{ Lang = csharp },
-		{ error("sorry, not yet implemented: `:- pragma foreign_import_module' for C#") }
+		{ error("sorry.
+:- import_module not yet implemented: `:- pragma foreign_import_module' for C#") }
 	;
 		{ Lang = managed_cplusplus },
-		{ error("sorry, not yet implemented: `:- pragma foreign_import_module' for Managed C++") }
+		{ error("sorry.
+:- import_module not yet implemented: `:- pragma foreign_import_module' for Managed C++") }
 	;
 		{ Lang = il },
-		{ error("sorry, not yet implemented: `:- pragma foreign_import_module' for IL") }
+		{ error("sorry.
+:- import_module not yet implemented: `:- pragma foreign_import_module' for IL") }
 	).
 
 :- pred get_c_body_code(foreign_body_info, list(user_foreign_code)).
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.206
diff -u -d -r1.206 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m	26 Feb 2002 02:45:45 -0000	1.206
+++ compiler/mercury_to_mercury.m	6 Mar 2002 00:53:50 -0000
@@ -39,11 +39,12 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module mercury_to_mercury.
+:- module parse_tree__mercury_to_mercury.
 :- interface.
 
-:- import_module prog_data, (inst).
-:- import_module hlds_goal, hlds_data.
+:- import_module parse_tree__prog_data, (parse_tree__inst).
+:- import_module hlds__hlds_goal, hlds__hlds_data.
+:- import_module libs__globals.
 
 :- import_module bool, std_util, list, io, varset, term.
 
@@ -326,9 +327,12 @@
 
 :- implementation.
 
-:- import_module prog_out, prog_util, hlds_pred, hlds_out, instmap.
-:- import_module recompilation_version, purity, term_util.
-:- import_module globals, options, termination, foreign.
+:- import_module parse_tree__prog_out, parse_tree__prog_util, hlds__hlds_pred.
+:- import_module hlds__hlds_out, hlds__instmap.
+:- import_module hlds__recompilation_version, check_hlds__purity.
+:- import_module transform_hlds__term_util.
+:- import_module libs__options, transform_hlds__termination.
+:- import_module backend_libs__foreign.
 
 :- import_module assoc_list, char, int, string, set, lexer, ops, require.
 :- import_module term, term_io, varset.
Index: compiler/middle_rec.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/middle_rec.m,v
retrieving revision 1.87
diff -u -d -r1.87 middle_rec.m
--- compiler/middle_rec.m	24 Apr 2001 03:58:59 -0000	1.87
+++ compiler/middle_rec.m	6 Mar 2002 00:53:50 -0000
@@ -10,11 +10,11 @@
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
 
-:- module middle_rec.
+:- module ll_backend__middle_rec.
 
 :- interface.
 
-:- import_module hlds_goal, llds, code_info.
+:- import_module hlds__hlds_goal, ll_backend__llds, ll_backend__code_info.
 
 :- pred middle_rec__match_and_generate(hlds_goal, code_tree,
 	code_info, code_info).
@@ -25,11 +25,14 @@
 
 :- implementation.
 
-:- import_module builtin_ops, hlds_module, hlds_data, prog_data, prog_out.
-:- import_module code_gen, unify_gen, code_util, code_aux, opt_util.
-:- import_module code_model.
+:- import_module backend_libs__builtin_ops, hlds__hlds_module.
+:- import_module hlds__hlds_data, parse_tree__prog_data, parse_tree__prog_out.
+:- import_module ll_backend__code_gen, ll_backend__unify_gen.
+:- import_module ll_backend__code_util, ll_backend__code_aux, ll_backend__opt_util.
+:- import_module backend_libs__code_model.
 
-:- import_module bool, set, int, std_util, tree, list, assoc_list, require.
+:- import_module bool, set, int, std_util, libs__tree, list, assoc_list.
+:- import_module require.
 :- import_module string.
 
 %---------------------------------------------------------------------------%
Index: compiler/ml_backend.m
===================================================================
RCS file: compiler/ml_backend.m
diff -N compiler/ml_backend.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ compiler/ml_backend.m	6 Mar 2002 00:06:18 -0000
@@ -0,0 +1,58 @@
+%-----------------------------------------------------------------------------%
+%
+% The medium-level code generator
+%
+:- module ml_backend.
+:- interface.
+:- import_module transform_hlds, check_hlds. % are these needed?
+:- import_module hlds, parse_tree, libs, backend_libs.
+:- import_module ll_backend. % XXX needed for llds_out__name_mangle, etc.
+
+%-----------------------------------------------------------------------------%
+
+:- include_module mlds.
+:- include_module ml_util.
+
+% Phase 4-ml: MLDS-specific HLDS to HLDS transformations and annotations.
+:- include_module add_heap_ops, add_trail_ops. % transformations
+:- include_module mark_static_terms. % annotation
+
+% Phase 5-ml: compile HLDS to MLDS
+:- include_module ml_code_gen.
+   :- include_module ml_type_gen.
+   :- include_module ml_call_gen.
+   :- include_module ml_unify_gen, ml_closure_gen.
+   :- include_module ml_switch_gen.
+      :- include_module ml_string_switch, ml_tag_switch, ml_simplify_switch.
+:- include_module ml_code_util.
+:- include_module rtti_to_mlds.
+
+% Phase 6-ml: MLDS -> MLDS transformations
+:- include_module ml_elim_nested.
+:- include_module ml_tailcall.
+:- include_module ml_optimize.
+
+% Phase 7-ml: compile MLDS to target code
+
+% MLDS->C back-end
+:- include_module mlds_to_c.
+
+% MLDS->Assembler back-end
+:- include_module maybe_mlds_to_gcc.
+% :- include_module mlds_to_gcc, gcc.
+
+% MLDS->Java back-end
+:- include_module mlds_to_java, java_util.
+
+% MLDS->.NET CLR back-end
+:- include_module mlds_to_il.
+:- include_module mlds_to_ilasm.
+:- include_module mlds_to_csharp.
+:- include_module mlds_to_mcpp.
+:- include_module ilds.
+:- include_module ilasm.
+:- include_module il_peephole.
+
+:- end_module ml_backend.
+
+%-----------------------------------------------------------------------------%
Index: compiler/ml_call_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_call_gen.m,v
retrieving revision 1.30
diff -u -d -r1.30 ml_call_gen.m
--- compiler/ml_call_gen.m	6 Feb 2002 18:44:18 -0000	1.30
+++ compiler/ml_call_gen.m	6 Mar 2002 00:53:50 -0000
@@ -13,13 +13,13 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module ml_call_gen.
+:- module ml_backend__ml_call_gen.
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_pred, hlds_goal.
-:- import_module code_model.
-:- import_module mlds, ml_code_util.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_pred, hlds__hlds_goal.
+:- import_module backend_libs__code_model.
+:- import_module ml_backend__mlds, ml_backend__ml_code_util.
 
 :- import_module list.
 
@@ -97,10 +97,11 @@
 
 :- implementation.
 
-:- import_module hlds_module, hlds_data.
-:- import_module builtin_ops.
-:- import_module type_util, mode_util, error_util.
-:- import_module options, globals.
+:- import_module hlds__hlds_module, hlds__hlds_data.
+:- import_module backend_libs__builtin_ops.
+:- import_module check_hlds__type_util, check_hlds__mode_util.
+:- import_module hlds__error_util.
+:- import_module libs__options, libs__globals.
 
 :- import_module bool, int, string, std_util, term, varset, require, map.
 
Index: compiler/ml_closure_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_closure_gen.m,v
retrieving revision 1.1
diff -u -d -r1.1 ml_closure_gen.m
--- compiler/ml_closure_gen.m	4 Mar 2002 07:31:35 -0000	1.1
+++ compiler/ml_closure_gen.m	6 Mar 2002 00:53:50 -0000
@@ -12,12 +12,12 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module ml_closure_gen.
+:- module ml_backend__ml_closure_gen.
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_pred, hlds_goal.
-:- import_module mlds, ml_code_util.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_pred, hlds__hlds_goal.
+:- import_module ml_backend__mlds, ml_backend__ml_code_util.
 
 :- import_module list.
 
@@ -61,17 +61,20 @@
 
 :- implementation.
 
-:- import_module hlds_module.
-:- import_module code_model, pseudo_type_info, rtti.
-:- import_module ml_unify_gen, ml_call_gen, rtti_to_mlds.
-:- import_module type_util, mode_util, error_util.
-:- import_module options, globals.
+:- import_module hlds__hlds_module.
+:- import_module backend_libs__code_model, backend_libs__pseudo_type_info.
+:- import_module backend_libs__rtti.
+:- import_module ml_backend__ml_unify_gen, ml_backend__ml_call_gen.
+:- import_module ml_backend__rtti_to_mlds.
+:- import_module check_hlds__type_util, check_hlds__mode_util.
+:- import_module hlds__error_util.
+:- import_module libs__options, libs__globals.
 
 % XXX The following modules depend on the LLDS,
 % so ideally they should not be used here.
-:- import_module continuation_info. % needed for `generate_closure_layout'
-:- import_module stack_layout.      % needed for `represent_locn_as_int'
-:- import_module llds.       	    % needed for `layout_locn'
+:- import_module ll_backend__continuation_info. % needed for `generate_closure_layout'
+:- import_module ll_backend__stack_layout.      % needed for `represent_locn_as_int'
+:- import_module ll_backend__llds.       	    % needed for `layout_locn'
 
 :- import_module assoc_list, bool, int, map, set, std_util, string, term.
 
Index: compiler/ml_code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.110
diff -u -d -r1.110 ml_code_gen.m
--- compiler/ml_code_gen.m	5 Mar 2002 10:59:19 -0000	1.110
+++ compiler/ml_code_gen.m	6 Mar 2002 00:53:50 -0000
@@ -719,14 +719,14 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module ml_code_gen.
+:- module ml_backend__ml_code_gen.
 
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_module, hlds_goal.
-:- import_module code_model.
-:- import_module mlds, ml_code_util.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_goal.
+:- import_module backend_libs__code_model.
+:- import_module ml_backend__mlds, ml_backend__ml_code_util.
 :- import_module io, map.
 
 %-----------------------------------------------------------------------------%
@@ -780,15 +780,18 @@
 
 :- implementation.
 
-:- import_module ml_type_gen, ml_call_gen, ml_unify_gen, ml_switch_gen.
-:- import_module ml_code_util.
-:- import_module llds. % XXX needed for pragma foreign code
-:- import_module export, foreign. % XXX needed for pragma foreign code
-:- import_module hlds_pred, hlds_data.
-:- import_module goal_util, type_util, mode_util, builtin_ops, error_util.
-:- import_module c_util.
-:- import_module passes_aux, modules.
-:- import_module globals, options.
+:- import_module ml_backend__ml_type_gen, ml_backend__ml_call_gen.
+:- import_module ml_backend__ml_unify_gen, ml_backend__ml_switch_gen.
+:- import_module ml_backend__ml_code_util.
+:- import_module ll_backend__llds. % XXX needed for pragma backend_libs__foreign code
+:- import_module backend_libs__export.
+:- import_module backend_libs__foreign. % XXX needed for pragma foreign code
+:- import_module hlds__hlds_pred, hlds__hlds_data.
+:- import_module hlds__goal_util, check_hlds__type_util.
+:- import_module check_hlds__mode_util, backend_libs__builtin_ops, hlds__error_util.
+:- import_module backend_libs__c_util.
+:- import_module hlds__passes_aux, parse_tree__modules.
+:- import_module libs__globals, libs__options.
 
 :- import_module assoc_list, bool, string, list.
 :- import_module int, set, term, require, std_util.
Index: compiler/ml_code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_util.m,v
retrieving revision 1.57
diff -u -d -r1.57 ml_code_util.m
--- compiler/ml_code_util.m	4 Mar 2002 07:31:35 -0000	1.57
+++ compiler/ml_code_util.m	6 Mar 2002 00:53:50 -0000
@@ -12,14 +12,15 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module ml_code_util.
+:- module ml_backend__ml_code_util.
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_module, hlds_pred.
-:- import_module builtin_ops, rtti, code_model.
-:- import_module mlds.
-:- import_module globals.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred.
+:- import_module backend_libs__builtin_ops, backend_libs__rtti.
+:- import_module backend_libs__code_model.
+:- import_module ml_backend__mlds.
+:- import_module libs__globals.
 
 :- import_module bool, int, list, map, std_util.
 
@@ -784,13 +785,15 @@
 
 :- implementation.
 
-:- import_module prog_data, prog_io.
-:- import_module hlds_goal, (inst), instmap, polymorphism.
-:- import_module foreign.
-:- import_module prog_util, type_util, mode_util, special_pred, error_util.
-:- import_module code_util. % XXX for `code_util__compiler_generated'.
-:- import_module ml_code_gen, ml_call_gen.
-:- import_module globals, options.
+:- import_module parse_tree__prog_data, parse_tree__prog_io.
+:- import_module hlds__hlds_goal, (parse_tree__inst), hlds__instmap.
+:- import_module check_hlds__polymorphism.
+:- import_module backend_libs__foreign.
+:- import_module parse_tree__prog_util, check_hlds__type_util.
+:- import_module check_hlds__mode_util, hlds__special_pred, hlds__error_util.
+:- import_module ll_backend__code_util. % XXX for `code_util__compiler_generated'.
+:- import_module ml_backend__ml_code_gen, ml_backend__ml_call_gen.
+:- import_module libs__globals, libs__options.
 
 :- import_module counter, stack, string, require, set, term, varset.
 
Index: compiler/ml_elim_nested.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_elim_nested.m,v
retrieving revision 1.54
diff -u -d -r1.54 ml_elim_nested.m
--- compiler/ml_elim_nested.m	3 Mar 2002 13:43:48 -0000	1.54
+++ compiler/ml_elim_nested.m	5 Mar 2002 23:53:34 -0000
@@ -344,11 +344,11 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module ml_elim_nested.
+:- module ml_backend__ml_elim_nested.
 
 :- interface.
 
-:- import_module mlds.
+:- import_module ml_backend__mlds.
 :- import_module io.
 
 %-----------------------------------------------------------------------------%
@@ -369,13 +369,13 @@
 :- implementation.
 :- import_module bool, counter, int, list, std_util, string, require.
 
-:- import_module ml_code_util, ml_util.
-:- import_module prog_util, type_util.
+:- import_module ml_backend__ml_code_util, ml_backend__ml_util.
+:- import_module parse_tree__prog_util, check_hlds__type_util.
 
 % the following imports are needed for mangling pred names
-:- import_module hlds_pred, prog_data, prog_out.
+:- import_module hlds__hlds_pred, parse_tree__prog_data, parse_tree__prog_out.
 
-:- import_module globals, options.
+:- import_module libs__globals, libs__options.
 
 	% Perform the specified action on the whole MLDS.
 	%
Index: compiler/ml_optimize.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_optimize.m,v
retrieving revision 1.17
diff -u -d -r1.17 ml_optimize.m
--- compiler/ml_optimize.m	3 Mar 2002 13:43:49 -0000	1.17
+++ compiler/ml_optimize.m	6 Mar 2002 00:53:50 -0000
@@ -29,10 +29,10 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module ml_optimize.
+:- module ml_backend__ml_optimize.
 :- interface.
 
-:- import_module mlds, io.
+:- import_module ml_backend__mlds, io.
 
 :- pred optimize(mlds, mlds, io__state, io__state).
 :- mode optimize(in, out, di, uo) is det.
@@ -41,8 +41,9 @@
 
 :- implementation.
 
-:- import_module ml_util, ml_code_util.
-:- import_module builtin_ops, globals, options, error_util.
+:- import_module ml_backend__ml_util, ml_backend__ml_code_util.
+:- import_module backend_libs__builtin_ops, libs__globals, libs__options.
+:- import_module hlds__error_util.
 
 :- import_module bool, int, list, require, std_util, string.
 
Index: compiler/ml_simplify_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_simplify_switch.m,v
retrieving revision 1.5
diff -u -d -r1.5 ml_simplify_switch.m
--- compiler/ml_simplify_switch.m	11 Feb 2002 11:27:05 -0000	1.5
+++ compiler/ml_simplify_switch.m	6 Mar 2002 00:53:50 -0000
@@ -20,10 +20,10 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module ml_simplify_switch.
+:- module ml_backend__ml_simplify_switch.
 :- interface.
 
-:- import_module mlds, ml_code_util.
+:- import_module ml_backend__mlds, ml_backend__ml_code_util.
 
 :- pred ml_simplify_switch(mlds__stmt::in, mlds__context::in,
 		mlds__statement::out,
@@ -33,8 +33,9 @@
 
 :- implementation.
 
-:- import_module ml_switch_gen, builtin_ops, type_util.
-:- import_module globals, options.
+:- import_module ml_backend__ml_switch_gen, backend_libs__builtin_ops.
+:- import_module check_hlds__type_util.
+:- import_module libs__globals, libs__options.
 
 :- import_module bool, int, list, map, require, std_util.
 
Index: compiler/ml_string_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_string_switch.m,v
retrieving revision 1.10
diff -u -d -r1.10 ml_string_switch.m
--- compiler/ml_string_switch.m	11 Feb 2002 11:27:05 -0000	1.10
+++ compiler/ml_string_switch.m	6 Mar 2002 00:53:50 -0000
@@ -15,14 +15,14 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module ml_string_switch.
+:- module ml_backend__ml_string_switch.
 
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_data, switch_util.
-:- import_module code_model.
-:- import_module mlds, ml_code_util.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_data, backend_libs__switch_util.
+:- import_module backend_libs__code_model.
+:- import_module ml_backend__mlds, ml_backend__ml_code_util.
 
 :- pred ml_string_switch__generate(cases_list::in, prog_var::in,
 		code_model::in, can_fail::in, prog_context::in,
@@ -33,9 +33,10 @@
 
 :- implementation.
 
-:- import_module ml_code_gen, ml_switch_gen, ml_simplify_switch.
-:- import_module builtin_ops, type_util.
-:- import_module globals, options.
+:- import_module ml_backend__ml_code_gen, ml_backend__ml_switch_gen.
+:- import_module ml_backend__ml_simplify_switch.
+:- import_module backend_libs__builtin_ops, check_hlds__type_util.
+:- import_module libs__globals, libs__options.
 
 :- import_module bool, int, string, list, map, std_util, assoc_list, require.
 
Index: compiler/ml_switch_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_switch_gen.m,v
retrieving revision 1.10
diff -u -d -r1.10 ml_switch_gen.m
--- compiler/ml_switch_gen.m	11 Jan 2002 04:23:20 -0000	1.10
+++ compiler/ml_switch_gen.m	6 Mar 2002 00:53:50 -0000
@@ -58,15 +58,15 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module ml_switch_gen.
+:- module ml_backend__ml_switch_gen.
 
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_goal, hlds_data.
-:- import_module code_model.
-:- import_module mlds, ml_code_util.
-:- import_module globals.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_goal, hlds__hlds_data.
+:- import_module backend_libs__code_model.
+:- import_module ml_backend__mlds, ml_backend__ml_code_util.
+:- import_module libs__globals.
 
 :- import_module list.
 
@@ -96,12 +96,13 @@
 
 :- implementation.
 
-:- import_module ml_tag_switch, ml_string_switch.
-:- import_module ml_code_gen, ml_unify_gen, ml_code_util, ml_simplify_switch.
-:- import_module switch_util, type_util.
-:- import_module foreign, options.
+:- import_module ml_backend__ml_tag_switch, ml_backend__ml_string_switch.
+:- import_module ml_backend__ml_code_gen, ml_backend__ml_unify_gen.
+:- import_module ml_backend__ml_code_util, ml_backend__ml_simplify_switch.
+:- import_module backend_libs__switch_util, check_hlds__type_util.
+:- import_module backend_libs__foreign, libs__options.
 
-:- import_module bool, int, string, map, tree, std_util, require.
+:- import_module bool, int, string, map, libs__tree, std_util, require.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/ml_tag_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_tag_switch.m,v
retrieving revision 1.4
diff -u -d -r1.4 ml_tag_switch.m
--- compiler/ml_tag_switch.m	23 Nov 2000 04:32:45 -0000	1.4
+++ compiler/ml_tag_switch.m	6 Mar 2002 00:53:50 -0000
@@ -11,14 +11,14 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module ml_tag_switch.
+:- module ml_backend__ml_tag_switch.
 
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_data, switch_util.
-:- import_module code_model.
-:- import_module mlds, ml_code_util.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_data, backend_libs__switch_util.
+:- import_module backend_libs__code_model.
+:- import_module ml_backend__mlds, ml_backend__ml_code_util.
 
 :- import_module list.
 
@@ -31,9 +31,10 @@
 
 :- implementation.
 
-:- import_module hlds_goal, hlds_module.
-:- import_module ml_code_gen, ml_switch_gen, ml_unify_gen, ml_simplify_switch.
-:- import_module builtin_ops, type_util.
+:- import_module hlds__hlds_goal, hlds__hlds_module.
+:- import_module ml_backend__ml_code_gen, ml_backend__ml_switch_gen.
+:- import_module ml_backend__ml_unify_gen, ml_backend__ml_simplify_switch.
+:- import_module backend_libs__builtin_ops, check_hlds__type_util.
 
 :- import_module assoc_list, map, int, string, require, std_util.
 
Index: compiler/ml_tailcall.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_tailcall.m,v
retrieving revision 1.15
diff -u -d -r1.15 ml_tailcall.m
--- compiler/ml_tailcall.m	12 Feb 2002 16:36:03 -0000	1.15
+++ compiler/ml_tailcall.m	6 Mar 2002 00:53:50 -0000
@@ -53,9 +53,9 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module ml_tailcall.
+:- module ml_backend__ml_tailcall.
 :- interface.
-:- import_module mlds.
+:- import_module ml_backend__mlds.
 :- import_module io.
 
 	% Traverse the MLDS, marking all optimizable tail calls
@@ -74,7 +74,8 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
-:- import_module prog_data, hlds_pred, hlds_out, error_util, ml_util.
+:- import_module parse_tree__prog_data, hlds__hlds_pred, hlds__hlds_out.
+:- import_module hlds__error_util, ml_backend__ml_util.
 :- import_module string, int, list, std_util.
 
 ml_mark_tailcalls(MLDS0, MLDS) -->
Index: compiler/ml_type_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_type_gen.m,v
retrieving revision 1.24
diff -u -d -r1.24 ml_type_gen.m
--- compiler/ml_type_gen.m	26 Feb 2002 02:45:48 -0000	1.24
+++ compiler/ml_type_gen.m	6 Mar 2002 00:53:50 -0000
@@ -23,9 +23,10 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module ml_type_gen.
+:- module ml_backend__ml_type_gen.
 :- interface.
-:- import_module prog_data, hlds_module, hlds_data, mlds.
+:- import_module parse_tree__prog_data, hlds__hlds_module, hlds__hlds_data.
+:- import_module ml_backend__mlds.
 :- import_module io.
 
 	% Generate MLDS definitions for all the types in the HLDS.
@@ -73,9 +74,10 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
-:- import_module hlds_pred, prog_data, prog_util, type_util, polymorphism.
-:- import_module ml_code_util, error_util.
-:- import_module globals, options.
+:- import_module hlds__hlds_pred, parse_tree__prog_data.
+:- import_module parse_tree__prog_util, check_hlds__type_util, check_hlds__polymorphism.
+:- import_module ml_backend__ml_code_util, hlds__error_util.
+:- import_module libs__globals, libs__options.
 
 :- import_module bool, int, string, list, map, std_util, term, require.
 
Index: compiler/ml_unify_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_unify_gen.m,v
retrieving revision 1.54
diff -u -d -r1.54 ml_unify_gen.m
--- compiler/ml_unify_gen.m	4 Mar 2002 07:31:35 -0000	1.54
+++ compiler/ml_unify_gen.m	6 Mar 2002 00:53:50 -0000
@@ -12,13 +12,13 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module ml_unify_gen.
+:- module ml_backend__ml_unify_gen.
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_module, hlds_data, hlds_goal.
-:- import_module code_model.
-:- import_module mlds, ml_code_util.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_data, hlds__hlds_goal.
+:- import_module backend_libs__code_model.
+:- import_module ml_backend__mlds, ml_backend__ml_code_util.
 
 :- import_module bool, list, std_util.
 
@@ -83,15 +83,17 @@
 
 :- implementation.
 
-:- import_module hlds_pred, hlds_out, builtin_ops.
-:- import_module ml_code_gen, ml_call_gen, ml_type_gen, ml_closure_gen.
-:- import_module prog_util, type_util, mode_util.
-:- import_module rtti, error_util.
-:- import_module globals, options.
+:- import_module hlds__hlds_pred, hlds__hlds_out, backend_libs__builtin_ops.
+:- import_module ml_backend__ml_code_gen, ml_backend__ml_call_gen.
+:- import_module ml_backend__ml_type_gen, ml_backend__ml_closure_gen.
+:- import_module parse_tree__prog_util, check_hlds__type_util.
+:- import_module check_hlds__mode_util.
+:- import_module backend_libs__rtti, hlds__error_util.
+:- import_module libs__globals, libs__options.
 
 % XXX The following modules depend on the LLDS,
 % so ideally they should not be used here.
-:- import_module code_util. 	    % needed for `cons_id_to_tag'.
+:- import_module ll_backend__code_util. 	    % needed for `cons_id_to_tag'.
 
 :- import_module int, string, map, require, term, varset.
 :- import_module assoc_list, set.
Index: compiler/ml_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_util.m,v
retrieving revision 1.17
diff -u -d -r1.17 ml_util.m
--- compiler/ml_util.m	3 Mar 2002 13:43:49 -0000	1.17
+++ compiler/ml_util.m	5 Mar 2002 23:53:18 -0000
@@ -11,12 +11,12 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module ml_util.
+:- module ml_backend__ml_util.
 :- interface.
 
-:- import_module mlds.
+:- import_module ml_backend__mlds.
 :- import_module list, std_util.
-:- import_module prog_data.  % for foreign_language
+:- import_module libs__globals.  % for foreign_language
 
 %-----------------------------------------------------------------------------%
 	% succeeds iff the definitions contain the entry point to
@@ -149,8 +149,8 @@
 
 :- implementation.
 
-:- import_module rtti.
-:- import_module bool, list, std_util, prog_data.
+:- import_module backend_libs__rtti.
+:- import_module bool, list, std_util, parse_tree__prog_data.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/mlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds.m,v
retrieving revision 1.85
diff -u -d -r1.85 mlds.m
--- compiler/mlds.m	3 Mar 2002 17:27:08 -0000	1.85
+++ compiler/mlds.m	6 Mar 2002 00:53:50 -0000
@@ -283,13 +283,15 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module mlds.
+:- module ml_backend__mlds.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, hlds_data.
-:- import_module prog_data, builtin_ops, rtti, code_model.
-:- import_module foreign, type_util.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_data.
+:- import_module parse_tree__prog_data, backend_libs__builtin_ops.
+:- import_module backend_libs__rtti, backend_libs__code_model.
+:- import_module backend_libs__foreign, check_hlds__type_util.
+:- import_module libs__globals.
 
 :- import_module bool, list, std_util, map.
 
@@ -1596,7 +1598,7 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
-:- import_module foreign, modules.
+:- import_module backend_libs__foreign, parse_tree__modules.
 :- import_module int, term, string, require.
 
 %-----------------------------------------------------------------------------%
Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.121
diff -u -d -r1.121 mlds_to_c.m
--- compiler/mlds_to_c.m	27 Feb 2002 13:56:58 -0000	1.121
+++ compiler/mlds_to_c.m	6 Mar 2002 00:53:50 -0000
@@ -20,10 +20,10 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module mlds_to_c.
+:- module ml_backend__mlds_to_c.
 :- interface.
 
-:- import_module mlds.
+:- import_module ml_backend__mlds.
 :- import_module io.
 
 	% output_mlds(MLDS, Suffix):
@@ -48,21 +48,23 @@
 
 :- implementation.
 
-:- import_module ml_util.
-:- import_module llds_out.	% XXX needed for llds_out__name_mangle,
+:- import_module ml_backend__ml_util.
+:- import_module ll_backend__llds_out.	% XXX needed for llds_out__name_mangle,
 				% llds_out__sym_name_mangle,
 				% llds_out__make_base_typeclass_info_name,
 				% output_c_file_intro_and_grade.
-:- import_module rtti.		% for rtti__addr_to_string.
-:- import_module rtti_to_mlds.	% for mlds_rtti_type_name.
-:- import_module hlds_pred.	% for pred_proc_id.
-:- import_module ml_code_util.	% for ml_gen_public_field_decl_flags, which is
+:- import_module backend_libs__rtti.		% for rtti__addr_to_string.
+:- import_module ml_backend__rtti_to_mlds.	% for mlds_rtti_type_name.
+:- import_module hlds__hlds_pred.	% for pred_proc_id.
+:- import_module ml_backend__ml_code_util.	% for ml_gen_public_field_decl_flags, which is
 				% used by the code that handles derived classes
-:- import_module ml_type_gen.	% for ml_gen_type_name
-:- import_module foreign.
-:- import_module globals, options, passes_aux.
-:- import_module builtin_ops, c_util, modules.
-:- import_module prog_data, prog_out, type_util, error_util, code_model.
+:- import_module ml_backend__ml_type_gen.	% for ml_gen_type_name
+:- import_module backend_libs__foreign.
+:- import_module libs__globals, libs__options, hlds__passes_aux.
+:- import_module backend_libs__builtin_ops, backend_libs__c_util.
+:- import_module parse_tree__modules.
+:- import_module parse_tree__prog_data, parse_tree__prog_out.
+:- import_module check_hlds__type_util, hlds__error_util, backend_libs__code_model.
 
 :- import_module bool, int, string, library, list, map.
 :- import_module assoc_list, term, std_util, require.
Index: compiler/mlds_to_csharp.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_csharp.m,v
retrieving revision 1.21
diff -u -d -r1.21 mlds_to_csharp.m
--- compiler/mlds_to_csharp.m	21 Jan 2002 04:39:18 -0000	1.21
+++ compiler/mlds_to_csharp.m	6 Mar 2002 00:53:50 -0000
@@ -9,10 +9,10 @@
 %
 % This code converts the MLDS representation of foreign language code into C#
 
-:- module mlds_to_csharp.
+:- module ml_backend__mlds_to_csharp.
 :- interface.
 
-:- import_module mlds.
+:- import_module ml_backend__mlds.
 :- import_module io.
 
 	% Convert the MLDS to C# and write it to a file.
@@ -25,19 +25,21 @@
 
 :- implementation.
 
-:- import_module globals, options, passes_aux.
-:- import_module builtin_ops, c_util, modules, tree.
-:- import_module hlds_pred. % for `pred_proc_id'.
-:- import_module prog_data, prog_out.
-:- import_module foreign, rtti, type_util, error_util.
+:- import_module libs__globals, libs__options, hlds__passes_aux.
+:- import_module backend_libs__builtin_ops, backend_libs__c_util.
+:- import_module parse_tree__modules, libs__tree.
+:- import_module hlds__hlds_pred. % for `pred_proc_id'.
+:- import_module parse_tree__prog_data, parse_tree__prog_out.
+:- import_module backend_libs__foreign, backend_libs__rtti.
+:- import_module check_hlds__type_util, hlds__error_util.
 
-:- import_module ilds, ilasm, il_peephole.
-:- import_module ml_util, ml_code_util.
+:- import_module ml_backend__ilds, ml_backend__ilasm, ml_backend__il_peephole.
+:- import_module ml_backend__ml_util, ml_backend__ml_code_util.
 
 :- import_module bool, int, map, string, list, assoc_list, term, std_util.
 :- import_module library, require, counter.
 
-:- import_module mlds_to_il.
+:- import_module ml_backend__mlds_to_il.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/mlds_to_gcc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_gcc.m,v
retrieving revision 1.63
diff -u -d -r1.63 mlds_to_gcc.m
--- compiler/mlds_to_gcc.m	18 Feb 2002 07:00:57 -0000	1.63
+++ compiler/mlds_to_gcc.m	6 Mar 2002 01:19:08 -0000
@@ -91,7 +91,8 @@
 :- module mlds_to_gcc.
 :- interface.
 
-:- import_module mlds, maybe_mlds_to_gcc, bool.
+:- import_module ml_backend.
+:- import_module ml_backend__mlds, ml_backend__maybe_mlds_to_gcc, bool.
 :- use_module io.
 
 	% run_gcc_backend(ModuleName, CallBack, CallBackOutput):
@@ -142,22 +143,29 @@
 :- implementation.
 
 :- use_module gcc.
+:- import_module parse_tree.
+:- import_module hlds.
+:- import_module check_hlds.
+:- import_module libs.
+:- import_module backend_libs.
+:- import_module ll_backend. % XXX
 
 % XXX some of these imports might be unused
 
-:- import_module ml_util.
-:- import_module mlds_to_c.	% to handle C foreign_code
-:- import_module llds_out.	% XXX needed for llds_out__name_mangle,
+:- import_module ml_backend__ml_util.
+:- import_module ml_backend__mlds_to_c.	% to handle C foreign_code
+:- import_module ll_backend__llds_out.	% XXX needed for llds_out__name_mangle,
 				% llds_out__sym_name_mangle,
 				% llds_out__make_base_typeclass_info_name,
-:- import_module rtti.		% for rtti__addr_to_string.
-:- import_module ml_code_util.	% for ml_gen_public_field_decl_flags, which is
+:- import_module backend_libs__rtti.		% for rtti__addr_to_string.
+:- import_module ml_backend__ml_code_util.	% for ml_gen_public_field_decl_flags, which is
 				% used by the code that handles derived classes
-:- import_module hlds_pred.	% for proc_id_to_int and invalid_pred_id
-:- import_module globals, options, passes_aux.
-:- import_module builtin_ops, modules.
-:- import_module prog_data, prog_out, prog_util, type_util, error_util.
-:- import_module pseudo_type_info, code_model.
+:- import_module hlds__hlds_pred.	% for proc_id_to_int and invalid_pred_id
+:- import_module libs__globals, libs__options, hlds__passes_aux.
+:- import_module backend_libs__builtin_ops, parse_tree__modules.
+:- import_module parse_tree__prog_data, parse_tree__prog_out.
+:- import_module parse_tree__prog_util, check_hlds__type_util, hlds__error_util.
+:- import_module backend_libs__pseudo_type_info, backend_libs__code_model.
 
 :- import_module bool, int, string, library, list, map.
 :- import_module assoc_list, term, std_util, require.
Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.106
diff -u -d -r1.106 mlds_to_il.m
--- compiler/mlds_to_il.m	3 Mar 2002 12:12:49 -0000	1.106
+++ compiler/mlds_to_il.m	6 Mar 2002 00:53:50 -0000
@@ -58,13 +58,13 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module mlds_to_il.
+:- module ml_backend__mlds_to_il.
 :- interface.
 
-:- import_module mlds, ilasm, ilds.
+:- import_module ml_backend__mlds, ml_backend__ilasm, ml_backend__ilds.
 :- import_module io, list, bool, std_util, set.
-:- import_module hlds_pred. % for `pred_proc_id'.
-:- import_module prog_data. % for `foreign_language'.
+:- import_module hlds__hlds_pred. % for `pred_proc_id'.
+:- import_module libs__globals. % for `foreign_language'.
 
 %-----------------------------------------------------------------------------%
 
@@ -135,16 +135,20 @@
 
 :- implementation.
 
-:- import_module globals, options, passes_aux.
-:- import_module builtin_ops, c_util, modules, tree.
-:- import_module prog_data, prog_out, prog_util, llds_out.
-:- import_module pseudo_type_info, rtti, type_util, code_model, foreign.
+:- import_module libs__globals, libs__options, hlds__passes_aux.
+:- import_module backend_libs__builtin_ops, backend_libs__c_util.
+:- import_module parse_tree__modules, libs__tree.
+:- import_module parse_tree__prog_data, parse_tree__prog_out.
+:- import_module parse_tree__prog_util, ll_backend__llds_out.
+:- import_module backend_libs__pseudo_type_info, backend_libs__rtti.
+:- import_module check_hlds__type_util, backend_libs__code_model, backend_libs__foreign.
 
-:- import_module ilasm, il_peephole.
-:- import_module ml_util, ml_code_util, error_util.
-:- import_module ml_type_gen.
-:- import_module foreign.
-:- use_module llds. /* for user_foreign_code */
+:- import_module ml_backend__il_peephole.
+:- import_module ml_backend__ml_util, ml_backend__ml_code_util.
+:- import_module hlds__error_util.
+:- import_module ml_backend__ml_type_gen.
+:- import_module backend_libs__foreign.
+:- use_module ll_backend__llds. /* for user_foreign_code */
 
 :- import_module bool, int, map, string, set, list, assoc_list, term.
 :- import_module library, require, counter.
Index: compiler/mlds_to_ilasm.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_ilasm.m,v
retrieving revision 1.16
diff -u -d -r1.16 mlds_to_ilasm.m
--- compiler/mlds_to_ilasm.m	18 Jul 2001 10:20:56 -0000	1.16
+++ compiler/mlds_to_ilasm.m	6 Mar 2002 00:53:50 -0000
@@ -12,10 +12,10 @@
 % generating output, while mlds_to_il takes care of generated IL from
 % MLDS.
 
-:- module mlds_to_ilasm.
+:- module ml_backend__mlds_to_ilasm.
 :- interface.
 
-:- import_module mlds.
+:- import_module ml_backend__mlds.
 :- import_module io.
 
 	% Convert the MLDS to IL and write it to a file.
@@ -28,22 +28,24 @@
 
 :- implementation.
 
-:- import_module globals, options, passes_aux.
-:- import_module builtin_ops, c_util, modules, tree.
-:- import_module hlds_pred. % for `pred_proc_id'.
-:- import_module prog_data, prog_out, llds_out.
-:- import_module rtti, type_util, error_util.
+:- import_module libs__globals, libs__options, hlds__passes_aux.
+:- import_module backend_libs__builtin_ops, backend_libs__c_util.
+:- import_module parse_tree__modules, libs__tree.
+:- import_module hlds__hlds_pred. % for `pred_proc_id'.
+:- import_module parse_tree__prog_data, parse_tree__prog_out.
+:- import_module ll_backend__llds_out.
+:- import_module backend_libs__rtti, check_hlds__type_util, hlds__error_util.
 
-:- import_module ilds, ilasm, il_peephole.
-:- import_module ml_util, ml_code_util.
-:- import_module mlds_to_csharp. /* to output C sharp code */
-:- import_module mlds_to_mcpp. /* to output MC++ code */
-:- use_module llds. /* for user_c_code */
+:- import_module ml_backend__ilds, ml_backend__ilasm, ml_backend__il_peephole.
+:- import_module ml_backend__ml_util, ml_backend__ml_code_util.
+:- import_module ml_backend__mlds_to_csharp. /* to output C sharp code */
+:- import_module ml_backend__mlds_to_mcpp. /* to output MC++ code */
+:- use_module ll_backend__llds. /* for user_c_code */
 
 :- import_module bool, int, map, string, set, list, assoc_list, term, std_util.
 :- import_module library, require, counter.
 
-:- import_module mlds_to_il.
+:- import_module ml_backend__mlds_to_il.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/mlds_to_java.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_java.m,v
retrieving revision 1.24
diff -u -d -r1.24 mlds_to_java.m
--- compiler/mlds_to_java.m	22 Feb 2002 01:51:09 -0000	1.24
+++ compiler/mlds_to_java.m	6 Mar 2002 00:53:50 -0000
@@ -44,10 +44,10 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module mlds_to_java.
+:- module ml_backend__mlds_to_java.
 :- interface.
 
-:- import_module mlds.
+:- import_module ml_backend__mlds.
 :- import_module io.
 
 :- pred mlds_to_java__output_mlds(mlds, io__state, io__state).
@@ -58,23 +58,24 @@
 
 :- implementation.
 
-:- import_module ml_util.
-:- import_module java_util. 
-:- import_module c_util.	% XXX needed for c_util__output_quoted_string
+:- import_module ml_backend__ml_util.
+:- import_module ml_backend__java_util. 
+:- import_module backend_libs__c_util.	% XXX needed for c_util__output_quoted_string
 				% c_util_output_quoted_multi_string
-:- import_module llds_out.	% XXX needed for llds_out__name_mangle,
+:- import_module ll_backend__llds_out.	% XXX needed for llds_out__name_mangle,
 				% llds_out__sym_name_mangle,
 				% llds_out__make_base_typeclass_info_name,
-:- import_module rtti.		% for rtti__addr_to_string.
-:- import_module rtti_to_mlds.	% for mlds_rtti_type_name.
-:- import_module hlds_pred.	% for pred_proc_id.
-:- import_module modules.       % for mercury_std_library_name.
-:- import_module ml_code_util.	% for ml_gen_local_var_decl_flags.
-:- import_module ml_type_gen.	% for ml_gen_type_name
-:- import_module export.	% for export__type_to_type_string
-:- import_module globals, options, passes_aux.
-:- import_module builtin_ops.
-:- import_module prog_data, prog_out, type_util, error_util.
+:- import_module backend_libs__rtti.		% for rtti__addr_to_string.
+:- import_module ml_backend__rtti_to_mlds.	% for mlds_rtti_type_name.
+:- import_module hlds__hlds_pred.	% for pred_proc_id.
+:- import_module parse_tree__modules.       % for mercury_std_library_name.
+:- import_module ml_backend__ml_code_util.	% for ml_gen_local_var_decl_flags.
+:- import_module ml_backend__ml_type_gen.	% for ml_gen_type_name
+:- import_module backend_libs__export.	% for export__type_to_type_string
+:- import_module libs__globals, libs__options, hlds__passes_aux.
+:- import_module backend_libs__builtin_ops.
+:- import_module parse_tree__prog_data, parse_tree__prog_out.
+:- import_module check_hlds__type_util, hlds__error_util.
 
 :- import_module bool, int, string, library, list, set.
 :- import_module assoc_list, term, std_util, require.
Index: compiler/mlds_to_mcpp.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_mcpp.m,v
retrieving revision 1.25
diff -u -d -r1.25 mlds_to_mcpp.m
--- compiler/mlds_to_mcpp.m	21 Jan 2002 04:39:20 -0000	1.25
+++ compiler/mlds_to_mcpp.m	6 Mar 2002 00:53:50 -0000
@@ -16,10 +16,10 @@
 %
 % This code converts the MLDS representation of foreign language code into MC++ 
 
-:- module mlds_to_mcpp.
+:- module ml_backend__mlds_to_mcpp.
 :- interface.
 
-:- import_module mlds.
+:- import_module ml_backend__mlds.
 :- import_module io.
 
 	% Convert the MLDS to MC++ and write it to a file.
@@ -40,21 +40,24 @@
 
 :- implementation.
 
-:- import_module globals, options, passes_aux.
-:- import_module builtin_ops, c_util, modules, tree.
-:- import_module hlds_pred. % for `pred_proc_id'.
-:- import_module prog_data, prog_out, llds_out.
-:- import_module foreign, rtti, type_util, error_util.
+:- import_module libs__globals, libs__options, hlds__passes_aux.
+:- import_module backend_libs__builtin_ops, backend_libs__c_util.
+:- import_module parse_tree__modules, libs__tree.
+:- import_module hlds__hlds_pred. % for `pred_proc_id'.
+:- import_module parse_tree__prog_data, parse_tree__prog_out.
+:- import_module ll_backend__llds_out.
+:- import_module backend_libs__foreign, backend_libs__rtti.
+:- import_module check_hlds__type_util, hlds__error_util.
 
-:- import_module ilds, ilasm, il_peephole.
-:- import_module ml_util, ml_code_util.
-:- import_module mlds_to_c. /* to output C code for .cpp files */
-:- use_module llds. /* for user_c_code */
+:- import_module ml_backend__ilds, ml_backend__ilasm, ml_backend__il_peephole.
+:- import_module ml_backend__ml_util, ml_backend__ml_code_util.
+:- import_module ml_backend__mlds_to_c. /* to output C code for .cpp files */
+:- use_module ll_backend__llds. /* for user_c_code */
 
 :- import_module bool, int, map, string, list, assoc_list, term, std_util.
 :- import_module library, require, counter.
 
-:- import_module mlds_to_il.
+:- import_module ml_backend__mlds_to_il.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/mode_debug.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mode_debug.m,v
retrieving revision 1.13
diff -u -d -r1.13 mode_debug.m
--- compiler/mode_debug.m	15 Nov 2000 00:47:58 -0000	1.13
+++ compiler/mode_debug.m	6 Mar 2002 00:53:50 -0000
@@ -12,11 +12,11 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module mode_debug.
+:- module check_hlds__mode_debug.
 
 :- interface.
 
-:- import_module mode_info.
+:- import_module check_hlds__mode_info.
 
 	% Print a debugging message which includes the port, message string,
 	% and the current instmap (but only if `--debug-modes' was enabled).
@@ -35,8 +35,10 @@
 :- implementation.
 :- import_module std_util, list, assoc_list, io, bool, map.
 :- import_module term, varset.
-:- import_module modes, globals, options, mercury_to_mercury, passes_aux.
-:- import_module hlds_goal, hlds_module, instmap, prog_data, (inst).
+:- import_module check_hlds__modes, libs__globals, libs__options.
+:- import_module parse_tree__mercury_to_mercury, hlds__passes_aux.
+:- import_module hlds__hlds_goal, hlds__hlds_module, hlds__instmap.
+:- import_module parse_tree__prog_data, (parse_tree__inst).
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/mode_errors.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mode_errors.m,v
retrieving revision 1.71
diff -u -d -r1.71 mode_errors.m
--- compiler/mode_errors.m	16 May 2001 04:50:49 -0000	1.71
+++ compiler/mode_errors.m	6 Mar 2002 00:53:50 -0000
@@ -13,12 +13,14 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module mode_errors.
+:- module check_hlds__mode_errors.
 
 :- interface.
 
-:- import_module hlds_data, hlds_pred, hlds_module, hlds_goal.
-:- import_module prog_data, mode_info, (inst).
+:- import_module hlds__hlds_data, hlds__hlds_pred, hlds__hlds_module.
+:- import_module hlds__hlds_goal.
+:- import_module parse_tree__prog_data, check_hlds__mode_info.
+:- import_module (parse_tree__inst).
 
 :- import_module bool, set, assoc_list, list, io.
 
@@ -186,9 +188,10 @@
 
 :- implementation.
 
-:- import_module hlds_out.
-:- import_module mode_info, mode_util, prog_out, mercury_to_mercury.
-:- import_module options, globals.
+:- import_module hlds__hlds_out.
+:- import_module check_hlds__mode_info, check_hlds__mode_util.
+:- import_module parse_tree__prog_out, parse_tree__mercury_to_mercury.
+:- import_module libs__options, libs__globals.
 
 :- import_module int, map, term_io, varset, term.
 :- import_module std_util, require.
Index: compiler/mode_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mode_info.m,v
retrieving revision 1.60
diff -u -d -r1.60 mode_info.m
--- compiler/mode_info.m	8 Feb 2001 11:37:47 -0000	1.60
+++ compiler/mode_info.m	6 Mar 2002 00:53:50 -0000
@@ -12,12 +12,14 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module mode_info.
+:- module check_hlds__mode_info.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, hlds_goal, hlds_data, instmap.
-:- import_module prog_data, mode_errors, delay_info, (inst).
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_goal.
+:- import_module hlds__hlds_data, hlds__instmap.
+:- import_module parse_tree__prog_data, check_hlds__mode_errors.
+:- import_module check_hlds__delay_info, (parse_tree__inst).
 :- import_module map, list, set, bool, assoc_list, std_util, io.
 
 :- interface.
@@ -339,7 +341,8 @@
 
 :- implementation.
 
-:- import_module delay_info, mode_errors, mode_util.
+:- import_module check_hlds__delay_info, check_hlds__mode_errors.
+:- import_module check_hlds__mode_util.
 :- import_module term, varset.
 :- import_module require, std_util, queue.
 
Index: compiler/mode_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mode_util.m,v
retrieving revision 1.139
diff -u -d -r1.139 mode_util.m
--- compiler/mode_util.m	8 Nov 2001 05:56:01 -0000	1.139
+++ compiler/mode_util.m	6 Mar 2002 00:53:50 -0000
@@ -10,12 +10,13 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module mode_util.
+:- module check_hlds__mode_util.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, hlds_goal, hlds_data, prog_data.
-:- import_module (inst), instmap.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_goal.
+:- import_module hlds__hlds_data, parse_tree__prog_data.
+:- import_module (parse_tree__inst), hlds__instmap.
 :- import_module bool, list.
 
 	% mode_get_insts returns the initial instantiatedness and
@@ -220,8 +221,10 @@
 
 :- implementation.
 :- import_module require, int, map, set, std_util, assoc_list, varset.
-:- import_module prog_util, prog_io, type_util.
-:- import_module inst_match, inst_util, mode_info.
+:- import_module parse_tree__prog_util, parse_tree__prog_io.
+:- import_module check_hlds__type_util.
+:- import_module check_hlds__inst_match, check_hlds__inst_util.
+:- import_module check_hlds__mode_info.
 :- import_module require, int, map, set, term, std_util, assoc_list, varset.
 
 %-----------------------------------------------------------------------------%
Index: compiler/modecheck_call.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modecheck_call.m,v
retrieving revision 1.39
diff -u -d -r1.39 modecheck_call.m
--- compiler/modecheck_call.m	12 Oct 2001 05:23:45 -0000	1.39
+++ compiler/modecheck_call.m	6 Mar 2002 00:53:50 -0000
@@ -18,11 +18,12 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module modecheck_call.
+:- module check_hlds__modecheck_call.
 :- interface.
 
-:- import_module hlds_goal, hlds_pred, hlds_module.
-:- import_module prog_data, modes, mode_info.
+:- import_module hlds__hlds_goal, hlds__hlds_pred, hlds__hlds_module.
+:- import_module parse_tree__prog_data, check_hlds__modes.
+:- import_module check_hlds__mode_info.
 :- import_module list, std_util.
 
 :- pred modecheck_call_pred(pred_id, proc_id, list(prog_var),
@@ -69,10 +70,12 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
-:- import_module hlds_data, instmap, prog_data, (inst), inst_util, type_util.
-:- import_module mode_info, mode_debug, modes, mode_util, mode_errors.
-:- import_module clause_to_proc, inst_match.
-:- import_module det_report, unify_proc.
+:- import_module hlds__hlds_data, hlds__instmap, parse_tree__prog_data.
+:- import_module (parse_tree__inst), check_hlds__inst_util, check_hlds__type_util.
+:- import_module check_hlds__mode_info, check_hlds__mode_debug.
+:- import_module check_hlds__modes, check_hlds__mode_util, check_hlds__mode_errors.
+:- import_module check_hlds__clause_to_proc, check_hlds__inst_match.
+:- import_module check_hlds__det_report, check_hlds__unify_proc.
 :- import_module int, map, bool, set, require, term, varset.
 
 modecheck_higher_order_call(PredOrFunc, PredVar, Args0, Modes, Det,
Index: compiler/modecheck_unify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modecheck_unify.m,v
retrieving revision 1.47
diff -u -d -r1.47 modecheck_unify.m
--- compiler/modecheck_unify.m	31 Jul 2001 18:37:18 -0000	1.47
+++ compiler/modecheck_unify.m	6 Mar 2002 00:53:50 -0000
@@ -17,10 +17,10 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module modecheck_unify.
+:- module check_hlds__modecheck_unify.
 :- interface.
 
-:- import_module hlds_goal, prog_data, mode_info.
+:- import_module hlds__hlds_goal, parse_tree__prog_data, check_hlds__mode_info.
 
 	% Modecheck a unification
 :- pred modecheck_unification(prog_var, unify_rhs, unification, unify_context,
@@ -40,12 +40,17 @@
 
 :- implementation.
 
-:- import_module llds, prog_util, type_util, module_qual, instmap.
-:- import_module hlds_module, hlds_goal, hlds_pred, hlds_data, hlds_out.
-:- import_module mode_debug, mode_util, mode_info, modes, mode_errors.
-:- import_module inst_match, inst_util, unify_proc, code_util, unique_modes.
-:- import_module typecheck, modecheck_call, (inst), quantification, make_hlds.
-:- import_module polymorphism.
+:- import_module ll_backend__llds, parse_tree__prog_util.
+:- import_module check_hlds__type_util, parse_tree__module_qual, hlds__instmap.
+:- import_module hlds__hlds_module, hlds__hlds_goal, hlds__hlds_pred.
+:- import_module hlds__hlds_data, hlds__hlds_out.
+:- import_module check_hlds__mode_debug, check_hlds__mode_util.
+:- import_module check_hlds__mode_info, check_hlds__modes, check_hlds__mode_errors.
+:- import_module check_hlds__inst_match, check_hlds__inst_util.
+:- import_module check_hlds__unify_proc, ll_backend__code_util, check_hlds__unique_modes.
+:- import_module check_hlds__typecheck, check_hlds__modecheck_call.
+:- import_module (parse_tree__inst), hlds__quantification, hlds__make_hlds.
+:- import_module check_hlds__polymorphism.
 
 :- import_module bool, list, map, std_util, int, set, require.
 :- import_module string, assoc_list.
Index: compiler/modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.254
diff -u -d -r1.254 modes.m
--- compiler/modes.m	20 Jul 2001 14:14:05 -0000	1.254
+++ compiler/modes.m	6 Mar 2002 00:53:50 -0000
@@ -127,11 +127,12 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module modes.
+:- module check_hlds__modes.
 
 :- interface.
 
-:- import_module prog_data, hlds_goal, hlds_module, hlds_pred, (inst), instmap.
+:- import_module parse_tree__prog_data, hlds__hlds_goal, hlds__hlds_module.
+:- import_module hlds__hlds_pred, (parse_tree__inst), hlds__instmap.
 :- import_module bool, list, io.
 
 	% modecheck(HLDS0, HLDS, UnsafeToContinue):
@@ -187,7 +188,7 @@
 
 % The following predicates are used by unique_modes.m.
 
-:- import_module mode_info, hlds_data.
+:- import_module check_hlds__mode_info, hlds__hlds_data.
 
 	% Modecheck a unification.
 
@@ -322,13 +323,19 @@
 
 :- implementation.
 
-:- import_module make_hlds, hlds_data, unique_modes, mode_debug.
-:- import_module mode_info, delay_info, mode_errors, inst_match, instmap.
-:- import_module type_util, mode_util, code_util, unify_proc, special_pred.
-:- import_module globals, options, mercury_to_mercury, hlds_out, int, set.
-:- import_module passes_aux, typecheck, module_qual, clause_to_proc.
-:- import_module modecheck_unify, modecheck_call, inst_util, purity.
-:- import_module prog_out, term, varset.
+:- import_module hlds__make_hlds, hlds__hlds_data, check_hlds__unique_modes.
+:- import_module check_hlds__mode_debug.
+:- import_module check_hlds__mode_info, check_hlds__delay_info.
+:- import_module check_hlds__mode_errors, check_hlds__inst_match, hlds__instmap.
+:- import_module check_hlds__type_util, check_hlds__mode_util.
+:- import_module ll_backend__code_util, check_hlds__unify_proc, hlds__special_pred.
+:- import_module libs__globals, libs__options, parse_tree__mercury_to_mercury.
+:- import_module hlds__hlds_out, int, set.
+:- import_module hlds__passes_aux, check_hlds__typecheck.
+:- import_module parse_tree__module_qual, check_hlds__clause_to_proc.
+:- import_module check_hlds__modecheck_unify, check_hlds__modecheck_call.
+:- import_module check_hlds__inst_util, check_hlds__purity.
+:- import_module parse_tree__prog_out, term, varset.
 
 :- import_module list, map, string, require, std_util.
 :- import_module assoc_list.
Index: compiler/module_qual.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/module_qual.m,v
retrieving revision 1.73
diff -u -d -r1.73 module_qual.m
--- compiler/module_qual.m	26 Feb 2002 02:45:48 -0000	1.73
+++ compiler/module_qual.m	6 Mar 2002 00:53:50 -0000
@@ -4,7 +4,7 @@
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
 %
-:- module module_qual.
+:- module parse_tree__module_qual.
 %	Main authors: stayl, fjh.
 %
 %	Module qualifies types, insts and modes within declaration items.
@@ -19,7 +19,7 @@
 %
 :- interface.
 
-:- import_module prog_data, recompilation.
+:- import_module parse_tree__prog_data, hlds__recompilation.
 :- import_module bool, list, std_util, io.
 
 	% module_qualify_items(Items0, Items, ModuleName, ReportUndefErrors,
@@ -111,10 +111,12 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module type_util, prog_io, prog_out, hlds_out.
-:- import_module prog_util, mercury_to_mercury, modules, globals, options.
-:- import_module (inst), instmap.
-:- import_module hlds_data.	% for cons_id.
+:- import_module check_hlds__type_util, parse_tree__prog_io.
+:- import_module parse_tree__prog_out, hlds__hlds_out.
+:- import_module parse_tree__prog_util, parse_tree__mercury_to_mercury.
+:- import_module parse_tree__modules, libs__globals, libs__options.
+:- import_module (parse_tree__inst), hlds__instmap.
+:- import_module hlds__hlds_data.	% for cons_id.
 
 :- import_module int, map, require, set, string, term, varset.
 :- import_module assoc_list.
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.220
diff -u -d -r1.220 modules.m
--- compiler/modules.m	24 Feb 2002 11:53:22 -0000	1.220
+++ compiler/modules.m	6 Mar 2002 00:53:50 -0000
@@ -35,11 +35,12 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module modules.
+:- module parse_tree__modules.
 
 :- interface.
 
-:- import_module foreign, prog_data, prog_io, globals, timestamp.
+:- import_module backend_libs__foreign, parse_tree__prog_data.
+:- import_module parse_tree__prog_io, libs__globals, hlds__timestamp.
 :- import_module std_util, bool, list, map, set, io.
 
 %-----------------------------------------------------------------------------%
@@ -618,9 +619,11 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
-:- import_module llds_out, passes_aux, prog_out, prog_util, mercury_to_mercury.
-:- import_module prog_io_util, options, module_qual, foreign.
-:- import_module recompilation_version.
+:- import_module ll_backend__llds_out, hlds__passes_aux, parse_tree__prog_out.
+:- import_module parse_tree__prog_util, parse_tree__mercury_to_mercury.
+:- import_module parse_tree__prog_io_util, libs__options.
+:- import_module parse_tree__module_qual, backend_libs__foreign.
+:- import_module hlds__recompilation_version.
 
 :- import_module string, map, term, varset, dir, library.
 :- import_module assoc_list, relation, char, require.
@@ -4850,9 +4853,10 @@
 			maybe_record_timestamp(Import, Ext, NeedQualifier,
 				MaybeTimestamp, Module0, Module1),
 			{ ModImplementationImports =
-				[Import | ModImplementationImports0] },
-			check_module_accessibility(ModuleName, Import,
-				ModItems0)
+				[Import | ModImplementationImports0] }
+			% XXX check_module_accessibility doesn't work
+			% check_module_accessibility(ModuleName, Import,
+			% 	ModItems0)
 		),
 		{ get_dependencies(Items, IndirectImports1, IndirectUses1) },
 		{ list__append(IndirectImports0, IndirectImports1,
@@ -4882,6 +4886,12 @@
 		% at this point, so the item list should include the items
 		% in the parent's interface) looking for an `include_module'
 		% declaration that names it.
+		%
+		% XXX The comment above is incorrect -- if the imported
+		% module's parent module was visible because it was
+		% imported by one of this module's parent modules,
+		% then we won't have read it in.  As a result, this
+		% code reports spurious errors.
 		%
 		(
 			{ get_children(Items, AccessibleSubModules) },
Index: compiler/opt_debug.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/opt_debug.m,v
retrieving revision 1.118
diff -u -d -r1.118 opt_debug.m
--- compiler/opt_debug.m	20 Feb 2002 03:14:14 -0000	1.118
+++ compiler/opt_debug.m	6 Mar 2002 00:53:50 -0000
@@ -10,12 +10,13 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module opt_debug.
+:- module ll_backend__opt_debug.
 
 :- interface.
 
-:- import_module llds, livemap.
-:- import_module code_model, rtti, layout, builtin_ops.
+:- import_module ll_backend__llds, ll_backend__livemap.
+:- import_module backend_libs__code_model, backend_libs__rtti.
+:- import_module ll_backend__layout, backend_libs__builtin_ops.
 
 :- import_module io, bool, list, assoc_list, std_util.
 
@@ -119,10 +120,11 @@
 
 :- implementation.
 
-:- import_module prog_out.
-:- import_module hlds_pred.
-:- import_module llds_out, code_util, opt_util.
-:- import_module globals, options.
+:- import_module parse_tree__prog_out.
+:- import_module hlds__hlds_pred.
+:- import_module ll_backend__llds_out, ll_backend__code_util.
+:- import_module ll_backend__opt_util.
+:- import_module libs__globals, libs__options.
 
 :- import_module int, set, map, string.
 
Index: compiler/opt_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/opt_util.m,v
retrieving revision 1.113
diff -u -d -r1.113 opt_util.m
--- compiler/opt_util.m	18 Feb 2002 07:00:58 -0000	1.113
+++ compiler/opt_util.m	6 Mar 2002 00:53:50 -0000
@@ -10,11 +10,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module opt_util.
+:- module ll_backend__opt_util.
 
 :- interface.
 :- import_module bool, map, list, std_util.
-:- import_module llds.
+:- import_module ll_backend__llds.
 
 :- type instrmap == map(label, instruction).
 :- type lvalmap == map(label, maybe(instruction)).
@@ -321,7 +321,8 @@
 
 :- implementation.
 
-:- import_module builtin_ops, exprn_aux, llds_out, hlds_pred.
+:- import_module backend_libs__builtin_ops, ll_backend__exprn_aux.
+:- import_module ll_backend__llds_out, hlds__hlds_pred.
 :- import_module int, string, set, require.
 
 opt_util__get_prologue(Instrs0, LabelInstr, Comments, Instrs) :-
Index: compiler/optimize.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/optimize.m,v
retrieving revision 1.28
diff -u -d -r1.28 optimize.m
--- compiler/optimize.m	31 May 2001 05:59:50 -0000	1.28
+++ compiler/optimize.m	6 Mar 2002 00:53:50 -0000
@@ -10,11 +10,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module optimize.
+:- module ll_backend__optimize.
 
 :- interface.
 
-:- import_module llds.
+:- import_module ll_backend__llds.
 :- import_module io, list.
 
 :- pred optimize_main(list(c_procedure)::in, global_data::in,
@@ -27,10 +27,14 @@
 
 :- implementation.
 
-:- import_module jumpopt, labelopt, dupelim, peephole.
-:- import_module frameopt, delay_slot, use_local_vars, options.
-:- import_module globals, passes_aux, opt_util, opt_debug.
-:- import_module wrap_blocks, hlds_pred, llds_out, continuation_info.
+:- import_module ll_backend__jumpopt, ll_backend__labelopt.
+:- import_module ll_backend__dupelim, ll_backend__peephole.
+:- import_module ll_backend__frameopt, ll_backend__delay_slot.
+:- import_module ll_backend__use_local_vars, libs__options.
+:- import_module libs__globals, hlds__passes_aux, ll_backend__opt_util.
+:- import_module ll_backend__opt_debug.
+:- import_module ll_backend__wrap_blocks, hlds__hlds_pred.
+:- import_module ll_backend__llds_out, ll_backend__continuation_info.
 
 :- import_module bool, int, string.
 :- import_module map, bimap, set, std_util, require, counter.
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.358
diff -u -d -r1.358 options.m
--- compiler/options.m	2 Mar 2002 12:43:17 -0000	1.358
+++ compiler/options.m	5 Mar 2002 23:53:19 -0000
@@ -16,7 +16,7 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module options.
+:- module libs__options.
 :- interface.
 :- import_module char, io, getopt.
 
@@ -519,7 +519,7 @@
 
 :- import_module string, bool, int, map, std_util, assoc_list, require, list.
 :- import_module dir.
-:- import_module handle_options.
+:- import_module libs__handle_options.
 
 :- type option_category
 	--->	warning_option
Index: compiler/par_conj_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/par_conj_gen.m,v
retrieving revision 1.8
diff -u -d -r1.8 par_conj_gen.m
--- compiler/par_conj_gen.m	23 Nov 2000 04:32:46 -0000	1.8
+++ compiler/par_conj_gen.m	6 Mar 2002 00:53:51 -0000
@@ -92,11 +92,12 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module par_conj_gen.
+:- module ll_backend__par_conj_gen.
 
 :- interface.
 
-:- import_module hlds_goal, code_model, llds, code_info.
+:- import_module hlds__hlds_goal, backend_libs__code_model, ll_backend__llds.
+:- import_module ll_backend__code_info.
 :- import_module list.
 
 :- pred par_conj_gen__generate_par_conj(list(hlds_goal), hlds_goal_info,
@@ -107,10 +108,12 @@
 
 :- implementation.
 
-:- import_module hlds_data, code_gen, code_util, options, globals, prog_data.
-:- import_module hlds_module, (inst), instmap, mode_util, code_info.
-:- import_module continuation_info.
-:- import_module set, tree, list, map, std_util, require, int.
+:- import_module hlds__hlds_data, ll_backend__code_gen, ll_backend__code_util.
+:- import_module libs__options, libs__globals, parse_tree__prog_data.
+:- import_module hlds__hlds_module, (parse_tree__inst), hlds__instmap.
+:- import_module check_hlds__mode_util, ll_backend__code_info.
+:- import_module ll_backend__continuation_info.
+:- import_module set, libs__tree, list, map, std_util, require, int.
 
 %---------------------------------------------------------------------------%
 
Index: compiler/parse_tree.m
===================================================================
RCS file: compiler/parse_tree.m
diff -N compiler/parse_tree.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ compiler/parse_tree.m	6 Mar 2002 00:02:55 -0000
@@ -0,0 +1,56 @@
+%-----------------------------------------------------------------------------%
+%
+% Phase 1: create the Parse Tree.
+%
+
+:- module parse_tree.
+:- interface.
+:- import_module libs.
+:- import_module hlds. % XXX for hlds_data__cons_id
+:- import_module backend_libs. % XXX for `foreign'
+
+% The parse tree data type itself.
+:- include_module prog_data, (inst).
+	% XXX inst uses hlds_data__cons_id
+
+% The parser.
+:- include_module prog_io.
+   :- include_module prog_io_goal, prog_io_dcg, prog_io_pragma.
+   :- include_module prog_io_typeclass, prog_io_util.
+
+% Pretty-printers.
+:- include_module prog_out, mercury_to_mercury.
+
+% Utility routines.
+:- include_module prog_util.
+
+% Transformations that act on the parse tree,
+% and stuff relating to the module system.
+:- include_module equiv_type.
+:- include_module modules, module_qual.
+
+% (Note that intermod and trans_opt also contain routines that
+% act on the parse tree, but those modules are considered part
+% of the HLDS transformations package.)
+% :- include_module intermod, trans_opt.
+
+% :- implementation.
+
+% XXX lots of stuff uses hlds_data__type_id and type_util.m.
+% XXX modules.m uses llds_out for the init names.
+
+%-----------------------------------------------------------------------------%
+
+:- implementation.
+
+:- import_module check_hlds.     % XXX for type_util.m
+:- import_module transform_hlds. % XXX for write_pragma_termination_info
+				     % in termination.m, which is used by
+				     % mercury_to_mercury.m
+:- import_module ll_backend.     % XXX for llds_out.m, which is used
+				     % by modules__append_to_init_list,
+				     % which creates the LLDS and RL
+				     % initialization code.
+:- end_module parse_tree.
+
+%-----------------------------------------------------------------------------%
Index: compiler/passes_aux.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/passes_aux.m,v
retrieving revision 1.40
diff -u -d -r1.40 passes_aux.m
--- compiler/passes_aux.m	2 May 2001 11:36:40 -0000	1.40
+++ compiler/passes_aux.m	6 Mar 2002 00:53:51 -0000
@@ -9,11 +9,11 @@
 
 % Author: zs
 
-:- module passes_aux.
+:- module hlds__passes_aux.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred, parse_tree__prog_data.
 :- import_module io, std_util, list, bool.
 
 %-----------------------------------------------------------------------------%
@@ -192,8 +192,9 @@
 
 :- implementation.
 
-:- import_module options, globals, hlds_out, prog_out, mode_util.
-:- import_module mercury_to_mercury.
+:- import_module libs__options, libs__globals, hlds__hlds_out.
+:- import_module parse_tree__prog_out, check_hlds__mode_util.
+:- import_module parse_tree__mercury_to_mercury.
 :- import_module int, string, map, require, varset.
 
 process_all_nonimported_procs(Task, ModuleInfo0, ModuleInfo) -->
Index: compiler/pd_cost.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pd_cost.m,v
retrieving revision 1.12
diff -u -d -r1.12 pd_cost.m
--- compiler/pd_cost.m	7 Apr 2001 14:04:53 -0000	1.12
+++ compiler/pd_cost.m	5 Mar 2002 23:53:35 -0000
@@ -11,11 +11,11 @@
 % the time taken by called predicates.
 %
 %-----------------------------------------------------------------------------%
-:- module pd_cost.
+:- module transform_hlds__pd_cost.
 
 :- interface.
 
-:- import_module hlds_goal.
+:- import_module hlds__hlds_goal.
 
 :- pred pd_cost__goal(hlds_goal::in, int::out) is det.
 
@@ -35,7 +35,7 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module hlds_data, prog_data.
+:- import_module hlds__hlds_data, parse_tree__prog_data.
 :- import_module int, list, set, std_util, require.
 
 %-----------------------------------------------------------------------------%
Index: compiler/pd_debug.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pd_debug.m,v
retrieving revision 1.5
diff -u -d -r1.5 pd_debug.m
--- compiler/pd_debug.m	24 Feb 2002 11:53:25 -0000	1.5
+++ compiler/pd_debug.m	6 Mar 2002 00:53:51 -0000
@@ -8,11 +8,12 @@
 %
 % Debugging routines for partial deduction.
 %-----------------------------------------------------------------------------%
-:- module pd_debug.
+:- module transform_hlds__pd_debug.
 
 :- interface.
 
-:- import_module pd_info, hlds_goal, hlds_pred, prog_data.
+:- import_module transform_hlds__pd_info, hlds__hlds_goal, hlds__hlds_pred.
+:- import_module parse_tree__prog_data.
 :- import_module list, string.
 
 :- pred pd_debug__do_io(pred(io__state, io__state)::pred(di, uo) is det,
@@ -46,8 +47,10 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module globals, hlds_module, hlds_out, instmap, options.
-:- import_module instmap, prog_out, goal_util, mercury_to_mercury.
+:- import_module libs__globals, hlds__hlds_module, hlds__hlds_out.
+:- import_module hlds__instmap, libs__options.
+:- import_module hlds__instmap, parse_tree__prog_out, hlds__goal_util.
+:- import_module parse_tree__mercury_to_mercury.
 :- import_module bool, io, set, std_util.
 
 pd_debug__do_io(Pred) -->
Index: compiler/pd_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pd_info.m,v
retrieving revision 1.8
diff -u -d -r1.8 pd_info.m
--- compiler/pd_info.m	30 Jul 2001 18:58:34 -0000	1.8
+++ compiler/pd_info.m	6 Mar 2002 00:53:51 -0000
@@ -9,12 +9,13 @@
 % Types for deforestation.
 %-----------------------------------------------------------------------------%
 
-:- module pd_info.
+:- module transform_hlds__pd_info.
 
 :- interface.
 
-:- import_module pd_term, hlds_module, hlds_pred, options, hlds_data, instmap.
-:- import_module hlds_goal, prog_data.
+:- import_module transform_hlds__pd_term, hlds__hlds_module, hlds__hlds_pred.
+:- import_module libs__options, hlds__hlds_data, hlds__instmap.
+:- import_module hlds__hlds_goal, parse_tree__prog_data.
 :- import_module bool, map, list, io, set, std_util, getopt.
 
 :- type pd_info 
@@ -158,8 +159,10 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module hlds_pred, prog_data, pd_debug, pd_util, det_util, globals.
-:- import_module inst_match, hlds_goal, prog_util, term.
+:- import_module hlds__hlds_pred, parse_tree__prog_data.
+:- import_module transform_hlds__pd_debug, transform_hlds__pd_util, check_hlds__det_util, libs__globals.
+:- import_module check_hlds__inst_match, hlds__hlds_goal.
+:- import_module parse_tree__prog_util, term.
 :- import_module assoc_list, bool, int, require, string.
 
 pd_info_init(ModuleInfo, ProcArgInfos, IO, PdInfo) :-
Index: compiler/pd_term.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pd_term.m,v
retrieving revision 1.3
diff -u -d -r1.3 pd_term.m
--- compiler/pd_term.m	11 Aug 2001 14:09:50 -0000	1.3
+++ compiler/pd_term.m	6 Mar 2002 00:53:51 -0000
@@ -31,11 +31,12 @@
 % 	useful (necessary?) if we start propagating equality constraints.
 %
 %-----------------------------------------------------------------------------%
-:- module pd_term.
+:- module transform_hlds__pd_term.
 
 :- interface.
 
-:- import_module hlds_goal, hlds_module, hlds_pred, instmap, pd_info.
+:- import_module hlds__hlds_goal, hlds__hlds_module, hlds__hlds_pred.
+:- import_module hlds__instmap, transform_hlds__pd_info.
 :- import_module list, std_util.
 
 	% pd_term__global_check(Module, CallGoal1, BetweenGoals, CallGoal2,
@@ -86,7 +87,8 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module hlds_pred, (inst), mode_util, prog_data, pd_util.
+:- import_module hlds__hlds_pred, (parse_tree__inst), check_hlds__mode_util.
+:- import_module parse_tree__prog_data, transform_hlds__pd_util.
 :- import_module assoc_list, bool, int, map, require, set.
 
 :- type global_term_info
Index: compiler/pd_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pd_util.m,v
retrieving revision 1.16
diff -u -d -r1.16 pd_util.m
--- compiler/pd_util.m	12 Oct 2001 05:23:45 -0000	1.16
+++ compiler/pd_util.m	6 Mar 2002 00:53:51 -0000
@@ -9,12 +9,14 @@
 % Utility predicates for deforestation and partial evaluation.
 %
 %-----------------------------------------------------------------------------%
-:- module pd_util.
+:- module transform_hlds__pd_util.
 
 :- interface.
 
-:- import_module pd_info, hlds_goal, hlds_module, hlds_pred, mode_errors.
-:- import_module prog_data, simplify, (inst).
+:- import_module transform_hlds__pd_info, hlds__hlds_goal, hlds__hlds_module.
+:- import_module hlds__hlds_pred, check_hlds__mode_errors.
+:- import_module parse_tree__prog_data, check_hlds__simplify.
+:- import_module (parse_tree__inst).
 :- import_module bool, list, map, set, std_util.
 
 	% Pick out the pred_proc_ids of the calls in a list of atomic goals.
@@ -138,11 +140,15 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module det_analysis, constraint, pd_cost, hlds_data, instmap.
-:- import_module unused_args, inst_match, (inst), quantification, mode_util.
-:- import_module code_aux, purity, mode_info, unique_modes, pd_debug.
-:- import_module type_util, det_util, det_analysis, options, goal_util.
-:- import_module det_report, inst_util.
+:- import_module check_hlds__det_analysis, transform_hlds__constraint.
+:- import_module transform_hlds__pd_cost, hlds__hlds_data, hlds__instmap.
+:- import_module transform_hlds__unused_args, check_hlds__inst_match.
+:- import_module (parse_tree__inst), hlds__quantification, check_hlds__mode_util.
+:- import_module ll_backend__code_aux, check_hlds__purity.
+:- import_module check_hlds__mode_info, check_hlds__unique_modes, transform_hlds__pd_debug.
+:- import_module check_hlds__type_util, check_hlds__det_util.
+:- import_module check_hlds__det_analysis, libs__options, hlds__goal_util.
+:- import_module check_hlds__det_report, check_hlds__inst_util.
 :- import_module assoc_list, int, require, set, term.
 
 pd_util__goal_get_calls(Goal0, CalledPreds) :-
Index: compiler/peephole.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/peephole.m,v
retrieving revision 1.77
diff -u -d -r1.77 peephole.m
--- compiler/peephole.m	21 Feb 2002 06:09:27 -0000	1.77
+++ compiler/peephole.m	6 Mar 2002 00:53:51 -0000
@@ -10,12 +10,12 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module peephole.
+:- module ll_backend__peephole.
 
 :- interface.
 
 :- import_module bool, list.
-:- import_module llds, globals.
+:- import_module ll_backend__llds, libs__globals.
 
 	% Peephole optimize a list of instructions.
 
@@ -25,7 +25,8 @@
 
 :- implementation.
 
-:- import_module builtin_ops, code_util, opt_util, opt_debug.
+:- import_module backend_libs__builtin_ops, ll_backend__code_util.
+:- import_module ll_backend__opt_util, ll_backend__opt_debug.
 :- import_module int, map, string, std_util.
 
 	% Patterns that can be switched off.
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/polymorphism.m,v
retrieving revision 1.218
diff -u -d -r1.218 polymorphism.m
--- compiler/polymorphism.m	11 Jan 2002 07:41:31 -0000	1.218
+++ compiler/polymorphism.m	6 Mar 2002 00:53:51 -0000
@@ -186,11 +186,11 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module polymorphism.
+:- module check_hlds__polymorphism.
 :- interface.
 
-:- import_module hlds_goal, hlds_module, hlds_pred.
-:- import_module prog_data, special_pred.
+:- import_module hlds__hlds_goal, hlds__hlds_module, hlds__hlds_pred.
+:- import_module parse_tree__prog_data, hlds__special_pred.
 
 :- import_module io, list, term, map.
 
@@ -326,12 +326,16 @@
 
 :- implementation.
 
-:- import_module hlds_data, typecheck, llds, prog_io.
-:- import_module type_util, mode_util, quantification, instmap, prog_out.
-:- import_module code_util, unify_proc, prog_util.
-:- import_module (inst), hlds_out, base_typeclass_info, goal_util, passes_aux.
-:- import_module clause_to_proc.
-:- import_module globals, options.
+:- import_module hlds__hlds_data, check_hlds__typecheck, ll_backend__llds.
+:- import_module parse_tree__prog_io.
+:- import_module check_hlds__type_util, check_hlds__mode_util.
+:- import_module hlds__quantification, hlds__instmap, parse_tree__prog_out.
+:- import_module ll_backend__code_util, check_hlds__unify_proc.
+:- import_module parse_tree__prog_util.
+:- import_module (parse_tree__inst), hlds__hlds_out.
+:- import_module backend_libs__base_typeclass_info, hlds__goal_util, hlds__passes_aux.
+:- import_module check_hlds__clause_to_proc.
+:- import_module libs__globals, libs__options.
 
 :- import_module bool, int, string, set, map.
 :- import_module term, varset, std_util, require, assoc_list.
Index: compiler/post_typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/post_typecheck.m,v
retrieving revision 1.35
diff -u -d -r1.35 post_typecheck.m
--- compiler/post_typecheck.m	22 Feb 2002 01:20:53 -0000	1.35
+++ compiler/post_typecheck.m	6 Mar 2002 00:53:51 -0000
@@ -31,9 +31,10 @@
 % were found by previous passes.
 %
 
-:- module post_typecheck.
+:- module check_hlds__post_typecheck.
 :- interface.
-:- import_module hlds_data, hlds_goal, hlds_module, hlds_pred, prog_data.
+:- import_module hlds__hlds_data, hlds__hlds_goal, hlds__hlds_module.
+:- import_module hlds__hlds_pred, parse_tree__prog_data.
 :- import_module list, io, bool, std_util.
 
 	% check_type_bindings(PredId, PredInfo, ModuleInfo, ReportErrors):
@@ -132,10 +133,13 @@
 
 :- implementation.
 
-:- import_module (assertion), code_util, typecheck, clause_to_proc.
-:- import_module mode_util, inst_match, (inst), prog_util, error_util.
-:- import_module mercury_to_mercury, prog_out, hlds_out, type_util, goal_util.
-:- import_module globals, options.
+:- import_module (hlds__assertion), ll_backend__code_util.
+:- import_module check_hlds__typecheck, check_hlds__clause_to_proc.
+:- import_module check_hlds__mode_util, check_hlds__inst_match.
+:- import_module (parse_tree__inst), parse_tree__prog_util, hlds__error_util.
+:- import_module parse_tree__mercury_to_mercury, parse_tree__prog_out.
+:- import_module hlds__hlds_out, check_hlds__type_util, hlds__goal_util.
+:- import_module libs__globals, libs__options.
 
 :- import_module map, set, assoc_list, term, require, int.
 :- import_module string, varset.
Index: compiler/pragma_c_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pragma_c_gen.m,v
retrieving revision 1.48
diff -u -d -r1.48 pragma_c_gen.m
--- compiler/pragma_c_gen.m	13 Feb 2002 09:56:25 -0000	1.48
+++ compiler/pragma_c_gen.m	6 Mar 2002 00:53:51 -0000
@@ -17,14 +17,14 @@
 % The scheme for model_non pragma_c_codes is substantially different,
 % so we handle them separately.
 
-:- module pragma_c_gen.
+:- module ll_backend__pragma_c_gen.
 
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_goal, hlds_pred.
-:- import_module code_model.
-:- import_module llds, code_info.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_goal, hlds__hlds_pred.
+:- import_module backend_libs__code_model.
+:- import_module ll_backend__llds, ll_backend__code_info.
 
 :- import_module list, std_util.
 
@@ -41,9 +41,10 @@
 
 :- implementation.
 
-:- import_module hlds_module, hlds_pred, llds_out, trace, tree.
-:- import_module code_util, foreign.
-:- import_module options, globals.
+:- import_module hlds__hlds_module, hlds__hlds_pred, ll_backend__llds_out.
+:- import_module ll_backend__trace, libs__tree.
+:- import_module ll_backend__code_util, backend_libs__foreign.
+:- import_module libs__options, libs__globals.
 
 :- import_module bool, string, int, assoc_list, set, map, require, term.
 
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.79
diff -u -d -r1.79 prog_data.m
--- compiler/prog_data.m	26 Feb 2002 02:45:49 -0000	1.79
+++ compiler/prog_data.m	5 Mar 2002 23:53:35 -0000
@@ -14,7 +14,7 @@
 % Simplifications are done only by make_hlds.m, which transforms
 % the parse tree which we built here into the HLDS.
 
-:- module prog_data.
+:- module parse_tree__prog_data.
 
 :- interface.
 
@@ -22,8 +22,8 @@
 % Any types which are needed in both the parse tree and in the HLDS
 % should be defined here, rather than in hlds*.m.
 
-:- import_module (inst), options.
-:- import_module recompilation.
+:- import_module (parse_tree__inst), libs__options, libs__globals.
+:- import_module hlds__recompilation.
 :- import_module bool, list, assoc_list, map, set, varset, term, std_util.
 
 %-----------------------------------------------------------------------------%
@@ -107,15 +107,6 @@
 	--->	type_only(type)
 	;	type_and_mode(type, mode).
 
-:- type foreign_language
-	--->	c
-% 	;	cplusplus
- 	;	csharp
- 	;	managed_cplusplus
-% 	;	java
- 	;	il
-	.
-
 :- type pred_or_func
 	--->	predicate
 	;	function.
@@ -1047,7 +1038,7 @@
 :- implementation.
 
 :- import_module string.
-:- import_module purity.
+:- import_module check_hlds__purity.
 
 :- type pragma_foreign_proc_attributes
 	--->	attributes(
Index: compiler/prog_io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io.m,v
retrieving revision 1.201
diff -u -d -r1.201 prog_io.m
--- compiler/prog_io.m	26 Feb 2002 02:45:50 -0000	1.201
+++ compiler/prog_io.m	6 Mar 2002 00:53:51 -0000
@@ -51,11 +51,12 @@
 %     be det and should return a meaningful indication of where an
 %     error occured).
 
-:- module prog_io.
+:- module parse_tree__prog_io.
 
 :- interface.
 
-:- import_module prog_data, prog_io_util, timestamp.
+:- import_module parse_tree__prog_data, parse_tree__prog_io_util.
+:- import_module hlds__timestamp.
 :- import_module bool, varset, term, list, io, std_util. 
 
 %-----------------------------------------------------------------------------%
@@ -192,11 +193,13 @@
 
 :- implementation.
 
-:- import_module prog_io_goal, prog_io_dcg, prog_io_pragma, prog_io_util.
-:- import_module prog_io_typeclass.
-:- import_module hlds_data, hlds_pred, prog_util, prog_out.
-:- import_module globals, options, (inst).
-:- import_module recompilation, recompilation_version.
+:- import_module parse_tree__prog_io_goal, parse_tree__prog_io_dcg.
+:- import_module parse_tree__prog_io_pragma, parse_tree__prog_io_util.
+:- import_module parse_tree__prog_io_typeclass.
+:- import_module hlds__hlds_data, hlds__hlds_pred, parse_tree__prog_util.
+:- import_module parse_tree__prog_out.
+:- import_module libs__globals, libs__options, (parse_tree__inst).
+:- import_module hlds__recompilation, hlds__recompilation_version.
 
 :- import_module int, string, std_util, parser, term_io, dir, require.
 :- import_module assoc_list, map, time.
Index: compiler/prog_io_dcg.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_dcg.m,v
retrieving revision 1.18
diff -u -d -r1.18 prog_io_dcg.m
--- compiler/prog_io_dcg.m	25 Sep 2001 09:36:54 -0000	1.18
+++ compiler/prog_io_dcg.m	6 Mar 2002 00:53:51 -0000
@@ -10,11 +10,11 @@
 % This module handles the parsing of clauses in Definite Clause Grammar
 % notation.
 
-:- module prog_io_dcg.
+:- module parse_tree__prog_io_dcg.
 
 :- interface.
 
-:- import_module prog_data, prog_io_util.
+:- import_module parse_tree__prog_data, parse_tree__prog_io_util.
 :- import_module varset, term.
 
 :- pred parse_dcg_clause(module_name, varset, term, term,
@@ -33,7 +33,8 @@
 
 :- implementation.
 
-:- import_module prog_io, prog_io_goal, prog_util, purity.
+:- import_module parse_tree__prog_io, parse_tree__prog_io_goal.
+:- import_module parse_tree__prog_util, check_hlds__purity.
 :- import_module int, map, string, std_util, list.
 
 %-----------------------------------------------------------------------------%
Index: compiler/prog_io_goal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_goal.m,v
retrieving revision 1.20
diff -u -d -r1.20 prog_io_goal.m
--- compiler/prog_io_goal.m	25 Sep 2001 09:36:54 -0000	1.20
+++ compiler/prog_io_goal.m	6 Mar 2002 00:53:51 -0000
@@ -9,11 +9,11 @@
 %
 % This module defines the predicates that parse goals.
 
-:- module prog_io_goal.
+:- module parse_tree__prog_io_goal.
 
 :- interface.
 
-:- import_module prog_data.
+:- import_module parse_tree__prog_data.
 :- import_module list, term.
 
 	% Convert a single term into a goal.
@@ -95,7 +95,8 @@
 
 :- implementation.
 
-:- import_module mode_util, purity, prog_io, prog_io_util, term_util.
+:- import_module check_hlds__mode_util, check_hlds__purity.
+:- import_module parse_tree__prog_io, parse_tree__prog_io_util, transform_hlds__term_util.
 :- import_module term.
 :- import_module int, map, string, std_util.
 
Index: compiler/prog_io_pragma.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.47
diff -u -d -r1.47 prog_io_pragma.m
--- compiler/prog_io_pragma.m	19 Feb 2002 09:48:21 -0000	1.47
+++ compiler/prog_io_pragma.m	6 Mar 2002 00:53:51 -0000
@@ -9,11 +9,11 @@
 %
 % This module handles the parsing of pragma directives.
 
-:- module prog_io_pragma.
+:- module parse_tree__prog_io_pragma.
 
 :- interface.
 
-:- import_module prog_data, prog_io_util.
+:- import_module parse_tree__prog_data, parse_tree__prog_io_util.
 :- import_module list, varset, term.
 
 	% parse the pragma declaration. 
@@ -22,8 +22,9 @@
 
 :- implementation.
 
-:- import_module globals, prog_io, prog_io_goal, prog_util.
-:- import_module term_util, term_errors.
+:- import_module libs__globals, parse_tree__prog_io, parse_tree__prog_io_goal.
+:- import_module parse_tree__prog_util.
+:- import_module transform_hlds__term_util, transform_hlds__term_errors.
 :- import_module int, map, string, std_util, bool, require, set.
 
 parse_pragma(ModuleName, VarSet, PragmaTerms, Result) :-
Index: compiler/prog_io_typeclass.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_typeclass.m,v
retrieving revision 1.21
diff -u -d -r1.21 prog_io_typeclass.m
--- compiler/prog_io_typeclass.m	25 Sep 2001 09:36:54 -0000	1.21
+++ compiler/prog_io_typeclass.m	6 Mar 2002 00:53:51 -0000
@@ -10,11 +10,11 @@
 % This module handles the parsing of typeclass declarations.
 % Perhaps some of this should go into prog_io_util.m?
 
-:- module prog_io_typeclass.
+:- module parse_tree__prog_io_typeclass.
 
 :- interface.
 
-:- import_module prog_data, prog_io_util.
+:- import_module parse_tree__prog_data, parse_tree__prog_io_util.
 :- import_module list, varset, term.
 
 	% parse a typeclass declaration. 
@@ -32,9 +32,10 @@
 
 :- implementation.
 
-:- import_module prog_io, prog_io_goal, prog_util, hlds_pred.
+:- import_module parse_tree__prog_io, parse_tree__prog_io_goal.
+:- import_module parse_tree__prog_util, hlds__hlds_pred.
 :- import_module term, varset.
-:- import_module int, string, std_util, require, type_util, set.
+:- import_module int, string, std_util, require, check_hlds__type_util, set.
 
 parse_typeclass(ModuleName, VarSet, TypeClassTerm, Result) :-
 		%XXX should return an error if we get more than one arg,
Index: compiler/prog_io_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_util.m,v
retrieving revision 1.21
diff -u -d -r1.21 prog_io_util.m
--- compiler/prog_io_util.m	25 Sep 2001 09:36:55 -0000	1.21
+++ compiler/prog_io_util.m	6 Mar 2002 00:53:51 -0000
@@ -21,11 +21,11 @@
 % if it is not.  The `Term' there should be the term which
 % is syntactically incorrect.
 
-:- module prog_io_util.
+:- module parse_tree__prog_io_util.
 
 :- interface.
 
-:- import_module prog_data, (inst).
+:- import_module parse_tree__prog_data, (parse_tree__inst).
 :- import_module list, map, std_util, term, io.
 
 :- type maybe2(T1, T2)	--->	error(string, term)
@@ -153,12 +153,13 @@
 
 :- implementation.
 
-:- import_module prog_io, prog_io_goal, options, globals.
+:- import_module parse_tree__prog_io, parse_tree__prog_io_goal, libs__options.
+:- import_module libs__globals.
 
 % XXX we should not need to import hlds*.m here.
 % But currently we need to import hlds_data.m for the `cons_id' type
 % that is used in insts.
-:- import_module hlds_data.
+:- import_module hlds__hlds_data.
 
 :- import_module bool, string, std_util, term.
 
Index: compiler/prog_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_out.m,v
retrieving revision 1.45
diff -u -d -r1.45 prog_out.m
--- compiler/prog_out.m	8 Feb 2002 02:26:58 -0000	1.45
+++ compiler/prog_out.m	5 Mar 2002 23:53:19 -0000
@@ -4,7 +4,7 @@
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
 
-:- module prog_out.
+:- module parse_tree__prog_out.
 
 % Main author: fjh.
 
@@ -18,7 +18,7 @@
 %-----------------------------------------------------------------------------%
 
 :- interface.
-:- import_module prog_data.
+:- import_module parse_tree__prog_data.
 :- import_module list, io.
 
 :- pred prog_out__write_messages(message_list, io__state, io__state).
Index: compiler/prog_rep.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_rep.m,v
retrieving revision 1.9
diff -u -d -r1.9 prog_rep.m
--- compiler/prog_rep.m	20 Feb 2002 03:14:18 -0000	1.9
+++ compiler/prog_rep.m	6 Mar 2002 00:53:51 -0000
@@ -14,11 +14,12 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module prog_rep.
+:- module ll_backend__prog_rep.
 
 :- interface.
 
-:- import_module hlds_pred, hlds_goal, hlds_module, instmap.
+:- import_module hlds__hlds_pred, hlds__hlds_goal, hlds__hlds_module.
+:- import_module hlds__instmap.
 :- import_module mdb, mdb__program_representation.
 
 :- pred prog_rep__represent_goal(hlds_goal::in, instmap::in, vartypes::in,
@@ -26,7 +27,7 @@
 
 :- implementation.
 
-:- import_module hlds_data, prog_data.
+:- import_module hlds__hlds_data, parse_tree__prog_data.
 :- import_module string, list, set, std_util, require, term.
 
 :- type prog_rep__info
Index: compiler/prog_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_util.m,v
retrieving revision 1.55
diff -u -d -r1.55 prog_util.m
--- compiler/prog_util.m	10 Aug 2001 08:29:29 -0000	1.55
+++ compiler/prog_util.m	5 Mar 2002 23:53:35 -0000
@@ -9,11 +9,11 @@
 % various utility predicates acting on the parse tree data
 % structure defined in prog_data.m.
 
-:- module prog_util.
+:- module parse_tree__prog_util.
 
 :- interface.
 
-:- import_module prog_data, term.
+:- import_module parse_tree__prog_data, term.
 :- import_module std_util, list.
 
 %-----------------------------------------------------------------------------%
@@ -199,7 +199,7 @@
 %-----------------------------------------------------------------------------%
 
 :- implementation.
-:- import_module mercury_to_mercury, (inst).
+:- import_module parse_tree__mercury_to_mercury, (parse_tree__inst).
 :- import_module bool, string, int, map, varset.
 
 %-----------------------------------------------------------------------------%
Index: compiler/pseudo_type_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pseudo_type_info.m,v
retrieving revision 1.5
diff -u -d -r1.5 pseudo_type_info.m
--- compiler/pseudo_type_info.m	21 Dec 2000 06:10:23 -0000	1.5
+++ compiler/pseudo_type_info.m	5 Mar 2002 23:53:35 -0000
@@ -14,9 +14,9 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module pseudo_type_info.
+:- module backend_libs__pseudo_type_info.
 :- interface.
-:- import_module prog_data, rtti.
+:- import_module parse_tree__prog_data, backend_libs__rtti.
 :- import_module list.
 
 	% pseudo_type_info__construct_pseudo_type_info(Type,
@@ -74,7 +74,7 @@
 
 :- implementation.
 
-:- import_module prog_util, type_util.
+:- import_module parse_tree__prog_util, check_hlds__type_util.
 :- import_module int, list, term, std_util, require.
 
 %---------------------------------------------------------------------------%
Index: compiler/purity.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/purity.m,v
retrieving revision 1.43
diff -u -d -r1.43 purity.m
--- compiler/purity.m	22 Feb 2002 01:20:54 -0000	1.43
+++ compiler/purity.m	6 Mar 2002 00:53:51 -0000
@@ -121,10 +121,11 @@
 %
 
 
-:- module purity.
+:- module check_hlds__purity.
 :- interface.
 
-:- import_module prog_data, hlds_module, hlds_goal, hlds_pred.
+:- import_module parse_tree__prog_data, hlds__hlds_module, hlds__hlds_goal.
+:- import_module hlds__hlds_pred.
 :- import_module io, bool, list.
 
 % The purity type itself is defined in prog_data.m as follows:
@@ -205,12 +206,15 @@
 
 :- implementation.
 
-:- import_module hlds_data, prog_io_util.
-:- import_module type_util, mode_util, code_util, prog_data, unify_proc.
-:- import_module globals, options, mercury_to_mercury, hlds_out.
-:- import_module passes_aux, typecheck, module_qual, clause_to_proc.
-:- import_module inst_util, prog_out.
-:- import_module post_typecheck.
+:- import_module hlds__hlds_data, parse_tree__prog_io_util.
+:- import_module check_hlds__type_util, check_hlds__mode_util.
+:- import_module ll_backend__code_util, parse_tree__prog_data, check_hlds__unify_proc.
+:- import_module libs__globals, libs__options, parse_tree__mercury_to_mercury.
+:- import_module hlds__hlds_out.
+:- import_module hlds__passes_aux, check_hlds__typecheck.
+:- import_module parse_tree__module_qual, check_hlds__clause_to_proc.
+:- import_module check_hlds__inst_util, parse_tree__prog_out.
+:- import_module check_hlds__post_typecheck.
 
 :- import_module map, varset, term, string, require, std_util.
 :- import_module assoc_list, bool, int, set.
Index: compiler/quantification.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/quantification.m,v
retrieving revision 1.80
diff -u -d -r1.80 quantification.m
--- compiler/quantification.m	7 Apr 2001 14:04:56 -0000	1.80
+++ compiler/quantification.m	5 Mar 2002 23:53:35 -0000
@@ -34,11 +34,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module quantification.
+:- module hlds__quantification.
 
 :- interface.
 
-:- import_module hlds_goal, hlds_pred, prog_data.
+:- import_module hlds__hlds_goal, hlds__hlds_pred, parse_tree__prog_data.
 :- import_module list, set.
 
 	%
@@ -120,7 +120,7 @@
 
 :- implementation.
 
-:- import_module instmap, goal_util.
+:- import_module hlds__instmap, hlds__goal_util.
 
 :- import_module map, term, varset.
 :- import_module std_util, bool, require.
Index: compiler/recompilation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation.m,v
retrieving revision 1.2
diff -u -d -r1.2 recompilation.m
--- compiler/recompilation.m	11 Jul 2001 15:44:21 -0000	1.2
+++ compiler/recompilation.m	6 Mar 2002 00:53:51 -0000
@@ -20,11 +20,11 @@
 % importing it need to be recompiled.
 %
 %-----------------------------------------------------------------------------%
-:- module recompilation.
+:- module hlds__recompilation.
 
 :- interface.
 
-:- import_module prog_data, timestamp.
+:- import_module parse_tree__prog_data, hlds__timestamp.
 :- import_module io, map, set, std_util, term.
 
 	% Identify a particular version of a program item.
@@ -229,8 +229,9 @@
 
 :- implementation.
 
-:- import_module prog_util.
-:- import_module globals, options, passes_aux, modules.
+:- import_module parse_tree__prog_util.
+:- import_module libs__globals, libs__options, hlds__passes_aux.
+:- import_module parse_tree__modules.
 :- import_module int, time, bool, list, require, string.
 
 %-----------------------------------------------------------------------------%
Index: compiler/recompilation_check.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_check.m,v
retrieving revision 1.9
diff -u -d -r1.9 recompilation_check.m
--- compiler/recompilation_check.m	26 Feb 2002 02:45:52 -0000	1.9
+++ compiler/recompilation_check.m	6 Mar 2002 00:53:51 -0000
@@ -8,11 +8,12 @@
 %
 % Check whether a module should be recompiled.
 %-----------------------------------------------------------------------------%
-:- module recompilation_check.
+:- module hlds__recompilation_check.
 
 :- interface.
 
-:- import_module modules, prog_io, prog_data.
+:- import_module parse_tree__modules, parse_tree__prog_io.
+:- import_module parse_tree__prog_data.
 :- import_module list, io.
 
 :- type modules_to_recompile
@@ -53,13 +54,15 @@
 
 :- implementation.
 
-:- import_module recompilation, recompilation_usage, recompilation_version.
-:- import_module timestamp.
-:- import_module prog_io_util, prog_util, prog_out, error_util.
-:- import_module globals, options.
-:- import_module hlds_pred.	% for field_access_function_name,
+:- import_module hlds__recompilation, hlds__recompilation_usage.
+:- import_module hlds__recompilation_version.
+:- import_module hlds__timestamp.
+:- import_module parse_tree__prog_io_util, parse_tree__prog_util.
+:- import_module parse_tree__prog_out, hlds__error_util.
+:- import_module libs__globals, libs__options.
+:- import_module hlds__hlds_pred.	% for field_access_function_name,
 				% type pred_id.
-:- import_module hlds_data.	% for type field_access_type
+:- import_module hlds__hlds_data.	% for type field_access_type
 
 :- import_module assoc_list, bool, exception, int, map, parser, require.
 :- import_module set, std_util, string, term, term_io.
Index: compiler/recompilation_usage.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_usage.m,v
retrieving revision 1.5
diff -u -d -r1.5 recompilation_usage.m
--- compiler/recompilation_usage.m	26 Feb 2002 02:45:53 -0000	1.5
+++ compiler/recompilation_usage.m	6 Mar 2002 00:53:51 -0000
@@ -8,11 +8,12 @@
 %
 % Write the file recording which imported items were used by a compilation.
 %-----------------------------------------------------------------------------%
-:- module recompilation_usage.
+:- module hlds__recompilation_usage.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, modules, recompilation, prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred, parse_tree__modules.
+:- import_module hlds__recompilation, parse_tree__prog_data.
 :- import_module assoc_list, io, list, map, set, std_util.
 
 	%
@@ -75,10 +76,12 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module hlds_data, hlds_pred, prog_util, type_util, (inst).
-:- import_module hlds_out, mercury_to_mercury, passes_aux, prog_data.
-:- import_module globals, options.
-:- import_module recompilation_version, timestamp.
+:- import_module hlds__hlds_data, hlds__hlds_pred, parse_tree__prog_util.
+:- import_module check_hlds__type_util, (parse_tree__inst).
+:- import_module hlds__hlds_out, parse_tree__mercury_to_mercury.
+:- import_module hlds__passes_aux, parse_tree__prog_data.
+:- import_module libs__globals, libs__options.
+:- import_module hlds__recompilation_version, hlds__timestamp.
 
 :- import_module assoc_list, bool, int, require.
 :- import_module queue, std_util, string.
Index: compiler/recompilation_version.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_version.m,v
retrieving revision 1.13
diff -u -d -r1.13 recompilation_version.m
--- compiler/recompilation_version.m	26 Feb 2002 02:45:53 -0000	1.13
+++ compiler/recompilation_version.m	6 Mar 2002 00:53:51 -0000
@@ -8,11 +8,12 @@
 %
 % Compute version numbers for program items in interface files.
 %-----------------------------------------------------------------------------%
-:- module recompilation_version.
+:- module hlds__recompilation_version.
 
 :- interface.
 
-:- import_module recompilation, prog_data, prog_io_util, timestamp.
+:- import_module hlds__recompilation, parse_tree__prog_data.
+:- import_module parse_tree__prog_io_util, hlds__timestamp.
 :- import_module io, std_util, term.
 
 	% recompilation_version__compute_version_numbers(SourceFileModTime,
@@ -33,8 +34,9 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module mercury_to_mercury, mode_util, prog_io, prog_util, type_util.
-:- import_module hlds_out, (inst).
+:- import_module parse_tree__mercury_to_mercury, check_hlds__mode_util.
+:- import_module parse_tree__prog_io, parse_tree__prog_util, check_hlds__type_util.
+:- import_module hlds__hlds_out, (parse_tree__inst).
 :- import_module assoc_list, bool, list, map, require, string, varset.
 
 recompilation_version__compute_version_numbers(SourceFileTime, Items,
Index: compiler/rl.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl.m,v
retrieving revision 1.17
diff -u -d -r1.17 rl.m
--- compiler/rl.m	27 Jun 2001 05:04:29 -0000	1.17
+++ compiler/rl.m	6 Mar 2002 00:53:51 -0000
@@ -13,12 +13,13 @@
 % Output to RL bytecodes by rl_out.m.
 %
 %-----------------------------------------------------------------------------%
-:- module rl. 
+:- module aditi_backend__rl. 
 
 :- interface.
 
-:- import_module hlds_data, hlds_goal, hlds_module, hlds_pred.
-:- import_module instmap, prog_data.
+:- import_module hlds__hlds_data, hlds__hlds_goal, hlds__hlds_module.
+:- import_module hlds__hlds_pred.
+:- import_module hlds__instmap, parse_tree__prog_data.
 :- import_module assoc_list, list, std_util, map, set.
 
 %-----------------------------------------------------------------------------%
@@ -670,8 +671,10 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module code_util, code_aux, globals, llds_out, options, prog_out.
-:- import_module mode_util, prog_util, type_util, llds.
+:- import_module ll_backend__code_util, ll_backend__code_aux, libs__globals.
+:- import_module ll_backend__llds_out, libs__options, parse_tree__prog_out.
+:- import_module check_hlds__mode_util, parse_tree__prog_util.
+:- import_module check_hlds__type_util, ll_backend__llds.
 :- import_module bool, int, require, string.
 
 rl__default_temporary_state(ModuleInfo, TmpState) :-
Index: compiler/rl_analyse.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_analyse.m,v
retrieving revision 1.2
diff -u -d -r1.2 rl_analyse.m
--- compiler/rl_analyse.m	24 Feb 2002 11:53:25 -0000	1.2
+++ compiler/rl_analyse.m	5 Mar 2002 23:53:35 -0000
@@ -9,11 +9,11 @@
 % Generic flow graph analysis for RL instructions.
 % This is mostly as described in the Dragon Book, chapter 10.
 %-----------------------------------------------------------------------------%
-:- module rl_analyse.
+:- module aditi_backend__rl_analyse.
 
 :- interface.
 
-:- import_module rl_block.
+:- import_module aditi_backend__rl_block.
 :- import_module io, list, map, set, std_util.
 
 	% rl_analyse(Blocks, Direction, Init, Confluence, Update, Results,
@@ -106,7 +106,7 @@
 
 :- implementation.
 
-:- import_module globals, options.
+:- import_module libs__globals, libs__options.
 :- import_module assoc_list, bool, relation, require, string.  
 
 rl_analyse(Blocks, Analysis, BlockDataMap0, BlockDataMap,
Index: compiler/rl_block.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_block.m,v
retrieving revision 1.2
diff -u -d -r1.2 rl_block.m
--- compiler/rl_block.m	1 Mar 2000 01:04:47 -0000	1.2
+++ compiler/rl_block.m	6 Mar 2002 00:53:51 -0000
@@ -10,11 +10,12 @@
 % Produce a flow graph. 
 % See the Dragon Book for details.
 %-----------------------------------------------------------------------------%
-:- module rl_block.
+:- module aditi_backend__rl_block.
 
 :- interface.
 
-:- import_module rl, hlds_pred, hlds_module, prog_data.
+:- import_module aditi_backend__rl, hlds__hlds_pred, hlds__hlds_module.
+:- import_module parse_tree__prog_data.
 :- import_module bool, io, int, list, map, relation, set, std_util.
 
 :- pred rl_block__create_flow_graph(bool::in, module_info::in, 
@@ -36,7 +37,7 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module hlds_module, rl_dump.
+:- import_module hlds__hlds_module, aditi_backend__rl_dump.
 :- import_module queue, require, string.
 
 rl_block__create_flow_graph(Debug, ModuleInfo, Proc, Info) -->
Index: compiler/rl_block_opt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_block_opt.m,v
retrieving revision 1.7
diff -u -d -r1.7 rl_block_opt.m
--- compiler/rl_block_opt.m	13 Mar 2000 05:24:37 -0000	1.7
+++ compiler/rl_block_opt.m	6 Mar 2002 00:53:51 -0000
@@ -21,11 +21,11 @@
 % To do -
 % push selections through union, sort etc.
 %-----------------------------------------------------------------------------%
-:- module rl_block_opt.
+:- module aditi_backend__rl_block_opt.
 
 :- interface.
 
-:- import_module rl_block.
+:- import_module aditi_backend__rl_block.
 :- import_module io, list.
 
 :- pred rl_block_opt(list(opt_flag)::in, rl_opt_info::in, rl_opt_info::out,
@@ -39,8 +39,10 @@
 
 :- implementation.
 
-:- import_module goal_util, hlds_goal, hlds_module, hlds_pred, inlining.
-:- import_module prog_data, rl, rl_key, globals, options.
+:- import_module hlds__goal_util, hlds__hlds_goal, hlds__hlds_module.
+:- import_module hlds__hlds_pred, transform_hlds__inlining.
+:- import_module parse_tree__prog_data, aditi_backend__rl.
+:- import_module aditi_backend__rl_key, libs__globals, libs__options.
 :- import_module assoc_list, bool, int, map, multi_map.
 :- import_module relation, require, set, std_util, string.
 
Index: compiler/rl_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_code.m,v
retrieving revision 1.11
diff -u -d -r1.11 rl_code.m
--- compiler/rl_code.m	13 Mar 2000 05:24:38 -0000	1.11
+++ compiler/rl_code.m	5 Mar 2002 23:53:19 -0000
@@ -8,7 +8,7 @@
 % Created Mon Mar 13 14:33:54 2000
 
 %-----------------------------------------------------------------------------%
-:- module rl_code.
+:- module aditi_backend__rl_code.
 
 %-----------------------------------------------------------------------------%
 :- interface.
@@ -438,7 +438,7 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module bytecode_data.
+:- import_module backend_libs__bytecode_data.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/rl_dump.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_dump.m,v
retrieving revision 1.7
diff -u -d -r1.7 rl_dump.m
--- compiler/rl_dump.m	13 Mar 2000 05:24:39 -0000	1.7
+++ compiler/rl_dump.m	6 Mar 2002 00:53:51 -0000
@@ -9,11 +9,11 @@
 % Output a human readable representation of RL for debugging.
 %
 %-----------------------------------------------------------------------------%
-:- module rl_dump.
+:- module aditi_backend__rl_dump.
 
 :- interface.
 
-:- import_module hlds_module, rl.
+:- import_module hlds__hlds_module, aditi_backend__rl.
 :- import_module io.
 
 :- pred rl_dump__write_procedure(module_info, rl_proc, io__state, io__state). 
@@ -26,7 +26,8 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module hlds_out, hlds_pred, mercury_to_mercury, prog_data.
+:- import_module hlds__hlds_out, hlds__hlds_pred.
+:- import_module parse_tree__mercury_to_mercury, parse_tree__prog_data.
 :- import_module bool, list, map, require, set, std_util.
 :- import_module term, term_io, varset.
 
Index: compiler/rl_exprn.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_exprn.m,v
retrieving revision 1.22
diff -u -d -r1.22 rl_exprn.m
--- compiler/rl_exprn.m	20 Feb 2002 03:14:19 -0000	1.22
+++ compiler/rl_exprn.m	6 Mar 2002 00:53:51 -0000
@@ -47,11 +47,12 @@
 % to specify which constructor to use.
 %
 %-----------------------------------------------------------------------------%
-:- module rl_exprn.
+:- module aditi_backend__rl_exprn.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, rl, rl_code, rl_file, prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred, aditi_backend__rl.
+:- import_module aditi_backend__rl_code, aditi_backend__rl_file, parse_tree__prog_data.
 :- import_module list.
 
 	% rl_exprn__generate_compare_exprn(ModuleInfo, SortSpec,
@@ -124,10 +125,13 @@
 
 :- implementation.
 
-:- import_module code_util, hlds_pred, hlds_data, inst_match.
-:- import_module instmap, mode_util, tree, type_util, prog_out.
-:- import_module rl_out, inlining, hlds_goal, prog_util, error_util.
-:- import_module builtin_ops.
+:- import_module ll_backend__code_util, hlds__hlds_pred, hlds__hlds_data.
+:- import_module check_hlds__inst_match.
+:- import_module hlds__instmap, check_hlds__mode_util, libs__tree.
+:- import_module check_hlds__type_util, parse_tree__prog_out.
+:- import_module aditi_backend__rl_out, transform_hlds__inlining.
+:- import_module hlds__hlds_goal, parse_tree__prog_util, hlds__error_util.
+:- import_module backend_libs__builtin_ops.
 
 :- import_module assoc_list, bool, char, int, map.
 :- import_module require, set, std_util, string, term, varset.
Index: compiler/rl_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_gen.m,v
retrieving revision 1.5
diff -u -d -r1.5 rl_gen.m
--- compiler/rl_gen.m	13 Jul 1999 08:53:28 -0000	1.5
+++ compiler/rl_gen.m	6 Mar 2002 00:53:51 -0000
@@ -12,11 +12,11 @@
 % transformations has been applied.
 %
 %-----------------------------------------------------------------------------%
-:- module rl_gen.
+:- module aditi_backend__rl_gen.
 
 :- interface.
 
-:- import_module hlds_module, rl.
+:- import_module hlds__hlds_module, aditi_backend__rl.
 :- import_module io.
 
 :- pred rl_gen__module(module_info, rl_code, io__state, io__state).
@@ -25,11 +25,15 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module code_aux, code_util, det_analysis, hlds_data, hlds_goal.
-:- import_module hlds_pred, instmap, mode_util, prog_data, prog_out.
-:- import_module rl_relops, rl_info.
-:- import_module tree, type_util, dependency_graph.
-:- import_module inst_match, (inst), goal_util, inlining, globals, options.
+:- import_module ll_backend__code_aux, ll_backend__code_util.
+:- import_module check_hlds__det_analysis, hlds__hlds_data, hlds__hlds_goal.
+:- import_module hlds__hlds_pred, hlds__instmap, check_hlds__mode_util.
+:- import_module parse_tree__prog_data, parse_tree__prog_out.
+:- import_module aditi_backend__rl_relops, aditi_backend__rl_info.
+:- import_module libs__tree, check_hlds__type_util.
+:- import_module transform_hlds__dependency_graph.
+:- import_module check_hlds__inst_match, (parse_tree__inst), hlds__goal_util.
+:- import_module transform_hlds__inlining, libs__globals, libs__options.
 
 :- import_module assoc_list, bool, char, int, list, map, queue.
 :- import_module relation, require, set, std_util, string, term, varset.
Index: compiler/rl_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_info.m,v
retrieving revision 1.1
diff -u -d -r1.1 rl_info.m
--- compiler/rl_info.m	6 Dec 1998 23:45:19 -0000	1.1
+++ compiler/rl_info.m	6 Mar 2002 00:53:51 -0000
@@ -8,11 +8,12 @@
 %
 % State type + access predicates for the Aditi-RL code generator.
 %-----------------------------------------------------------------------------%
-:- module rl_info.
+:- module aditi_backend__rl_info.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, prog_data, rl, tree.
+:- import_module hlds__hlds_module, hlds__hlds_pred, parse_tree__prog_data.
+:- import_module aditi_backend__rl, libs__tree.
 :- import_module bool, io, list, map, set, std_util, string.
 
 :- type rl_info.
@@ -235,8 +236,9 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module code_util, globals, llds_out, mode_util, options, type_util.
-:- import_module hlds_goal, prog_out.
+:- import_module ll_backend__code_util, libs__globals, ll_backend__llds_out.
+:- import_module check_hlds__mode_util, libs__options, check_hlds__type_util.
+:- import_module hlds__hlds_goal, parse_tree__prog_out.
 :- import_module int, require.
 
 :- type rl_info
Index: compiler/rl_key.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_key.m,v
retrieving revision 1.8
diff -u -d -r1.8 rl_key.m
--- compiler/rl_key.m	6 Oct 2000 10:18:33 -0000	1.8
+++ compiler/rl_key.m	6 Mar 2002 00:53:51 -0000
@@ -13,11 +13,12 @@
 % traverse the relation in sorted order to the upper bound.
 %
 %-----------------------------------------------------------------------------%
-:- module rl_key.
+:- module aditi_backend__rl_key.
 
 :- interface.
 
-:- import_module hlds_goal, hlds_module, prog_data, rl.
+:- import_module hlds__hlds_goal, hlds__hlds_module, parse_tree__prog_data.
+:- import_module aditi_backend__rl.
 :- import_module list, map.
 
 	% Work out the upper and lower bounds for the inputs to an
@@ -51,7 +52,8 @@
 
 :- implementation.
 
-:- import_module hlds_data, hlds_pred, prog_util, type_util.
+:- import_module hlds__hlds_data, hlds__hlds_pred, parse_tree__prog_util.
+:- import_module check_hlds__type_util.
 :- import_module assoc_list, bool, int, require, set, std_util.
 
 rl_key__extract_indexing(no_inputs, _, _, _, []). 
Index: compiler/rl_liveness.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_liveness.m,v
retrieving revision 1.3
diff -u -d -r1.3 rl_liveness.m
--- compiler/rl_liveness.m	23 Jun 1999 04:22:58 -0000	1.3
+++ compiler/rl_liveness.m	5 Mar 2002 23:53:36 -0000
@@ -14,11 +14,11 @@
 % Make sure the inputs to uniondiff and insert instructions have at most
 % one reference by inserting copy or make_unique instructions.
 %-----------------------------------------------------------------------------%
-:- module rl_liveness.
+:- module aditi_backend__rl_liveness.
 
 :- interface.
 
-:- import_module rl_block.
+:- import_module aditi_backend__rl_block.
 :- import_module io.
 
 :- pred rl_liveness(rl_opt_info, rl_opt_info, io__state, io__state).
@@ -27,7 +27,7 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module rl, rl_analyse.
+:- import_module aditi_backend__rl, aditi_backend__rl_analyse.
 :- import_module bool, int, list, map, relation, require, set, std_util.
 
 rl_liveness(Opt0, Opt, IO0, IO) :-
Index: compiler/rl_loop.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_loop.m,v
retrieving revision 1.1
diff -u -d -r1.1 rl_loop.m
--- compiler/rl_loop.m	6 Dec 1998 23:45:28 -0000	1.1
+++ compiler/rl_loop.m	5 Mar 2002 23:53:19 -0000
@@ -13,11 +13,11 @@
 %	Addison-Wesley, 1986.
 %-----------------------------------------------------------------------------%
 
-:- module rl_loop.
+:- module aditi_backend__rl_loop.
 
 :- interface.
 
-:- import_module rl_block.
+:- import_module aditi_backend__rl_block.
 
 	% Given the flow graph for a procedure, return a new flow 
 	% graph with loop invariant instructions moved out of loops.
@@ -26,7 +26,7 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module rl.
+:- import_module aditi_backend__rl.
 :- import_module assoc_list, bimap, bool, int, list, map, queue, relation.
 :- import_module require, set, std_util.
 
Index: compiler/rl_opt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_opt.m,v
retrieving revision 1.3
diff -u -d -r1.3 rl_opt.m
--- compiler/rl_opt.m	9 Jun 1999 01:28:47 -0000	1.3
+++ compiler/rl_opt.m	6 Mar 2002 00:53:51 -0000
@@ -8,11 +8,11 @@
 %
 % Call the RL optimization passes.
 %-----------------------------------------------------------------------------%
-:- module rl_opt.
+:- module aditi_backend__rl_opt.
 
 :- interface.
 
-:- import_module hlds_module, rl.
+:- import_module hlds__hlds_module, aditi_backend__rl.
 :- import_module io, list.
 
 :- pred rl_opt__procs(module_info, list(rl_proc), list(rl_proc),
@@ -22,9 +22,11 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module globals, options, passes_aux, prog_out.
-:- import_module rl_block, rl_liveness.
-:- import_module rl_block_opt, rl_loop, rl_sort, rl_stream.
+:- import_module libs__globals, libs__options, hlds__passes_aux.
+:- import_module parse_tree__prog_out.
+:- import_module aditi_backend__rl_block, aditi_backend__rl_liveness.
+:- import_module aditi_backend__rl_block_opt, aditi_backend__rl_loop.
+:- import_module aditi_backend__rl_sort, aditi_backend__rl_stream.
 :- import_module bool, list.
 
 rl_opt__procs(ModuleInfo, Procs0, Procs) -->
Index: compiler/rl_relops.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_relops.m,v
retrieving revision 1.5
diff -u -d -r1.5 rl_relops.m
--- compiler/rl_relops.m	1 Mar 2000 01:04:51 -0000	1.5
+++ compiler/rl_relops.m	6 Mar 2002 00:53:51 -0000
@@ -8,11 +8,12 @@
 %
 % Generate intermediate code for relational operations.
 %-----------------------------------------------------------------------------%
-:- module rl_relops.
+:- module aditi_backend__rl_relops.
 
 :- interface.
 
-:- import_module hlds_goal, instmap, prog_data, rl, rl_info.
+:- import_module hlds__hlds_goal, hlds__instmap, parse_tree__prog_data.
+:- import_module aditi_backend__rl, aditi_backend__rl_info.
 :- import_module bool, list, std_util.
 
 /*
@@ -95,8 +96,10 @@
 
 :- implementation.
 
-:- import_module code_aux, hlds_data, hlds_module, hlds_pred, mode_util.
-:- import_module tree, rl_key, globals, options.
+:- import_module ll_backend__code_aux, hlds__hlds_data, hlds__hlds_module.
+:- import_module hlds__hlds_pred, check_hlds__mode_util.
+:- import_module libs__tree, aditi_backend__rl_key, libs__globals.
+:- import_module libs__options.
 :- import_module int, map, require, set.
 
 %-----------------------------------------------------------------------------%
Index: compiler/rl_sort.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_sort.m,v
retrieving revision 1.9
diff -u -d -r1.9 rl_sort.m
--- compiler/rl_sort.m	8 Aug 2001 06:36:21 -0000	1.9
+++ compiler/rl_sort.m	6 Mar 2002 00:53:51 -0000
@@ -30,11 +30,11 @@
 % the same way - I'm not sure if this is a good idea.
 %
 %-----------------------------------------------------------------------------%
-:- module rl_sort.
+:- module aditi_backend__rl_sort.
 
 :- interface.
 
-:- import_module rl_block.
+:- import_module aditi_backend__rl_block.
 :- import_module io.
 
 :- pred rl_sort__proc(rl_opt_info, rl_opt_info, io__state, io__state).
@@ -44,7 +44,8 @@
 
 :- implementation.
 
-:- import_module hlds_module, prog_data, rl, rl_analyse, rl_key.
+:- import_module hlds__hlds_module, parse_tree__prog_data, aditi_backend__rl.
+:- import_module aditi_backend__rl_analyse, aditi_backend__rl_key.
 :- import_module assoc_list, bool, int, list, map, relation, require, set.
 :- import_module std_util.
 
Index: compiler/rl_stream.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_stream.m,v
retrieving revision 1.6
diff -u -d -r1.6 rl_stream.m
--- compiler/rl_stream.m	18 Apr 2000 05:06:00 -0000	1.6
+++ compiler/rl_stream.m	5 Mar 2002 23:53:20 -0000
@@ -29,11 +29,11 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module rl_stream.
+:- module aditi_backend__rl_stream.
 
 :- interface.
 
-:- import_module rl_block.
+:- import_module aditi_backend__rl_block.
 
 :- pred rl_stream__detect_streams(rl_opt_info, rl_opt_info).
 :- mode rl_stream__detect_streams(in, out) is det.
@@ -41,7 +41,7 @@
 %-----------------------------------------------------------------------------%
 :- implementation.
 
-:- import_module rl.
+:- import_module aditi_backend__rl.
 :- import_module assoc_list, bag, int, list, map, multi_map.
 :- import_module relation, require, set, std_util.
 
Index: compiler/rtti.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti.m,v
retrieving revision 1.15
diff -u -d -r1.15 rtti.m
--- compiler/rtti.m	25 Jan 2002 08:22:52 -0000	1.15
+++ compiler/rtti.m	5 Mar 2002 23:53:36 -0000
@@ -20,13 +20,13 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module rtti.
+:- module backend_libs__rtti.
 
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_module, hlds_pred, hlds_data.
-:- import_module pseudo_type_info, code_model.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_data.
+:- import_module backend_libs__pseudo_type_info, backend_libs__code_model.
 
 :- import_module bool, list, std_util.
 
@@ -489,9 +489,9 @@
 
 :- implementation.
 
-:- import_module code_util.	% for code_util__compiler_generated
-:- import_module llds_out.	% for name_mangle and sym_name_mangle
-:- import_module hlds_data, type_util, mode_util.
+:- import_module ll_backend__code_util.	% for code_util__compiler_generated
+:- import_module ll_backend__llds_out.	% for name_mangle and sym_name_mangle
+:- import_module hlds__hlds_data, check_hlds__type_util, check_hlds__mode_util.
 
 :- import_module string, require.
 
Index: compiler/rtti_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti_out.m,v
retrieving revision 1.24
diff -u -d -r1.24 rtti_out.m
--- compiler/rtti_out.m	25 Jan 2002 08:22:53 -0000	1.24
+++ compiler/rtti_out.m	6 Mar 2002 00:53:51 -0000
@@ -19,12 +19,12 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module rtti_out.
+:- module ll_backend__rtti_out.
 
 :- interface.
 
-:- import_module prog_data, hlds_data.
-:- import_module rtti, llds_out.
+:- import_module parse_tree__prog_data, hlds__hlds_data.
+:- import_module backend_libs__rtti, ll_backend__llds_out.
 :- import_module bool, io.
 
 	% output a C expression holding the address of the C name of
@@ -87,9 +87,10 @@
 
 :- implementation.
 
-:- import_module pseudo_type_info, code_util, llds, prog_out, c_util.
-:- import_module error_util.
-:- import_module options, globals.
+:- import_module backend_libs__pseudo_type_info, ll_backend__code_util.
+:- import_module ll_backend__llds, parse_tree__prog_out, backend_libs__c_util.
+:- import_module hlds__error_util.
+:- import_module libs__options, libs__globals.
 :- import_module int, string, list, require, std_util.
 
 %-----------------------------------------------------------------------------%
Index: compiler/rtti_to_mlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti_to_mlds.m,v
retrieving revision 1.26
diff -u -d -r1.26 rtti_to_mlds.m
--- compiler/rtti_to_mlds.m	4 Mar 2002 07:31:36 -0000	1.26
+++ compiler/rtti_to_mlds.m	6 Mar 2002 00:53:51 -0000
@@ -14,9 +14,9 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module rtti_to_mlds.
+:- module ml_backend__rtti_to_mlds.
 :- interface.
-:- import_module hlds_module, rtti, mlds.
+:- import_module hlds__hlds_module, backend_libs__rtti, ml_backend__mlds.
 :- import_module list.
 
 	% return a list of MLDS definitions for the given rtti_data list.
@@ -30,9 +30,11 @@
 :- func mlds_rtti_type_name(rtti_name) = string.
 
 :- implementation.
-:- import_module foreign, prog_data, hlds_data.
-:- import_module pseudo_type_info, prog_util, prog_out, type_util.
-:- import_module ml_code_util, ml_unify_gen, ml_closure_gen.
+:- import_module backend_libs__foreign, parse_tree__prog_data, hlds__hlds_data.
+:- import_module backend_libs__pseudo_type_info, parse_tree__prog_util.
+:- import_module parse_tree__prog_out, check_hlds__type_util.
+:- import_module ml_backend__ml_code_util, ml_backend__ml_unify_gen.
+:- import_module ml_backend__ml_closure_gen.
 :- import_module bool, list, std_util, string, term, require.
 
 rtti_data_list_to_mlds(ModuleInfo, RttiDatas) =
Index: compiler/saved_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/saved_vars.m,v
retrieving revision 1.31
diff -u -d -r1.31 saved_vars.m
--- compiler/saved_vars.m	7 Apr 2001 14:04:57 -0000	1.31
+++ compiler/saved_vars.m	6 Mar 2002 00:53:51 -0000
@@ -21,11 +21,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module saved_vars.
+:- module ll_backend__saved_vars.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred.
+:- import_module hlds__hlds_module, hlds__hlds_pred.
 :- import_module io.
 
 :- pred saved_vars_proc(pred_id::in, proc_id::in,
@@ -39,8 +39,9 @@
 
 :- implementation.
 
-:- import_module hlds_goal, hlds_out, goal_util, quantification, passes_aux.
-:- import_module mode_util, prog_data, term, varset.
+:- import_module hlds__hlds_goal, hlds__hlds_out, hlds__goal_util.
+:- import_module hlds__quantification, hlds__passes_aux.
+:- import_module check_hlds__mode_util, parse_tree__prog_data, term, varset.
 :- import_module bool, list, set, map, std_util, require.
 
 %-----------------------------------------------------------------------------%
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.98
diff -u -d -r1.98 simplify.m
--- compiler/simplify.m	13 Sep 2001 23:18:14 -0000	1.98
+++ compiler/simplify.m	6 Mar 2002 00:53:51 -0000
@@ -24,12 +24,13 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module simplify.
+:- module check_hlds__simplify.
 
 :- interface.
 
-:- import_module hlds_goal, hlds_module, hlds_pred, det_report, det_util.
-:- import_module common, instmap, globals.
+:- import_module hlds__hlds_goal, hlds__hlds_module, hlds__hlds_pred.
+:- import_module check_hlds__det_report, check_hlds__det_util.
+:- import_module check_hlds__common, hlds__instmap, libs__globals.
 :- import_module io, bool, list, map.
 
 :- pred simplify__pred(list(simplification), pred_id, module_info, module_info,
@@ -73,11 +74,16 @@
 
 :- implementation.
 
-:- import_module code_aux, det_analysis, follow_code, goal_util, const_prop.
-:- import_module hlds_module, hlds_data, (inst), inst_match, varset.
-:- import_module options, passes_aux, prog_data, mode_util, type_util.
-:- import_module code_util, quantification, modes, purity, pd_cost.
-:- import_module prog_util, unify_proc, special_pred, polymorphism.
+:- import_module ll_backend__code_aux, check_hlds__det_analysis.
+:- import_module ll_backend__follow_code, hlds__goal_util, transform_hlds__const_prop.
+:- import_module hlds__hlds_module, hlds__hlds_data, (parse_tree__inst).
+:- import_module check_hlds__inst_match, varset.
+:- import_module libs__options, hlds__passes_aux, parse_tree__prog_data.
+:- import_module check_hlds__mode_util, check_hlds__type_util.
+:- import_module ll_backend__code_util, hlds__quantification.
+:- import_module check_hlds__modes, check_hlds__purity, transform_hlds__pd_cost.
+:- import_module parse_tree__prog_util, check_hlds__unify_proc.
+:- import_module hlds__special_pred, check_hlds__polymorphism.
 
 :- import_module set, require, std_util, int, term.
 
@@ -2100,7 +2106,7 @@
 	% exported for common.m
 :- interface.
 
-:- import_module prog_data.
+:- import_module parse_tree__prog_data.
 :- import_module set.
 
 :- pred simplify_info_init(det_info::in, list(simplification)::in, instmap::in,
Index: compiler/special_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/special_pred.m,v
retrieving revision 1.27
diff -u -d -r1.27 special_pred.m
--- compiler/special_pred.m	26 Feb 2002 02:45:53 -0000	1.27
+++ compiler/special_pred.m	6 Mar 2002 00:53:51 -0000
@@ -13,9 +13,10 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module special_pred.
+:- module hlds__special_pred.
 :- interface.
-:- import_module prog_data, hlds_data, hlds_module, hlds_pred.
+:- import_module parse_tree__prog_data, hlds__hlds_data, hlds__hlds_module.
+:- import_module hlds__hlds_pred.
 :- import_module list, map, std_util.
 
 :- type special_pred_map	==	map(special_pred, pred_id).
@@ -90,7 +91,8 @@
 
 :- implementation.
 
-:- import_module globals, options, type_util, mode_util, prog_util.
+:- import_module libs__globals, libs__options, check_hlds__type_util.
+:- import_module check_hlds__mode_util, parse_tree__prog_util.
 :- import_module bool.
 
 special_pred_list([unify, index, compare]).
Index: compiler/stack_layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stack_layout.m,v
retrieving revision 1.62
diff -u -d -r1.62 stack_layout.m
--- compiler/stack_layout.m	3 Mar 2002 13:43:50 -0000	1.62
+++ compiler/stack_layout.m	6 Mar 2002 00:53:51 -0000
@@ -25,11 +25,12 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module stack_layout.
+:- module ll_backend__stack_layout.
 
 :- interface.
 
-:- import_module prog_data, continuation_info, hlds_module, llds.
+:- import_module parse_tree__prog_data, ll_backend__continuation_info.
+:- import_module hlds__hlds_module, ll_backend__llds.
 :- import_module std_util, list, map, counter.
 
 :- pred stack_layout__generate_llds(module_info::in, module_info::out,
@@ -48,11 +49,14 @@
 
 :- implementation.
 
-:- import_module globals, options, llds_out, trace_params, trace.
-:- import_module hlds_data, hlds_goal, hlds_pred.
-:- import_module prog_util, prog_out, instmap.
-:- import_module prog_rep, static_term, layout_out.
-:- import_module rtti, layout, ll_pseudo_type_info, (inst), code_util.
+:- import_module libs__globals, libs__options, ll_backend__llds_out.
+:- import_module libs__trace_params, ll_backend__trace.
+:- import_module hlds__hlds_data, hlds__hlds_goal, hlds__hlds_pred.
+:- import_module parse_tree__prog_util, parse_tree__prog_out, hlds__instmap.
+:- import_module ll_backend__prog_rep, ll_backend__static_term.
+:- import_module ll_backend__layout_out.
+:- import_module backend_libs__rtti, ll_backend__layout.
+:- import_module ll_backend__ll_pseudo_type_info, (parse_tree__inst), ll_backend__code_util.
 :- import_module assoc_list, bool, string, int, require.
 :- import_module map, term, set, varset.
 
Index: compiler/static_term.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/static_term.m,v
retrieving revision 1.2
diff -u -d -r1.2 static_term.m
--- compiler/static_term.m	30 Jan 2002 05:08:47 -0000	1.2
+++ compiler/static_term.m	5 Mar 2002 23:53:20 -0000
@@ -13,11 +13,11 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module static_term.
+:- module ll_backend__static_term.
 
 :- interface.
 
-:- import_module llds.
+:- import_module ll_backend__llds.
 :- import_module counter, std_util.
 
 :- pred static_term__term_to_rval(univ::in, maybe(rval)::out,
@@ -27,7 +27,7 @@
 
 :- implementation.
 
-:- import_module builtin_ops.
+:- import_module backend_libs__builtin_ops.
 :- import_module deconstruct, list, require.
 
 static_term__term_to_rval(Univ, Rval, CellCounter0, CellCounter) :-
Index: compiler/store_alloc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/store_alloc.m,v
retrieving revision 1.77
diff -u -d -r1.77 store_alloc.m
--- compiler/store_alloc.m	7 Apr 2001 14:04:58 -0000	1.77
+++ compiler/store_alloc.m	6 Mar 2002 00:53:51 -0000
@@ -22,11 +22,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module store_alloc.
+:- module ll_backend__store_alloc.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred.
+:- import_module hlds__hlds_module, hlds__hlds_pred.
 
 :- pred store_alloc_in_proc(proc_info, pred_id, module_info, proc_info).
 :- mode store_alloc_in_proc(in, in, in, out) is det.
@@ -36,9 +36,11 @@
 
 :- implementation.
 
-:- import_module follow_vars, liveness, hlds_goal, llds, prog_data.
-:- import_module options, globals, trace_params, trace.
-:- import_module goal_util, mode_util, instmap.
+:- import_module ll_backend__follow_vars, ll_backend__liveness.
+:- import_module hlds__hlds_goal, ll_backend__llds, parse_tree__prog_data.
+:- import_module libs__options, libs__globals, libs__trace_params.
+:- import_module ll_backend__trace.
+:- import_module hlds__goal_util, check_hlds__mode_util, hlds__instmap.
 :- import_module list, map, set, std_util, assoc_list.
 :- import_module bool, int, require.
 
Index: compiler/stratify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stratify.m,v
retrieving revision 1.25
diff -u -d -r1.25 stratify.m
--- compiler/stratify.m	7 Apr 2001 14:04:59 -0000	1.25
+++ compiler/stratify.m	6 Mar 2002 00:53:51 -0000
@@ -29,11 +29,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module stratify.
+:- module check_hlds__stratify.
 
 :- interface.
 
-:- import_module hlds_module, io.
+:- import_module hlds__hlds_module, io.
 
 	% Perform stratification analysis, for the given module.
 	% If the "warn-non-stratification" option is set this 
@@ -46,9 +46,11 @@
 
 :- implementation.
 
-:- import_module dependency_graph, hlds_pred, hlds_goal, hlds_data.
-:- import_module hlds_module, type_util, mode_util, prog_data, passes_aux.
-:- import_module prog_out, globals, options.
+:- import_module transform_hlds__dependency_graph, hlds__hlds_pred.
+:- import_module hlds__hlds_goal, hlds__hlds_data.
+:- import_module hlds__hlds_module, check_hlds__type_util.
+:- import_module check_hlds__mode_util, parse_tree__prog_data, hlds__passes_aux.
+:- import_module parse_tree__prog_out, libs__globals, libs__options.
 
 :- import_module assoc_list, map, list, set, bool, std_util, relation, require.
 :- import_module string.
Index: compiler/string_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/string_switch.m,v
retrieving revision 1.37
diff -u -d -r1.37 string_switch.m
--- compiler/string_switch.m	8 Jul 2001 16:40:11 -0000	1.37
+++ compiler/string_switch.m	6 Mar 2002 00:53:51 -0000
@@ -13,13 +13,13 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module string_switch.
+:- module ll_backend__string_switch.
 
 :- interface.
 
-:- import_module prog_data, hlds_data, hlds_goal.
-:- import_module switch_util, code_model.
-:- import_module llds, code_info.
+:- import_module parse_tree__prog_data, hlds__hlds_data, hlds__hlds_goal.
+:- import_module backend_libs__switch_util, backend_libs__code_model.
+:- import_module ll_backend__llds, ll_backend__code_info.
 
 :- pred string_switch__generate(cases_list, prog_var, code_model,
 	can_fail, store_map, label, branch_end, branch_end, code_tree,
@@ -31,7 +31,8 @@
 
 :- implementation.
 
-:- import_module builtin_ops, code_gen, trace, tree.
+:- import_module backend_libs__builtin_ops, ll_backend__code_gen.
+:- import_module ll_backend__trace, libs__tree.
 :- import_module bool, int, string, list, map, std_util, assoc_list, require.
 
 string_switch__generate(Cases, Var, CodeModel, _CanFail, StoreMap,
Index: compiler/switch_detection.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/switch_detection.m,v
retrieving revision 1.96
diff -u -d -r1.96 switch_detection.m
--- compiler/switch_detection.m	7 Apr 2001 14:04:59 -0000	1.96
+++ compiler/switch_detection.m	6 Mar 2002 00:53:52 -0000
@@ -12,11 +12,12 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module switch_detection.
+:- module check_hlds__switch_detection.
 
 :- interface.
 
-:- import_module hlds_goal, hlds_module, hlds_pred, prog_data.
+:- import_module hlds__hlds_goal, hlds__hlds_module, hlds__hlds_pred.
+:- import_module parse_tree__prog_data.
 :- import_module bool, io, list.
 
 :- pred detect_switches(module_info::in, module_info::out,
@@ -47,9 +48,11 @@
 
 :- implementation.
 
-:- import_module hlds_goal, hlds_data, prog_data, instmap, inst_match.
-:- import_module modes, mode_util, type_util, det_util.
-:- import_module passes_aux, term.
+:- import_module hlds__hlds_goal, hlds__hlds_data, parse_tree__prog_data.
+:- import_module hlds__instmap, check_hlds__inst_match.
+:- import_module check_hlds__modes, check_hlds__mode_util.
+:- import_module check_hlds__type_util, check_hlds__det_util.
+:- import_module hlds__passes_aux, term.
 :- import_module char, int, assoc_list, map, set, std_util, require.
 
 %-----------------------------------------------------------------------------%
Index: compiler/switch_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/switch_gen.m,v
retrieving revision 1.76
diff -u -d -r1.76 switch_gen.m
--- compiler/switch_gen.m	24 Oct 2001 07:09:56 -0000	1.76
+++ compiler/switch_gen.m	6 Mar 2002 00:53:52 -0000
@@ -41,11 +41,12 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module switch_gen.
+:- module ll_backend__switch_gen.
 
 :- interface.
 
-:- import_module prog_data, hlds_goal, hlds_data, code_model, code_info, llds.
+:- import_module parse_tree__prog_data, hlds__hlds_goal, hlds__hlds_data.
+:- import_module backend_libs__code_model, ll_backend__code_info, ll_backend__llds.
 :- import_module list.
 
 :- pred switch_gen__generate_switch(code_model, prog_var, can_fail, list(case),
@@ -57,12 +58,14 @@
 
 :- implementation.
 
-:- import_module dense_switch, string_switch, tag_switch, lookup_switch.
-:- import_module code_gen, unify_gen, code_aux, code_util.
-:- import_module switch_util, type_util.
-:- import_module trace, globals, options.
+:- import_module ll_backend__dense_switch, ll_backend__string_switch.
+:- import_module ll_backend__tag_switch, ll_backend__lookup_switch.
+:- import_module ll_backend__code_gen, ll_backend__unify_gen.
+:- import_module ll_backend__code_aux, ll_backend__code_util.
+:- import_module backend_libs__switch_util, check_hlds__type_util.
+:- import_module ll_backend__trace, libs__globals, libs__options.
 
-:- import_module bool, int, string, map, tree, std_util, require.
+:- import_module bool, int, string, map, libs__tree, std_util, require.
 
 %---------------------------------------------------------------------------%
 
Index: compiler/switch_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/switch_util.m,v
retrieving revision 1.6
diff -u -d -r1.6 switch_util.m
--- compiler/switch_util.m	20 Feb 2002 03:14:21 -0000	1.6
+++ compiler/switch_util.m	6 Mar 2002 00:53:52 -0000
@@ -12,9 +12,10 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module switch_util.
+:- module backend_libs__switch_util.
 :- interface.
-:- import_module prog_data, hlds_goal, hlds_data, hlds_module, type_util.
+:- import_module parse_tree__prog_data, hlds__hlds_goal, hlds__hlds_data.
+:- import_module hlds__hlds_module, check_hlds__type_util.
 :- import_module list, assoc_list, map, std_util.
 
 %-----------------------------------------------------------------------------%
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.31
diff -u -d -r1.31 table_gen.m
--- compiler/table_gen.m	20 Feb 2002 03:14:21 -0000	1.31
+++ compiler/table_gen.m	6 Mar 2002 00:53:52 -0000
@@ -227,11 +227,11 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module table_gen.
+:- module transform_hlds__table_gen.
 
 :- interface.
 
-:- import_module hlds_module.
+:- import_module hlds__hlds_module.
 
 :- pred table_gen__process_module(module_info::in, module_info::out) is det.
 
@@ -239,13 +239,18 @@
 
 :- implementation.
 
-:- import_module hlds_out, prog_out.
-:- import_module hlds_pred, instmap, polymorphism.
-:- import_module code_aux, det_analysis, follow_code, goal_util, const_prop.
-:- import_module hlds_module, hlds_goal, hlds_data, (inst), inst_match.
-:- import_module globals, options, passes_aux, prog_data, mode_util, type_util.
-:- import_module code_util, quantification, modes, purity, prog_util.
-:- import_module code_model, continuation_info, rtti, llds.
+:- import_module hlds__hlds_out, parse_tree__prog_out.
+:- import_module hlds__hlds_pred, hlds__instmap, check_hlds__polymorphism.
+:- import_module ll_backend__code_aux, check_hlds__det_analysis.
+:- import_module ll_backend__follow_code, hlds__goal_util, transform_hlds__const_prop.
+:- import_module hlds__hlds_module, hlds__hlds_goal, hlds__hlds_data.
+:- import_module (parse_tree__inst), check_hlds__inst_match.
+:- import_module libs__globals, libs__options, hlds__passes_aux.
+:- import_module parse_tree__prog_data, check_hlds__mode_util, check_hlds__type_util.
+:- import_module ll_backend__code_util, hlds__quantification.
+:- import_module check_hlds__modes, check_hlds__purity, parse_tree__prog_util.
+:- import_module backend_libs__code_model, ll_backend__continuation_info.
+:- import_module backend_libs__rtti, ll_backend__llds.
 
 :- import_module term, varset.
 :- import_module bool, int, string, list, assoc_list.
Index: compiler/tag_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/tag_switch.m,v
retrieving revision 1.51
diff -u -d -r1.51 tag_switch.m
--- compiler/tag_switch.m	23 Nov 2000 04:32:48 -0000	1.51
+++ compiler/tag_switch.m	6 Mar 2002 00:53:52 -0000
@@ -10,13 +10,13 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module tag_switch.
+:- module ll_backend__tag_switch.
 
 :- interface.
 
-:- import_module prog_data, hlds_goal, hlds_data.
-:- import_module switch_util, code_model.
-:- import_module llds, code_info.
+:- import_module parse_tree__prog_data, hlds__hlds_goal, hlds__hlds_data.
+:- import_module backend_libs__switch_util, backend_libs__code_model.
+:- import_module ll_backend__llds, ll_backend__code_info.
 
 :- import_module list.
 
@@ -30,10 +30,12 @@
 
 :- implementation.
 
-:- import_module builtin_ops, hlds_module, hlds_pred, code_gen, trace.
-:- import_module options, globals, type_util, prog_data.
+:- import_module backend_libs__builtin_ops, hlds__hlds_module.
+:- import_module hlds__hlds_pred, ll_backend__code_gen, ll_backend__trace.
+:- import_module libs__options, libs__globals, check_hlds__type_util.
+:- import_module parse_tree__prog_data.
 
-:- import_module assoc_list, map, tree, bool, int, string.
+:- import_module assoc_list, map, libs__tree, bool, int, string.
 :- import_module require, std_util.
 
 %-----------------------------------------------------------------------------%
Index: compiler/term_errors.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/term_errors.m,v
retrieving revision 1.16
diff -u -d -r1.16 term_errors.m
--- compiler/term_errors.m	9 Aug 2000 07:47:55 -0000	1.16
+++ compiler/term_errors.m	6 Mar 2002 00:53:52 -0000
@@ -12,11 +12,11 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module term_errors.
+:- module transform_hlds__term_errors.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred, parse_tree__prog_data.
 
 :- import_module io, bag, std_util, list, assoc_list.
 
@@ -128,9 +128,11 @@
 
 :- implementation.
 
-:- import_module hlds_out, prog_out, passes_aux, error_util.
+:- import_module hlds__hlds_out, parse_tree__prog_out, hlds__passes_aux.
+:- import_module hlds__error_util.
 :- import_module term, varset.
-:- import_module mercury_to_mercury, term_util, options, globals.
+:- import_module parse_tree__mercury_to_mercury, transform_hlds__term_util.
+:- import_module libs__options, libs__globals.
 
 :- import_module bool, int, string, map, bag, require.
 
Index: compiler/term_pass1.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/term_pass1.m,v
retrieving revision 1.10
diff -u -d -r1.10 term_pass1.m
--- compiler/term_pass1.m	18 Mar 1999 01:31:33 -0000	1.10
+++ compiler/term_pass1.m	6 Mar 2002 00:53:52 -0000
@@ -20,11 +20,12 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module term_pass1.
+:- module transform_hlds__term_pass1.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, term_util, term_errors.
+:- import_module hlds__hlds_module, hlds__hlds_pred.
+:- import_module transform_hlds__term_util, transform_hlds__term_errors.
 :- import_module io, list, std_util.
 
 :- type arg_size_result
@@ -48,8 +49,10 @@
 
 :- implementation.
 
-:- import_module term_traversal, term_errors, hlds_goal, hlds_data, prog_data.
-:- import_module mode_util, type_util, lp.
+:- import_module transform_hlds__term_traversal, transform_hlds__term_errors.
+:- import_module hlds__hlds_goal, hlds__hlds_data, parse_tree__prog_data.
+:- import_module check_hlds__mode_util, check_hlds__type_util.
+:- import_module transform_hlds__lp.
 
 :- import_module int, float, char, string, bool, set, bag, map.
 :- import_module term, varset, require.
Index: compiler/term_pass2.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/term_pass2.m,v
retrieving revision 1.8
diff -u -d -r1.8 term_pass2.m
--- compiler/term_pass2.m	20 Nov 1998 04:09:23 -0000	1.8
+++ compiler/term_pass2.m	6 Mar 2002 00:53:52 -0000
@@ -14,10 +14,10 @@
 % For details, please refer to the papers mentioned in termination.m.
 %-----------------------------------------------------------------------------
 
-:- module term_pass2.
+:- module transform_hlds__term_pass2.
 :- interface.
 
-:- import_module hlds_module, hlds_pred, term_util.
+:- import_module hlds__hlds_module, hlds__hlds_pred, transform_hlds__term_util.
 :- import_module list.
 
 :- pred prove_termination_in_scc(list(pred_proc_id)::in, module_info::in,
@@ -25,8 +25,9 @@
 
 :- implementation.
 
-:- import_module term_traversal, term_errors.
-:- import_module hlds_goal, prog_data, type_util, mode_util.
+:- import_module transform_hlds__term_traversal, transform_hlds__term_errors.
+:- import_module hlds__hlds_goal, parse_tree__prog_data.
+:- import_module check_hlds__type_util, check_hlds__mode_util.
 
 :- import_module std_util, bool, int, assoc_list.
 :- import_module set, bag, map, term, require.
Index: compiler/term_traversal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/term_traversal.m,v
retrieving revision 1.17
diff -u -d -r1.17 term_traversal.m
--- compiler/term_traversal.m	7 Apr 2001 14:04:59 -0000	1.17
+++ compiler/term_traversal.m	6 Mar 2002 00:53:52 -0000
@@ -16,12 +16,13 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module term_traversal.
+:- module transform_hlds__term_traversal.
 
 :- interface.
 
-:- import_module term_util, term_errors.
-:- import_module hlds_module, hlds_pred, hlds_goal, prog_data.
+:- import_module transform_hlds__term_util, transform_hlds__term_errors.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_goal.
+:- import_module parse_tree__prog_data.
 :- import_module list, bag, map, std_util, set.
 
 :- type traversal_info
@@ -96,7 +97,7 @@
 
 :- implementation.
 
-:- import_module hlds_data, type_util.
+:- import_module hlds__hlds_data, check_hlds__type_util.
 :- import_module bool, int, require.
 
 traverse_goal(Goal, Params, Info0, Info) :-
Index: compiler/term_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/term_util.m,v
retrieving revision 1.17
diff -u -d -r1.17 term_util.m
--- compiler/term_util.m	26 Feb 2002 02:45:53 -0000	1.17
+++ compiler/term_util.m	6 Mar 2002 00:53:52 -0000
@@ -15,12 +15,13 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module term_util.
+:- module transform_hlds__term_util.
 
 :- interface.
 
-:- import_module term_errors, prog_data.
-:- import_module hlds_module, hlds_pred, hlds_data, hlds_goal.
+:- import_module transform_hlds__term_errors, parse_tree__prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_data.
+:- import_module hlds__hlds_goal.
 
 :- import_module std_util, bool, int, list, map, bag.
 
@@ -207,8 +208,9 @@
 
 :- implementation.
 
-:- import_module inst_match, prog_out, mode_util, type_util.
-:- import_module globals, options.
+:- import_module check_hlds__inst_match, parse_tree__prog_out.
+:- import_module check_hlds__mode_util, check_hlds__type_util.
+:- import_module libs__globals, libs__options.
 
 :- import_module assoc_list, require.
 
Index: compiler/termination.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/termination.m,v
retrieving revision 1.23
diff -u -d -r1.23 termination.m
--- compiler/termination.m	5 Mar 2001 10:31:05 -0000	1.23
+++ compiler/termination.m	6 Mar 2002 00:53:52 -0000
@@ -43,12 +43,13 @@
 % 			
 %----------------------------------------------------------------------------%
 
-:- module termination.
+:- module transform_hlds__termination.
 
 :- interface.
 
 :- import_module io, bool, std_util, list.
-:- import_module prog_data, hlds_module, hlds_pred, term_util.
+:- import_module parse_tree__prog_data, hlds__hlds_module, hlds__hlds_pred.
+:- import_module transform_hlds__term_util.
 
 	% Perform termination analysis on the module.
 
@@ -84,12 +85,17 @@
 
 :- implementation.
 
-:- import_module term_pass1, term_pass2, term_errors.
-:- import_module inst_match, passes_aux, options, globals.
-:- import_module hlds_data, hlds_goal, dependency_graph, varset.
-:- import_module mode_util, hlds_out, code_util, prog_out, prog_util.
-:- import_module mercury_to_mercury, type_util, special_pred.
-:- import_module modules.
+:- import_module transform_hlds__term_pass1, transform_hlds__term_pass2.
+:- import_module transform_hlds__term_errors.
+:- import_module check_hlds__inst_match, hlds__passes_aux, libs__options.
+:- import_module libs__globals.
+:- import_module hlds__hlds_data, hlds__hlds_goal.
+:- import_module transform_hlds__dependency_graph, varset.
+:- import_module check_hlds__mode_util, hlds__hlds_out, ll_backend__code_util.
+:- import_module parse_tree__prog_out, parse_tree__prog_util.
+:- import_module parse_tree__mercury_to_mercury, check_hlds__type_util.
+:- import_module hlds__special_pred.
+:- import_module parse_tree__modules.
 
 :- import_module map, int, char, string, relation.
 :- import_module require, bag, set, term.
Index: compiler/timestamp.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/timestamp.m,v
retrieving revision 1.3
diff -u -d -r1.3 timestamp.m
--- compiler/timestamp.m	20 Jan 2002 07:32:16 -0000	1.3
+++ compiler/timestamp.m	5 Mar 2002 23:53:20 -0000
@@ -8,7 +8,7 @@
 %
 % Timestamp representation for smart recompilation.
 %-----------------------------------------------------------------------------%
-:- module timestamp.
+:- module hlds__timestamp.
 
 :- interface.
 
Index: compiler/top_level.m
===================================================================
RCS file: compiler/top_level.m
diff -N compiler/top_level.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ compiler/top_level.m	6 Mar 2002 00:21:56 -0000
@@ -0,0 +1,22 @@
+%-----------------------------------------------------------------------------%
+
+:- module top_level.
+:- interface.
+
+% the front-ends
+:- import_module parse_tree, hlds, check_hlds, transform_hlds.
+
+% back-ends that we currently use or plan to use
+:- import_module aditi_backend, ll_backend, ml_backend.
+
+% obsolete or incomplete back-ends
+:- import_module bytecode_backend.
+
+% misc utilities
+:- import_module libs, backend_libs.
+
+:- include_module mercury_compile.
+
+:- end_module top_level.
+
+%-----------------------------------------------------------------------------%
Index: compiler/trace.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trace.m,v
retrieving revision 1.49
diff -u -d -r1.49 trace.m
--- compiler/trace.m	18 Feb 2002 07:00:58 -0000	1.49
+++ compiler/trace.m	6 Mar 2002 00:53:52 -0000
@@ -42,12 +42,13 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module trace.
+:- module ll_backend__trace.
 
 :- interface.
 
-:- import_module hlds_goal, hlds_pred, hlds_module.
-:- import_module globals, prog_data, llds, code_info.
+:- import_module hlds__hlds_goal, hlds__hlds_pred, hlds__hlds_module.
+:- import_module libs__globals, parse_tree__prog_data, ll_backend__llds.
+:- import_module ll_backend__code_info.
 :- import_module map, std_util, set.
 
 	% The kinds of external ports for which the code we generate will
@@ -218,9 +219,12 @@
 
 :- implementation.
 
-:- import_module continuation_info, trace_params, llds_out, layout_out, tree.
-:- import_module type_util, (inst), instmap, inst_match, mode_util.
-:- import_module code_model, code_util, options.
+:- import_module ll_backend__continuation_info, libs__trace_params.
+:- import_module ll_backend__llds_out, ll_backend__layout_out, libs__tree.
+:- import_module check_hlds__type_util, (parse_tree__inst), hlds__instmap.
+:- import_module check_hlds__inst_match, check_hlds__mode_util.
+:- import_module backend_libs__code_model, ll_backend__code_util.
+:- import_module libs__options.
 
 :- import_module list, bool, int, string, map, std_util, require, term, varset.
 
Index: compiler/trace_params.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trace_params.m,v
retrieving revision 1.5
diff -u -d -r1.5 trace_params.m
--- compiler/trace_params.m	18 Jan 2001 01:18:58 -0000	1.5
+++ compiler/trace_params.m	5 Mar 2002 23:53:20 -0000
@@ -13,11 +13,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module trace_params.
+:- module libs__trace_params.
 
 :- interface.
 
-:- import_module llds.
+:- import_module ll_backend__llds. % XXX for trace_port
 :- import_module bool.
 
 :- type trace_level.
Index: compiler/trans_opt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trans_opt.m,v
retrieving revision 1.16
diff -u -d -r1.16 trans_opt.m
--- compiler/trans_opt.m	16 Jul 2001 08:21:05 -0000	1.16
+++ compiler/trans_opt.m	6 Mar 2002 00:53:52 -0000
@@ -45,14 +45,14 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module trans_opt.
+:- module transform_hlds__trans_opt.
 
 %-----------------------------------------------------------------------------%
 
 :- interface.
 
 :- import_module io, bool, list.
-:- import_module hlds_module, modules, prog_data.
+:- import_module hlds__hlds_module, parse_tree__modules, parse_tree__prog_data.
 
 :- pred trans_opt__write_optfile(module_info, io__state, io__state).
 :- mode trans_opt__write_optfile(in, di, uo) is det.
@@ -70,9 +70,11 @@
 
 :- implementation.
 
-:- import_module intermod, hlds_pred, mercury_to_mercury.
-:- import_module prog_io, globals, code_util.
-:- import_module passes_aux, prog_out, options, termination.
+:- import_module transform_hlds__intermod, hlds__hlds_pred.
+:- import_module parse_tree__mercury_to_mercury.
+:- import_module parse_tree__prog_io, libs__globals, ll_backend__code_util.
+:- import_module hlds__passes_aux, parse_tree__prog_out, libs__options.
+:- import_module transform_hlds__termination.
 
 :- import_module set, string, list, map, varset, term, std_util.
 
Index: compiler/transform.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/transform.m,v
retrieving revision 1.14
diff -u -d -r1.14 transform.m
--- compiler/transform.m	3 Mar 1998 17:36:21 -0000	1.14
+++ compiler/transform.m	6 Mar 2002 00:53:52 -0000
@@ -28,9 +28,9 @@
 % your transformer upset the ordering in a conjunction.
 %-----------------------------------------------------------------------------%
 
-:- module transform.
+:- module transform_hlds__transform.
 :- interface.
-:- import_module hlds_goal, mode_info.
+:- import_module hlds__hlds_goal, check_hlds__mode_info.
 :- import_module list.
 
 %:- pred unfold__in_proc(pred_id, proc_id, hlds_goal_expr,
@@ -46,8 +46,9 @@
 
 :- implementation.
 :- import_module map, set, std_util.
-:- import_module mode_util, delay_info, term, require.
-:- import_module varset, code_aux, prog_data, instmap.
+:- import_module check_hlds__mode_util, check_hlds__delay_info, term, require.
+:- import_module varset, ll_backend__code_aux, parse_tree__prog_data.
+:- import_module hlds__instmap.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/transform_hlds.m
===================================================================
RCS file: compiler/transform_hlds.m
diff -N compiler/transform_hlds.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ compiler/transform_hlds.m	6 Mar 2002 00:07:35 -0000
@@ -0,0 +1,55 @@
+%-----------------------------------------------------------------------------%
+%          
+% Phase 4: High-level transformations
+%	that are independent of the choice of back-end
+%	(the "middle" HLDS pass).
+%  
+
+:- module transform_hlds.
+:- interface.
+:- import_module check_hlds. % is this needed?
+:- import_module hlds, parse_tree, libs.
+
+%-----------------------------------------------------------------------------%
+
+:- include_module intermod, trans_opt.
+
+:- include_module dependency_graph.	% XXX imports llds (for profiling labels)
+
+:- include_module table_gen.
+
+:- include_module (lambda).
+
+:- include_module termination.
+   :- include_module term_pass1, term_pass2, term_traversal, term_errors.
+   :- include_module term_util.
+   :- include_module lp. % this could alternatively go in the `libs' module
+
+% Optimizations (HLDS -> HLDS)
+:- include_module higher_order.
+:- include_module inlining.
+:- include_module deforest.
+   :- include_module pd_cost, pd_debug, pd_info, pd_term.
+   :- include_module pd_util.
+:- include_module delay_construct.
+:- include_module unused_args.
+:- include_module unneeded_code.
+:- include_module accumulator.
+   :- include_module goal_store.
+:- include_module dead_proc_elim.
+:- include_module const_prop.
+
+% XXX The following modules are all currently unused.
+:- include_module constraint, transform.
+:- include_module excess.
+:- include_module lco.
+
+%-----------------------------------------------------------------------------%
+
+:- implementation.
+:- import_module ll_backend. % XXX for code_util, code_aux
+:- import_module backend_libs. % XXX for rtti
+
+:- end_module transform_hlds.
+
+%-----------------------------------------------------------------------------%
Index: compiler/transform_llds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/transform_llds.m,v
retrieving revision 1.8
diff -u -d -r1.8 transform_llds.m
--- compiler/transform_llds.m	8 Feb 2001 11:37:48 -0000	1.8
+++ compiler/transform_llds.m	6 Mar 2002 00:53:52 -0000
@@ -18,11 +18,11 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module transform_llds.
+:- module ll_backend__transform_llds.
 
 :- interface.
 
-:- import_module llds, io.
+:- import_module ll_backend__llds, io.
 
 :- pred transform_llds(c_file, c_file, io__state, io__state).
 :- mode transform_llds(in, out, di, uo) is det.
@@ -31,7 +31,8 @@
 
 :- implementation.
 
-:- import_module builtin_ops, globals, options, opt_util, prog_data.
+:- import_module backend_libs__builtin_ops, libs__globals, libs__options.
+:- import_module ll_backend__opt_util, parse_tree__prog_data.
 :- import_module bool, int, list, require, std_util, counter.
 
 transform_llds(LLDS0, LLDS) -->
Index: compiler/tree.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/tree.m,v
retrieving revision 1.14
diff -u -d -r1.14 tree.m
--- compiler/tree.m	13 Jul 2001 14:21:22 -0000	1.14
+++ compiler/tree.m	5 Mar 2002 23:53:20 -0000
@@ -13,7 +13,7 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module tree.
+:- module libs__tree.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/type_ctor_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/type_ctor_info.m,v
retrieving revision 1.21
diff -u -d -r1.21 type_ctor_info.m
--- compiler/type_ctor_info.m	26 Feb 2002 02:45:54 -0000	1.21
+++ compiler/type_ctor_info.m	6 Mar 2002 00:53:52 -0000
@@ -31,11 +31,11 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module type_ctor_info.
+:- module backend_libs__type_ctor_info.
 
 :- interface.
 
-:- import_module hlds_module, rtti.
+:- import_module hlds__hlds_module, backend_libs__rtti.
 :- import_module list.
 
 :- pred type_ctor_info__generate_hlds(module_info::in, module_info::out)
@@ -46,11 +46,13 @@
 
 :- implementation.
 
-:- import_module rtti, pseudo_type_info.
-:- import_module hlds_data, hlds_pred, hlds_out.
-:- import_module make_tags, prog_data, prog_util, prog_out.
-:- import_module code_util, special_pred, type_util, globals, options.
-:- import_module builtin_ops, error_util.
+:- import_module backend_libs__rtti, backend_libs__pseudo_type_info.
+:- import_module hlds__hlds_data, hlds__hlds_pred, hlds__hlds_out.
+:- import_module hlds__make_tags, parse_tree__prog_data.
+:- import_module parse_tree__prog_util, parse_tree__prog_out.
+:- import_module ll_backend__code_util, hlds__special_pred.
+:- import_module check_hlds__type_util, libs__globals, libs__options.
+:- import_module backend_libs__builtin_ops, hlds__error_util.
 
 :- import_module bool, string, int, map, std_util, assoc_list, require.
 :- import_module term.
Index: compiler/type_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/type_util.m,v
retrieving revision 1.105
diff -u -d -r1.105 type_util.m
--- compiler/type_util.m	5 Mar 2002 10:59:23 -0000	1.105
+++ compiler/type_util.m	6 Mar 2002 00:53:52 -0000
@@ -14,11 +14,12 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module type_util.
+:- module check_hlds__type_util.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, hlds_data, prog_data, globals.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_data.
+:- import_module parse_tree__prog_data, libs__globals.
 :- import_module term.
 :- import_module std_util, list, map.
 
@@ -485,7 +486,8 @@
 
 :- implementation.
 
-:- import_module prog_io, prog_io_goal, prog_util, options, globals.
+:- import_module parse_tree__prog_io, parse_tree__prog_io_goal.
+:- import_module parse_tree__prog_util, libs__options, libs__globals.
 :- import_module bool, char, int, string.
 :- import_module assoc_list, require, varset.
 
Index: compiler/typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.311
diff -u -d -r1.311 typecheck.m
--- compiler/typecheck.m	22 Feb 2002 01:20:55 -0000	1.311
+++ compiler/typecheck.m	6 Mar 2002 00:53:52 -0000
@@ -98,11 +98,12 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- module typecheck.
+:- module check_hlds__typecheck.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred, hlds_data, prog_data.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_data.
+:- import_module parse_tree__prog_data.
 :- import_module bool, io, list, map.
 
 	% typecheck(Module0, Module, FoundError,
@@ -152,10 +153,14 @@
 
 :- implementation.
 
-:- import_module hlds_goal, prog_util, type_util, modules, code_util.
-:- import_module prog_io, prog_io_util, prog_out, hlds_out, error_util.
-:- import_module mercury_to_mercury, mode_util, options, getopt, globals.
-:- import_module passes_aux, clause_to_proc, special_pred, inst_match.
+:- import_module hlds__hlds_goal, parse_tree__prog_util.
+:- import_module check_hlds__type_util, parse_tree__modules, ll_backend__code_util.
+:- import_module parse_tree__prog_io, parse_tree__prog_io_util.
+:- import_module parse_tree__prog_out, hlds__hlds_out, hlds__error_util.
+:- import_module parse_tree__mercury_to_mercury, check_hlds__mode_util.
+:- import_module libs__options, getopt, libs__globals.
+:- import_module hlds__passes_aux, check_hlds__clause_to_proc.
+:- import_module hlds__special_pred, check_hlds__inst_match.
 
 :- import_module int, set, string, require, multi_map.
 :- import_module assoc_list, std_util, term, varset, term_io.
Index: compiler/unify_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unify_gen.m,v
retrieving revision 1.118
diff -u -d -r1.118 unify_gen.m
--- compiler/unify_gen.m	20 Feb 2002 03:14:22 -0000	1.118
+++ compiler/unify_gen.m	6 Mar 2002 00:53:52 -0000
@@ -14,14 +14,14 @@
 %
 %---------------------------------------------------------------------------%
 
-:- module unify_gen.
+:- module ll_backend__unify_gen.
 
 :- interface.
 
-:- import_module prog_data.
-:- import_module hlds_goal, hlds_data.
-:- import_module code_model.
-:- import_module llds, code_info.
+:- import_module parse_tree__prog_data.
+:- import_module hlds__hlds_goal, hlds__hlds_data.
+:- import_module backend_libs__code_model.
+:- import_module ll_backend__llds, ll_backend__code_info.
 
 :- type test_sense
 	--->	branch_on_success
@@ -38,11 +38,15 @@
 
 :- implementation.
 
-:- import_module rtti, layout, builtin_ops.
-:- import_module hlds_module, hlds_pred, prog_data, prog_out, code_util.
-:- import_module mode_util, type_util, code_aux, hlds_out, tree, arg_info.
-:- import_module globals, options, continuation_info, stack_layout.
-:- import_module rl, trace, error_util.
+:- import_module backend_libs__rtti, ll_backend__layout.
+:- import_module backend_libs__builtin_ops.
+:- import_module hlds__hlds_module, hlds__hlds_pred, parse_tree__prog_data.
+:- import_module parse_tree__prog_out, ll_backend__code_util.
+:- import_module check_hlds__mode_util, check_hlds__type_util.
+:- import_module ll_backend__code_aux, hlds__hlds_out, libs__tree, ll_backend__arg_info.
+:- import_module libs__globals, libs__options, ll_backend__continuation_info.
+:- import_module ll_backend__stack_layout.
+:- import_module aditi_backend__rl, ll_backend__trace, hlds__error_util.
 
 :- import_module term, bool, string, int, list, map, require, std_util.
 
Index: compiler/unify_proc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unify_proc.m,v
retrieving revision 1.104
diff -u -d -r1.104 unify_proc.m
--- compiler/unify_proc.m	26 Feb 2002 02:45:54 -0000	1.104
+++ compiler/unify_proc.m	6 Mar 2002 00:53:52 -0000
@@ -43,11 +43,13 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module unify_proc.
+:- module check_hlds__unify_proc.
 
 :- interface.
-:- import_module hlds_module, hlds_pred, hlds_goal, hlds_data.
-:- import_module mode_info, prog_data, special_pred.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_goal.
+:- import_module hlds__hlds_data.
+:- import_module check_hlds__mode_info, parse_tree__prog_data.
+:- import_module hlds__special_pred.
 :- import_module bool, std_util, io, list.
 
 :- type proc_requests.
@@ -122,17 +124,22 @@
 
 :- implementation.
 
-:- import_module globals, options.
-:- import_module code_util, code_info, type_util.
-:- import_module mercury_to_mercury, hlds_out.
-:- import_module make_hlds, polymorphism, post_typecheck, prog_util, prog_out.
-:- import_module quantification, clause_to_proc, term, varset.
-:- import_module modes, mode_util, inst_match, instmap, (inst).
-:- import_module switch_detection, cse_detection, det_analysis, unique_modes.
-:- import_module recompilation.
-:- import_module goal_util.
+:- import_module libs__globals, libs__options.
+:- import_module ll_backend__code_util, ll_backend__code_info.
+:- import_module check_hlds__type_util.
+:- import_module parse_tree__mercury_to_mercury, hlds__hlds_out.
+:- import_module hlds__make_hlds, check_hlds__polymorphism.
+:- import_module check_hlds__post_typecheck, parse_tree__prog_util, parse_tree__prog_out.
+:- import_module hlds__quantification, check_hlds__clause_to_proc, term.
+:- import_module varset.
+:- import_module check_hlds__modes, check_hlds__mode_util.
+:- import_module check_hlds__inst_match, hlds__instmap, (parse_tree__inst).
+:- import_module check_hlds__switch_detection, check_hlds__cse_detection.
+:- import_module check_hlds__det_analysis, check_hlds__unique_modes.
+:- import_module hlds__recompilation.
+:- import_module hlds__goal_util.
 
-:- import_module tree, map, set, queue, int, string, require, assoc_list.
+:- import_module libs__tree, map, set, queue, int, string, require, assoc_list.
 
 	% We keep track of all the complicated unification procs we need
 	% by storing them in the proc_requests structure.
Index: compiler/unique_modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unique_modes.m,v
retrieving revision 1.72
diff -u -d -r1.72 unique_modes.m
--- compiler/unique_modes.m	7 Apr 2001 14:05:02 -0000	1.72
+++ compiler/unique_modes.m	6 Mar 2002 00:53:52 -0000
@@ -33,9 +33,10 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module unique_modes.
+:- module check_hlds__unique_modes.
 :- interface. 
-:- import_module hlds_module, hlds_pred, hlds_goal, mode_info.
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_goal.
+:- import_module check_hlds__mode_info.
 :- import_module io, bool.
 
 	% check every predicate in a module
@@ -57,10 +58,14 @@
 
 :- implementation.
 
-:- import_module hlds_data, mode_debug, modecheck_unify, modecheck_call.
-:- import_module mode_util, prog_out, hlds_out, mercury_to_mercury, passes_aux.
-:- import_module modes, prog_data, mode_errors, llds, unify_proc.
-:- import_module (inst), instmap, inst_match, inst_util.
+:- import_module hlds__hlds_data, check_hlds__mode_debug.
+:- import_module check_hlds__modecheck_unify, check_hlds__modecheck_call.
+:- import_module check_hlds__mode_util, parse_tree__prog_out, hlds__hlds_out.
+:- import_module parse_tree__mercury_to_mercury, hlds__passes_aux.
+:- import_module check_hlds__modes, parse_tree__prog_data.
+:- import_module check_hlds__mode_errors, ll_backend__llds, check_hlds__unify_proc.
+:- import_module (parse_tree__inst), hlds__instmap, check_hlds__inst_match.
+:- import_module check_hlds__inst_util.
 :- import_module term, varset.
 :- import_module assoc_list, bag, int, list, map.
 :- import_module require, set, std_util, string.
Index: compiler/unneeded_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unneeded_code.m,v
retrieving revision 1.9
diff -u -d -r1.9 unneeded_code.m
--- compiler/unneeded_code.m	7 Apr 2001 14:05:03 -0000	1.9
+++ compiler/unneeded_code.m	6 Mar 2002 00:53:52 -0000
@@ -53,11 +53,11 @@
 %
 %-----------------------------------------------------------------------------%
 
-:- module unneeded_code.
+:- module transform_hlds__unneeded_code.
 
 :- interface.
 
-:- import_module hlds_module, hlds_pred.
+:- import_module hlds__hlds_module, hlds__hlds_pred.
 :- import_module io.
 
 :- pred unneeded_code__process_proc_msg(pred_id::in, proc_id::in,
@@ -69,10 +69,12 @@
 
 :- implementation.
 
-:- import_module prog_data, hlds_goal, prog_data.
-:- import_module inst_match, instmap, mode_util.
-:- import_module passes_aux, hlds_out, globals, options.
-:- import_module code_aux, goal_path, quantification.
+:- import_module parse_tree__prog_data, hlds__hlds_goal, parse_tree__prog_data.
+:- import_module check_hlds__inst_match, hlds__instmap, check_hlds__mode_util.
+:- import_module hlds__passes_aux, hlds__hlds_out, libs__globals.
+:- import_module libs__options.
+:- import_module ll_backend__code_aux, check_hlds__goal_path.
+:- import_module hlds__quantification.
 :- import_module std_util, bool, int, list, assoc_list, map, set, require.
 
 	% The branch_alts and branch_point types record the information the
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.74
diff -u -d -r1.74 unused_args.m
--- compiler/unused_args.m	12 Feb 2002 15:47:56 -0000	1.74
+++ compiler/unused_args.m	6 Mar 2002 00:53:52 -0000
@@ -38,12 +38,12 @@
 %  The predicates are then fixed up. Unused variables and unifications are
 %	removed.
 
-:- module unused_args.
+:- module transform_hlds__unused_args.
 
 %-------------------------------------------------------------------------------
 :- interface.
 
-:- import_module hlds_module.
+:- import_module hlds__hlds_module.
 :- import_module io.
 
 :- pred unused_args__process_module(module_info::in, module_info::out,
@@ -52,10 +52,14 @@
 %-------------------------------------------------------------------------------
 :- implementation.
 
-:- import_module hlds_pred, hlds_goal, hlds_data, hlds_out, type_util, instmap.
-:- import_module code_util, globals, make_hlds, mercury_to_mercury, mode_util.
-:- import_module options, prog_data, prog_out, quantification, special_pred.
-:- import_module passes_aux, inst_match, modules, polymorphism, goal_util.
+:- import_module hlds__hlds_pred, hlds__hlds_goal, hlds__hlds_data.
+:- import_module hlds__hlds_out, check_hlds__type_util, hlds__instmap.
+:- import_module ll_backend__code_util, libs__globals, hlds__make_hlds.
+:- import_module parse_tree__mercury_to_mercury, check_hlds__mode_util.
+:- import_module libs__options, parse_tree__prog_data, parse_tree__prog_out.
+:- import_module hlds__quantification, hlds__special_pred.
+:- import_module hlds__passes_aux, check_hlds__inst_match.
+:- import_module parse_tree__modules, check_hlds__polymorphism, hlds__goal_util.
 
 :- import_module assoc_list, bool, char, int, list, map, require.
 :- import_module set, std_util, string.
Index: compiler/use_local_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/use_local_vars.m,v
retrieving revision 1.1
diff -u -d -r1.1 use_local_vars.m
--- compiler/use_local_vars.m	24 Apr 2001 03:59:03 -0000	1.1
+++ compiler/use_local_vars.m	6 Mar 2002 00:53:52 -0000
@@ -48,11 +48,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module use_local_vars.
+:- module ll_backend__use_local_vars.
 
 :- interface.
 
-:- import_module llds.
+:- import_module ll_backend__llds.
 :- import_module list, counter.
 
 :- pred use_local_vars__main(list(instruction)::in, list(instruction)::out,
@@ -60,7 +60,8 @@
 
 :- implementation.
 
-:- import_module basic_block, livemap, exprn_aux, opt_util.
+:- import_module ll_backend__basic_block, ll_backend__livemap.
+:- import_module ll_backend__exprn_aux, ll_backend__opt_util.
 :- import_module int, set, map, counter, std_util, require.
 
 %-----------------------------------------------------------------------------%
Index: compiler/var_locn.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/var_locn.m,v
retrieving revision 1.4
diff -u -d -r1.4 var_locn.m
--- compiler/var_locn.m	6 Mar 2001 05:51:25 -0000	1.4
+++ compiler/var_locn.m	6 Mar 2002 00:53:52 -0000
@@ -15,11 +15,12 @@
 
 %----------------------------------------------------------------------------%
 
-:- module var_locn.
+:- module ll_backend__var_locn.
 
 :- interface.
 
-:- import_module prog_data, hlds_goal, llds, options.
+:- import_module parse_tree__prog_data, hlds__hlds_goal, ll_backend__llds.
+:- import_module libs__options.
 :- import_module bool, map, set, list, assoc_list, std_util.
 
 :- type var_locn_info.
@@ -317,7 +318,8 @@
 
 :- implementation.
 
-:- import_module code_util, exprn_aux, options, tree.
+:- import_module ll_backend__code_util, ll_backend__exprn_aux, libs__options.
+:- import_module libs__tree.
 :- import_module getopt, int, string, bag, require, varset, term.
 
 :- type dead_or_alive	--->	dead ; alive.
Index: compiler/wrap_blocks.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/wrap_blocks.m,v
retrieving revision 1.3
diff -u -d -r1.3 wrap_blocks.m
--- compiler/wrap_blocks.m	9 Jul 2001 12:21:55 -0000	1.3
+++ compiler/wrap_blocks.m	5 Mar 2002 23:53:20 -0000
@@ -17,11 +17,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- module wrap_blocks.
+:- module ll_backend__wrap_blocks.
 
 :- interface.
 
-:- import_module llds.
+:- import_module ll_backend__llds.
 :- import_module list.
 
 :- pred wrap_blocks(list(instruction)::in, list(instruction)::out)
@@ -29,7 +29,7 @@
 
 :- implementation.
 
-:- import_module opt_util.
+:- import_module ll_backend__opt_util.
 :- import_module bool, int, std_util, require.
 
 wrap_blocks(Instrs0, Instrs) :-
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list