Commit Graph

102 Commits

Author SHA1 Message Date
Fergus Henderson
f61718a7f1 By default, disable value numbering.
options.m:
	By default, disable value numbering.
	(From what I understand it should work now, but nevertheless
	it should not be enabled by default since it slows down
	compilation.)
1995-08-27 17:25:38 +00:00
Zoltan Somogyi
bebe96be34 Look inside blocks introduced by value numbering when looking
frameopt:
	Look inside blocks introduced by value numbering when looking
	restorations of succip.

value_number, opt_util:
	If we are using conservative garbage collection, disable value
	numbering for blocks that allocate more than one cell on the heap.
	This allows value numbering of most blocks to work in the absence
	of -DALL_INTERIOR_POINTERS.

all other source files:
	Clean up "blank" lines that nevertheless contain space or tab
	characters.
1995-08-27 11:10:20 +00:00
Dylan Shuttleworth
e0553b11d5 Added a new compilation warning (& option), which issues a warning if
options.m, mercury_compile.pp:
	Added a new compilation warning (& option), which issues a warning if
	a module has an interface section that doesn't export anything, or
	is non-existant.
1995-08-17 09:17:23 +00:00
Zoltan Somogyi
1a0d509e19 Reorganized the way ready-for-reuse structures are represented.
common:
	Reorganized the way ready-for-reuse structures are represented.
	The type of the variable to which the structure is bound is now
	stored with the structure information, so we can avoid reusing
	a structure for a variable of a different type (which may have
	a different data representation). This is necessary for correct
	handling of convert_item/2 in prog_io.

options:
	Turn on common structure optimization by default.
1995-07-30 07:44:06 +00:00
Fergus Henderson
ba7dd9c98d Split most of the option post-processing into a separate predicate.
mercury_compile.pp, options.m:
	Split most of the option post-processing into a separate predicate.
	Changed the handling of --num-tag-bits: previously this option was
	ignored unless you specified --tags high, but now it works like
	it originally did, i.e. even with --tags low.  The autoconf value
	is only used if no --num-tag-bits option is specified.
	Removed the undocumented arbitrary limit of a maximum of 6 tag bits.
	(On a 64-bit architecture, you might well want to use 30 tag bits!)
1995-07-29 11:21:32 +00:00
Zoltan Somogyi
109d17e10b Removed the notion of "internal determinism"; commits are now indicated
hlds:
	Removed the notion of "internal determinism"; commits are now indicated
	through "some" goals. Renamed the predicate module_info_shapes to
	module_info_get_shapes. Will later change other predicates also to
	get consistent naming.

hlds_out:
	Removed printing of internal determinisms.

det_analysis:
	Changes to accommodate the new way of signalling commits. The comments
	on optimizations have been modified to reflect the need for information
	about whether goals can raise exceptions. Exported two predicates for
	use by follow_code.

live_vars:
	Changes to accommodate the new way of signalling commits.

code_gen:
	Shift the handling of commits to "some" goals. Some predicates
	had three versions, one for each code model; these have been
	simplified significantly. The sequence of predicates has also
	been rationalised a bit. There is still room for improvement
	on both fronts.

disj_gen, ite_gen, middle_rec:
	Changed calls to modified predicates in code_gen.

common:
	When this pass changes A == f(B, C), D := f(B, C) into A == f(B, C),
	D := A, it can change the scopes of A, B and C. The pass did not
	take this into account; now it does. The pass is still disabled
	until it has been more adequately tested.

mercury_compile:
	Moved followcode into the back end. We now thread ModuleInfo through
	the backend instead of Shapes, since follow_code modifies other parts
	of ModuleInfo as well. Rationalised the stage numbers, WHICH MEANS
	-d NUMBERS HAVE CHANGED.

follow_code:
	Follow_code is now after determinism analysis, so that we can check
	that it does not change the determinism of the branched structure
	we are pushing code into. We now push not just builtins but also the
	first call after the branched structure into the branched structure,
	since this will reduce register shuffling. Made a start on pushing code
	into the fronts of branched structures, when some code before the branch
	point is useful only in one branch.

options:
	Added an option prev_code for the (incomplete) functionality in
	follow_code.

vn_flush:
	Moved a comment about future functionality to where it now belongs.

cse_detection:
	Removed obsolete debugging predicate.
