Commit Graph

17 Commits

Author SHA1 Message Date
Fergus Henderson
63ffdba4b9 Add a comment about `det' unifications to the discussion of
Estimated hours taken: 0.25

compiler/prog_data.m:
	Add a comment about `det' unifications to the discussion of
	`real' and `fake' unifications of clobbered insts.
1997-04-10 20:20:43 +00:00
Zoltan Somogyi
91c4330db7 The first half of a change to introduce nondet pragma C goals.
Estimated hours taken: 12

The first half of a change to introduce nondet pragma C goals.
This half makes the necessary modifications to the HLDS; the next
half will modify the LLDS and emit it.

prog_data:
	Add a new pragma type for nondet pragma c_codes; these specify
	the names of a a bunch of variables to save across backtracking,
	and a list of label names to which backtracking may take place.

	Rename is_recursive to may_call_mercury, since this is a more
	direct expression of the meaning.

prog_io:
	Move much of the functionality to new files.

prog_io_dcg, prog_io_goal, prog_io_pragma, prog_io_util:
	New files, made up of pieces of prog_io.

hlds_goal:
	Add an extra argument to the pragma_c_goals to store the extra
	information present in the new type of pragma c_codes.

det_analysis:
	Take into account that the new type of pragma_c goal may have
	more than one solution.

goal_util:
	Rename variables in the new field of pragma_cs.

live_vars:
	Allocate stack slots to the saved variables in the new type of pragma_c
	goals.

make_hlds:
	Handle the new type of pragma_c goals.

mercury_output, hlds_out:
	Output the new type of pragma_c goals.

garbage_out:
	Rename type "det" to "frame_type".

others:
	Ignore one more arg of pragma_c goals or import prog_io_util.
1997-01-27 07:45:40 +00:00
Simon Taylor
bb2b816787 * Inter-module unused argument removal.
Estimated hours taken: 100

* Inter-module unused argument removal.

* Allow the user to specify which directories should be searched
for .opt files.

* Enhancements to simplify.m and common.m which will be useful for
partial deduction.

compiler/options.m
	Added and documented options:
	--intermod-unused-args to enable inter-module unused argument removal.
	--intermod-directory <dir>, same as --search-directory except used
		to locate .opt files.
	--use-search-directories-for-intermod - use the search directories
		for .opt files as well.
	--warn-simple-code - a flag to control the warnings produced by
		simplify.m so that they respect --inhibit-warnings.

compiler/unused_args.m
	Use the unused argument info from the .opt file.
	Clobber the dependency_info if any new preds were added.

compiler/hlds_module.m
	Added a field to the module_info to store unused argument
	information from .opt files.

compiler/prog_data.m
	Add :- pragma unused_args to hold unused argument information.
	This should only be used in .opt files.

compiler/make_hlds.m
	Build the unused_arg_info field in the module_info.
	Check that pragma unused_args only appears in .opt files.
	Fill in the non-locals field in the goal_info for the builtin
	stubs so that mode analysis computes the correct instmap delta.

compiler/intermod.m
	Read in the unused argument information for the current module when
	compiling to C. This is used to ensure that clauses are produced with
	the correct number of removed arguments (it may be possible to remove
	more arguments with the information from other modules).
	Fix a bug in the handling of module qualified function calls and
	higher-order predicate constants.

compiler/handle_options.m
	Handle --intermod-unused-args and
	--use-search-directories-for-intermod.

compiler/mercury_compile.m
	Run the entire front end and polymorphism (not just up to
	typechecking) when building the .opt file with
	--intermod-unused-args.
	Use the new interface to simplify.m, remove calls to excess.m
	and common.m.

compiler/code_util.m
compiler/llds_out.m
	When generating local code for a specialized version of a predicate
	from another module, put this module's name on the label to avoid
	link errors.

compiler/higher_order.m
	Don't add the originating module name to the name of the specialized
	version, since that is now done in code_util.m.
	Clobber the dependency graph so that inlining will work on the
	specialized versions in profiling grades (this will cause slightly
	slower compilation in profiling grades, something I need to fix).

