Commit Graph

48 Commits

Author SHA1 Message Date
Zoltan Somogyi
707ed33da0 Fixed two bugs. First, if a primary tag value did not have cases for
tag_switch:
	Fixed two bugs. First, if a primary tag value did not have cases for
	all its secondary tag values, we now emit a goto the failure label
	if the secondary tag does not match any case; we used to just fall
	through. Second, the failure code itself used to be generated in
	the context of the end of one of the cases; this should now be fixed,
	although I want to go over it with Tom to make sure.

	The computation of the secondary tag is now done once, instead of
	being repeated at every secondary tag test.

options:
	Set tag_switch_size to 4 by default, reduced from 8. It was this change
	that exposed the two bugs above. After the fix, the compiler is smaller
	by about 2 Kb.

switch_gen:
	Add some comments.

code_util:
	Fixed nonstandard indentation.
1995-09-24 08:45:34 +00:00
Fergus Henderson
139675dec7 Add EXTRA_MLFLAGS variable, so that you can set
compiler/Mmake:
	Add EXTRA_MLFLAGS variable, so that you can set
	EXTRA_MLFLAGS=--no-strip if you want to preserve
	the debugging info.

code_util.m, polymorphism.m, hlds.m, special_pred.m:
	Move the stuff dealing with special_preds from hlds.m into
	a new module special_pred.  Add a new predicate special_pred_get_type
	to that module, and use it in code_util.m and polymorphism.m
	(replacing some fairly non-maintainable hacks).

make_hlds.m, unify_proc.m:
	Import special_pred.m.
1995-09-21 04:48:16 +00:00
Tibor Benyi
3c99089327 Commited all modifications needed for type_to_term and term_to_type. 1995-09-08 12:25:39 +00:00
Zoltan Somogyi
eef27b6a67 Removed the caller argument from the call, call_closure and goto LLDS
instructions, and the last argument from local labels. All these were
placeholders for info put in there by prof.m and used when emitting C
code.

The set of labels that serve as return points are now calculated in llds.m
just before each procedure has its C code generated. This set is passed to
output_instruction along with the label at the start of the procedure.
1995-09-05 10:16:19 +00:00
Fergus Henderson
cdc666a331 More work on higher order predicates and lambda goals.
Lambda expressions now work, and you can now use polymorphic predicates
as higher-order pred terms.  (Mode checking and determinism checking
are still not implemented, and the modes of call/N are very restrictive.
But these change makes solutions/2 a lot more useful now.)

hlds.m:
	Comment out the stuff for recording num_warnings, since it
	wasn't being used.  Instead we now use that slot in the
	module_info for a counter which holds a number to use to
	name the predicates for lambda expressions.  Add a new
	predicate module_info_next_lambda_count/3 to get and
	increment this counter.

modes.m:
	Transform higher-order pred constants into lambda expressions.
	(Also, use slightly more meaningful variable names in a few places.)

polymorphism.m:
	Use module_info_next_lambda_count/3 to name the predicates
	created for lambda expressions.

code_util.m:
	Handle __LambdaGoal__ labels correctly.
1995-08-26 06:43:35 +00:00
Zoltan Somogyi
b905b2f4d8 Added an extra argument to call, which contains a maybe of the unification
context of the unification from which call was made. We we use this to generate
significantly better error messages. (There should be no more messages of the
form "call to __Unify__(blah blah blah) can fail".) Most of the files are
changed just to reflect this.

An unrelated change in det_analysis is that we now ensure the absence of
cycles by modifying the new inferred determinism in the light of the old
one, ensuring that any changes are monotonic.

In hlds_out, inhibit the printing of pseudo-imported predicates (unifications)
since nobody cares about them except sometimes Fergus.
1995-07-31 08:35:41 +00:00
Fergus Henderson
36878440a1 This batch of changes implements complicated modes of complicated
unifications.  See the comments at the top of unify_proc.m for
details of how it's done.

hlds.m:
	Add new export statuses `pseudo_imported' and `pseudo_exported'
	to handle unification predicates, which can now have complicated
	modes.

code_gen.pp, code_info.m, common.m, constraint.m, cse_detection.m,
follow_code.m, follow_vars.m, hlds_out.m, inlining.m, live_vars,
make_hlds.m, mercury_compile.pp, modes.m, store_alloc.m,
switch_detection.m:
	Handle pseudo_imported predicates.

