Commit Graph

11 Commits

Author SHA1 Message Date
Fergus Henderson
d948aecd92 Make a start at implementing code generation for complicated
lots of files:
	Make a start at implementing code generation for complicated
	unifications.  In the HLDS, change complicated_unify/4 to
	complicated_unify/2 since we didn't need the extra two args
	after all.

peephole.nl:
	A couple of minor efficiency improvements.

queue.nl:
	Add queue__queue_to_list/2.
1994-09-01 20:31:58 +00:00
Fergus Henderson
d6ca6e3797 Ensure that Makefile.mercury can be used as a generic
*Makefile*:
	Ensure that Makefile.mercury can be used as a generic
	Makefile for Mercury programs.  It now gets included by the
	Makefiles in the tests/ directory.
	(It's highly likely that these changes have broken something.)

code_util.nl, peephole.nl, code_info.nl:
	Move peephole__neg_rval to code_util.nl, so that it can
	also be used by code_info.nl.  Improve it a bit.

disj_gen.nl:
	Minor stylistic changes.

peephole.nl:
	Use bintree_set(label) rather than map(label, bool).

ite_gen.nl:
	Implement non-deterministic if-then-elses.

mercury_compile.nl:
	Change the action in the automatically generated .dep makefile
	to use `$(MNL)' rather than `$(NC)' to link the `.no' files
	together.

mode_util.nl, mode_info.nl:
	Fix some (recently detected) determinism errors.

options.nl:
	Rearrange the options into a vaguely meaninful order and
	add a couple of comments.
1994-08-30 21:07:52 +00:00
Fergus Henderson
ac0f113de6 Install ml.sh.
Makefile:
	Install ml.sh.

*_gen.nl, code_info.nl:

	Reorganize the handling of failure continuations and mixing
	det/semidet/nondet code in the one procedure.
	It should now work! ;-)

	The category_context field has gone away.
	The fall_though field is now a stack(maybe(label)) rather
	than a stack(label).  If Cont = yes(label), then we
	fail by jumping to that label.  If Cont = no, then we
	fail by executing a redo().  Whenever we create a semidet
	choice point, we just push a failure continuation label.
	Whenever we create a nondet choice point, we do two things:
	(1) generate code which does a `modframe()'
	(2) push a failure continuation label
	The failure continuation records what value is currently in the
	redoip.  This allows us to short-circuit redo() instructions
	into direct jumps.  Whenever we get to a nondet goal, we change
	the current failure continuation to `no', since the nondet goal
	might have left some choice points behind.
	(TODO: The same sort of mechanism would allow us to optimize `redo()'
	to `fail()' but we don't do that yet; also currently we generate
	quite a few unnecessary modframe() instructions.)

	`generate_[i]cond_branch' has gone away.
	Instead, push a failure continuation and then call
	generate_test_and_fail.

code_util.nl, llds.nl:
	Fix newly discovered determinism errors.

code_info.nl, live_vars.nl:
	framevars start at 0, not at 1!!!
1994-08-28 21:39:24 +00:00
Fergus Henderson
a407841788 Only save and restore the heap pointer if the goal being
backtracked over contains a construction unification or a
non-builtin call.  Add code to save/restore the heap pointer
in one or two places where this was missing, e.g. semidet disjunctions.

Change switch/2 into switch/3 so that we can store the `local
determinism' of the switch there, rather than in the goal_info.

Fix code generation for semidet/nondet switches, so that
we omit the test for the last case if the switch is locally
det.
1994-08-27 08:29:26 +00:00
Thomas Conway
d49ac15b83 Fix the handling of assignments to dead variables,
call_gen.nl code_info.nl unify_gen.nl:
	Fix the handling of assignments to dead variables,
	Fix several problems where live registers got clobbered.

llds.nl:
	Fix the output for nonlocal calls.
1994-07-05 04:06:17 +00:00
Fergus Henderson
29d193f8f6 Translate calls to `is' into calls to builtin_*.
prog_io.nl:
	Translate calls to `is' into calls to builtin_*.

int.nl:
	Export builtin_*.

builtins.nl code_util.nl int.nl llds.nl prog_io.nl:
	Add a `mod' operator.
1994-06-29 18:09:51 +00:00
Thomas Conway
1a855efa62 Fix the interface dependencies so that they are not circular.
code_util.nl:
	Fix the interface dependencies so that they are not circular.

group.nl:
	Fix a determinism error.

switch_gen.nl unify_gen.nl:
	Bug fixes - survive a whole lot more test cases.
1994-06-28 13:09:35 +00:00
Fergus Henderson
faaa081ebc Output introduced unifications in the correct order:
make_hlds.nl:
	Output introduced unifications in the correct order:
	they should be generated top-down, not bottom up.

hlds_out.nl:
	Don't output lines which don't contain any information.

modes.nl:
	Avoid spurious determinism warnings for complicated
	unifies.

code_util.nl:
	Fix a couple of bugs.
1994-06-28 00:47:24 +00:00
Thomas Conway
e10492fa2a Added mkbody and body rvals which expand to macros.
llds.nl:
	Added mkbody and body rvals which expand to macros.

*_gen.nl code_info.nl:
	Fixed tag stuff. String things call error/1 but the
	rest is approximately right. Still wants for testing.
1994-06-27 16:13:00 +00:00
Fergus Henderson
94d9c1abb9 Use det_pred(...), semidet_pred(...), nondet_pred(...)
mercury_builtin.nl:
	Use det_pred(...), semidet_pred(...), nondet_pred(...)
	rather than call_pred(...) for the higher-order predicate modes.

prog_io.nl, io.nl, varset.nl, etc.
	Add determinism annotations.

hlds.nl, make_hlds.nl, LOTS of other files:
	Reorganize the way the predicate table works.
	Make hlds.nl a bit more modular.
	Change call/4 to call/5.
	Remove all/2 from the hlds.
	Changed pred_id to an integer.
	Added pred_call_id which is similar to the old pred_id.

Makefile:
	Add a rule for creating *.hlds_dump.

array.nl:
	Fix determinism error.

det_analysis.nl:
	Fix a bug in printing determinism warnings.

fix_errors.sed:
	Modify this so it allows all the `inferred nondet' determinism
	errors but none of the `inferred semidet' ones.

llds.nl:
	Rename llds__pred_mode_id as llds__proc_id.

mode_errors.nl:
	Finally got around to implementing Zoltan's suggestions
	about the error messages from the mode analysis.
	If an error occurs in a conjunction, only one error message
	is printed out - the first error which doesn't relate to
	a head unification.

modes.nl:
	Handle X = f(X) properly.  NB: determinism analysis and code
	generation still get it wrong!

undef_modes, undef_insts:
	I've broken the error message code, since it's not easy
	to print pred_ids.  I just changed it so that it didn't
	print the pred_ids out.  Should fix this properly at some stage...
1994-06-14 14:23:52 +00:00
Thomas Conway
6f3f6c374f code_util.nl: oops! 1994-06-09 08:11:54 +00:00