Estimated hours taken: 2
Branches: main
compiler/*.m:
Import only one compiler module per line. Sort the blocks of imports.
This makes it easier to merge in changes.
In a couple of places, remove unnecessary imports.
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.
Estimated hours taken: 6
Eliminated a lot of the dependencies on the the `code_model' type,
and move that type from llds.m into a new module `code_model'.
The aim of this change is to improve the modularity of the compiler by
reducing the number of places in the compiler front-end that depend
on back-end concepts and the number of places in the MLDS back-end
which depend on the LLDS.
compiler/code_model.m:
New module. Contains the code_model type and associated
procedures.
compiler/llds.m:
Move the code_model type into code_model.m.
compiler/hlds_goal.m:
Move the goal_info_get_code_model procedure into code_model.m,
to avoid having the HLDS modules import code_model.
compiler/hlds_out.m:
Delete `hlds_out__write_code_model', since it wasn't being used.
compiler/hlds_pred.m:
Move the proc_info_interface_code_model procedure into code_model.m,
to avoid having the HLDS modules import code_model.
compiler/goal_path.m:
When computing the `maybe_cut' field for `some' goals,
compute it by comparing the determinism rather than by
comparing the goal_infos.
compiler/unique_modes.m:
Use determinism and test for soln_count = at_most_many
rather than using code_model and testing for model_non.
compiler/inlining.m:
Test for determinism nondet/multi rather than testing
for code_model model_non.
compiler/hlds_pred.m:
compiler/det_report.m:
Change valid_code_model_for_eval_method, which succeeded unless
the eval_method was minimal_model and the code_model was model_det,
to valid_determinism_for_eval_method, which succeeds unless the
eval_method is minimal_model and the determinism cannot fail.
As well as avoiding a dependency on code_model in the HLDS
modules, this also fixes a bug where det_report could give
misleading error messages, saying that `multi' was a valid
determinism for `minimal_model' predicates, when in fact the
compiler will always report a determinism error if you declare
a `minimal_model' predicate with determinism `multi'.
(Actually the code in which this bug occurs is in fact
unreachable, but this is no doubt also a bug... I'll address
that one in a separate change.)
compiler/lookup_switch.m:
Simplify the code a bit by using globals__lookup_*_option
rather than globals__get_option and then getopt__lookup_option.
compiler/*.m:
Add `import_module' declarations for `code_model', and in some
cases remove `import_module' declarations for `llds'.