Move some declarations around and make some other minor changes in order

Estimated hours taken: 4

Move some declarations around and make some other minor changes in order
to reduce the number and complexity of the intermodule dependencies.
In particular, ensure that prog_data.m does not need to import
hlds*.m, purity.m, rl.m, or term_util.m.

Since we expect to have only one input language, but potentially many
different target languages, the general design principle that we have adopted
in order to minimize the number of dependencies, particularly cyclic ones,
is that modules which belong to an earlier stage of compilation should
not depend on modules which belong to a later stage of compilation.
However, that design principle has not been adhered to in many cases.
This change reduces the number of such cases.

compiler/prog_data.m:
compiler/hlds_pred.m:
	Move definition of the types `eval_method' and `pred_or_func'
	from hlds_pred.m to prog_data.m.
	Add new type `mode_num' to prog_data.m, defined by
	`type mode_num == int', and change the proc_id argument of
	the `unused_args' pragma to instead use this type instead of proc_id.
	Delete the import of module hlds_pred from prog_data.m.

compiler/prog_data.m:
compiler/hlds_data.m:
	Move the definition of the type `determinism' from hlds_data.m to
	prog_data.m.  Delete the import of module hlds_data from prog_data.m.

compiler/prog_data.m:
compiler/purity.m:
	Move the definition of the type `purity' from purity.m to prog_data.m.
	Add import of module prog_data to purity.m.
	Delete the import of module purity from prog_data.m.

	This is needed because purity.m imports hlds*.m and so by
	importing purity.m, prog_data.m was indirectly importing hlds*.m.

	(An possible alternative here would be to split purity.m into two
	parts, called say purity.m and check_purity.m; of these, only the
	second would import hlds*.m.  But that would be a significantly
	more complicated change.)

compiler/prog_data.m:
compiler/rl.m:
	Move the definition of the `index_spec' and `index_type' types from
	rl.m to prog_data.m.  Delete the import of module rl from prog_data.m.

compiler/prog_data.m:
	Add new types `pragma_arg_size_info' and `pragma_termination_info'
	to prog_data.m.  These are similar to the existing types
	`arg_size_info' and `termination_info' defined in term_util.m,
	except that they correspond more directly to what is actually
	used in `pragma termination_info' declarations.

compiler/term_util.m:
	Add new predicates `add_context_to_arg_size_info' and
	`add_context_to_pragma_termination_info' for converting
	the prog_data types to their corresponding term_util types.

compiler/make_hlds.m:
compiler/mercury_to_mercury.m:
compiler/prog_io_pragma.m:
compiler/unused_args.m:
	Minor modifications to handle the change in the type of the
	mode number argument in `unused_args' pragmas, and in the types
	of the arg_size_info and termination_info arguments in
	`termination_info' pragmas.

compiler/mercury_to_mercury.m:
compiler/prog_io_pragma.m:
compiler/inst.m:
compiler/make_hlds.m:
compiler/call_gen.m:
compiler/common.m:
compiler/continuation_info.m:
compiler/det_report.m:
compiler/hlds_pred.m:
compiler/lambda.m:
compiler/magic_util.m:
compiler/modecheck_call.m:
compiler/prog_io_goal.m:
compiler/prog_io_util.m:
compiler/prog_util.m:
compiler/termination.m:
	Delete imports of modules purity, rl, and hlds_pred, or
	move them from the interface section to the implementation section.

compiler/inst.m:
compiler/prog_io_util.m:
        Add an XXX comment explaining why we need to import hlds_data.m.
This commit is contained in:
Fergus Henderson
1999-07-08 05:08:58 +00:00
parent c69fb79895
commit 6af76f74ea
21 changed files with 296 additions and 114 deletions

View File

@@ -13,7 +13,7 @@
:- interface.
:- import_module prog_data, hlds_data.
:- import_module prog_data.
:- import_module list, term.
% Convert a single term into a goal.