1995-07-27 02:00:19 +00:00
Fergus Henderson
9f67cb46b2 Add -o' (--output-file') and `--link-flags' options.
mercury_compile.pp, options.m:
	Add `-o' (`--output-file') and `--link-flags' options.
	Separate the "Output Options" into two sections.
	Change `-m-' (`--no-modecheck') to `-t' (`--typecheck-only').
1995-07-16 15:06:40 +00:00
Fergus Henderson
b959be5716 Split the "Output Options" into two sets - mutually exclusive
options.m:
	Split the "Output Options" into two sets - mutually exclusive
	"Output Options" and additional "Auxiliary Output Options".
1995-07-16 08:34:48 +00:00
Zoltan Somogyi
0bc196dbdd Cleanup of the option set. Main change is making linking the default,
options:
	Cleanup of the option set. Main change is making linking the default,
	and the replacement of -g, --compile and --link by -e, -C and -c.
	WARNING: this makes the compiler inconsistent with the standard mmake
	configuration, so don't do a cvs update yet unless you know what you
	are doing.

conf:
	Find out at configuration time how many bits the --tags low option
	uses.

mercury_compile:
	With the help of conf, we now make sure --tags and --num-tag-bits
	are consistent. We use the new set of options. We also generate
	program-specific .clean rules in .dep files.

make_tags:
	Mercury_compile now makes sure that --tags and --num-tag-bits are
	consistent, so make_tags need not do it.

mode_errors:
	Use the new set of options.

llds:
	Changes to introduce the new option use_macro_for_redo_fail and
	change --mod-comments into --auto-comments.

cse_detection:
	We now print the messages about redoing mode analysis, switch detection
	and cse detection only if very verbose is on.

typecheck:
	The error message for wrong number of arguments now gives the actual
	number and the right number(s).

value_number:
	Tighten the sanity check; theold version wasn't tight enough for
	the code generated for prof.m.
1995-07-12 15:11:00 +00:00
Peter Ross
dede5314a7 Added the profiling option, which generates a file <module>.prof, which
options.m:
	Added the profiling option, which generates a file <module>.prof, which
	contains the static call graph.

dependency_graph.m:
	Predicate to output the static call graph in a form useful for the
	profiler.

prof.m:
	Scan's through the LLDS marking all labels that are continuation
	labels.  eg All label's cont_type field should be unknown now.

llds.m, code_info.m:
	Minor changes so that the above stuff works.
1995-07-10 15:07:19 +00:00
Andrew Bromage
59af355dcb Dependency graph code fix. 1995-07-07 03:40:43 +00:00
Andrew Bromage
9dddf14a3f OK, finally, everything should be back in order. 1995-07-05 23:38:32 +00:00
Andrew Bromage
fda56846cb With any luck, this should be the call_graph branch successfully
merged.  Do not use --constraint-propagation, because it doesn't
schedule conjunctions properly yet.
1995-07-04 03:15:30 +00:00
Fergus Henderson
0713ab1575 Change the type of the first two arguments of unify/5 in
hlds.m and lots of other files:
	Change the type of the first two arguments of unify/5 in
	hlds__goal_expr from `term, term' to `var, unify_rhs'
	where unify_rhs is given by

		:- type unify_rhs
			--->	var(var)
			;	functor(const, list(var))
			;	lambda_goal(list(var), hlds__goal).

	This change was for two reasons: firstly, it simplifies the
	code in a lot of places, and secondly, it is a step towards
	implementing lambda closures and higher-order predicates
	properly.
1995-06-25 13:47:14 +00:00
Zoltan Somogyi
159e986015 Add a new option, --optimize-fulljumps, which defaults on.
options, optimize:
	Add a new option, --optimize-fulljumps, which defaults on.

jumpopt, opt_util:
	If --optimize-fulljumps is set, replace unconditional gotos with
	the instruction sequence they point to. This not only avoids a jump
	at runtime, but also increases basic block length and makes value
	numbering more effective.

peephole:
	Fulljump optimization can replace a recursive tailcall with the
	initial part of the code of the procedure. Therefore peephole now
	looks for a decr_sp followed by an incr_sp, and removes such pairs
	from the instruction sequence.

frameopt:
	Do not consider a decr_sp followed by an incr_sp to be a fatal error
	(just in case peephole is switched off).

vn_block:
	Fix a big tickled by fulljump optimization: maxfr, curfr and succip
	were not required to be made up to date before an if_val exited
	the extended basic block.

