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

72 lines
2.5 KiB
ObjectPascal

%-----------------------------------------------------------------------------%
% Copyright (C) 2001 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.
%-----------------------------------------------------------------------------%
% maybe_mlds_to_gcc - Convert MLDS to the GCC back-end representation,
% if the GCC back-end interface has been enabled.
% Main author: fjh.
% This is just a wrapper around mlds_to_gcc.m to enable that
% file to be included iff we were configured with the
% gcc back-end interface enabled.
%-----------------------------------------------------------------------------%
:- module ml_backend__maybe_mlds_to_gcc.
:- interface.
:- import_module ml_backend__mlds, bool.
:- use_module io.
:- type frontend_callback(T) == pred(T, io__state, io__state).
:- inst frontend_callback == (pred(out, di, uo) is det).
% Invoke the callback either via gcc__run_backend, or directly,
% depending on whether the gcc back-end interface has
% been enabled.
:- pred maybe_mlds_to_gcc__run_gcc_backend(mercury_module_name,
frontend_callback(T), T, io__state, io__state).
:- mode maybe_mlds_to_gcc__run_gcc_backend(in, in(frontend_callback), out,
di, uo) is det.
% Either invoke mlds_to_gcc__compile_to_asm, or report an error
% message, depending on whether the gcc back-end interface has
% been enabled. In the former case,
% the bool returned is `yes' iff the module contained C code.
:- pred maybe_mlds_to_gcc__compile_to_asm(mlds__mlds, bool,
io__state, io__state).
:- mode maybe_mlds_to_gcc__compile_to_asm(in, out, di, uo) is det.
%-----------------------------------------------------------------------------%
:- implementation.
#if ENABLE_GCC_BACK_END
:- use_module mlds_to_gcc.
maybe_mlds_to_gcc__run_gcc_backend(ModuleName, CallBack, CallBackOutput) -->
mlds_to_gcc__run_gcc_backend(ModuleName, CallBack, CallBackOutput).
maybe_mlds_to_gcc__compile_to_asm(MLDS, ContainsCCode) -->
mlds_to_gcc__compile_to_asm(MLDS, ContainsCCode).
#else
:- import_module hlds__passes_aux.
:- import_module string.
maybe_mlds_to_gcc__run_gcc_backend(_ModuleName, CallBack, CallBackOutput) -->
CallBack(CallBackOutput).
maybe_mlds_to_gcc__compile_to_asm(_MLDS, no) -->
report_error(
"Sorry, `--target asm' not supported: this installation of the Mercury\n" ++
"compiler was built without support for the GCC back-end interface.").
#endif
%-----------------------------------------------------------------------------%