compiler/simplify.m
	Merge a branching goal and an adjacent switch where the branches
	of the first goal contain extra information about the switched
	on variable of the second goal.
	Merge the excess assignments and common subexpression elimination
	passes into simplify.m.

compiler/excess.m
	The functionality of this module is now in simplify.m, but I'll
	leave it here for now.

compiler/instmap.m
	Added predicates instmap__bind_var_to_functor and
	instmap_delta_bind_var_functor to which take a var, cons_id
	and an instmap and adjust the inst of the var. This is used to
	update the instmap at the beginning of each case in a switch.
	Fix a bug in merge_instmap_delta where variables whose inst had
	information added in one branch of a switch, disj, or ite had that
	changed inst included in the instmap_delta for the entire
	branched goal.

compiler/mode_util.m
	Use instmap_delta_bind_var_to_functor in recompute_instmap_delta.
	Added predicate bind_inst_to_functor which takes a ground or bound
	inst and a cons_id and adjusts the top level of the inst to be bound
	to that cons_id. Other types of inst are left unchanged.
	Change recompute_instmap_delta so that the switched on variable of
	a switch is bound to the functor in each case even if the binding
	unification has been removed. Added a boolean argument to request
	recomputation of instmap_deltas for atomic goals.

compiler/modes.m
compiler/unique_modes.m
	Make sure that the instmap_delta for each branch of a switch
	includes the extra information added by the functor test.

compiler/common.m
	Removed the goal traversal. Leave preds to be called by simplify.m
	to optimise common unifications and calls.
	Warn about and eliminate multiple calls to a predicate with the same
	input arguments.
	Replace deconstructions of known terms with assignments to the output
	variables where this would not make more variables live at stack
	flushes.

compiler/follow_code.m
	Exported move_follow_code_select.
	Don't move follow code into erroneous branches.

library/string.nu.nl
	Added string__contains_char/2.

compiler/base_type_layout.m
compiler/special_pred.m
compiler/vn_order.m
library/mercury_builtin.m
	Removed duplicate calls.

doc/user_guide.texi
	Documented options.

tests/warnings/duplicate_call.m
tests/warnings/duplicate_call.exp
	Test duplicate call warning.
1997-01-20 03:27:59 +00:00
Fergus Henderson
d0e054223a Allow `pragma export' for semidet predicates and for det/semidet functions.
Estimated hours taken: 4

Allow `pragma export' for semidet predicates and for det/semidet functions.
(Previously it only worked for det predicates.)

prog_data.m:
	Add a pred_or_func field to the pragma_export struct.

prog_io.m:
	Add code to parse `pragma export' declarations for functions,
	e.g. `pragma export(foo(in) = out, "foo")'.

mercury_to_mercury.m:
	Add code to print out `pragma export' declarations for functions.

module_qual.m:
	Change export/3 to export/4.

export.m:
	Handle semidet procedures -- the C function returns TRUE/FALSE
	depending on whether the Mercury procedure succeeded or failed.

	Handle functions -- for det functions whose return value has
	mode `out', the Mercury function return value is returned as the C
	function return value.

	Don't call save_registers() after returning from call_engine(),
	since call_engine() now saves them itself.

	When generating header files, don't make up argument names
	for the function prototypes, instead just leave the arguments
	unnamed.  Also, make sure the `#ifndef HEADER_NAME_H' comes
	at the very start of the file, before #include "imp.h".
1996-12-20 17:34:22 +00:00
David Overton
37c5340f1c Added code to various sections of the compiler to parse
Estimated hours taken: 80

Added code to various sections of the compiler to parse
`pragma fact_table' declarations and add them to the HLDS.

Added output of fact_table dependencies to .d and .dep files.

Added a new module fact_table.m for parsing the actual fact tables and
generating code.  This is not finished yet.

