... (mostly) in one place.
compiler/file_names.m:
Change the module_name_to_search_file_name predicate to
- take as input a specification of where the caller intends to search for
the file name returned by this predicate (the new search_which_dirs
input argument),
- use insts to check, at compile time, whether this specification
is compatible with the extension of the file (by intentionally causing
the call to have a mode error if they are not compatible),
- if they are compatible, return a "search authorization" that contains
the information in the search_which_dirs argument in a form that
should be known *only* to file_names.m (which issues the authorization)
and find_module.m (which acts on such authorizations).
To make the above possible, move the search_which_dirs type here
from find_module.m, move many insts on the ext type here from several
other modules, and add some new insts on that type.
Improve documentation.
compiler/find_module.m:
Delete the search_which_dirs type that this diff moves to file_names.m.
Add in its place the search_auth_dirs type, which represents search
authorizations. Make all predicates in this module take search
authorizations instead of search specifications as inputs.
The difference is that only the module_name_to_search_file_name
predicate in file_names.m, and a few functions in this module,
generate search authorizations that involve references to the
various options containing lists of directory names.
compiler/make.file_names.m:
Replace predicates that take a maybe_for_search argument with two
predicates each, one for not for search and one for search. This is
because the for search versions now take two extra arguments:
a search_which_dirs input argument and a search_auth_dirs output argument.
Factor out the common code from the resulting predicate pairs
where this is worth while.
Improve documentation.
compiler/make.timestamp.m:
Replace predicates that take a maybe_for_search argument with two
predicates each, one for not for search and one for search. This is
because the for search versions and the not_for_search versions
now call different predicates, and two separate predicates ends up
being less code that tests around all the calls.
Factor out the common code from the resulting predicate pairs
where this is worth while.
Delete the code that specifies the default list of directories
in which to search for files with given extensions, since it is now
in file_names.m (in a modified form).
compiler/analysis.framework.m:
Delete the inst definitions that this diff moves to file_names.m.
compiler/compile_target_code.m:
compiler/file_kind.m:
Provide more precise insts for the outputs of some predicates.
This is because some of their callers need those insts to satisfy
the new requirements of module_name_to_search_file_name.
compiler/make.top_level.m:
Add a note.
compiler/read_modules.m:
Conform to the changes above. Split the handling of source files
(which do not require search) from the handling of .int* and .*opt files
(which do).
compiler/analysis.file.m:
compiler/check_libgrades.m:
compiler/make.check_up_to_date.m:
compiler/make.get_module_dep_info.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/mercury_compile_front_end.m:
compiler/mmc_analysis.m:
compiler/options_file.m:
compiler/write_deps_file.m:
Conform to the changes above.
For any given extension, only one or two kinds of searches (meaning,
sources of list of directories to search) make sense. We want the type system
to help us ensure that we never ask for a combination that does not make
sense. This diff is a step towards that.
compiler/analysis.framework.m:
compiler/mmc_analysis.m:
Specify an inst for the extensions used by analysis framework.
Restrict the operations of the framework to work on just these extensions.
compiler/analysis.file.m:
compiler/analysis.operations.m:
Restrict read and write operations to just the extensions
used by the analysis framework.
Add an XXX.
compiler/file_names.m:
Add a predicate to return just the base filename (i.e. the filename
in the current directory) corresponding to a module name + extension.
compiler/mercury_compile_llds_back_end.m:
compiler/mlds_to_c_file.m:
Use that predicate to avoid calling module_name_to_search_file_name
with extensions that *always* would get the base name returned anyway.
compiler/find_module.m:
Add an inst for the set of search kinds that make sense for
a significant number of extensions.
compiler/make.get_module_dep_info.m:
Use that new inst to restrict some search operations to just those
search kinds.
compiler/read_modules.m:
Fix bitrot in a comment.
compiler/analysis.framework.m:
compiler/analysis.operations.m:
Split the old contents of analysis.m between these two modules.
analysis.framework.m contains the general framework which may have
any number of instances; analysis.operations defines one instance.
compiler/analysis.m:
Replace this module's old contents with include_module declarations
for the two new modules above (as well as the existing include_module
for analysis.file).
compiler/analysis.file.m:
compiler/exception_analysis.m:
compiler/format_call.m:
compiler/handle_options.m:
compiler/hlds_module.m:
compiler/hlds_pred.m:
compiler/make.check_up_to_date.m:
compiler/make.program_target.m:
compiler/make.timestamp.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_middle_passes.m:
compiler/mmc_analysis.m:
compiler/structure_reuse.analysis.m:
compiler/structure_reuse.direct.m:
compiler/structure_reuse.domain.m:
compiler/structure_reuse.indirect.m:
compiler/structure_sharing.analysis.m:
compiler/structure_sharing.domain.m:
compiler/tabling_analysis.m:
compiler/trailing_analysis.m:
compiler/unused_args.m:
Conform to the changes above.
compiler/notes/compiler_design.html:
Add the new modules to the list currently undocumented modules.