[m-dev.] for review: conditionally include Aditi support

Simon Taylor stayl at cs.mu.OZ.AU
Tue Apr 27 17:06:52 AEST 1999


Hi,

On second thoughts, its probably better to do the conditional compilation
in rl_out.m rather than mercury_compile.m, since that way it will annoy
less people. Here's a relative diff - the changes to mercury_compile.m
have been undone.

Simon.


Estimated hours taken: 3

Preprocess mercury_compile.m and rl_file.m to remove dependencies
on rl_code.m. This is done to avoid major mode analysis efficiency
problems on the alias branch.

Mmake.common.in:
	Include the Aditi support by default.

compiler/Mmakefile:
	Add rules to process `.pp' files.

compiler/rl_out.pp:
compiler/rl_file.pp:
	Add preprocessing to remove dependencies on rl_code.m.

compiler/rl_out.m:
compiler/rl_file.m:
	Removed.

compiler/rl_out.m:
compiler/rl.m:
compiler/rl_gen.m:
compiler/magic.m:
	Move the code to convert schemas to strings into rl.m,
	since these are not just used for RL output.


--- rl_out.m	Tue Apr 27 16:50:44 1999
+++ rl_out.pp	Fri Apr 23 17:01:54 1999
@@ -11,18 +11,21 @@
 % See $ADITI_ROOT/src/rosi/rlo_spec.tex for a partial specification 
 % of the bytecodes. (copy in ~stayl/aditi/src/rosi/rlo_spec.tex)
 %
-% Be sure not to add unnecessary dependencies on this module, since
-% compiling the code in rl_code.m is very inefficient in the alias branch.
-% Any dependencies there are should be in `.pp' files bracketed by
-% #ifdef INCLUDE_ADITI_OUTPUT ... #else ... #endif
-% as in mercury_compile.pp and rl_file.pp.
+% The conditional compilation in this module is done to avoid 
+% major efficiency problems when compiling the large disjunctions
+% in rl_code.m using the alias branch mode checker.
 %
 %-----------------------------------------------------------------------------%
 :- module rl_out.
 
 :- interface.
 
-:- import_module rl, rl_code, rl_file, hlds_module, tree.
+:- import_module rl, rl_file, hlds_module, tree.
+#if INCLUDE_ADITI_OUTPUT	% See ../Mmake.common.in.
+:- import_module rl_code.
+#else
+#endif
+
 :- import_module list, io, std_util.
 
 	% Output schemas for locally defined base and derived relations to
@@ -39,6 +42,7 @@
 :- pred rl_out__generate_rl_bytecode(module_info::in, list(rl_proc)::in, 
 		maybe(rl_file)::out, io__state::di, io__state::uo) is det.
 
+#if INCLUDE_ADITI_OUTPUT	% See ../Mmake.common.in.
 	% Given a predicate to update the labels in a bytecode, update
 	% all the labels in a tree of bytecodes.
 :- pred rl_out__resolve_addresses(pred(bytecode, bytecode),
@@ -46,13 +50,21 @@
 :- mode rl_out__resolve_addresses(pred(in, out) is det, in, out) is det.
 
 :- type byte_tree == tree(list(bytecode)).
+#else
+#endif
 
 %-----------------------------------------------------------------------------%
 :- implementation.
 
 :- import_module code_util, hlds_data, hlds_pred, prog_data, prog_out.
 :- import_module llds, globals, options, rl_code, tree, type_util, passes_aux.
-:- import_module rl_exprn, rl_file, getopt, modules, prog_util, magic_util.
+:- import_module rl_file, getopt, modules, prog_util, magic_util.
+
+#if INCLUDE_ADITI_OUTPUT	% See ../Mmake.common.in.
+:- import_module rl_exprn.
+#else
+#endif
+
 :- import_module assoc_list, bool, char, int, map, multi_map, require, set.
 :- import_module string, term, tree, varset.
 
@@ -136,6 +148,8 @@
 	
 %-----------------------------------------------------------------------------%
 
+#if INCLUDE_ADITI_OUTPUT	% See ../Mmake.common.in,
+
 rl_out__generate_rl_bytecode(ModuleInfo, Procs, MaybeRLFile) -->
 	{ module_info_name(ModuleInfo, ModuleName0) },
 	module_name_to_file_name(ModuleName0, ".rlo", yes, RLOName),
@@ -269,7 +283,13 @@
 		[]
 	),
 	maybe_write_string(Verbose, "done\n").
+#else
+rl_out__generate_rl_bytecode(_, _, _) -->
+	{ error(
+	"rl_out.pp: `--aditi' requires `INCLUDE_ADITI_OUTPUT'") }.
+#endif
 	
+#if INCLUDE_ADITI_OUTPUT
 :- pred rl_out__generate_proc_bytecode(rl_proc::in, 
 		rl_out_info::in, rl_out_info::out) is det.
 
@@ -1920,6 +1939,9 @@
 			N,O,P,Q,R,S,T,U,V,W,X,_),
 	Info = rl_out_info(A,B,C,D,E,F,G,H,I,J,K,L,M,
 			N,O,P,Q,R,S,T,U,V,W,X,TmpVars).
+
+#else	% !INCLUDE_ADITI_OUTPUT
+#endif
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
--- Mmakefile	Tue Apr 27 16:53:57 1999
+++ Mmakefile2	Fri Apr 23 16:41:30 1999
@@ -102,7 +102,7 @@
 
 # we need to make sure the .pp files get converted to .m before
 # we do the make depend
-mercury_compile.depend: mercury_compile.m rl_file.m
+mercury_compile.depend: rl_file.m rl_out.m
 
 .PHONY: all
 all:		mercury nuprolog sicstus
@@ -172,7 +172,7 @@
 	for file in *.pp; do \
 		if [ "$$file" != "*.pp" ]; then \
 			rm -f `basename $$file .pp`.m; \
-		fi \
+		fi; \
 	done
 
 realclean:
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list