Added ability to have `pragma c_code' declarations for Mercury
functions.

Modified Files:
   compiler/hlds_module.m
	Added predicate `module_info_set_pred_info' to add a `pred_info'
	entry to `module_info' given a `pred_id'.

   compiler/make_hlds.m
	Added code to handle new `pragma fact_table' declarations.
	New predicate `module_add_pragma_fact_table' which calls the
	fact compiler in fact_table.m to compile the fact table and
	generate C code to access it.  Then add the C code to the HLDS
	as a `pragma c_code'.

	Mercury functions can now have `pragma c_code' declarations.

   compiler/intermod.m
   	Included PredOrFunc argument in call to mercury_output_pragma_c_code.

   compiler/mercury_compile.m
	Added parameters to some predicates to allow fact table
	dependency information to be passed around.

   compiler/mercury_to_mercury.m
   	Handle output of `pragma fact_table' declarations.
	Handle output of `pragma c_code' declarations for functions.

   compiler/module_qual.m
   	Handle module qualification of `pragma fact_table'
	declarations.

   compiler/modules.m
   	New predicate `get_fact_table_dependencies' to work out which
	fact tables a module depends on.
	Changes to `write_dependency_file' to write out fact table
	dependencies.
	Changes to some other predicates to allow fact table
	dependencies to be passed around the module.

   compiler/prog_data.m
   	Added new functor `fact_table(sym_name, arity, string)'
	to the `pragma_type' type.
	Added a `pred_or_func' field to the `c_code' functor of the
	`pragma_type' type.

   compiler/prog_io.m
   	Added code to `parse_pragma_type' to parse `:- pragma fact_table'.
	Here is a sample declaration.  The facts are in a file called
	"factfile":

	:- pred facts(string, int, float).
	:- mode facts(out, out, out) is multidet.
	:- pragma fact_table(facts/3, "factfile").

	Mercury functions can now have `pragma c_code' declarations.
	Here is a sample declaration:

	:- func c_add(int, int) = int.
	:- pragma c_code(non_recursive, c_add(A::in, B::in) = (C::out), "
		C = A + B;
		").


Added Files:
   compiler/fact_table.m
   	Module not yet finished, but it compiles correctly and doesn't
	interfere with the rest of the compiler.

	Main purposes of the module are to parse the fact table
	file, perform type, mode and determinism checks and generate C
	code for the fact table.

	Completed so far:  parsing, type and mode checking,
	determinism inference.  A C array is output to represent the
	table, but no functions are produced yet to access it.
1996-12-17 23:40:31 +00:00
Fergus Henderson
4c3bbe13e2 Add some comments.
Estimated hours taken: 0.5

compiler/prog_io.m:
compiler/prog_data.m:
	Add some comments.
1996-12-14 20:27:25 +00:00
Zoltan Somogyi
5d64b759db The main changes are
Estimated hours taken: 12

The main changes are

1	associating a name with the arguments of constructors

2	removing the follow_vars field from calls, higher-order calls
	and complicated unifications, since they are not used

3	merging the follow_vars and store_alloc passes, since they logically
	belong together

4	add a new module, lco, for detecting opportunities for last
	call optimization modulo constructor application; it won't
	actually apply the optimization until the mode system becomes
	expressive enough to handle it (this module detects 529 opportunities
	in the compiler and library)

5	make "-O3 --optimize-value-number" do the right thing; previously,
	it used not to apply value numbering because the vnrepeat option
	defaulted to zero

6	don't refer to .err2 files anymore; use .err instead.

prog_data:
	The list associated with each value of type "constructor" now
	contains not only the types of the arguments but their names as well.

equiv_type, hlds_data, hlds_out, make_hlds, mercury_to_{goedel,mercury},
mode_util, module_qual, shapes, type_util, unify_proc:
	Modify the traversal of type definitions to account for the names
	in the lists inside values of type "constructor".

prog_io:
	Parse argument names. An unrelated change is that we now
	check whether :- pred declarations give modes to some of their
	arguments but not to all, in which case we return an error.

hlds_goal:
	Remove the follow_vars field from calls, higher-order calls
	and complicated unifications.

*.m:
	Handle the new arities of calls, higher order calls and complicated
	unifications.

mercury_compile:
	Don't call follow_vars directly anymore, but do call lco if its option
	is set. Also flush the main output before a call to maybe_report_stats
	to prevent ugly output.

store_alloc:
	Call follow_vars directly.

follow_vars:
	Expose the initialization and traversal predicates for store_alloc.

lco:
	Find opportunities for last call optimization modulo constructor
	application.

passes_aux:
	Add a HLDS traversal type for lco.

optimize:
	Consider the vnrepeat count to be zero unless value numbering is on.

options:
	Set the default value of vnrepeat to 1.

modules:
	Don't refer to .err2 files.
1996-11-04 06:26:51 +00:00
Simon Taylor
5d3fc10571 - Inter-module optimization.
Estimated hours taken: 50

- Inter-module optimization.
Allows inlining and higher-order specialization across module boundaries.
Gives ~10% speed-up on the compiler compiling to C.

- The code to handle explicit type qualification.
The test to recognise a type qualification is semidet_fail'ed
until we work out which operator to use.

- Improved data structures in module_qual.m.
Also, module qualification of the modes of lambda expressions is now
done in make_hlds.m, since it is more convenient now that type
qualifications are module qualified there also.

* Type qualification and module qualifiers on higher-order predicate
constants and function calls still need to be implemented before this
will work on all programs.

* To create a version of a program using this optimization method,
add --intermodule-optimization to MCFLAGS, mmake change_clean,
mmake depend, then make as normal.

* mmake change_clean removes the executable, the .dep file and all
.cs and .os.

compiler/intermod.m
	Handle input and output of .opt files.

compiler/modules.m
	Added some new dependencies in the .d files for
	the .c and .opt files if inter-module optimization
	is being used.
	Also added .opt and .optdate to the list of things for
	mmake realclean to remove.
	Added a target, change_clean, which removes only those files
	necessary to force a rebuild using --intermodule-optimization.
	These are <module>, <module>.dep and all the .c, .o and .s files.

compiler/options.m
	Added options:
		--make-optimization-interface - make the .opt file.
		--intermodule-optimization - puts extra dependencies
			into .d files and turns on input of .opt files.

compiler/make_hlds.m
	Changes to give items from .opt files the correct import_status.
	Also, when matching pragma_c_code clauses to the declared modes
	of the predicates, expand and match on the initial and final insts
	of the argument modes, not the modes themselves, since items in
	.opt files have the modes expanded.
	Module qualify the modes of lambda expressions in unravel_unification
	rather than during mode analysis.
	Parse explicit type qualifications, and add these to the vartypes.
	At the moment this is disabled.

compiler/typecheck.m
	Get the head type params from the tvarset, not from the arg types,
	so that tvars in type qualifications are included.
	Added checks to prevent matching of predicates, functions and
	constructors which should not be visible to a clause.

compiler/module_qual.m
	Module qualify explicit type qualifications.
	More efficient data structures.

compiler/mercury_to_mercury.m
	Export some predicates. Make sure C code strings are properly
	quoted in the .opt files.

compiler/hlds_out.m
	Output function calls correctly. Alter hlds_out__write_goal to write
	out type qualifications on all functors if writing a .opt file.

compiler/hlds_pred.m
	Added a new import_status opt_imported for clauses and declarations
	read from a .opt file. Pred and func declarations read from a .opt
	file get an `opt_decl' import_status so that the compiler doesn't
	expect clauses for them and local preds can't use them.
	Also added import_status abstract_imported and abstract_exported
	to describe types which have only an abstract definition imported
	or exported.
	Added a field to clauses_info to store the map(var, type) from
	explicit type qualifications.
	Renamed pred_info_set_status/3 to pred_info_set_import_status/3 to
	be consistent with pred_info_import_status/2.

