Commit Graph

41 Commits

Author SHA1 Message Date
Peter Wang
1c069bd786 Convert a semidet predicate to a det function for maintainability.
Estimated hours taken: 0.1
Branches: main

compiler/make.module_target.m:
	Convert a semidet predicate to a det function for maintainability.
2006-04-04 08:03:43 +00:00
Peter Wang
ad75e65dec Fix an inconsistency which prevented `mmc --make' from being able to
Estimated hours taken: 0.2
Branches: main, release

compiler/make.module_target.m:
	Fix an inconsistency which prevented `mmc --make' from being able to
	make `.opt' or `.analysis' files on platforms/grades where `mmc
	--make' is unable to fork().
2006-04-03 13:20:10 +00:00
Zoltan Somogyi
be5b71861b Convert almost all the compiler modules to use . instead of __ as
Estimated hours taken: 6
Branches: main

compiler/*.m:
	Convert almost all the compiler modules to use . instead of __ as
	the module qualifier.

	In some cases, change the names of predicates and types to make them
	meaningful without the module qualifier. In particular, most of the
	types that used to be referred to with an "mlds__" prefix have been
	changed to have a "mlds_" prefix instead of changing the prefix to
	"mlds.".

	There are no algorithmic changes.
2006-03-17 01:40:46 +00:00
Julien Fischer
9d8ca0ad37 Remove residual parts of the Aditi backend that weren't deleted the other day.
Estimated hours taken: 1.5
Branches: main

Remove residual parts of the Aditi backend that weren't deleted the other day.

configure.in:
Mmake.common.in:
	Remove support for enabling the Aditi backend.

runtime/mercury_aditi.h:
	Remove this file.

runtime/Mmakefile:
runtime/mercury.h:
runtime/mercury_imp.h:
runtime/mercury_ho_call.[ch]:
runtime/mercury_wrapper.[ch]:
	Delete support for Aditi in the runtime.

scripts/Mmake.rules:
scripts/Mmake.vars.in:
scripts/c2init.in:
scripts/parse_ml_options.sh-subr.in:
	Remove mmake support for building .rlo files, etc.

util/mkinit.c:
	Remove Aditi specific code.

compiler/bytecode_data.m:
compiler/closure_analysis.m:
compiler/code_model.m:
compiler/compile_target_code.m:
compiler/det_analysis.m:
compiler/handle_options.m:
compiler/hlds_goal.m:
compiler/hlds_module.m:
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/make_hlds_error.m:
compiler/make_hlds_passes.m:
compiler/mercury_to_mercury.m:
compiler/mlds_to_gcc.m:
compiler/modecheck_call.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/options.m:
compiler/prog_data.m:
compiler/prog_foreign.m:
compiler/prog_mode.m:
compiler/prog_type.m:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/term_errors.m:
compiler/unify_proc.m:
mdbcomp/prim_data.m:
	Remove residual support for Aditi.

library/ops.m:
	Remove the 'aditi_bottom_up' and 'aditi_top_down' operators from the
	ops table.

doc/reference_manual.texi:
doc/user_guide.texi:
	Delete the sections on the Aditi interface.

extras/aditi/*:
	Delete this.
2006-02-24 07:11:21 +00:00
Peter Wang
755cf5aa15 This patch improves the handling of libraries with the intermodule
Estimated hours taken: 25
Branches: main

This patch improves the handling of libraries with the intermodule
analysis framework.  `.analysis' files can now be installed into library
directories and used when analysing local modules.

analysis/analysis.m:
analysis/analysis.file.m:
compiler/mmc_analysis.m:
	Separate the `module_id_to_file_name' method of the `compiler'
	typeclass into `module_id_to_read_file_name' and
	`module_id_to_write_file_name'.  Add `module_is_local' method.

	Change the calls to `module_id_to_file_name' appropriately for the
	context.  This allows us to find the `.analysis' files of library
	modules.

	Only write results, IMDG and request files for local modules.

	Force `.analysis' files of the currently-analysed module to be written
	out, even if it would be empty.  This avoids us trying to reanalyse the
	module later.

compiler/options.m:
	Add internal compiler option `--local-module-id'.

compiler/make.dependencies.m:
	Add `make_local_module_id_options' to build a list of
	`--local-module-id' options.

compiler/make.module_target.m:
	Add predicate `make_module_target_extra_options' so we can pass the
	`--local-module-id' options.

compiler/make.program_target.m:
	Analyse modules in bottom up order, according to the module dependency
	graph.  The current analyses don't support non-default call patterns,
	so this should reduce the number of analysis passes to get (close to)
	to a fixpoint.

	Pass `--local-module-id' options when building analysis files, so the
	analysis framework knows which modules are local.

	Install `.analysis' files when installing libraries.

compiler/modules.m:
	Make `.analysis', `.analysis_date', `.imdg' and `.request' files
	architecture- or grade-specified so they go into grade directories
	when `--use-grade-subdirs' is used.

	Search for `.analysis' files in the same directories as `.opt' and
	`.trans_opt' files.

	Export predicate `add_module_relations' to help build module dependency
	graphs.

compiler/mercury_compile.m:
	Fix a bug where the unused argument optimisation pass was always being
	run if `--intermodule-analysis' was enabled.
2006-02-13 03:47:44 +00:00
Peter Wang
d202be54a0 This patch mainly adds the ability to perform intermodule analysis of modules
Estimated hours taken: 20
Branches: main

This patch mainly adds the ability to perform intermodule analysis of modules
as a separate step from code generation.  It makes a start on automatic
reanalysis of modules if their .analysis files become invalid or suboptimal.

analysis/analysis.file.m:
analysis/analysis.m:
	Add a predicate `read_module_overall_status' to read just the overall
	status of an analysis file.

	Fix a bug where analysis results were being discarded (upon reading) if
	the module's overall status was `invalid'.  We can't do that as then we
	wouldn't know which results changed after reanalysis.

	Touch a `FOO.analysis_date' file after module `FOO' is analysed.
	This is needed to indicate the time at which `FOO' was last analysed,
	as `FOO.analysis' can be modified at other times.

	Add a mutable boolean variable `debug_analysis' that can be set
	to enable debugging messages for the analysis framework.

compiler/handle_options.m:
compiler/options.m:
	Add new compiler options `--make-analysis-registry',
	`--debug-intermodule-analysis' and `--analysis-repeat'.

compiler/make.dependencies.m:
	Add `.analysis' files as dependencies of compiled code files if
	`--intermodule-analysis' is used.

compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
	Add a `FOO.analyse' pseudo-target to `mmc --make'.  This produces all
	the `.analysis' files needed to compile the top-level module `FOO',
	reanalysing modules until none of the `.analysis' files are invalid.
	The `--analysis-repeat' option can also be used to force
	`suboptimal' modules to be reanalysed a number of times.

	Perform an analysis pass when building executables or libraries to make
	sure that compilation does not proceed with invalid analysis files.

	Treat `.analysis' files specially when checking whether they are out of
	date.  Analysis files require looking at their contents to determine
	whether they are invalid (in which case they are out of date), or valid
	(in which case we look at the timestamp of the corresponding
	`.analysis_date' file).

compiler/mercury_compile.m:
	Make `.analysis' be written out only when `--make-analysis-registry'
	is used, like `--make-transitive-optimization-interface'.
	`mmc --make' runs the compiler the `--make-analysis-registry'
	option as appropriate.

compiler/exception_analysis.m:
compiler/trailing_analysis.m:
compiler/unused_args.m:
	Only record intermodule dependencies and analysis results when
	`--make-analysis-registry' is enabled, not when
	`--intermodule-analysis' is enabled.

doc/user_guide.texi:
	Document `--debug-intermodule-analysis' and `--analysis-repeat'.
2006-02-06 05:39:45 +00:00
Peter Wang
af878d04f9 Some work on the intermodule analysis framework.
Estimated hours taken: 45
Branches: main

Some work on the intermodule analysis framework.  The main changes are that
modules and analysis results have statuses associated with them, which are
saved in the `.analysis' files, and there is now code to handle intermodule
dependency graphs (that record which modules are dependent on a particular
analysis result).

Automatic recompilation of modules that use out of date or invalid analysis
results from other modules is not handled yet.

analysis/README:
analysis/analysis.m:
analysis/analysis.file.m:
	Remove the `FuncInfo' type variable everywhere.  This was originally
	designed to be used by analyses to store "extra" information that
	would be passed from an analysis implementation through the analysis
	framework, back to methods defined by the analysis implementation
	itself.

	The main problem was that `FuncInfo' made `Call' or `Answer' values
	hard to compare, as a `FuncInfo' value always had to be present for a
	comparison to be made (because the methods in the partial_order
	typeclass required FuncInfos).  One example of when this is hard to
	satisfy is when we are ready to write everything out to disk at the
	end of all analyses.  At this step there is much comparing of Call
	and Answer values, but this step is not invoked by any particular
	analysis pass.  To compare values we would need to get the FuncInfos
	from somewhere, which means we would have to store FuncInfos in the
	analysis_info maps as well.  And any time you have two FuncInfos, you
	need to choose one of the FuncInfos arbitrarily.

	Since FuncInfos would have to be read/written with every Call and
	Answer value, including IMDGs, I have changed it so that that any
	information which might be be stored in a `FuncInfo' should be stored
	in the corresponding `Call' value itself.

	Change the format of analysis result files to include an overall
	status for the module and a status for each analysis result.  The
	statuses record whether the module or analysis result could be
	improved by further compilation, or if the module or analysis result
	is no longer valid.

	Add code to read and write intermodule dependency graphs (IMDGs).  The
	IMDG file for module M records all the modules which depend on an
	analysis result for a procedure defined in M.

	Bump analysis file format version numbers as they are incompatible
	with earlier versions.

compiler/mercury_compile.m:
	Make `mercury_compile_after_front_end' use state variables for
	copies of the HLDS and update it to match changes in the intermodule
	analysis framework.

compiler/mmc_analysis.m:
	Add the trail usage analysis to the list of analyses to be used with
	the intermodule analysis framework.

	Update the entry for unused argument elimination.

	Add predicate `module_id_func_id'.

compiler/add_pragma.m:
compiler/hlds_module.m:
compiler/trailing_analysis.m:
	Make the trail usage analysis pass able to make use of the intermodule
	analysis framework.

	Associate each `trailing_status' in the `trailing_info' map with an
	`analysis_status', i.e. whether it is optimal or not.

compiler/unused_args.m:
	Update to match the removal of `FuncInfo' arguments and the
	addition of analysis statuses.

	Record the unused argument analysis result for a procedure even if
	all of the procedures arguments are used, so that callers of the
	procedure will know not to request more precise answers.

	Record the dependence of the current module on analysis results from
	other modules.

compiler/goal_util.m:
	Add predicate `pred_proc_ids_from_goal/2'.

compiler/make.m:
compiler/make.dependencies.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/modules.m:
scripts/Mmake.vars.in:
	Make `mmc --make' and `mmake' realclean `.analysis', `.imdg' and
	`.request' files of non-library modules.  Files for imported library
	modules won't be deleted, but they probably shouldn't be generated in
	the first place.

NEWS:
library/list.m:
	Add a `list.map2_foldl2' predicate.

compiler/Mmakefile:
	Add the `analysis' directory to the list of directories to be
	processed by mtags.
2006-01-25 03:27:38 +00:00
Julien Fischer
45fdb6c451 Use expect/3 in place of require/2 throughout most of the
Estimated hours taken: 4
Branches: main

compiler/*.m:
	Use expect/3 in place of require/2 throughout most of the
	compiler.

	Use unexpected/2 (or sorry/2) in place of error/1 in more
	places.

	Fix more dodgy assertion error messages.

	s/map(prog_var, mer_type)/vartypes/ where the latter is meant.
2005-11-28 04:11:59 +00:00
Zoltan Somogyi
f9fe8dcf61 Improve the error messages generated for determinism errors involving committed
Estimated hours taken: 8
Branches: main

Improve the error messages generated for determinism errors involving committed
choice contexts. Previously, we printed a message to the effect that e.g.
a cc pred is called in context that requires all solutions, but we didn't say
*why* the context requires all solutions. We now keep track of all the goals
to the right that could fail, since it is these goals that may reject the first
solution of a committed choice goal.

The motivation for this diff was the fact that I found that locating the
failing goal can be very difficult if the conjunction to the right is
a couple of hundred lines long. This would have been a nontrivial problem,
since (a) unifications involving values of user-defined types are committed
choice goals, and (b) we can expect uses of user-defined types to increase.

compiler/det_analysis.m:
	Keep track of goals to the right of the current goal that could fail,
	and include them in the error representation if required.

compiler/det_report.m:
	Include the list of failing goals to the right in the representations
	of determinism errors involving committed committed choice goals.

	Convert the last part of this module that wasn't using error_util
	to use error_util. Make most parts of this module just construct
	error message specifications; print those specifications (using
	error_util) in only a few places.

compiler/hlds_out.m:
	Add a function for use by the new code in det_report.m.

compiler/error_util.m:
	Add a function for use by the new code in det_report.m.

compiler/error_util.m:
compiler/compiler_util.m:
	Error_util is still changing reasonably often, and yet it is
	included in lots of modules, most of which need only a few simple
	non-parse-tree-related predicates from it (e.g. unexpected).
	Move those predicates to a new module, compiler_util.m. This also
	eliminates some undesirable dependencies from libs to parse_tree.

compiler/libs.m:
	Include compiler_util.m.

compiler/notes/compiler_design.html:
	Document compiler_util.m, and fix the documentation of some other
	modules.

compiler/*.m:
	Import compiler_util instead of or in addition to error_util.
	To make this easier, consistently use . instead of __ for module
	qualifying module names.

tests/invalid/det_errors_cc.{m,err_exp}:
	Add this new test case to test the error messages for cc contexts.

tests/invalid/det_errors_deet.{m,err_exp}:
	Add this new test case to test the error messages for unifications
	inside function symbols.

tests/invalid/Mmakefile:
	Add the new test cases.

tests/invalid/det_errors.err_exp:
tests/invalid/magicbox.err_exp:
	Change the expected output to conform to the change in det_report.m,
	which is now more consistent.
2005-10-28 02:11:03 +00:00
Julien Fischer
294fcf3ba4 Fix a bug report by Michael Day. When using mmc --make
Estimated hours taken: 3
Branches: main, release

Fix a bug report by Michael Day.  When using mmc --make
to build .opt files the compiler wasn't responding to
SIGINT and SIGTERM.

compiler/make.module_target.m:
	Build intermodule-optimization interfaces
	in a forked process when when using mmc --make
	so that it responds to SIGINT and SIGTERM.
2005-04-27 03:19:19 +00:00
Julien Fischer
87fb88961c Minor cleanups for mmc --make. There are no algorithmic
Estimated hours taken: 0.5
Branches: main

Minor cleanups for mmc --make.  There are no algorithmic
changes.

compiler/make.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/process_util.m:
	Bring these modules into line with our current coding
	standard.
2005-04-26 04:32:49 +00:00
Zoltan Somogyi
34d5181f3a Bring these modules up to date with our current style guidelines.
Estimated hours taken: 4
Branches: main

compiler/mercury_to_mercury.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
compiler/make.module_dep_file.m:
compiler/make.util.m:
compiler/make.m:
	Bring these modules up to date with our current style guidelines.
	Use predmode declarations where appropriate. Use state variable syntax
	where appropriate. Switch to four-space indentation where this reduces
	the number of places with excessive indentation. Use explicit
	predicates instead of lambda expressions where appropriate.

compiler/*.m:
	Minor style fixes.
2005-03-30 00:50:21 +00:00
Zoltan Somogyi
3c60c0e485 Change a bunch of modules to import only one module per line, even
Estimated hours taken: 4
Branches: main

compiler/*.m:
	Change a bunch of modules to import only one module per line, even
	from the library.

compiler/mlds_to_il.m:
compiler/mlds_to_managed.m:
	Convert these modules to our current coding style. Use state variables
	where appropriate. Use predmode declarations where possible.
2005-03-22 06:40:32 +00:00
Ian MacLarty
4970242093 Use proc_label data structure defined in mdbcomp.prim_data instead of proc_id
Estimated hours taken: 4
Branches: main

Use proc_label data structure defined in mdbcomp.prim_data instead of proc_id
defined in mdb.declarative_execution and delete proc_id, since these data
structures are almost identical.

browser/declarative_execution.m
	Remove proc_id and flat_module_name types.  Use
	mdbcomp.prim_data.proc_label and mdbcomp.prim_data.module_name instead.

browser/declarative_debugger.m
browser/declarative_oracle.m
browser/declarative_tree.m
browser/declarative_user.m
	Use mdbcomp.prim_data.proc_label and mdbcomp.prim_data.module_name
	instead of mdb.declarative_execution.proc_id and
	mdb.declarative_execution.module_name.

mdbcomp/prim_data.m
compiler/prog_out.m
	Move sym_name_to_string from prog_out to prim_data.
	Fix comment for prog_out.sym_name_and_arity_to_string.

compiler/bytecode.m
compiler/check_typeclass.m
compiler/code_gen.m
compiler/deforest.m
compiler/higher_order.m
compiler/hlds_code_util.m
compiler/hlds_error_util.m
compiler/hlds_module.m
compiler/hlds_out.m
compiler/intermod.m
compiler/layout_out.m
compiler/make.module_target.m
compiler/make_hlds.m
compiler/mercury_compile.m
compiler/mercury_to_mercury.m
compiler/ml_elim_nested.m
compiler/mlds_to_c.m
compiler/mlds_to_gcc.m
compiler/mlds_to_il.m
compiler/mlds_to_java.m
compiler/mlds_to_managed.m
compiler/modes.m
compiler/modules.m
compiler/opt_debug.m
compiler/options_file.m
compiler/polymorphism.m
compiler/prog_io.m
compiler/prog_rep.m
compiler/rl.m
compiler/rl_exprn.m
compiler/rl_gen.m
compiler/rl_info.m
compiler/rl_out.pp
compiler/rtti.m
compiler/rtti_out.m
compiler/rtti_to_mlds.m
compiler/source_file_map.m
compiler/table_gen.m
compiler/trans_opt.m
compiler/unify_gen.m
compiler/unique_modes.m
compiler/unused_args.m
	Use mdbcomp.prim_data.sym_name_to_string instead of
	prog_out.sym_name_to_string.
2005-02-01 07:11:42 +00:00
Zoltan Somogyi
20cd51e70a This is a cleanup diff; there are no changes in algorithms.
Estimated hours taken: 8
Branches: main

This is a cleanup diff; there are no changes in algorithms.

compiler/delay_info.m:
compiler/instmap.m:
compiler/inst_match.m:
compiler/inst_util.m:
compiler/make.module_target.m:
compiler/mode_errors.m:
compiler/modes.m:
compiler/mode_util.m:
compiler/process_util.m:
compiler/prog_io_goal.m:
compiler/prog_io.m:
compiler/prog_io_pragma.m:
compiler/prog_io_typeclass.m:
compiler/recompilation.check.m:
compiler/recompilation.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
compiler/unique_modes.m:
	Bring these modules up to date with our current style guidelines.
	Switch to predmode syntax and state variable notation where
	appropriate. Switch argument orders where this makes it possible
	to use state variable notation. Use the svmap and svset modules
	where appropriate. Fix inconsistent indentation; in some places,
	fix inconsistent placement of comments.

compiler/passes_aux.m:
compiler/modecheck_unify.m:
compiler/mercury_compile.m:
compiler/post_typecheck.m:
compiler/prog_io_dcg.m:
compiler/mode_ordering.m:
compiler/inst_graph.m:
compiler/polymorphism.m:
compiler/prog_io_util.m:
compiler/mode_debug.m:
compiler/mode_robdd.check.m:
compiler/transform.m:
	Minor changes to conform to the changed argument orders of some
	predicates in the cleaned up modules. Also, some minor cleanups.
2004-12-23 06:49:21 +00:00
Zoltan Somogyi
885fd4a387 Remove almost all dependencies by the modules of parse_tree.m on the modules
Estimated hours taken: 12
Branches: main

Remove almost all dependencies by the modules of parse_tree.m on the modules
of hlds.m. The only such dependencies remaining now are on type_util.m.

compiler/hlds_data.m:
compiler/prog_data.m:
	Move the cons_id type from hlds_data to prog_data, since several parts
	of the parse tree data structure depend on it (particularly insts).
	Remove the need to import HLDS modules in prog_data.m by making the
	cons_ids that refer to procedure ids refer to them via a new type
	that contains shrouded pred_ids and proc_ids. Since pred_ids and
	proc_ids are abstract types in hlds_data, add predicates to hlds_data
	to shroud and unshroud them.

	Also move some other types, e.g. mode_id and class_id, from hlds_data
	to prog_data.

compiler/hlds_data.m:
compiler/prog_util.m:
	Move predicates for manipulating cons_ids from hlds_data to prog_util.

compiler/inst.m:
compiler/prog_data.m:
	Move the contents of inst.m to prog_data.m, since that is where it
	belongs, and since doing so eliminates a circular dependency.
	The separation doesn't serve any purpose any more, since we don't
	need to import hlds_data.m anymore to get access to the cons_id type.

compiler/mode_util.m:
compiler/prog_mode.m:
compiler/parse_tree.m:
	Move the predicates in mode_util that don't depend on the HLDS to a new
	module prog_mode, which is part of parse_tree.m.

compiler/notes/compiler_design.m:
	Mention prog_mode.m, and delete the mention of inst.m.

compiler/mercury_to_mercury.m:
compiler/hlds_out.m:
	Move the predicates that depend on HLDS out of mercury_to_mercury.m
	to hlds_out.m. Export from mercury_to_mercury.m the predicates needed
	by the moved predicates.

compiler/hlds_out.m:
compiler/prog_out.m:
	Move predicates for printing parts of the parse tree out of hlds_out.m
	to prog_out.m, since mercury_to_mercury.m needs to use them.

compiler/purity.m:
compiler/prog_out.m:
	Move predicates for printing purities from purity.m, which is part
	of check_hlds.m, to prog_out.m, since mercury_to_mercury.m needs to use
	them.

compiler/passes_aux.m:
compiler/prog_out.m:
	Move some utility predicates (e.g. for printing progress messages) from
	passes_aux.m to prog_out.m, since some predicates in submodules of
	parse_tree.m need to use them.

compiler/foreign.m:
compiler/prog_data.m:
	Move some types from foreign.m to prog_data.m to allow the elimination
	of some dependencies on foreign.m from submodules of parse_tree.m.

compiler/*.m:
	Conform to the changes above, mostly by updating lists of imported
	modules and module qualifications. In some cases, also do some local
	cleanups such as converting predicate declarations to predmode syntax
	and fixing white space.
2004-06-14 04:17:03 +00:00
Simon Taylor
6f62656e64 Clean up the conversion of targets to file names by `mmc --make'.
Estimated hours taken: 3
Branches: main

Clean up the conversion of targets to file names by `mmc --make'.
Don't assume that every target can be converted simply by adding
an extension -- this isn't true for object files for foreign code
or fact tables.

compiler/make.m:
compiler/make.*.m:
	s/factt_object/fact_table_object/

	Instead of having one fact_table_object target for each module,
	have one for each fact table file.  Previously it wasn't possible
	to identify a fact_table_object target with a target file without
	additional information.

compiler/make.util.m:
compiler/make.*.m:
	make_util.target_extension now returns a `maybe' type, since
	foreign code and fact table targets can't be converted to
	file names by adding an extension.

	Add predicates module_target_to_file_name and
	module_target_to_search_file_name which are like
	module_name_to_file_name, but which handle the
	special cases for foreign code and fact tables
	correctly.
2003-09-24 06:35:26 +00:00
Simon Taylor
404a95cdd7 Remove Unix dependencies in the compiler.
Estimated hours taken: 50
Branches: main

Remove Unix dependencies in the compiler.

Avoid calling passes_aux.invoke_shell_command, which
requires the presence of a Unix shell.

The implementation of fact tables still has dependencies
on Unix utilities (e.g. sort).

aclocal.m4:
	Don't pass Unix style paths to MSVC.

configure.in:
	Use `cygpath -m' rather than `cygpath -w'.
	`cygpath -m' uses '/' as the directory separator,
	so it doesn't cause quoting problems in shell
	scripts.

	Apply $CYGPATH to $PREFIX, $LIBDIR, $CONFIG_PREFIX
	and $CONFIG_LIBDIR.

	Don't pass `-lm' when linking with MSVC.

configure.in:
compiler/options.m:
scripts/Mercury.config.in:
	Add extra configuration options to deal with differences
	between linking with gcc and MSVC:
		--linker-opt-separator
		--linker-link-lib-flag
		--linker-link-lib-suffix
		--shlib-linker-link-lib-flag
		--shlib-linker-link-lib-suffix
		--linker-path-flag

NEWS:
doc/user_guide.texi:
compiler/options.m:
compiler/compile_target_code.m:
compiler/make.program_target.m:
	Instead of substituting in an arbitrary shell script when
	processing `--pre-link-command' and `--extra-init-command',
	require that these options specify a command which will
	be passed the name of the source file containing the main
	module as the first argument, with the source files containing
	the remaining modules following. This is simpler and avoids
	dependencies on a shell.

	Fix quote_arg to handle Windows paths better.

compiler/handle_options.m:
	Don't attempt to use symlinks if they're not available.

compiler/compile_target_code.m:
	Be more careful about quoting.

	Don't call invoke_shell_command where invoke_system_command
	would do.

	Allow linking using MSVC.

compiler/modules.m:
	Remove make_directory, which is now implemented by dir.m.

	Use io.make_symlink rather than shell scripts.

	Implement mercury_update_interface in Mercury.

compiler/llds_out.m:
compiler/make.program_target.m:
	Use dir.make_directory, not modules.make_directory,
	which has been removed.

compiler/make.module_target.m:
	Invoke mercury_compiler directly, not through the
	mmc script to avoid shell dependencies.

	If we can't fork() child `mmc --make' processes,
	pass the arguments to the child process using a
	file to avoid overflowing system limits on Windows.

compiler/mercury_compile.m:
compiler/options_file.m:
	Read argument files.

	Handle backslash-newline in options files correctly.

compiler/passes_aux.m:
	invoke_system_command shouldn't set the exit status --
	the caller may be able to try something else.

compiler/process_util.m:
	Export can_fork for use by make.module_target.m.

	Remove hacks to work around bugs in the implementation
	of zero-arity foreign procs.

compiler/prog_io.m:
	Handle bizarre file names without aborting.

library/Mmakefile:
library/print_extra_inits:
	Move code to find extra initialization functions into
	print_extra_inits, due to the change to the handling
	of the --extra-init-command option described above.

scripts/mmc.in:
	Set the MERCURY_COMPILER environment variable if it is
	not already set, so that the mercury_compile executable
	knows where to find itself.

scripts/mercury.bat.in:
	Make this actually work.

tools/bootcheck:
	Set ANALYSIS_LIB_NAME.

	Apply cygpath (-m not -w) to $root.

	Link print_extra_inits into the stage2 and stage3
	library directories.

util/mkinit.c:
	Handle '\\' in path names.
2003-08-06 12:38:14 +00:00
Zoltan Somogyi
9551640f55 Import only one compiler module per line. Sort the blocks of imports.
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.
2003-03-15 03:09:14 +00:00
Michael Wybrow
cdca9fed0a Add Java support to the foreign language interface.
Estimated hours taken: 70
Branches: main

Add Java support to the foreign language interface.

mercury/compiler/compile_target_code.m:
mercury/compiler/make.module_target.m:
mercury/compiler/mercury_compile.m:
	Pass `compile_java_file' a Java filename rather than a module name.

mercury/compiler/globals.m:
	Add `java' as a `foreign_language'.

mercury/compiler/handle_options.m:
	Allow Java as a back-end foreign language if the target language
	is Java.

mercury/compiler/hlds_data.m:
	Allow Java foreign_types.

mercury/compiler/intermod.m:
mercury/compiler/foreign.m:
mercury/compiler/make.util.m:
mercury/compiler/make_hlds.m:
mercury/compiler/mercury_compile.m:
mercury/compiler/mercury_to_mercury.m:
mercury/compiler/ml_code_gen.m:
mercury/compiler/mlds.m:
mercury/compiler/mlds_to_c.m:
mercury/compiler/mlds_to_il.m:
mercury/compiler/mlds_to_ilasm.m:
mercury/compiler/mlds_to_java.m:
mercury/compiler/pragma_c_gen.m:
mercury/compiler/prog_data.m:
mercury/compiler/prog_io_pragma.m:
	Add or modify existing code to support `java' as a `foreign_language'
	and Java `foreign_type's.

mercury/compiler/mlds_to_java.m:
	Nicely indent the generated code that unboxes arguments from
	return-argument	arrays which are used for methods with multiple
	return arguments.
2003-02-11 02:14:28 +00:00
Simon Taylor
886d2ae474 Make it easier to use shared libraries on x86 with
Estimated hours taken: 20
Branches: main

Make it easier to use shared libraries on x86 with
`mmc --make'.

There is now a third kind of object file, `.lpic_o'.
These files are compiled with `--pic-reg' but not with
CFLAGS_FOR_PIC, so they can be linked with shared Mercury
libraries.

On x86, executables which are linked with shared Mercury
libraries now depend on $(main_module.lpic_os), not
$(main_module.os).

This doesn't work with Mmake because ml doesn't know
which libraries are Mercury libraries, so it can't
link with the static versions of those libraries if
MERCURY_LINKAGE is set to "static".

configure.in:
bindist/bindist.configure.in:
bindist/bindist.build_vars.in:
	Work out whether `.lpic_o' files are needed.

compiler/modules.m:
	Add `.lpic_o' to the list of grade or architecture
	dependent files.

NEWS:
README.Linux:
compiler/options.m:
doc/user_guide.texi:
	Document MERCURY_LINKAGE, LINKAGE, --linkage,
	--mercury-linkage and -R.

compiler/options_file.m:
compiler/make.program_target.m:
	Handle LINKAGE and MERCURY_LINKAGE variables.

	Allow LIBGRADES, LINKAGE and MERCURY_LINKAGE to be target-specific.

scripts/mmc.in:
	Set up the default linkage using the MERCURY_LINKAGE
	variable.

compiler/compile_target_code.m:
	Build `.lpic_o' files.

	Work out which type of object files to link with.

	When linking statically with Mercury libraries,
	find the absolute pathname for the `.a' file
	for each Mercury library, and pass that to ml,
	rather than just using `-lname'.

	Pass `-R' options to ml for each `-R' option to mmc.

compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/mercury_compile.m:
	Specify which type of object files to build.

compiler/make.program_target.m:
compiler/make.module_target.m:
	Make sure all generated object files are cleaned up.

compiler/prog_io.m:
	Add a better message for files which can't be found.

compiler/make.util.m:
	Add `.lpic_o' to the list of extensions.

compiler/Mmakefile:
profiler/Mmakefile:
deep_profiler/Mmakefile:
	Pass `--linkage shared' to mmc (`--shared' is in MLFLAGS).

tests/Mmakefile:
tests/mmc_make/Mmakefile:
tests/mmc_make/Mercury.options:
tests/mmc_make/complex_test.{m,exp}:
tests/mmc_make/hello.{m,exp}:
	Test `mmc --make'.

tests/lib/complex*.m:
	The complex numbers library from the extras distribution,
	for use in the mmc_make tests.
2003-01-23 00:24:20 +00:00
Peter Ross
e868b11dee Change `mmc --make' so that it no longer builds the external foreign
Estimated hours taken: 28
Branches: main

Change `mmc --make' so that it no longer builds the external foreign
object files at the same time as it builds the target object file.

This allows one to build on the IL backend where building an external
foreign file assembly depends on having all the imported Mercury
assemblies built first.

Various fixes were also added so that `mmc --make --grade il' could make
an executable.

compiler/compile_target_code.m:
	Change il_assemble so that we always build a .dll version
	irrespective of whether it contains main or not, as MC++ or C#
	code may refer to the dll.
	Add Mercury/dlls to the search path for the C# and MC++
	compilers.
	s,/,\\\\,g in the C# filename as the MS C# compiler doesn't
	understand / as a directory seperator.
	Add the referenced dlls to the C# compilers command line.
	Export maybe_pic_object_file_extension.

compiler/handle_options.m:
	Fix a bug where copmute_grade incorrectly generated `hl.il'
	instead of `il' as the grade name because we weren't always
	considering the --target option.

compiler/make.m:
	Add to the compilation_task_type type the alternatives
	foreign_code_to_object_code and fact_table_foreign_code_file.
	Add to the module_target_type type the alternatives
	foreign_asm, foreign_object and factt_object.

compiler/make.dependencies.m:
	Add code to handle the new module_target_type alternatives.
	Add code to build the new alternatives to
	compilation_task_type.

compiler/make.module_target.m:
	Add rules to build the foreign_code_to_object_code and
	fact_table_code_to_object_code.

compiler/make.program_target.m:
	Determine the targets needed to be built for all the external
	foreign files and add them to build target list.

compiler/make.util.m:
	Add code to handle the new module_target_type alternatives.
	Change write_target_file to output the correct name when
	building the foreign_asm and foreign_object targets.

compiler/modules.m:
	Move referenced_dlls into the interface for use by
	`compile_target_code.m'.
	Don't place dlls in a sub-directory because on the IL backend
	the dlls are `part' of the executable file.
	Add a `MkDir' argument to fact_table_file_name which
	optionally creates a directory to store the generated
	file_name in.

tests/hard_coded/foreign_proc_make.exp:
tests/hard_coded/foreign_proc_make.m:
tests/hard_coded/foreign_proc_make2.m:
	Add a test case.
2002-12-23 12:34:20 +00:00
Peter Ross
91e84bb9dd Change `mmc --make' so that it no longer builds the external foreign
Estimated hours taken: 28
Branches: main

Change `mmc --make' so that it no longer builds the external foreign
object files at the same time as it builds the target object file.

This allows one to build on the IL backend where building an external
foreign file assembly depends on having all the imported Mercury
assemblies built first.

Various fixes were also added so that `mmc --make --grade il' could make
an executable.

compiler/compile_target_code.m:
	Change il_assemble so that we always build a .dll version
	irrespective of whether it contains main or not, as MC++ or C#
	code may refer to the dll.
	Add Mercury/dlls to the search path for the C# and MC++
	compilers.
	s,/,\\\\,g in the C# filename as the MS C# compiler doesn't
	understand / as a directory seperator.
	Add the referenced dlls to the C# compilers command line.
	Export maybe_pic_object_file_extension.

compiler/handle_options.m:
	Fix a bug where copmute_grade incorrectly generated `hl.il'
	instead of `il' as the grade name because we weren't always
	considering the --target option.

compiler/make.m:
	Add to the compilation_task_type type the alternatives
	foreign_code_to_object_code and fact_table_foreign_code_file.
	Add to the module_target_type type the alternatives
	foreign_asm, foreign_object and factt_object.

compiler/make.dependencies.m:
	Add code to handle the new module_target_type alternatives.
	Add code to build the new alternatives to
	compilation_task_type.

compiler/make.module_target.m:
	Add rules to build the foreign_code_to_object_code and
	fact_table_code_to_object_code.

compiler/make.program_target.m:
	Determine the targets needed to be built for all the external
	foreign files and add them to build target list.

compiler/make.util.m:
	Add code to handle the new module_target_type alternatives.
	Change write_target_file to output the correct name when
	building the foreign_asm and foreign_object targets.

compiler/modules.m:
	Move referenced_dlls into the interface for use by
	`compile_target_code.m'.
	Don't place dlls in a sub-directory because on the IL backend
	the dlls are `part' of the executable file.
	Add a `MkDir' argument to fact_table_file_name which
	optionally creates a directory to store the generated
	file_name in.

tests/hard_coded/foreign_proc_make.exp:
tests/hard_coded/foreign_proc_make.m:
tests/hard_coded/foreign_proc_make2.m:
	Add a test case.
2002-12-20 09:47:28 +00:00
Peter Ross
d35f2d60ac Address some review comments from stayl from a long time ago.
Estimated hours taken: 0.25
Branches: main, release

compiler/make.module_target.m:
compiler/modules.m:
	Address some review comments from stayl from a long time ago.
2002-11-29 12:01:12 +00:00
Simon Taylor
3fda5cf170 With `--make', warn if a target specified on the command line
Estimated hours taken: 1
Branches: main

With `--make', warn if a target specified on the command line
is already up to date.

compiler/make.util.m:
	Check whether a target that was found to be up to date
	was specified on the command line.

compiler/make.m:
	Add the targets specified on the command line to the make_info.

compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.dependencies.m:
	Call make__util__maybe_warn_up_to_date_target when a target
	is found to be up to date.

	Remove targets from the list of targets specified on the command
	line as they are processed to avoid generating multiple warnings.

compiler/options.m:
doc/user_guide.texi:
	Add an option `--no-warn-up-to-date'.

tests/warnings/Mmakefile:
tests/warnings/up_to_date.{m,exp}:
	Test case.
2002-10-30 13:32:02 +00:00
Simon Taylor
f647f928e0 Add some documentation.
Estimated hours taken: 0.25
Branches: main

compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
	Add some documentation.
2002-10-14 06:46:34 +00:00
Simon Taylor
e175b43ca0 Fix bugs in `--rebuild'.
Estimated hours taken: 2
Branches: main

Fix bugs in `--rebuild'.

compiler/compile_target_code.m:
	Always recompile the `module_init.c' file with `--rebuild'.

compiler/handle_options.m:
	The code to make `--rebuild' imply `--make' was after some
	uses of the value of `--make', in particular the code to
	make `--make' imply `--use-subdirs'.

compiler/make.dependencies.m:
compiler/make.program_target.m:
compiler/make.module_target.m:
	Add a sanity check to make sure that all files that should
	have been produced when building a target have been produced,
	and reporting a proper error message if they have not.
2002-08-26 04:56:58 +00:00
Simon Taylor
723a9b921c Fix quoting of arguments to commands invoked by mmc.
Estimated hours taken: 2
Branches: main

Fix quoting of arguments to commands invoked by mmc.

compiler/compile_target_code.m:
compiler/make.module_target.m:
	Quote arguments passed to commands.

compiler/options_file.m:
	Pass each word in the value of CFLAGS (MLFLAGS, etc) as a
	separate `--cflag' option so it can be quoted correctly.

NEWS:
compiler/options.m:
doc/user_guide.texi:
	For each `--Xflags' option, add a `--Xflag' option which
	quotes its argument if necessary then adds it to
	the `--Xflags' option.
2002-08-08 06:25:48 +00:00
Peter Ross
cb87fd1131 When intermodule optimization is enabled make the .o file depend on all
Estimated hours taken: 0.5
Branches: main

When intermodule optimization is enabled make the .o file depend on all
the possible imported .mh files.  This avoids unneccessary recompilation
because the .mh files are less likely to change, as well as a directory
search for .m files.

compiler/export.m:
    Always produce a .mh file because intermodule optimization relies on
    it.

compiler/modules.m:
    Make the .o file depend on all the possible .mh files which could be
    imported when intermodule optimization is enabled.

compiler/modules.m:
compiler/make.module_target.m:
    Correctly calculate the set of .mh files.
2002-08-07 14:40:39 +00:00
Simon Taylor
44ef4e118b Library installation with `mmc --make'.
Estimated hours taken: 10
Branches: main

Library installation with `mmc --make'.

compiler/make.m:
compiler/make.program_target.m:
	Handle `mmc --make lib<module>.install'.

compiler/options.m:
	Add an option `--use-grade-subdirs', which causes
	all grade-dependenent files to be placed in
	`Mercury/<grade>/<ext>s' subdirectories, even
	those files that are intended for use by the user.

	`--use-grade-subdirs' is not documented because it
	is only intended for use in library installation
	with `mmc --make' (it doesn't work at all with Mmake).
	Documenting it would require documenting (and setting
	in stone) the layout of the `Mercury' directory, which
	is probably a bad idea.

Mmake.workspace:
compiler/handle_options.m:
scripts/Mmake.rules:
	Header files are now always searched for using the plain
	file name (not Mercury/mihs/module.mih), so add a
	`--c-include-directory' option to search Mercury/mihs
	in the current directory.

compiler/modules.m:
compiler/intermod.m:
compiler/make.module_dep_file.m:
compiler/mercury_compile.m:
compiler/mlds_to_c.m:
compiler/trans_opt.m:
	Handle `--use-grade-subdirs' in module_name_to_file_name.

	Add module_name_to_search_file_name, which should be
	used to generate the names of files that might be part
	of an installed library. This is needed because installation
	and local directory hierarchies have a different layout,
	A better long-term fix would be to change things so that
	the installation and local directory layouts are the same.

compiler/make.util.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
	Add an extra argument to get_target_timestamp and
	get_file_name to specify whether the file should
	be searched for.

compiler/options_file.m:
scripts/Mmake.vars.in:
	Handle the LIBGRADES and INSTALL_PREFIX make variables.

doc/user_guide.texi:
	Remove the statement that library installation is
	not supported with `mmc --make'.
2002-08-07 13:12:11 +00:00
Simon Taylor
442092c547 Fix a bug which caused compilation to continue
Estimated hours taken: 0.25
Branches: main

compiler/make.module_target.m:
	Fix a bug which caused compilation to continue
	even after errors.
2002-07-17 07:09:21 +00:00
Simon Taylor
29ee1fc877 Replace a hard-coded ".o" with the value of
Estimated hours taken: 0.1
Branches: main

compiler/make.module_target.m:
	Replace a hard-coded ".o" with the value of
	`--object-file-extension'.
2002-07-04 14:18:07 +00:00
Simon Taylor
2d5d20f547 s/--errorcheck_only/--errorcheck-only/
Estimated hours taken: 0.1
Branches: main

compiler/make.module_target.m:
	s/--errorcheck_only/--errorcheck-only/

compiler/options.m:
	s/--very_verbose/--very-verbose/
2002-07-02 06:19:37 +00:00
Simon Taylor
be92cdb69a Fix the handling of header files with `mmc --make'.
Estimated hours taken: 3
Branches: main

Fix the handling of header files with `mmc --make'.

compiler/make.module_target.m:
	Check that all files made by the command are present
	(for example, previously only the `.c_date' files were
	checked, not the `.c' files).

compiler/make.util.m:
	In high-level C grades, don't rebuild the `.o' file if an
	irrelevant part of a `.mih' file has changed. If a relevant
	part of a `.mih' file changed, the interface files of the
	imported module must have changed in a way that would force
	the `.c' and `.o' files of the current module to be rebuilt.

	When finding the timestamps for header files, make sure
	the current directory is searched.

	Header files are created using mercury_update_interface,
	so to check whether a header file is up to date we need
	to check the timestamp on the `.c_date' or `.s_date' file,
	not the header file itself.

compiler/make.dependencies.m:
	Add some more debugging messages.
	Fix the format of some error messages.
2002-06-21 16:52:46 +00:00
Simon Taylor
ac5c98bdaf Fix problems with the compiler-generated header files:
Estimated hours taken: 25
Branches: main

Fix problems with the compiler-generated header files:
1. the header files are grade dependent, but the header files
   can only be installed for one grade.
2. the generated header files can clash with system headers.

To solve these problems, the compiler now generates a
grade dependent `.mih' file containing the declarations
needed when a module is imported in a high-level C code
grade, and a grade independent `.mh' file, which contains
the prototypes for `:- pragma export' declarations.

compiler/export.m:
	Generate a `.mh' rather than a `.h' file for the `:- pragma export'
	declarations.

	Allow the header file generated by export.m to be used with
	`--high-level-code'.

compiler/modules.m:
library/Mmakefile:
	Add a module.install_grade_hdrs target to install the `.mih'
	files in a grade-dependent directory.

compiler/arg_info.m:
compiler/hlds_out.m:
compiler/hlds_pred.m:
	Make it easier to tell if the arg_info field of the proc_info
	has been set.

compiler/mlds_to_c.m:
	Include both the `.mh' and `.mih' files for imported modules.

	The type used as the return value for a semidet procedure
	exported to C is `MR_bool', not `MR_Word'.

compiler/mlds_to_c.m:
compiler/modules.m:
	Don't add a `mercury.' prefix to the standard library
	header file names. They can't clash with the system
	headers any more.

compiler/mercury_compile.m:
compiler/mlds_to_c.m:
	Use export.m to generate the header file for `:- pragma export'
	declarations even in hlc grades.

compiler/mlds.m:
compiler/ml*.m:
	Distinguish between the `.mh' and `.mih' files
	in `mlds__import's.

compiler/handle_options.m:
scripts/Mmake.vars.in:
scripts/mgnuc.in:
	Add C include directory options for the installed grade
	dependent `.mih' files.

Mmakefile:
scripts/Mmake.rules:
	s/h/mih/ in the commands to save the grade dependent
	files when installing the library grades.

compiler/make.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
compiler/make.util.m:
	Handle dependencies on `.mh' and `.mih' files.

NEWS:
doc/user_guide.texi:
	Document the change.
2002-05-30 12:55:23 +00:00
Simon Taylor
d0e8840ab7 Handle `mmc --make lib<module>' target, which builds all the files
Estimated hours taken: 3

Handle `mmc --make lib<module>' target, which builds all the files
required to use a library in the current grade.

compiler/make.m:
	Check for `lib<module>' when attempting to classify a target.

compiler/make.program_target.m:
compiler/compile_target_code.m:
	Make `.init' files when building the `.a' file.

	Invoke the command given by `--pre-link-command' before linking.

compiler/make.module_target.m:
compiler/make.util.m:
	Move find_oldest_timestamp into make.util.m for
	use by make.program_target.m.

compiler/options.m:
doc/user_guide.texi:
	Add an option `--make-init-file-command', to specify an
	alternative command to make the `.init' file. This is needed
	for the standard library.

	Add an option `--pre-link-command', which specifies a
	command to be run before linking. This is useful if there
	are foreign files which depend on headers produced by
	the Mercury compiler.
2002-05-13 18:22:33 +00:00
Simon Taylor
78495d8b99 Complete the support for building libraries with `mmc --make'.
Estimated hours taken: 2.5
Branches: main

Complete the support for building libraries with `mmc --make'.

compiler/make.m:
compiler/make.module_target.m:
compiler/mercury_compile.m:
compiler/compile_target_code.m:
	Generate the `.pic_o' files needed to build shared libraries.

scripts/mmc.in:
	Add `--pic-object-extension', `--create-archive-command'
	`--create-archive-command-output-flag',
	`--create-archive-commandflags' and `--ranlib-command'
	options to DEFAULT_MCFLAGS.

	Allow DEFAULT_MCFLAGS to be overridden in the environment,
	for consistency with the other *FLAGS variables.
2002-05-06 11:43:56 +00:00
Simon Taylor
37cf90e213 The .int0' file for a module depends on the .int0' file for the
Estimated hours taken: 1
Branches: main

compiler/make.module_target.m:
	The `.int0' file for a module depends on the `.int0' file for the
	parent module, which caused circular dependencies with nested
	sub-modules, resulting in a compiler abort. The circular dependencies
	are now removed from the list of dependencies to make.
	Test case: tests/valid/foreign_type_spec.m.
2002-04-23 20:41:46 +00:00
Fergus Henderson
7597790760 Use sub-modules to structure the modules in the Mercury compiler directory.
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.
2002-03-20 12:37:56 +00:00
Simon Taylor
a719e74ee9 Rearrange some code after the `--make' change.
Estimated hours taken: 1.5
Branches: main

Rearrange some code after the `--make' change. This was not done
as part of that change for ease of reviewing.

compiler/mercury_compile.m:
compiler/compile_target_code.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
	Move code to compile the generated code into compile_target_code.m.

compiler/make.util.m:
compiler/passes_aux.m:
compiler/process_util.m:
	Move process and signal handling functionality into process_util.m.

compiler/Mmakefile:
	Compile process_util.c with `--no-ansi' so that the declarations
	of `struct sigaction' and `kill' are available on Linux.

compiler/notes/compiler_design.html:
	Document compile_target_code.m and process_util.m.
	Move timestamp.m into the "Miscellaneous" section (it's
	used by make as well as smart recompilation).
	Fix the documentation of options_file.m.
2002-03-18 04:44:16 +00:00
Simon Taylor
9c9601808d Add an alternative implementation of Mmake as part of the compiler.
Estimated hours taken: 500

Add an alternative implementation of Mmake as part of the compiler.
The advantages of this are
	- more accurate dependencies
	- no `mmake depend' step
	- less process creation (no processes are created to
		build interface files).

Still to do:
	- handle --split-c-files
	- handle the IL backend properly
	- library installation
	- allow the compiler to be built and the nightly tests
	  to be run with `mmc --make'

compiler/make.m:
	Control the build process.

compiler/make.program_target.m:
	Build executables and libraries.

compiler/make.module_target.m:
	Build C files, object files, interface files etc.

compiler/make.dependencies.m:
	Work out the depenendencies between targets.

compiler/make.module_dep_file.m:
	Record the inter-module dependencies between invocations of mmc.

compiler/make.util.m:
	Utility predicates used by `mmc --make'.

compiler/compile_target_code.m:
	This module will eventually contain the predicates used
	to compile the target code files generated by the compiler
	which are now in mercury_compile.m. (That will be done
	as a separate change for ease of reviewing).

	For now compile_target_code.m

compiler/mercury_compile.m:
	Export the predicates used to compile target code.

	Call make.m.

	Pass the name of the top-level module in the source file to modules.m.
	It is needed when generating the `.module_dep' files.

	Lookup the option defaults (which will eventually be stored in
	DEFAULT_MCFLAGS by the mmc script) before compiling. Up until now
	the option defaults have been passed on the command line by the
	mmc script, but with `mmc --make' the default options need
	to be overridden by the value of the MCFLAGS make variable, but
	the MCFLAGS make variable is overridden by command line options.

	Pass the value of `--link-flags' to c2init.

	Remove some uninformative messages printed when a C, IL, etc.
	compilation fails.

compiler/options_file.m:
	Read files containing Make style variable assignments.

compiler/options.m:
doc/user_guide.texi:
	Add a new options category: build system options.

	Add some extra options:
	--warn-undefined-options-variables - like mmake --warn-undefined-vars
	--verbose-commands - print commands that the user might be
		interested in, like C compilation, but not things
		like mercury_update_interface.
	--output-compile-error-lines - print the first n lines
		of the error file generated by a command.
	--generate-mmc-make-modules-dependencies - generate dependencies
		for use by `mmc --make' even when using Mmake.

	--il-assembler, --ilasm-flags, --mcpp-compiler, --mcpp-flags,
	--csharp-compiler, --csharp-flags, --install-prefix,
	--install-command, --libgrades, --options-files,
	--options-search-directories.

compiler/modules.m:
	Add fields to the `module_imports' type for use by make.*m.

	Don't try to fill in fields of the module_imports structure
	lazily. It's error prone, and probably doesn't save much
	anyway.

	Clean up the code to compute what foreign languages
	are used by a list of item.

	Simplify the handling of fact tables by recording that a module
	containing fact tables has foreign code to implement them,
	rather than requiring separate checks everywhere.

	Generalise predicates like get_interface so that they
	work even after the imported items have been read.

	Fix the handling of header files with the LLDS backend.

	Install the `.module_dep' files created for use by
	`mmc --make'.

compiler/*.m:
	Use record syntax rather than explicit deconstruction to
	refer to fields of the `module_imports' type.

compiler/*.m:
	Be more careful about where output goes.
	mercury_compile.m sets the output stream to be io__stderr_stream
	at the start of compilation, so remove all explicit writes to
	io__stderr_stream (with `--make' the error output stream may be
	a `.err' file, not io__stderr_stream).

	Change all occurrences of io__tell/io__told to use
	io__open_output/io__close_output (io__told restores the current
	output stream to io__stdout_stream, not the previous value).

compiler/passes_aux.m:
	Make the output from system commands go to the current
	output stream, not C stdout and stderr.

	Allow commands to be printed with `--verbose-commands'.

	Remove uninformative error messages when a command fails.

compiler/timestamp.m:
	Add functions oldest_timestamp and newest_timestamp.

compiler/llds_out.m:
	Record the number of C files written with `--split-c-files'
	in <module>.num_split.

compiler/prog_io.m:
compiler/*.m:
	`search_for_file' now returns the directory in which the
	file was found.

compiler/foreign.m:
	Use sub-typing to make some calls to predicates in this
	module `det' rather than `semidet'.

compiler/handle_options.m:
	Return the option arguments.

compiler/Mmakefile:
	make.util.m refers to kill() and `struct sigaction' which
	are not exported from <signal.h> unless `--no-ansi' is
	passed to gcc.

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

runtime/mercury_signal.h:
runtime/mercury_signal.c:
	Add a function MR_signal_should_restart() which alters
	whether a signal restarts or interrupts system calls.
	In general restarting is the preferred behaviour, but
	the wait() for a child process needs to be interruptible.

scripts/Mmake.vars.in:
	Add subdirs for `.module_dep', `.err_date'
	and `.num_split' files.

library/io.m:
	Add a version of io_call_system which returns the signal
	that killed the command rather than converting it into
	an error message.

	Add a predicate to interpret the result of system() or wait().

library/list.m:
	Add list__map_foldl2 and a unique mode for list__foldl3.

NEWS:
	Document the new library predicates.

configure.in:
runtime/mercury_conf.h.in:
	Check for siginterrupt().

doc/user_guide.texi:
	Document the new options.

	Add a description of `mmc --make' to the "Using Mmake" chapter.
2002-03-12 16:33:37 +00:00