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.
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.)
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.
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.
... 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
... 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
... 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.
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.
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.
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.
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.
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.