modes.m, constraint.m:
	Change modecheck to return an updated module_info, since
	modechecking may insert new entries into the unify_requests
	queue in the module_info.  Make sure that modechecking
	never inserts requests into the unify_requests queue
	for code that has mode errors (or needs rescheduling).

call_gen.m, polymorphism.m:
	Move duplicated code into unify_proc.m.

clause_to_proc.m:
	Add new predicate clauses_to_proc for use by unify_proc.m.

unify_proc.m:
	Implement complicated unifications with complicated modes.
1995-07-20 13:32:36 +00:00
Tibor Benyi
6844c51665 enabled read and write (without the error this time). 1995-07-11 03:01:07 +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
Peter Ross
6cc1f3e0b0 Changed the way the extra field in the label type is defined.
*.m:
	Changed the way the extra field in the label type is defined.  Now
	all labels are initially assumed to be 'unknown' and a seperate
	profiling pass (to be implemented) will determine whether the label can
	be accessed externally.
1995-06-27 09:48:20 +00:00
Fergus Henderson
f0d77e44ba Don't report a compile error if there is a higher-order pred
modes.m, typecheck.m, code_util.m:
	Don't report a compile error if there is a higher-order pred
	unification in a compiler-generated predicate.  (Instead, delay
	the error until run-time so that it only occurs if the higher-order
	pred unification in question actually gets executed.)
1995-06-24 14:12:44 +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
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
77b16b11d9 Implement floating point.
code_util.nl, float.nl, llds.nl, mercury_builtin.nl, opt_debug.nl,
parser.nl, polymorphism.nl, sp_lib.nl, string.nl, string.nu.nl,
type_util.nl, typecheck.nl, unify_gen.nl:
	Implement floating point.

Makefile.common:
	Remove `-include test.dep' line.  Use Mmake.

int.nl:
	Update a few of the comments.

io.nu.nl:
	For Sicstus Prolog, if main/2 is not defined then enter the
	debugger.
1995-03-15 14:28:24 +00:00
Peter Ross
d9865c2fc1 Introduced a new predicate which ignore's any whitespace in the input.
io.nl:
	Introduced a new predicate which ignore's any whitespace in the input.
	Needs to have all the whitespace character's added to it.

*.nl and *.pp:
	Changed the implementation of time profiling.  Now during a compile,
	the compiler identifies all the internal labels which can be accessed
	externally, and marks them.  At the moment, these are the continuation
	labels of calls and the next disjunct in nondet disjunctions.  Then
	at the .mod output, it places a macro 'update_prof_current_proc' to
	restore the profiling counter.
1995-03-13 17:09:01 +00:00
Peter Ross
fcc624ae6b Introduced an extra argument to the LLDS goto.
llds.nl:
	Introduced an extra argument to the LLDS goto.  It is the label
	address of the Caller and is used for the profiling of tailcall's.

*.nl and *.pp:
	Propagated the extra argument to all the appropiate files.
1995-02-28 04:20:27 +00:00
Fergus Henderson
f862db3245 Lots of changes to implement compare/3.
*.nl:
	Lots of changes to implement compare/3.
1995-02-07 07:48:28 +00:00
Thomas Conway
b759b4436a change occurences of is_builtin and not_builtin to abstract
various:
	change occurences of is_builtin and not_builtin to abstract
	calls.

code_info.nl:
	perform transitive checking for variable dependencies.
1995-02-07 07:39: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
Fergus Henderson
fb0aacfb5b Add a comment.
code_util.nl:
	Add a comment.
1995-02-02 08:14:47 +00:00
Fergus Henderson
280479f7ee Fix bug in make_proc_label: for unification predicates,
code_util.nl:
	Fix bug in make_proc_label: for unification predicates,
	look at the _last_ argument to determine the type for
	name mangling, not the first, since we introduce extra
	higher-order arguments at the start.

make_hlds.nl, hlds.nl:
	Ensure that the proc_info head_vars has the right length even for
	imported predicates.  This fixes a problem with --polymorphism.

make_hlds, unify_proc.nl, prog_util.nl:
	Output unification procedures for equivalence types.

polymorphism.nl:
	Ensure that this works even for unification procedures for
	equivalence types, which are a bit wierd since they are not
	quite type correct.

typecheck.nl:
	Don't attempt to typecheck unification predicates, since
	they are already type-correct when we construct them.
	In particular don't typecheck unification procedures for
	equivalence types, since it would report a spurious error.

mercury_to_mercury.nl:
	Remove a superfluous duplicate clause.
1995-01-20 10:02:03 +00:00
Fergus Henderson
1032e2a841 Change things so that only call/1 is builtin.
code_util.nl, polymorphism.nl, mercury_builtin.nl:
	Change things so that only call/1 is builtin.
	For call/N, we can implement them by hand in mercury_builtin.nl.
	(Procedure call overhead is the least of our worries right now.)

	Note that call/N still only works in the following mode.
		:- call (in, in, ..., in) is semidet.
	You can't use it to call det predicates.
1995-01-17 22:42:07 +00:00
Fergus Henderson
996b2584bb Don't assume that unification predicates always have exactly two
code_util.nl:
	Don't assume that unification predicates always have exactly two
	arguments, since polymorphism.nl may add extra arguments to them.
1995-01-14 18:46:45 +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
Fergus Henderson
1a977ea19a Replace all occurrences of `not(Vars, Goal)' with just
*.nl:
	Replace all occurrences of `not(Vars, Goal)' with just
	plain `not(Goal)'.