vn_util:
	Simplify some more patterns of vnrvals. The extra patterns are
	involved in testing conditions that are known to be true or false.
	These patterns can arise when fulljump optimization replaces a
	recursive tailcall.
1995-06-24 15:53:28 +00:00
Zoltan Somogyi
15b8ea11d0 Put the comment about the contents of stack slots before the initial
code_gen.pp:
	Put the comment about the contents of stack slots before the initial
	label, since this way it will be preserved by optimizations.

cse_detection.m:
	Extended the search to look for cses in if-then-elses and switches
	as well as disjunctions. Removed InstmapDelta from preds in which it
	was not being used.

det_analysis.m:
	Make the diagnosis routines more robust. The changes here avoid the
	Philip's problems with lexical.m.

jumpopt.m:
	Minor formatting changes.

livemap.m:
	Avoid duplicating livevals instructions when optimizations are
	repeated, since this can confuse some optimizations.

llds.m:
	Minor documentation change.

make_hlds.m:
	Minor formatting change.

mercury_compile.pp:
	Do not map arguments to registers if any semantic errors have been
	found.

middle_rec.m and code_aux.m:
	Apply middle recursion only if tail recursion is not possible,
	since tail recursion yields more efficient code.

opt_util.m:
	Added a predicate to recognize constant conditions in if_vals.
	Modified a predicate to make it better suited for frameopt.

optimize.pp:
	Changed the way optimizations were repeated to allow better control.
	Repeat peephole once more after frameopt, since the new frameopt
	can benefit from this.

options.m:
	Removed the --compile-to-c option, which was obsolete. Added an
	option for predicate-wide value numbering, which is off by default.
	Changed some of the default values of optimization flags to reduce
	compilation time while holding the loss of speed of generated code
	to a minimum.

peephole.m:
	Look for if_vals whose conditions are constants, and eliminate the
	if_val or turn it into a goto depending on the value of the constant.
	Generalized the condition for optimizing incr_sp/decr_sp pairs.

value_number.m:
	Added a prepass to separate primary tag tests in if-then-elses from
	the test of the secondary tag, which requires dereferencing the
	pointer.

	Added sanity check routines to test two aspects of the generated code.
	First, whether it produces the same values for the live variables as
	the original code, and second, whether it has moved any dereferences
	of a pointer before a test of the tag of that pointer. If either test
	fails, we use the old instruction sequence.

vn_debug.m:
	New messages to announce the failure of the sanity checks. They are
	enabled by default, but of course can only appear if value numbering
	is turned on (it is still off by default).

vn_flush.m:
	Threaded a list of forbidden lvals (lvals that may not be assigned to)
	through the flushing routines. When saving the old value of an lval
	that is being assigned to, we use this list to avoid modifying any of
	the values used on the right hand side of the assignment, even if the
	saving of an old value results in assignment that requires another
	save, and so on recursively.

	When the flushing of a node_lval referred to a shared vn, the uses of
	the access vns of the node_lvals were not being adjusted properly.
	Now they are.

vn_order.m:
	The ctrl_vn phase of the ordering was designed to ensure that all
	nodes that need not come before a control node come after it. However,
	nodes were created after this phase operated, causing leakage of some
	value nodes in front of control nodes. Some of these led to pointer
	dereferences before tag tests, causing bus errors. The ctrl_vn phase
	is now last to avoid this problem.

vn_table.m:
	Added an extra interface predicate to support the sanity checks in
	value_number.

vn_util.m:
	The transformation of c1-e2 into (0-e2)+c1 during vnrval simplification
	could lead to an infinite loop in the compiler if c1 was zero. A test
	for this case now prevents the loop.
1995-06-17 06:08:09 +00:00
Fergus Henderson
da5d2b787a Tidy up the option help messages.
compiler/options.m:
	Tidy up the option help messages.
1995-05-26 17:19:13 +00:00
Fergus Henderson
2250fbb0fd Fix bug where `mc --link hello' did not pass -DCONSERVATIVE_GC
mercury_compile.pp, options.m:
	Fix bug where `mc --link hello' did not pass -DCONSERVATIVE_GC
	to the C compiler.
1995-05-20 13:16:46 +00:00
Zoltan Somogyi
0fe764bfba Perform arg_info only if we are generating code.
mercury_compile:
	Perform arg_info only if we are generating code.