compiler/hlds_data.m
	Added an import_status field to the hlds__mode_defn and
	hlds__inst_defn so that intermod.m knows what has already
	been exported.

compiler/equiv_type.m
	Pass out the equiv_map and export a predicate used to
	expand type qualifications.

compiler/dead_proc_elim.m
	Remove non-optimized versions of opt_imported preds. All
	optimizations must give the optimized version an import_status
	of local.

compiler/code_util.m
	Changed code_util__make_local_entry_label so that `localcall's
	are used for recursive calls in exported predicates.

compiler/code_aux.m
	Changed code_aux__contains_only_builtins_2 so that it doesn't
	check for complicated unifies, since any time this is called,
	complicated unifies have either not been created (when called
	when writing the .opt files) or have been converted to calls
	(when called during inlining).

compiler/higher_order.m
	Make sure that the specialized versions get unique names.

compiler/mercury_compile.pp
	Add calls to intermod.m predicates.

compiler/bytecode_gen.m
	Bracketed some '->'/2 insts so that they can be parsed by SICStus.

compiler/peephole.m
	Replace computed_gotos where all the targets are the same with
	an unconditional goto.

compiler/notes/COMPILER_DESIGN
	Documented intermod.m.

library/list.m
	Added list__all_same/1, which is true if all elements of a list are
	identical. Also added list__last/2, which returns the final element
	of a list, failing on the empty list.

library/io.m
	Change the format specifier for io__write_float so that the decimal
	point is always output. Without this, the result may not be a valid
	Mercury floating point constant.

library/varset.m
	Add predicate varset__create_name_var_map/2 to create a mapping
	from variable name to variable id given a varset. This is used
	in processing type qualifications.

scripts/Mmake.rules
scripts/Mmake.vars.in
	Add suffixes, rules and options for .opt and .optdate.

scripts/mercury_update_interface.in
	Work-around for a problem with parallel gmake. mc --make-interface
	was being run twice in a row on the same module. The first call
	mercury_update_interface moves module.int.tmp to module.int,
	then the second can't find module.int.tmp. The work-around is to
	ignore the exit status of the mv.

Some cleaning up:

compiler/*.m
	Fixed some out of date comments about the handling of
	complicated_unify. Also commented some dead code to do
	with generation of code for complicated_unify.

compiler/modes.m
compiler/mode_info.m
	Moved code to module qualify modes of lambda expressions into
	make_hlds.
	Moved predicates resolve_pred_overloading and find_matching_pred_id
	into typecheck, renaming with a typecheck__ prefix, so that these
	can be called from intermod.m.

compiler/undef_modes.m
compiler/undef_types.m
	Removed - their functionality is now in module_qual.m, except
	for checking for looping equivalence types.

compiler/no_builtin.m
compiler/nit_builtin.m
	Removed - they were made useless (if they weren't already) by
	the removal of the --builtin-module option.

compiler/notes/AUTHORS
	Updated student email addresses.
1996-09-11 08:56:25 +00:00
Zoltan Somogyi
a15c032df7 Flesh out the code already here for traversing module_infos,
Estimated hours taken: 4

passes_aux:
	Flesh out the code already here for traversing module_infos,
	making it suitable to handle all the passes of the back end.

mercury_compile:
	Use the traversal code in passes_aux to invoke the back end passes
	over each procvedure in turn. Print a one-line message for each
	predicate if -v is given (this fixes a long-standing bug).

excess.m, follow_code.m, follow_vars.m, live_vars.m, lveness.m, store_alloc.m:
	Remove the code to traverse module_infos, since it is now unnecessary.

export.m:
	Remove an unused argument from export__produce_header_file_2.

others:
	Move imports from interfaces to implementations, or in some cases
	remove them altogether.
1996-08-03 12:06:26 +00:00
Fergus Henderson
6ebe46c20a Implement a new `:- pragma source_file("<source file name>").' declaration,
Estimated hours taken: 3