type_util.nl, switch_gen.nl:
	Higher-order pred types are not user-defined types.
	Add a `predtype' type category for them.

call_gen.nl:
	Change call_closure/2 to call_closure/3 (with liveinfo).
	Plus a little bit of random hacking.
1995-01-10 18:35:59 +00:00
Fergus Henderson
18b52a2d6c Change field(int, rval, int) to field(int, rval, rval), so
llds.nl, *.nl:
	Change field(int, rval, int) to field(int, rval, rval), so
	that the field number can be calculated at runtime
	(We need this for predicate closures).
	Also, remove the incr_hp(int) instruction and replace it
	with a heap_alloc(rval) rval.
	(We need to determine the space allocated at runtime
	for predicate closures, and also we want it to be an rval
	not an instruction so we can get conservative garbage collection
	to work.)

unify_gen.nl:
	More work for higher-order predicate closures.

std_util.nl:
	Recode `bool__and' and `bool__or' more elegantly.
1995-01-10 13:47:17 +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
67d15cc907 Added comprehensive optimization of detstack frame manipulation
frameopt, opt_util, code_uti, middle_recl:
	Added comprehensive optimization of detstack frame manipulation
	instructions, replacing the earlier limited one. In the process,
	moved a function from middle_rec to code_util, since frameopt
	could also use it.

switch_gen:
	Specialized the handling of switches with two cases to avoid
	pipeline breaks.

std_util:
	Added boolean and and or predicates.

set:
	Added membership enquiry function.

mercury_compile:
	Commented out a manual garbage collection point that was causing
	trouble.
1994-12-09 01:12:45 +00:00
Fergus Henderson
c3f704120a Renamed doit.pl as doit.swi.
doit.pl, doit.swi:
	Renamed doit.pl as doit.swi.

error.nl, code_util.nl, io.nu.nl, mercury_builtin.nl, portray.nl,
typecheck.nl, term_io.nl:
	Various changes required by SWI-Prolog and/or Sicstus Prolog.

swi_builtin.nl, swi_lib.nl, doit.swi, mc.swi, mercury_compile.doit.swi:
	Various stuff to get it working under SWI-Prolog.

doit.sp, mercury_compile.doit.sp:
	Various stuff used in an (as yet unsuccessful) attempt to get
	it to work under Sicstus Prolog.

