Files
mercury/compiler/code_model.m
Fergus Henderson 7597790760 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.

Mmakefile:
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/Mmakefile:
	Update settings of *FLAGS-<modulename> to use the appropriate
	nested module names.

compiler/recompilation_check.m:
compiler/recompilation_version.m:
compiler/recompilation_usage.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
compiler/recompilation.version.m:
	Convert the `recompilation_*' modules into sub-modules of the
	`recompilation' module.

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'.

Mmake.common.in:
trace/Mmakefile:
runtime/Mmakefile:
	Rename the %.check.c targets as %.check_hdr.c,
	to avoid conflicts with compiler/recompilation.check.c.
2002-03-20 12:37:56 +00:00

63 lines
2.5 KiB
Mathematica

%-----------------------------------------------------------------------------%
% Copyright (C) 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.
%-----------------------------------------------------------------------------%
:- 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
% that is defined in prog_data.m. It ignores most of the distinctions in
% the determinism type and keeps only the distinctions that are important
% for code generation.
% We define this in a different module than the `determinism' type because
% it is only used by some of the different back-ends, not all of them.
% It is used by the MLDS, LLDS, and bytecode back-ends, but not by the
% Aditi-RL back-end.
%-----------------------------------------------------------------------------%
:- interface.
:- import_module parse_tree__prog_data.
:- import_module hlds__hlds_pred, hlds__hlds_goal.
:- type code_model
---> model_det % functional & total
; model_semi % just functional
; model_non. % not functional
:- pred determinism_to_code_model(determinism, code_model).
:- mode determinism_to_code_model(in, out) is det.
:- mode determinism_to_code_model(out, in) is multi.
:- pred proc_info_interface_code_model(proc_info, code_model).
:- mode proc_info_interface_code_model(in, out) is det.
:- pred goal_info_get_code_model(hlds_goal_info, code_model).
:- mode goal_info_get_code_model(in, out) is det.
%-----------------------------------------------------------------------------%
:- implementation.
determinism_to_code_model(det, model_det).
determinism_to_code_model(semidet, model_semi).
determinism_to_code_model(nondet, model_non).
determinism_to_code_model(multidet, model_non).
determinism_to_code_model(cc_nondet, model_semi).
determinism_to_code_model(cc_multidet, model_det).
determinism_to_code_model(erroneous, model_det).
determinism_to_code_model(failure, model_semi).
proc_info_interface_code_model(ProcInfo, CodeModel) :-
proc_info_interface_determinism(ProcInfo, Determinism),
determinism_to_code_model(Determinism, CodeModel).
goal_info_get_code_model(GoalInfo, CodeModel) :-
goal_info_get_determinism(GoalInfo, Determinism),
determinism_to_code_model(Determinism, CodeModel).
%-----------------------------------------------------------------------------%