Implement a new `:- pragma source_file("<source file name>").' declaration,
and a `#<line number>' directive, to make it more convenient to use
preprocessors or to use Mercury as a target language.

prog_data.m:
	Add `source_file' pragma.

make_hlds.m, module_qual.m:
	Ignore `pragma source_file' declarations.

mercury_to_mercury.m:
	Print `pragma source_file' declarations.
	Simplify a couple of unnecessarily complicated bits of code.

prog_io.m:
	Parse `source_file' pragmas.  When parsing items, check for them;
	handle `pragma source_file' declarations by keeping track of the
	source file name, and passing it to parser__parse_term/4.

	Also, change the "Error: module should start with a `:- module'
	declaration" message from an error to a warning.

	Also, fix the capitalization in a bunch of error messages:
	change from "Error: Blah" to "Error: blah".
1996-07-03 13:22:54 +00:00
Simon Taylor
5d9e4158f7 Module qualification of types, insts and modes.
Estimated hours taken: 45

Module qualification of types, insts and modes.

Added a new interface file - <module>.int3. This contains the
short interface qualified as much as possible given the information
in the current module.

When producing the .int and .int2 files for a module, the compiler uses
the information in the .int3 files of modules imported in the interface
to fully module qualify all items. The .int2 file is just a fully
qualified version of the .int3 file. The .int3 file cannot be overwritten
by the fully qualified version in the .int2 file because then mmake would
not be able to tell when the interface files that depend on that .int3
file really need updating.

