Files
mercury/compiler/commit_gen.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

69 lines
2.2 KiB
Mathematica

%---------------------------------------------------------------------------%
% Copyright (C) 1997-1998 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.
%---------------------------------------------------------------------------%
%
% File: commit_gen.m
%
% Main authors: conway, fjh, zs.
%
% The predicates of this module generate code for performing commits.
%
%---------------------------------------------------------------------------%
:- module ll_backend__commit_gen.
:- interface.
:- 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 ll_backend__code_gen, libs__tree.
:- import_module std_util, require.
commit_gen__generate_commit(OuterCodeModel, Goal, Code) -->
{ Goal = _ - InnerGoalInfo },
{ goal_info_get_code_model(InnerGoalInfo, InnerCodeModel) },
(
{ OuterCodeModel = model_det },
(
{ InnerCodeModel = model_det },
code_gen__generate_goal(InnerCodeModel, Goal, Code)
;
{ InnerCodeModel = model_semi },
{ error("semidet model in det context") }
;
{ InnerCodeModel = model_non },
code_info__prepare_for_det_commit(CommitInfo,
PreCommit),
code_gen__generate_goal(InnerCodeModel, Goal, GoalCode),
code_info__generate_det_commit(CommitInfo, Commit),
{ Code = tree(PreCommit, tree(GoalCode, Commit)) }
)
;
{ OuterCodeModel = model_semi },
(
{ InnerCodeModel = model_det },
code_gen__generate_goal(InnerCodeModel, Goal, Code)
;
{ InnerCodeModel = model_semi },
code_gen__generate_goal(InnerCodeModel, Goal, Code)
;
{ InnerCodeModel = model_non },
code_info__prepare_for_semi_commit(CommitInfo,
PreCommit),
code_gen__generate_goal(InnerCodeModel, Goal, GoalCode),
code_info__generate_semi_commit(CommitInfo, Commit),
{ Code = tree(PreCommit, tree(GoalCode, Commit)) }
)
;
{ OuterCodeModel = model_non },
code_gen__generate_goal(InnerCodeModel, Goal, Code)
).