Split equiv_type.m into two parts.

The old equiv_type.m's growth was organic, not planned. It mixed predicates
operating on different levels, and even predicates on the same level
were not always logically organized.

compiler/equiv_type_parse_tree.m:
    This module contains the bulk of the old equiv_type.m, the part
    concerned with processing parse tree items and their major components.

compiler/equiv_type.m:
    The part of the old equiv_type.m that deals with expanding equivalences
    inside basic parts of program representations.

compiler/parse_tree.m:
compiler/notes/compiler_design.html:
    Include and document the new module.

compiler/decide_type_repn.m:
compiler/mercury_compile_make_hlds.m:
    Conform to the changes above.
This commit is contained in:
Zoltan Somogyi
2026-03-01 22:43:32 +11:00
parent 48a95366e1
commit 85876a9ecc
6 changed files with 2279 additions and 2173 deletions

View File

@@ -166,6 +166,7 @@
:- import_module libs.options.
:- import_module parse_tree.build_eqv_maps.
:- import_module parse_tree.equiv_type.
:- import_module parse_tree.equiv_type_parse_tree.
:- import_module parse_tree.parse_tree_out_type_repn.
:- import_module parse_tree.prog_data.
:- import_module parse_tree.prog_type.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -61,7 +61,7 @@
:- import_module mdbcomp.
:- import_module mdbcomp.sym_name.
:- import_module parse_tree.build_eqv_maps.
:- import_module parse_tree.equiv_type.
:- import_module parse_tree.equiv_type_parse_tree.
:- import_module parse_tree.error_util.
:- import_module parse_tree.file_names.
:- import_module parse_tree.generate_mmakefile_fragments.

View File

@@ -698,17 +698,22 @@ are module qualified during mode analysis.
</ul>
<p>
The parse tree module also contains equiv_type.m,
which does expansion of equivalence types,
and of `with_type` and `with_inst` annotations
on predicate and function type and mode declarations.
The parse tree module also contains equiv_type_parse_tree.m,
which orchestrates
the expansion of equivalence types in all parse tree components,
and also propagates the information
in `with_type` and `with_inst` annotations
into the type and mode declarations of predicates and functions.
The part of its job gathering the definitions to be expanded
is done by build_eqv_maps.m.
is done by build_eqv_maps.m,
and the part involving expansions in basic parts of program representations
(meaning, those significantly smaller than a prog_item)
is done by equiv_type.m.
<p>
Expansion of equivalence types is really part of type-checking,
but is done on the parse tree rather than on the HLDS
because it turned out to be much easier to implement that way.
(Though later we had to add a pass the expand equivalence types
(Though later we had to add a pass to expand equivalence types
in the HLDS anyway.)
<h4>The hlds.m package</h4>

View File

@@ -115,6 +115,7 @@
:- include_module convert_parse_tree.
:- include_module deps_map.
:- include_module equiv_type.
:- include_module equiv_type_parse_tree.
:- include_module file_names.
:- include_module get_dependencies.
:- include_module grab_modules.