The --warn-interface-imports option can be used to check whether
a module imported in the interface really needs to be imported in
the interface.


compiler/module_qual.m
Module qualify all types, insts and modes. Also checks for modules
imported in the interface of a module that do not need to be.

compiler/modules.m
The .int file for a module now depends on the .int3 files of imported
modules. Added code to generate the make rule for the .int file in the
.d file. There is now a file .date2 which records the last time the
.int2 file was updated.
The .int3 files are made using the --make-short-interface option
introduced a few weeks ago.

compiler/options.m
Added option --warn-interface-imports to enable warning about interface
imports which need not be in the interface. This is off by default
because a lot of modules in the library import list.m when they only
need the type list, which is defined in mercury_builtin.m.
Removed option --builtin-module, since the mercury_builtin name is wired
into the compiler in a large number of places.

compiler/prog_util.m
Added a predicates construct_qualified_term/3 and construct_qualfied_term/4
which take a sym_name, a list of argument term and a context for the /4
version and give a :/2 term.

compiler/type_util.m
Modified type_to_type_id to handle qualified types. Also added predicates
construct_type/3 and construct_type/4 which take a sym_name and a list of
types and return a type by calling prog_util:construct_qualified_term.

compiler/modes.m
On the first iteration of mode analysis, module qualify the modes of
lambda expressions.

compiler/mode_info.m
Added field to mode_info used to decide whether or not to module qualify
lambda expressions.

compiler/mode_errors.m
Added dummy mode error for when module qualification fails so that mode
analysis will stop.
Added code to strip mercury_builtin qualifiers from error messages to
improve readability.

compiler/typecheck.m
Strip builtin qualifiers from error messages.

compiler/llds.m
compiler/llds_out.m
compiler/opt_util.m
compiler/opt_debug.m
Change the format of labels produced for the predicates to use the
qualified version of the type name.

compiler/mercury_compile.pp
Call module_qual__module_qualify_items and make_short_interface.
Remove references to undef_modes.m and undef_types.m

compiler/undef_modes.m
compiler/undef_types.m
Removed, since their functionality is now in module_qual.m.

compiler/prog_io.m
Changed to qualify the subjects of type, mode and inst declarations.