llds:
	Handle redo and fail by outputing a branch to their labels in the
	runtime, since this is smaller than the code for the macro itself.

dupelim, options:
	Added an extra optimization pass to eliminate duplicate blocks of
	code. Reduces compiler size by half a percent.
1995-05-08 05:32:05 +00:00
Zoltan Somogyi
0f46c5d4e7 Merged in changes from the pass_str_branch. 1995-05-06 07:29:58 +00:00
Fergus Henderson
2466336b79 Fix bug - the default gc method is "conservative", not "none".
compiler/options.m:
	Fix bug - the default gc method is "conservative", not "none".
1995-04-15 05:50:36 +00:00
Fergus Henderson
c767fd5341 A bunch of changes to implement the procs-per-c-function option.
options.m call_gen.m code_gen.pp code_info.m code_util.m llds.m unify_gen.m:
	A bunch of changes to implement the procs-per-c-function option.
	This default is now `--procs-per-c-function 1', for reasonable
	efficiency of compilation, but for efficiency of generated code
	(e.g. when compiling benchmarks!)
	use `--procs-per-c-function 0' (0 really means infinity).

	I haven't tested this in any mode except asm_fast, so it's possible
	that this change might break the other modes.  If that turns out
	to be the case, let me know.  The symptom will be an error from
	the C compiler or linker.
1995-04-13 19:17:48 +00:00
Zoltan Somogyi
1780579b73 fix the problem with destroying stack frames and creating
frameopt:
	fix the problem with destroying stack frames and creating
	them again later, accessing detstackvars that were earlier
	nominally destroyed.

vn_livemap:
	renamed it to livemap since frameopt now uses it also.

value_number, vn_*:
	Fixed some bugs. Reorganized the handling of blocks: they are now
	put in at the last minute before llds writes out the code.
	Made a start towards exploiting info about cheaper copies of
	values.

optimize, options:
	Made value_numbering an iterated optimization. Added a new
	option to control how many times it is iterated together
	with other the jumpopt, peephole and labelopt.

llds, call_gen, code_gen, code_info, middle_rec, opt_debug:
	changed type of the argument of livevals to plain set.

