Commit Graph

716 Commits

Author SHA1 Message Date
Zoltan Somogyi
85876a9ecc 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.
2026-03-01 22:43:32 +11:00
Zoltan Somogyi
b560f66ab9 Move four modules from check_hlds.m to hlds.m.
After this, I think all modules in the check_hlds package belong there.

compiler/inst_match.m:
compiler/mode_test.m:
    Move these modules from the check_hlds package to the hlds package
    because most of their uses are outside the semantic analysis passes
    that the check_hlds package is intended to contain.

compiler/inst_merge.m:
    Move this module from the check_hlds package to the hlds package
    because it is imported by only two modules, instmap.m and inst_match.m,
    and after this diff, both are in the hlds package.

compiler/implementation_defined_literals.m:
    Move this module from the check_hlds package to the hlds package
    because it does a straightforward program transformation that
    does not have anything to do with semantic analysis (though its
    invocation does happen between semantic analysis passes).

compiler/notes/compiler_design.html:
    Update the documentation of the goal_path.m module. (I checked the
    documentation of the moved modules, which did not need updates,
    and found the need for this instead.)

compiler/*.m:
    Conform to the changes above. (For many modules, this deletes
    their import of the check_hlds package itself.)
2026-02-27 15:16:44 +11:00
Julien Fischer
cd48b281df Add a missing word.
compiler/notes/compiler_design.html:
    As above.
2026-02-25 15:27:00 +11:00
Julien Fischer
c99565e517 Minor fix for compiler design doc.
compiler/notes/compiler_design.html:
    s/compile_target_code.m/link_target_code.m/ where the latter
    was meant.
2026-02-25 15:24:02 +11:00
Zoltan Somogyi
2afa32259a Carve four new modules out of unused_args.m.
compiler/unused_args_analysis.m:
    New module containing the parts of the old unused_args.m
    that deal with the intermodule analysis framework.

compiler/unused_args_base_ops.m:
    New module containing the parts of the old unused_args.m
    that define and operate on the main data structure we use
    to find out which variables are unused.

compiler/unused_args_optimize.m:
    New module containing the parts of the old unused_args.m
    that "optimize out" unused arguments.

compiler/unused_args_warn_pragma.m:
    New module containing the parts of the old unused_args.m
    that generate warnings about unused arguments, and that generate
    unused_args pragmas for .opt files. The module contains both
    because they share the same test for whether we want to ignore
    any unused arguments in a predicate.

compiler/unused_args.m:
    Delete the moved code.

compiler/transform_hlds.m:
compiler/notes/compiler_design.html:
    Include and document the new modules.

compiler/mercury_compile_middle_passes.m:
compiler/mmc_analysis.m:
    Conform to the changes above.
2026-02-24 02:32:37 +11:00
Zoltan Somogyi
019ea41ec4 Break up add_pragma.m into four new modules.
compiler/add_pragma_decl.m:
compiler/add_pragma_gen.m:
compiler/add_pragma_impl.m:
    These three new modules add declarative pragmas, implementation pragmas,
    and compiler-generated pragmas to the HLDS respectively.

compiler/add_pragma_util.m:
    This new module contains the parts of the old add_pragma.m
    that are needed by more than one of the three modules above.

compiler/add_pragma.m:
    Delete this module.

compiler/notes/compiler_design.html:
    Update the relevant documentation.

compiler/add_pragma_tabling.m:
    Use standard length section dividers.

compiler/make_hlds.m:
    Include the new modules.

compiler/make_hlds_passes.m:
    Import the new modules.
2026-02-17 16:45:43 +11:00
Zoltan Somogyi
ab0d1a31a2 Carve add_pragma_type_spec_constr.m ...
... out of add_pragma_type_spec.m.

compiler/add_pragma_type_spec.m:
compiler/add_pragma_type_spec_constr.m:
    As above.

compiler/add_pragma.m:
    Import the new module.

compiler/make_hlds.m:
    Include the new module.

compiler/notes/compiler_design.html:
    Document the new module.
2026-02-17 15:11:03 +11:00
Zoltan Somogyi
b024b5f533 Carve build_eqv_maps.m out of equiv_type.m.
compiler/build_eqv_maps.m:
compiler/equiv_type.m:
    As above.

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

compiler/decide_type_repn.m:
compiler/equiv_type_hlds.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile_make_hlds.m:
compiler/qual_info.m:
    Conform to the changes above.
2026-02-16 11:11:10 +11:00
Zoltan Somogyi
36e8833145 Add a new option, --warn-unused-types.
When set, this option tells the compiler to generate warnings
about locally-defined types that are neither used in the module
nor exported to any other module.

compiler/options.m:
    Add the new option.

compiler/unused_types.m:
    New module to implement the new option.

compiler/mercury_compile_front_end.m:
    Invoke the new module, unless the presence of previous errors
    would make its warnings just a distraction.

compiler/check_hlds.m:
    Include the new module.

compiler/notes/compiler_design.html:
    Document the new module.

compiler/typecheck_error_wrong_type.m:
    Simplify some code.

browser/declarative_tree.m:
compiler/accumulator.m:
compiler/du_type_layout.m:
compiler/intermod.m:
compiler/mode_errors.m:
compiler/parse_inst_mode_defn.m:
compiler/polyhedron.m:
compiler/split_parse_tree_src.m:
compiler/tag_switch_util.m:
compiler/typecheck_error_unify.m:
compiler/unneeded_code.m:
deep_profiler/mdprof_test.m:
library/getopt.m:
library/getopt_io.m:
    Delete unused types reported by the new option.

library/rtti_implementation.m:
    Comment out unused type reported by the new option. This type was exported
    to both Java and C#, but this diff comments it out because neither language
    the Java or the C# runtime system seems to use the exported versions
    either. (Bootcheck in both java and csharp grades worked, with the
    same number of test case failures as before.) We do not delete it,
    because it may be useful in the future.

tests/warnings/help_text.err_exp:
    Expect the documentation of the new option.

tests/invalid_nodepend/Mmakefile:
    Specify --warn-unused-types for two test cases to test that the compiler
    does NOT generate warnings about unused types in the presence of previous
    errors.

tests/warnings/abstract_type_decl.err_exp:
tests/warnings/bug412.err_exp:
tests/warnings/warn_dead_procs.err_exp:
    Expect the new warnings for unused types.

tests/warnings/Mmakefile:
    Specify --warn-unused-types for the three test cases listed above.
2026-02-15 11:26:34 +11:00
Julien Fischer
2fb788c403 Add a missing word to the coding standards.
compiler/notes/coding_standard.html:
    As above.
2026-01-21 20:16:07 +11:00
Zoltan Somogyi
f7a0e88d89 Minor improvements to compiler_design.html.
List the top modules of the make.m package first,
and the utility and data structure modules last.

Mention the deleted backends.

Improve wording in several places.

Fix some cut-and-paste errors.
2026-01-19 14:01:38 +11:00
Julien Fischer
ce26cc1928 Minor fix to compiler_design doc.
compiler/notes/compiler_design.html:
    As above.
2026-01-19 11:33:58 +11:00
Zoltan Somogyi
17f0230447 Carve three new modules out of switch_detection.m.
Simplify the interfaces between the new modules and switch_detection.m.

compiler/scout_disjunctions.m:
    New module containing the part of the old switch_detection.m
    that scouts disjunctions ahead of the main pass in bulk.

compiler/find_bind_var.m:
    New module containing the part of the old switch_detection.m
    that scouts disjunctions as *part* of the main pass, piecemeal.

compiler/switch_candidates.m:
    New module containing the part of the old switch_detection.m
    that recognizes candidate switches, and chooses the best switch
    if there is more than one candidate.

compiler/switch_detection.m:
    Delete the moved code. Conform to the interface simplifications.

compiler/check_hlds.m:
compiler/notes/compiler_design.html:
    Add and document the new modules.

compiler/cse_detection.m:
    Conform to the changes above.

compiler/hlds_out_goal.m:
    Add the capability to format a case as a string.
2026-01-10 10:40:43 +11:00
Julien Fischer
f546e8c8a3 Update the work-in-progress file.
compiler/notes/work_in_progress.html:
     Delete the entry about the bytecode backend, since that
     backend was deleted in commit 039d6eaef.
2025-12-29 02:14:40 +11:00
Zoltan Somogyi
d5ed3079de Carve type_inst_mode_map.m out of convert_parse_tree.m.
compiler/convert_parse_tree.m:
compiler/type_inst_mode_map.m:
    As above.

compiler/parse_tree.m:
compiler/notes/compiler_design.html:
    Add the new module to the parse_tree package, and document it.

compiler/comp_unit_interface.m:
compiler/recompilation.version.m:
    Conform to the changes above.
2025-11-18 09:28:14 +11:00
Zoltan Somogyi
d7f2d23018 Rename three modules.
compiler/fact_table_gen.m:
compiler/opt_format_call.m:
    "fact_table" and "format_call" are both the names of pragmas. Rename

    - fact_table.m to fact_table_gen.m, and
    - format_call.m to opt_format_call.m

    to avoid having their module names being syntax-highlighted.

compiler/opt_format_call_errors.m:
    Rename format_call_errors.m to conform to the second rename above.

compiler/simplify.m:
    Conform to the changes above, and delete redundant module qualifiers.

compiler/add_pragma.m:
compiler/det_infer_goal.m:
compiler/ll_backend.m:
compiler/notes/compiler_design.html:
compiler/simplify_proc.m:
    Conform to the changes above.
2025-10-20 11:34:48 +11:00
Zoltan Somogyi
20d778aa37 Carve typecheck_cons_infos.m out of typecheck_unify_var_functor.m.
compiler/typecheck_cons_infos.m:
    New module containing the parts of the old typecheck_unify_var_functor.m
    that compute the set of things (du and builtin data constructors,
    user-defined functions, compiler-defined field access functions)
    that a function symbol can refer to.

compiler/typecheck_unify_var_functor.m:
    Delete the code moved to the new module. Note that

    - this code should have been in one block, but wasn't, and
    - the moved and not-moved parts of the module need almost disjoint
      sets of imports.

compiler/check_hlds.m:
compiler/notes/compiler_design.html:
    Add and document the new module.
2025-10-20 05:47:22 +11:00
Zoltan Somogyi
9c6f8a1e2c Split inst_make.m out of inst_util.m.
compiler/inst_util.m:
compiler/inst_make.m:
    Move all the parts of inst_util.m that depend on code that is
    properly in the check_hlds package to the new module inst_make.m,
    which is itself in the check_hlds package, leaving no need
    for the new, reduced inst_util.m to import check_hlds.m.

compiler/check_hlds.m:
    Add and document the new module.
compiler/notes/compiler_design.html:

compiler/inst_abstract_unify.m:
compiler/modecheck_unify.m:
compiler/unique_modes.m:
    Import the new module.
2025-10-09 00:51:29 +11:00
Zoltan Somogyi
41fb00dfc3 Fix a missing list opener, ...
... and improve some explanations.
2025-10-08 22:58:23 +11:00
Zoltan Somogyi
2730c2b802 Rename three modules in the make package.
compiler/make.prereqs.m:
compiler/make.prereqs_cache.m:
compiler/make.index_set.m:
    Rename make.dependencies.m to make.prereqs.m;
    rename make.deps_cache.m to make.prereqs_cache.m; and
    rename make.deps_set.m to make.index_set.m.

    We have several kinds of dependencies in the Mercury system;
    the renames make clear that these modules deal with prerequisites
    of make targets. The reason why the word "prereq" is not part of the
    new name of the third module is that this module's functionality is
    generic; it does not care whether the modules and files it deals with
    (representing them as index values in sets) are prerequisites or not.

compiler/make.m:
compiler/notes/compiler_design.html:
    Rename the above modules.

compiler/make.find_local_modules.m:
compiler/make.make_info.m:
compiler/make.module_target.m:
compiler/make.top_level.m:
compiler/mercury_compile_main.m:
    Conform to the changes above.

An unrelated change that ought to have been committed separately
but is now too hard to disentangle from the change above:

Stop creating .err.tmp files.

compiler/make.build.m:
    When we start to build a module target, always direct diagnostic
    outout to the module's .err file. Do this whether the module
    has a .err file already or not, since we want to overwrite any
    existing .err file anyway.

    Simplify the interface of the affected predicates by deleting
    arguments that are no longer needed.

compiler/make.make_info.m:
    Stop keeping track of which modules have had .err files
    created for them already, since we no longer need this info.

compiler/make.get_module_dep_info.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
    Conform to the changed argument lists in make.build.m.

    Give a predicate a more descriptive name.
2025-09-17 14:32:53 +10:00
Zoltan Somogyi
da4a3d03e2 Rename pragma_c_gen.m to foreign_proc_gen.m.
compiler/foreign_proc_gen.m:
    As above.

compiler/proc_gen.m:
    Conform to the rename, and delete comments that related to code
    that was moved to another module ages ago.

compiler/code_gen.m:
compiler/ll_backend.m:
compiler/llds_out_instr.m:
compiler/notes/compiler_design.html:
compiler/prog_data_foreign.m:
    Conform to the rename.
2025-09-16 04:40:12 +10:00
Zoltan Somogyi
b7b4e12dc8 Carve two new modules out of superhomogeneous.m.
compiler/superhomogeneous_lambda.m:
    Carve the code handling lambda expressions out of superhomogeneous.m.
    This code was about 49% of the code of the module.

compiler/superhomogeneous_util.m:
    Carve some utility types and predicates out of superhomogeneous.m,
    since it now also needed by superhomogeneous_lambda.m.

    Also, delete the unused function unify_var_term_project_var.

compiler/superhomogeneous.m:
    Delete the moved code.

compiler/make_hlds.m:
compiler/notes/compiler_design.html:
    Include and document the new modules.

compiler/add_clause.m:
compiler/field_access.m:
compiler/goal_expr_to_goal.m:
    Conform to the changes above.
2025-08-27 15:09:04 +02:00
Zoltan Somogyi
fce9f97ae5 Rename generate_dep_d_files.m to d_file_deps.m. 2025-08-02 06:19:59 +02:00
Zoltan Somogyi
b31b0c9422 Carve check_field_access_functions.m ...
... out of add_pred.m.

compiler/add_pred.m:
compiler/check_field_access_functions.m:
    As above.

compiler/make_hlds.m:
compiler/notes/compiler_design.html:
    Add and document the new module.

compiler/make_hlds_passes.m:
    Conform to the changes above.
2025-07-14 14:55:33 +02:00
Zoltan Somogyi
0891ff754f Include modules named in supertypes in .int2 files.
This fixes a bug that prevented the compilation of another change
to the compiler I am working on. The commit of that change will ve
the test case for this fix.

compiler/comp_unit_interface.m:
    When computing which modules need to be imported in .int2 files,
    include modules named by the supertype of an exported subtype.

compiler/notes/interface_files.html:
    Fix some documentation errors I found while researching the bug.

compiler/options.m:
    Make it possible to test for the presence of this fix in the
    installed compiler.

tests/warnings/help_text.err_exp:
    Expect the new synonym for compiler_sufficiently_recent.
2025-07-07 19:29:55 +02:00
Zoltan Somogyi
debcd0ab02 Carve option_categories.m out of options.m.
This reduces the size of the compiler's biggest module. It also deletes
the option_category type from option.m's .int file, which helps almost
all of the modules that import options.m.

compiler/option_categories.m:
compiler/options.m:
    As above.

compiler/libs.m:
compiler/notes/compiler_design.html:
    Add and document the new module.

compiler/print_help.m:
    Import option_categories.m.
2025-06-24 13:41:15 +02:00
Zoltan Somogyi
d0a2dd7eed Set up for printing help text from optdb structures.
compiler/optdb_help.m:
    Move the definition of help type used in optdb structures to this
    new module (unchanged).

compiler/print_help.m:
    Put a placeholder here for the new help text printing predicate.
    The idea is that

    - print_help.m will import both options.m and optdb_help.m;
    - options.m will import only optdb_help.m; while
    - optdb_help.m will not import either of the other two modules.

compiler/options.m:
    Import the new module.

    Export optdb and the option_category type for code that will
    go into print_help.m.

    Rename the predicate that compares the old and new databases.

compiler/libs.m:
    Add the new module to the libs package.

compiler/notes/compiler_design.html:
    Describe the role of the new module.

compiler/mercury_compile_main.m:
    To get print_help.m linked into executables, add code to lnvoke
    the placeholder predicate in print_help.m.
2025-06-18 21:38:26 +02:00
Zoltan Somogyi
6c7c6d7d49 Carve print_help_old.m out of options.m.
compiler/options.m:
compiler/print_help_old.m:
    Move the parts of options.m that

    - define the help structure, and
    - print help structures

    to the new print_help_old module. The name includes "old" because
    it intended to be supersed by another module, named print_help,
    when we switch over to generating help text via the optdb predicate.
    This will define a different version of the help type, one whose printing
    requires access to each option's default value.

compiler/libs.m:
    Add the new module.

compiler/notes/compiler_design.html:
    Document the intended final state of this work.
2025-06-17 05:39:54 +02:00
Zoltan Somogyi
0c23ad7c64 Carve five new modules out of goal_util.m.
Each of the new modules has much better cohesion than the old goal_util.m.

There are no algorithmic changes.

compiler/goal_contains.m:
    New module for predicates that compute what subgoals a goal contains.

compiler/goal_refs.m:
    New module for predicates that compute what predicates a goal
    calls or otherwise references.

compiler/goal_reorder.m:
    New module for predicates that test whether two goals can be reordered.

compiler/goal_transform.m:
    New module for predicates that transform goals.

compiler/goal_vars.m:
    New module for predicates that compute what variables occur in a goal.

compiler/goal_util.m:
    Delete the code moved to the new modules. Move some related predicates
    next to each other.

compiler/hlds.m:
compiler/notes/compiler_design.html:
    Include and document the new modules.

compiler/*.m:
    Conform to the changes above. Most import just one of the old
    goal_util.m's six successor modules; some import two; while a very few
    import three. None import more than that.
2025-05-22 22:54:48 +10:00
Zoltan Somogyi
9e4af76181 Split mark_trace_goals.m from simplify_proc.m.
This is to prepare for adding warnings about moved trace goals.

compiler/mark_trace_goals.m:
compiler/simplify_proc.m:
    As above.

compiler/simplify.m:
compiler/notes/compiler_design.html:
    Add and document the new module.
2025-05-04 11:14:56 +10:00
Zoltan Somogyi
cc5f1a2f59 Make a warning more specific.
When warning about unresolved polymorphism involving an anonymous variable,
add to the diagnostic a description of the origin of the variable.
(Or origins, it if has more than one in different control branches.)

compiler/post_typecheck.m:
    Change the wording we use to warn about unresolved polymorphism.
    The old wording said that such warnings are *always* caused by calls
    to polymorphic predicates, but this is not true, so say only that
    it is *usually* caused by such calls.

    If the warning is about the type of an anonymous variable,
    then use the new module below to locate its first occurence in the code.
    Without that info, the only way to locate the problem is reading
    HLDS dumps, which is not something we can expect non-developers to do.

compiler/var_origins.m:
    A new module to find and report variable's origins.

compiler/hlds.m:
compiler/post_typecheck.m:
    Include and document the new variable.

tests/invalid/bug184.err_exp:
tests/invalid/freefree.err_exp:
tests/invalid/typeclass_test_8.err_exp:
tests/invalid/unsatisfiable_constraint.err_exp:
    Expect the new wording of the warning, and (in some cases)
    the extra info we now print.

tests/warnings/unresolved_polymorphism_anon.{m,exp}:
    A test case specically for the new functionality.

tests/warnings/Mmakefile:
    Enable the new test case.
2025-05-03 17:46:33 +10:00
Zoltan Somogyi
f0ab53e0ce Replace det_report.m with det_check_{proc,goal,switch}.m.
compiler/det_report.m:
    Delete this module, after moving all its code somewhere else.

compiler/det_check_proc.m:
compiler/det_check_goal.m:
compiler/det_check_switch.m:
    These new modules between them contain *most* of the code that used
    to be in det_report.m.

    - det_check_proc.m contains the code that checks for incompatibilities
      of a procedure's determinism with the other properties of the procedure
      (such as a I/O predicate being something other than det or cc_multi),

    - det_check_goal.m infers the determinism of goals, with the
      assistance of ...

    - det_check_switch.m handles checks on switches (such as reporting
      which cons_ids are not being handled by switches that should be
      complete but are not).

    det_check_switch.m is the largest of these modules; it is separate
    from det_check_goal.m *because* of its size.

compiler/check_hlds.m:
compiler/notes/compiler_design.html:
    Effect and document the replacement.

compiler/common.m:
compiler/det_infer_goal.m:
    Move some code from det_report.m to each of these modules.
    In each case, the moved code is used only by the moved-to module.

compiler/det_analysis.m:
    Move code from det_report.m, that is used only by *clients* of this module
    to control the operation of this module, to this module.

compiler/error_spec.m:
    Move code from det_report.m that is used by more than one of the new
    modules.

compiler/deforest.m:
compiler/det_util.m:
compiler/fact_table.m:
compiler/format_call.m:
compiler/pd_util.m:
compiler/try_expand.m:
    Conform to the changes above.
2025-03-11 23:27:30 +11:00
Zoltan Somogyi
b35f3d20db Carve det_infer_goal.m out of det_analysis.m.
compiler/det_infer_goal.m:
    New module containing the part of the code of det_analysis.m
    that deals with inferring a goal's determinism.

    Update predicates' argument orders to conform to our current coding
    standards.

    Export a main predicate that does only what our callers want it to do,
    and does not require them to know about its internal details.

compiler/det_analysis.m:
    Delete the moved code, leaving only the code dealing with the control
    of mode inference. Note: the moved code used to be *in the middle*
    of the inference code.

compiler/check_hlds.m:
compiler/notes/compiler_design.html:
    Add and document the new module.

compiler/pd_util.m:
compiler/simplify_proc.m:
    Conform to the changes above.
2025-03-11 12:13:49 +11:00
Zoltan Somogyi
217a4368c6 Carve check_options.m out of handle_options.m.
compiler/check_options.m:
    New module containing the purely-checking parts of handle_options.m.

compiler/handle_options.m:
    Delete the moved code.

compiler/libs.m:
compiler/notes/compiler_design.html:
    Add and document the new module.
2025-02-15 04:51:03 +11:00
Zoltan Somogyi
4b912fb892 Carve new modules out of typecheck_errors.m.
The new modules all have significantly better cohesion than the original.
In several cases, the original typecheck_errors.m had the code dealing
with a single issue not in a single block, but split up into several blocks,
interspersed with code dealing with different issues. This could have been
fixed while retaining all the code in a single module, but addressing
each concern in a separate module makes it much easier to *keep* it fixed.

compiler/typecheck_error_arg_vector.m:
    New module containing the code from typecheck_errors.m that deals with
    errors in the argument vectors of clause heads.

compiler/typecheck_error_builtin.m:
    New module containing the code from typecheck_errors.m that deals with
    builtin types and operations.

compiler/typecheck_error_diff.m:
    New module containing the code from typecheck_errors.m that generates
    descriptions of differences between actual and expected types.

compiler/typecheck_error_unify.m:
    New module containing the code from typecheck_errors.m that generates
    error messages for type errors in unifications.

compiler/typecheck_error_wrong_type.m:
    New module containing the code from typecheck_errors.m that generates
    error messages for type errors in unifications.

compiler/check_hlds.m:
compiler/notes/compiler_design.html:
    Include and document the new modules.

compiler/typecheck_errors.m:
    Delete the code moved to the new modules.

compiler/typecheck_error_util.m:
    Move some utility predicates here from typecheck_errors.m, because
    either (a) they themselves are needed in more than one of the new modules,
    or (b) they are are needed only in one module, but are so closely related
    to another utility predicate needed in a different module that
    putting them next to each other is necessary to avoid unwanted divergence.

compiler/typecheck_clauses.m:
compiler/typecheck_unify_var_functor.m:
    Conform to the changes above by importing new modules as needed.
2025-02-14 21:08:58 +11:00
Zoltan Somogyi
8aaa0a958f Carve two new modules out of item_util.m.
compiler/convert_import_use.m:
    New module for converting to and from checked representations
    of import_module and use_module declarations.

compiler/convert_include.m:
    New module for converting to and from checked representations
    of include_module declarations.

compiler/item_util.m:
    Delete the moved code.

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

compiler/check_import_accessibility.m:
compiler/comp_unit_interface.m:
compiler/convert_parse_tree.m:
compiler/grab_modules.m:
compiler/make_hlds_separate_items.m:
compiler/parse_module.m:
compiler/parse_tree_out.m:
compiler/unused_imports.m:
    Conform to the changes above.
2025-01-25 08:03:57 +11:00
Zoltan Somogyi
216c2218c5 Fix description of Java compilation. 2025-01-21 19:34:41 +11:00
Zoltan Somogyi
4cfa5c226b Carve link_target_code.m out of compile_target_code.m.
compiler/compile_target_code.m:
compiler/link_target_code.m:
    Move the parts of compile_target_code.m that concern linking
    to the new module link_target_code.m. Leave the parts concerned
    with just compilation.

    The new module link_target_code.m imports compile_target_code.m,
    but not vice versa. To make this possible, get compile_target_code.m
    to decide PIC vs non-PIC for executables, since that info is needed
    during non-linking tasks, while making that decision for linking tasks
    in link_target_code.m.

    Reorder the contents of link_target_code.m to put related predicates
    next to each other, and to put these groups of related predicates
    into a meaningful order.

    Inline a tiny predicate at its only call site. Replace a boolean argument
    with a value of a bespoke type.

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

compiler/file_util.m:
    Move a predicate here from compile_target_code.m. It is needed
    by both compile_target_code.m and link_target_code.m, but it would
    feel wrong for it to be exported by compile_target_code.m. It looks
    much better for it to be exported by file_util.m.

compiler/make.program_target.m:
    Conform to the changes above.

    Move a predicate next to its only caller.

    Add an XXX.

compiler/make.clean.m:
compiler/make.make_info.m:
compiler/make.module_target.m:
compiler/make.top_level.m:
compiler/mercury_compile_augment.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
    Conform to the changes above.
2025-01-20 00:43:07 +11:00
Zoltan Somogyi
c3f58711fc Move pred markers and goal features to a new module.
compiler/hlds_markers.m:
    This is that new module.

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

compiler/hlds_pred.m:
compiler/hlds_goal.m:
    Delete the moved code.

compiler/*.m:
    Conform to the changes above. Roughly a third of the modules
    that import hlds_pred.m or hlds_goal.m import the new module.
2025-01-12 22:06:06 +11:00
Zoltan Somogyi
79bfb1247f Carve prog_parse_tree.m out of prog_item.m.
compiler/prog_item.m:
compiler/prog_parse_tree.m:
    Split prog_item.m into two modules, with the new module prog_parse_tree.m
    containing the definitions of the file-kind-specific parse trees,
    and prog_item.m continuing to contain the definitions of the items
    that occur in those parse trees. Specialize the top-of-module comment
    to the current contents of each module.

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

compiler/*.m:
    Conform to the changes above.
2024-12-19 01:27:00 +11:00
Zoltan Somogyi
68b0124590 Carve mercury_compile_augment.m ...
... out of mercury_compile_main.m.

compiler/mercury_compile_augment.m:
compiler/mercury_compile_main.m:
    As above. Give the exported predicate from the new module a more
    accurately descriptive name.

compiler/top_level.m:
compiler/notes/compiler_design.html:
    Include and document the new module.
2024-12-11 03:33:58 +11:00
Zoltan Somogyi
702ede3f8b Carve color_schemes.m out of globals.m.
compiler/color_schemes.m:
compiler/globals.m:
    As above.

    In globals.m, delete some obsolete comments.

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

compiler/handle_options.m:
compiler/write_error_spec.m:
    Conform to the changes above.
2024-12-04 04:30:26 +11:00
Zoltan Somogyi
f163f3b963 Move argument processing code to its own module.
compiler/mercury_compile_args.m:
    Carve this new module out of mercury_compile_main.m.

compiler/mercury_compile_main.m:
    Replace the moved code with an import of the new module.

compiler/top_level.m:
compiler/notes/compiler_design.html:
    Include and document the new module.
2024-12-03 03:52:40 +11:00
Zoltan Somogyi
276f94071f Carve two modules out of generate_dep_d_files.m.
compiler/output_imports_graph.m:
compiler/warn_unread_modules.m:
    The two new modules, which each do just one job.

compiler/parse_tree.m:
compiler/generate_dep_d_files.m:
compiler/notes/compiler_design.html:
    Include, import and document the new modules.
2024-11-18 07:52:21 +11:00
Zoltan Somogyi
50459653ff Carve parse_goal_util.m out of parse_goal.m.
compiler/parse_goal.m:
compiler/parse_goal_util.m:
    As above. This improves the cohesion of parse_goal.m.

compiler/parse_tree.m:
compiler/notes/compiler_design.html:
    Add the new module to the parse_tree package, and document it.

compiler/parse_dcg_goal.m:
    Conform to the change above.
2024-11-15 15:53:10 +11:00
Zoltan Somogyi
1fbd5a0500 Make documentation more readable.
Add an XXX.
2024-11-06 00:55:07 +11:00
Peter Wang
f456bda245 Fix spelling.
compiler/notes/install_directory_structure.html:
    Fix spelling.

    Replace "plain files" with "regular files".
2024-09-30 14:22:33 +10:00
Zoltan Somogyi
e3b7fbea2d Document mmake rules for installs. 2024-09-29 17:06:52 +02:00
Zoltan Somogyi
b1bfa30c4a Add a summary of the PROPOSED install dir structure.
Update the PROPOSED install dir of .dll and .int files.
2024-09-27 20:00:12 +02:00
Zoltan Somogyi
b187e2d096 Carve opt_deps_spec.m out of generate_dep_d_files.m.
compiler/opt_deps_spec.m:
    This new module contains the parts of the old generate_dep_d_files.m
    that deal mainly with dependencies involving .trans_opt files, with
    a few parts dealing with .opt files.

compiler/generate_dep_d_files.m:
    Delete the code moved to the new module.

    Eliminate a totally unnecessary use of higher order code.

compiler/parse_tree.m:
    Add the new module to this package.

compiler/notes/compiler_design.html:
    Document the new module.
2024-09-23 14:15:02 +02:00