make_hlds.nl, unify_proc.nl:
	Do some stuff for complicated unifications.
	(Note: this may break things!  If things stop working,
	let me know and I'll fix it.)
1994-10-19 10:19:29 +00:00
Fergus Henderson
f87d753f93 Remove the "detect builtins" pass.
builtins.nl, call_gen.nl, code_util.nl, mercury_compile.nl, modes.nl:
	Remove the "detect builtins" pass.
	Instead, determing which predicate calls are builtins
	happens during the mode analysis pass.  modes.nl calls
	code_util__is_builtin.

io.nl, io.nu.nl:
	Move io__get/set_globals from io.nu.nl to io.nl.

modes.nl, mode_errors.nl:
	Warn about predicates which have no modes.

arg_info.nl:
	Generate correct arg_info for all predicates, including
	imported predicates and predicates with no clauses.

typecheck.nl:
	Don't warn about predicate having no clauses if the
	the predicate is a builtin.
1994-10-05 15:56:55 +00:00
Fergus Henderson
51edae00c4 Make sure that we output a local entry label, not a global one,
code_util.nl, llds.nl:
	Make sure that we output a local entry label, not a global one,
	when generating code for local (non-exported) procedures.

mercury_to_mercury.nl, hlds.nl:
	Remove declarations for some undefined predicates,
	caught by the new warning I added recently.

make_hlds.nl:
	Oops, forgot to check that in with my last change.
1994-10-03 15:58:21 +00:00
Fergus Henderson
d8c9479872 Override the MERCURY_LIB_OBJS variable when invoking ml.
Makefile.mercury:
	Override the MERCURY_LIB_OBJS variable when invoking ml.
	This avoids some bootstrapping problems.
	Also, add mercury_compile.nu.

Makefile.common:
	Bump NU-Prolog's -u option up to 2000 (8M), to avoid some memory
	problems.

array.nl, bintree.nl, char.nl, dir.nl, globals.nl, list.nl, map.nl, modes.nl,
prog_util.nl, stack.nl, std_util.nl, string.nl, term.nl:
	Avoid the use of implied modes.

code_info.nl, bimap.nl, make_hlds.nl, mercury_compile.nl,
mercury_to_mercury.nl, unify_proc.nl:
	Fix determinism errors which had previously not been discovered
	because of either implied modes or running out of memory.
	(Note that I had to change the interface to bimap__lookup, since
	it's not possible to make it bidirectional.)

code_util.nl, llds.nl, opt_debug.nl, value_number.nl:
	Rename `operator' as `binary_op'.

hlds.nl, code_info.nl, unify_gen.nl, llds.nl, opt_debug.nl, switch_gen.nl:
	*** Handle simple cases of higher-order pred terms. ***
	(We don't yet handle taking the address of an overloaded
	predicate or a predicate with multiple modes.
	We don't handle closures.  call/1 and call/N are not yet implemented.
	This has not yet been tested.)

make_hlds.nl:
	Modify the mode priority ordering so that semidet modes get
	selected before det ones.

llds.nl:
	Don't include the priority part of the mode number in the mangled
	label name.  *** Note: this will break some things! ***

mercury_compile.nl:
	Move the NU-Prolog hacks into mercury_compile.nu.nl.

switch_gen.nl:
	Fix a simple logic bug in handling the grab/slap of the code_info.

prog_io.nl, builtins.nl, int.nl:
	Fix bugs and omissions with handling of the new arithmetic operators.

prog_io.nl:
	As a quick hack, strip off calls to io__gc_call
	(this avoids spurious error messages which are due to
	the fact that we don't get mode analysis right in those cases).
1994-10-02 17:00:57 +00:00
Fergus Henderson
1a27233878 Make the handling of builtins a little more general.
call_gen.nl:
	Make the handling of builtins a little more general.

code_info.nl, unify_gen.nl:
	Use code_info__get_next_label_number rather than
	the lower-level routines code_info__get_label_count
	and set_label_count.

code_util.nl:
	Rame atom_to_operator as code_util__atom_to_binop
	and add code_util__atom_to_unop.

prog_io.nl, code_util.nl, llds.nl, int.nl, opt_debug.
	Add bitwise operators.
	Add array_index binary operator.
	Add hash_string unary operator.
	Add int__log2 predicate.
	Cast operands to (int) in llds.nl, so that we
	get integer comparisons and integer operations.

string.nl:
	Add string__hash predicate.

interpreter.nl:
	Use disjunction in semidet preds.

options.nl:
	Add --smart-indexing option (enabled by default).

switch_gen.nl:
	**** Generate a hash table lookup for string switches. ****
1994-09-30 21:42:27 +00:00
Zoltan Somogyi
8f3ebdbdd4 Created new module opt_util to hold utility functions needed by the
optimization modules.
1994-09-10 10:15:22 +00:00
Fergus Henderson
37474a09f1 Reorganize the LLDS representation to minimize duplication.
llds.nl, *_gen.nl, code*.nl, unify_proc.nl, peephole.nl:
	Reorganize the LLDS representation to minimize duplication.
1994-09-09 23:24:40 +00:00
Zoltan Somogyi
6037067537 Moved predicates that test properties of instrs from peephole.nl to
code_util.nl.
1994-09-03 06:50:12 +00:00
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