compiler/*.m
Changes to stop various parts of the compiler from throwing away
module qualifiers.
Qualified various mercury_builtin builtins, e.g. in, out, term etc.
where they are wired in to the compiler.

compiler/hlds_data.m
The mode_table and user_inst_table are now abstract types each
storing the {mode | inst}_id to hlds__{mode | inst}_defn maps
and a list of mode_ids or inst_ids. This was done to improve the
efficiency of module qualifying the modes of lambda expressions
during mode analysis.
module_info_optimize/2 now sorts the lists of ids.
The hlds_module interface to the mode and inst tables has not changed.

compiler/hlds_module.m
Added yet another predicate to search the predicate table.
predicate_table_search_pf_sym_arity searches for predicates or
functions matching the given sym_name, arity and pred_or_func.

compiler/higher_order.m
Changed calls to solutions/2 to list__filter/3. Eliminated unnecessary
requantification of goals.

compiler/unused_args.m
Improved abstraction slightly.
1996-06-11 06:30:10 +00:00
Fergus Henderson
0e1e0b0b91 Implement recursive' and non_recursive' pragma c_code declarations.
Estimated hours taken: 4

Implement `recursive' and `non_recursive' pragma c_code declarations.
This allows the compiler to optimize cases when the C code
is known to not call Mercury code.  It's also necessary
to allow C code which modifies the hp register to work
(such code must be declared `non_recursive', otherwise
the registers will be saved and restored over it).
To make things bootstrap OK, the old pragma c_code declarations
default to `non_recursive'.

prog_data.m, hlds_goal.m:
	Add new field c_is_recursive to pragma c_code goals.

prog_io.m:
	Parse the new `recursive' and `non_recursive' pragma c_code
	declarations.

make_hlds.m:
	Pass the c_is_recursive field from the parse tree to the HLDS.

live_vars.m:
	For non-recursive C code, don't save variables on the stack.

code_gen.pp:
	For non-recursive C code, don't save variables on the stack,
	don't mark the succip as needing to be saved, and don't
	call save_registers() and restore_registers().

*.m:
	Change c_code/5 to c_code/6.
1996-06-10 17:18:50 +00:00
Fergus Henderson
d4ae54b727 Add a comment.
Estimated hours taken: 0.1

compiler/prog_data.m:
	Add a comment.
1996-05-27 17:12:25 +00:00
Fergus Henderson
b4cf70fccc Rename the pragma' type as pragma_type', to avoid bootstrapping
Estimated hours taken: 0.25

prog_data.m, prog_io.m:
	Rename the `pragma' type as `pragma_type', to avoid bootstrapping
	problems caused by my change to make `pragma' an operator.
1996-05-25 04:10:49 +00:00
Fergus Henderson
a8acf00f9d Add a new pragma `:- pragma obsolete(Name/Arity).';
Estimated hours taken: 3

Add a new pragma `:- pragma obsolete(Name/Arity).';
the effect of this pragma is that we issue a warning for
any call to the specified predicate(s) or function(s).

prog_data.m:
	Add new pragma type `obsolete'.
prog_io.m:
	Parse pragma `obsolete'.
hlds_pred.m, hlds_out.m:
	Add new pred_marker `obsolete'
make_hlds.m:
	When we encounter a pragma `obsolete', insert `request(obsolete)'
	in the pred_marker list for the specified predicate(s) and function(s).
simplify.m:
	For each predicate call, check if the called predicate has been
	marked as obsolete.  If so, return a `warn_obsolete' warning.
det_report.m:
	Add a new warning type `warn_obsolete', and add code to print
	the warning for this warning type.
det_analysis.m:
	Add a comment.
1996-05-21 19:09:28 +00:00
Fergus Henderson
60b9fa83b6 Implement higher-order functions.
Estimated hours taken: 12

Implement higher-order functions.

Add higher-order function terms
(function lambda expressions, e.g. `Func = (func(X) = Y :- Y is 2 * X)'
and higher-order function calls (apply/N, e.g. `Z = apply(Func, 42)').
Add higher-order function insts and modes.

hlds_goal.m:
	Add a new field pred_or_func to lambda_goal.

prog_data.m:
	Add a new field pred_or_func to pred_inst_info.

prog_io.m:
	Add support for parsing higher-order function terms and
	higher-order function insts and modes.

make_hlds.m:
	Add support for parsing higher-order function terms.

typecheck.m:
	Add support for type-checking higher-order function calls
	and higher-order function terms.

modes.m, mode_errors.m:
	Add support for mode-checking higher-order function calls
	and higher-order function terms.

higher_order.m:
	Handle higher-order function types and insts.

hlds_pred.m:
	Add new predicate pred_args_to_func_args, for extracting the
	function arguments and function return from the arguments
	of a predicate that is really a function.

*.m:
	Minor changes to handle new pred_or_func field in lambda_goals
	and pred_inst_infos.
1996-05-14 10:07:46 +00:00
Zoltan Somogyi
59e1f13a89 New file to hold the data type definitions from prog_io.
Estimated hours taken: 0.2

New file to hold the data type definitions from prog_io.
1996-04-24 01:02:32 +00:00