[m-dev.] diff: minor improvement for RL optimization

Simon Taylor stayl at cs.mu.OZ.AU
Wed May 19 14:44:48 AEST 1999



Estimated hours taken: 1

compiler/rl_opt.m:
compiler/rl_block_opt.m:
	Make it easier to turn off individual optimizations.


Index: rl_block_opt.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/rl_block_opt.m,v
retrieving revision 1.2
diff -u -u -r1.2 rl_block_opt.m
--- rl_block_opt.m	1999/03/08 06:07:14	1.2
+++ rl_block_opt.m	1999/05/19 04:34:22
@@ -507,6 +507,7 @@
 	dag_get_output_loc_map(Locs),
 	dag_get_node_info_map(NodeInfoMap0),
 	{ NodeInfo0 = node_info(Instr, OutputRels0) },
+	dag_get_flags(Flags),
 	(
 		% Look for a union and a difference which can be
 		% changed into a union_diff.
@@ -518,6 +519,8 @@
 		% B-tree indexing a zero arity relation would be pretty silly.
 		{ Schema \= [] },
 
+		{ list__member(add_uniondiff, Flags) },
+
 		{
 			UnionInputLocs = [DiffLoc0, IOLoc0],
 			rl_block_opt__get_difference_info(NodeInfoMap0, Locs,
@@ -567,11 +570,15 @@
 			[]	
 		)
 	;
+		{ list__member(merge_output_projections, Flags) }
+	->
 		% If there are multiple projections of this node,
 		% combine them into one instruction. If the conditions
 		% have a key range, we insist that they all have the
 		% same one.
 		rl_block_opt__merge_output_projections(Node, Changed)
+	;
+		{ Changed = no }	
 	).
 
 %-----------------------------------------------------------------------------%
Index: rl_opt.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/rl_opt.m,v
retrieving revision 1.1
diff -u -u -r1.1 rl_opt.m
--- rl_opt.m	1998/12/06 23:45:32	1.1
+++ rl_opt.m	1999/05/19 04:34:53
@@ -1,5 +1,5 @@
 %-----------------------------------------------------------------------------%
-% Copyright (C) 1998 University of Melbourne.
+% Copyright (C) 1998-1999 University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
@@ -64,6 +64,7 @@
 	),
 
 	globals__io_lookup_bool_option(optimize_rl, Opt),
+	globals__io_lookup_bool_option(optimize_rl_index, OptIndex),
 	( { Opt = yes } ->
 		% rl_block_opt.m requires liveness to have been run.
 		maybe_write_string(VeryVerbose, 
@@ -81,8 +82,14 @@
 		maybe_write_string(VeryVerbose, NameStr),
 		maybe_write_string(VeryVerbose, "..."),
 		maybe_flush_output(VeryVerbose),
-		rl_block_opt([add_uniondiff, merge_output_projections],
-			Info15, Info20),
+
+		{ Flags0 = [merge_output_projections] },
+		{ OptIndex = yes ->
+			Flags = [add_uniondiff | Flags0]
+		;
+			Flags = Flags0
+		},
+		rl_block_opt(Flags, Info15, Info20),
 		maybe_write_string(VeryVerbose, "done.\n"),
 		rl_opt__maybe_dump_rl(Debug, NameStr,
 			"20", "block_opt", Info20)
@@ -99,7 +106,6 @@
 	rl_opt__maybe_dump_rl(Debug, NameStr, "30", "liveness", Info30),
 	maybe_write_string(VeryVerbose, "done.\n"),
 
-	globals__io_lookup_bool_option(optimize_rl_index, OptIndex),
 	( { OptIndex = yes } ->
 		maybe_write_string(VeryVerbose,
 			"% Optimizing sorting and indexing in "),
--------------------------------------------------------------------------
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