Warning: in more than a week I haven't been able to fully test this change,
dur to kryten's flakiness and bugs upstream of the optimizer.
1995-04-02 11:19:07 +00:00
Fergus Henderson
ac4f8ba0fb Add copyright messages.
compiler/*:
	Add copyright messages.
	Change all occurences of *.nl in comments to *.m.

compiler/mercury_compile.pp:
	Change the output to the .dep files to use *.m rather than *.nl.
	(NOTE: this means that `mmake' will not work any more if you
	call your files *.nl!!!)
1995-03-30 21:03:41 +00:00
Fergus Henderson
949037ca75 Generate N procedures per C function.
code_gen.pp, options.m:
	Generate N procedures per C function.
1995-03-27 16:51:16 +00:00
Fergus Henderson
97ac041923 Some minor corrections to the help message.
options.m:
	Some minor corrections to the help message.
1995-03-18 10:40:25 +00:00
Fergus Henderson
89360cdf4c Use mkdir -p.
Makefile.common:
	Use mkdir -p.

	Add mmake.sh.

	Change the tags rule so that it gets the .pp files first.

	Change the name of the compiler target from comp to mercury_compile.

	Remove the rules for test.exe since they duplicate the auto-generated
	ones in test.dep (which call the target `test' not `test.exe').

	Remove the `code_gen' target.  (Tom, if you need it, put it in
	Makefile.params.)

	Hack around with the installation rules (still in a state of flux).

options.nl:
	Disable the --mod-comments option by default.

llds.nl:
	Only output the gc livevals comment if --mod-comments is enabled.

mercury_compile.nl, prog_io.nl:
	Handle `file not found' errors more cleanly.
	When making the dependencies, assume that any files not found
	are library files, so don't put them in the dependencies.

modes.nl:
	Resolve type ambiguity introduced by change to prog_io.nl.

Mmake.rules Mmake.vars:
	Split Makefile.mercury into two halves for use by mmake.
	NOTE: I haven't removed Makefile.mercury yet, so any changes
	need to be made in both places!
1995-03-07 14:38:42 +00:00
Fergus Henderson
232fd2d22d Change the default grade from fast' to asm_fast.gc'.
Makefile.mercury:
	Change the default grade from `fast' to `asm_fast.gc'.

Makefile.common, mercury_compile.pp:
	Change the rules in the generated .dep makefiles so that
	the NU-Prolog executable is called `<module>.nu', not `<module>'.
	Add new rules for creating `<module>' and `<module>_init.c'
	using mc and mod2init.

mercury_compile.pp:
	Fix a couple of bugs in the option handling: firstly `--gc
	conservative' should imply `--tags none', and secondly the
	CONSERVATIVE_GC, TAGBITS, and HIGHTAGS #defines were not
	being passed to gcc.
1995-03-06 16:40:12 +00:00
Zoltan Somogyi
2d0f72076b Whenever we do a test of a variable against a non-constant functor,
unify_gen:
	Whenever we do a test of a variable against a non-constant functor,
	we now try to turn it into a negated test on a constant functor.
	This is possible if these two functors are the only ones.

code_aux:
	Added an extra predicate to look up type definitions to make the
	previous change easier.

llds, code_gen, opt_util, opt_debug, frameopt, jumpopt, peephole:
	Added a boolean argument to do_succeed to say whether the nondet
	frame should be discarded on success or not. The default is no,
	but peephole has an optimization that tries to turn on this flag.

optimize, value_number, vn*:
	Restructured the top level of value numbering as part of an effort
	to identify blocks that could be optimized further given our knowledge
	that the contents of e.g. stackvars is also in registers when we
	jump to those blocks. Redone the interface between value_number and
	frameopt to allow value_number to be iterated, which is necessary
	to take advantage of the previously mentioned capability. Threated
	the I/O state through the relevant predicates; value numbering doesn't
	use non-logical I/O any more.
1995-03-06 09:42:39 +00:00
Fergus Henderson
02b73b3e75 Fix a couple of minor errors in the help message.
options.nl:
	Fix a couple of minor errors in the help message.
1995-03-01 02:51:20 +00:00
Fergus Henderson
b1c1b675e5 Add --asm-labels option.
options.nl:
	Add --asm-labels option.
	Add new grades asm* and *.gc.
	Allow both spellings of the --optimi{s,z}e* options.
1995-02-26 17:12:13 +00:00
Zoltan Somogyi
2e64d7bc0f Added a target to make the library as a shared library, not just as
Makefile.*:
	Added a target to make the library as a shared library, not just as
	an archive.

code_gen, options:
	Introduced a new option to disable middle recursion optimization.
	This is needed to generate the right example code for section 3 of
	the JLP paper.

jumpopt:
	Factored some code.

frameopt:
	Put back a most of an optimization lost by a previous change.

vn_order:
	Changed the computation of desired dependencies; the new method should
	lead to improvements more frequently.
1995-02-13 06:38:49 +00:00
Peter Ross
73f5a811a5 Added an extra argument for profiling to call in llds.nl and
*.nl :
	Added an extra argument for profiling to call in llds.nl and
	propogated this throught out all the necessary files.
1995-02-08 05:14:13 +00:00
Thomas Conway
7ed52d2c78 Fix the code generation for call/N to handle input args.
call_gen.nl:
	Fix the code generation for call/N to handle input args.

code_util.nl:
	Recognise all call/Ns as builtin

options.nl:
	Turn off common subexpression elimination by default
1995-02-07 03:27:50 +00:00
Jane Anna Langley
f3c87277f1 1. Fixed common.nl, like it actually works now. Wow!
2.	Moved common subexpression evaluation so that it occurs
	after switch detection.
3.	Made common subexpression optimisation "on" by default.
1995-02-03 05:26:48 +00:00
Tyson Dowd
d77adf4951 A new module to handle the output of the garbage collection
garbage_out.*:
	A new module to handle the output of the garbage collection
	information, presently it generates and puts the continuation
	table into a .garb file.

Makefile, Makefile.mercury:
	Rule for creating .garb files, and new dependencies for
	targets.

io.nl, io.nu.nl:
	Added io__read_anything/3 and io__read_anything/4.

mercury_compile.pp, options.nl:
	Added option support for garbage collection, `--gc accurate'
	switches on .garb file output, but code-generation must
	also be on.

shapes.nl:
	Cosmetic changes.
1995-02-01 05:12:38 +00:00
Jane Anna Langley
527f7d6fc7 Added common.nl a module intended to do some common subexpression
optimisation.  It doesn't appear to be doing that yet but nor does
it appear to be doing any harm :-)

It can be switched out in any case with the --no-common-subexpression option
1995-01-31 06:03:30 +00:00
Fergus Henderson
62fa8be865 Add new targets `mercury_compile.sicstus' (the Mercury compiler
Makefile.common:
	Add new targets `mercury_compile.sicstus' (the Mercury compiler
	compiled with Sicstus) and `mercury_compile.sicstus.debug'
	(debugging version of the above).

*.nl:
	Use Sicstus-compatible char and string escapes.
	Avoid the use of explicit existential quantification.
	Various other hacks to get things to parse correctly under Sicstus.

prog_io.nl:
	Don't allow (A -> B) in DCGs, since NU-Prolog and Mercury give
	it different semantics to Sicstus.

sp_builtin.nl, sp_lib.nl:
	Split sp_builtin.nl into sp_builtin.nl and sp_lib.nl.

sp_conv.sed:
	Add sed script which converts some character escapes so that
	they work with Sicstus.

term_io.nl:
	Remove term_io__prefix_op etc. since they aren't used anymore.
1995-01-31 06:00:16 +00:00
Thomas Conway
a6409d7a10 Added more stuff needed for the call_graph.
graph.nl:
	Added more stuff needed for the call_graph.

mercury_to_mercury.nl:
	added a version of the predicate for outputing
	mode declarations that leaves off the ':-' and '\n'

options.nl:
	added the option -C for generating a call graph in the
	file <module>.call_graph
1995-01-27 01:12:01 +00:00
Fergus Henderson
865beeb3ca Various minor bugfixes.
Makefile.common:
	Various minor bugfixes.

Makefile.mercury:
	Add rules for creating assembler (.s) files.

term.nl, *.nl:
	Replace term__context_init/1 with term__context_init/0.
	The first argument was always zero anyway.

io.nl:
	Change the interface to io__read_char and io__read_line so that
	they return a better error indicator.
	Add a new predicate io__putback_char.

polymorphism.nl:
	Don't abort if a predicate doesn't have any modes.

options.nl:
	Let's try turning polymorphism on again.  It seems to work this time.

string.nl, string.nu.nl:
	Add string__to_float.
	Move implementation of string__to_int from string.nl to string.nu.nl.
1995-01-23 17:07:17 +00:00
Zoltan Somogyi
da8b38a184 Turn value numbering back off by default. 1995-01-22 08:47:07 +00:00
Zoltan Somogyi
c69207303c Added back an old garbage collection point.
mercury_compile:
	Added back an old garbage collection point.

optimize:
	Added some new garbage collection points, and made the file into .pp.

value_number, vn_util, opt_debug:
	Changed the way access vns are counted. Pushed noop vnlvals towards
	the front of the flush order; this can improve the speed of the
	generated code.

middle_rec:
	Clarified a bit of code.
1995-01-21 11:20:24 +00:00
Fergus Henderson
65ac02d56e Add some targets for compiling the compiler and the library.
Makefile.common:
	Add some targets for compiling the compiler and the library.

type_util.nl, dense_switch.nl, switch_gen.nl, polymorphism.nl:
	Rename inttype, chartype, etc. as int_type, char_type, etc.
	Add polymorphic_type.

modes.nl, mode_errors.nl:
	Report an error for direct attempts to unify higher-order pred types.
	(Of course, we don't catch indirect attempts via polymorphic types -
	that would require global analysis.  For them, we report the error
	at runtime.)

modes.nl:
	Remove unreachable code from conjuctions.
	(XXX also should do this for if-then-else.)

options.nl:
	Turn -p off by default.  I'll turn it on again when it works ;-)
1995-01-19 16:09:44 +00:00
Fergus Henderson
5e97f88e1c Make --polymorphism enabled by default.
options.nl:
	Make --polymorphism enabled by default.
1995-01-18 13:09:50 +00:00
Fergus Henderson
aabd98b210 Add a -p' or --polymorphism' option to enable the polymorphism.nl
mercury_compile.nl, options.nl:
	Add a `-p' or `--polymorphism' option to enable the polymorphism.nl
	pass.
1995-01-14 18:43:31 +00:00
Fergus Henderson
48e3dea925 Fix some bugs:
polymorphism.nl:
	Fix some bugs:
		- I had forgotten to update the argmodes of the modified
		  procedures
		- I was updating the argtypes and attempting to use there
		  old value.  I fixed this by splitting the algorithm
		  into two passes.
		- to compute the types of the arguments to a call,
		  apply the type mapping from the _caller_ not the callee.
	Also improve efficiency in a couple of places.

hlds.nl:
	Add some new access predicates required by polymorphism.nl.

list.nl:
	Add a new predicate list__duplicate, which is used by polymorphism.nl.

typecheck.nl, type_util.nl:
	Move the type_unify routines from typecheck.nl into type_util.nl,
	since they're also needed by polymorphism.nl.

term.nl:
	Export term__apply_rec_substitution_to_list, since it's needed
	by polymorphism.nl.

- - - - - - - - - - - - - - - - - - - - - - - - -

mode_util.nl, type_util.nl:
	Move some routines from mode_util.nl to type_util.nl, where they
	really belong.

- - - - - - - - - - - - - - - - - - - - - - - - -

make_hlds.nl, code_util.nl, typecheck.nl:
	Mark builtin predicates as "external" in make_hlds.nl,
	rather than checking for them as a special case in typecheck.nl.

- - - - - - - - - - - - - - - - - - - - - - - - -

prog_io.nl, hlds.nl, typecheck.nl:
	For documentation purposes, define equivalent types `tvar',
	`tvarset', `tsubst' for type variables, type varsets, and
	type substitutions.

- - - - - - - - - - - - - - - - - - - - - - - - -

mercury_compile.pp, options.nl:
	Change the handling of the --dump-hlds option so that you can
	now dump the HLDS after any of the 12 HLDS transformation passes.

- - - - - - - - - - - - - - - - - - - - - - - - -

make_hlds.nl:
	Report an error if there are clauses for an imported predicate.

- - - - - - - - - - - - - - - - - - - - - - - - -

io.nu.nl:
	Add a new predicate r/1 which is like run/1 except that
	you pass it a string rather than a list of atoms.
	So now you can do
		$ mercury_compile.debug
		Mercury Interpreter 0.1
		NU-Prolog 1.6.4
		1?- r("mc -options blah blah blah").
1995-01-14 11:59:51 +00:00
Zoltan Somogyi
1b543b4583 Turn off value_number by default for everyone else. 1995-01-10 16:36:07 +00:00
Zoltan Somogyi
cfa6ef72d9 Closer to working than before :-)
value_number, vn_util:
	Closer to working than before :-)

opt_util:
	Moved all value_number-related functionality from there to vn_util.

llds and other files:
	Renamed live_lvalues to liveinfo, and added a list of these as a
	third argument to call_closure as well. Fergus and Tom, please generate
	this third argument in call_gen.
1995-01-10 16:34:51 +00:00
Fergus Henderson
c074b02970 In term__create_var, use bit reversals rather than random numbers
term.nl:
	In term__create_var, use bit reversals rather than random numbers
	to ensure that the binary trees remain balanced.

call_gen.nl:
	For polymorphic unifications, generate a call to fatal_error().

code_gen.nl, hlds.nl, make_hlds.nl, modes.nl, unify_proc.nl:
	Move the unify_request data structure from code_info to the HLDS,
	and move the unify_request handling from code_gen.nl to modes.nl.
	This is because we now generate HLDS code rather than LLDS code
	for complicated unifications.

code_util.nl, hlds_out.nl:
	Do some special name mangling for =/2.

float.nl, typecheck.nl, undef_types.nl, term.nl, hlds.nl:
	Until we implement `float' properly, define it as an abstract type
	in float.nl.

hlds.nl, make_hlds.nl:
	Rename `local_pred, imported_pred, exported_pred' to just
	`local, imported, exported' since they also apply to types, etc.,
	not just to preds.

mercury_compile.pp, mercury_to_goedel.nl, prog_util.nl:
	Replace to goedel__ prefixes in prog_util.nl with prog_util__.

std_util.nl:
	Change the code for semidet_succeed to avoid determinism warning.
1994-12-29 01:12:12 +00:00
Zoltan Somogyi
f5dfd6a643 Broke switch_gen into four pieces. The three optimized switch methods are
now in dense_switch, string_switch and tag_switch, with the original
if-then-else implementation and the code that decides on optimizations
still in switch_gen.

Added options to replace the magic numbers governing the choice of switch
method.

Added comments to frameopt, jumpopt, labelopt and peephole.
1994-12-22 02:55:16 +00:00