[m-dev.] for review: MLDS switch optimization

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Nov 14 18:40:35 AEDT 2000


Estimated hours taken: 0.25

compiler/ml_code_util.m:
compiler/mlds.m:
	Add some more comments, to clarify things that Tyson
	identified in his review of my last change.

Workspace: /home/pgrad/fjh/ws/hg
Index: compiler/ml_code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_util.m,v
retrieving revision 1.29
diff -u -d -r1.29 ml_code_util.m
--- compiler/ml_code_util.m	2000/11/09 04:08:26	1.29
+++ compiler/ml_code_util.m	2000/11/13 04:28:06
@@ -1735,6 +1735,8 @@
 			% each procedure
 			%
 
+				% XXX we should use the standard library
+				% `counter' type here
 			func_label :: mlds__func_sequence_num,
 			commit_label :: commit_sequence_num,
 			label :: label_num,
Index: compiler/mlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds.m,v
retrieving revision 1.39
diff -u -d -r1.39 mlds.m
--- compiler/mlds.m	2000/11/08 07:23:08	1.39
+++ compiler/mlds.m	2000/11/13 04:48:43
@@ -695,6 +695,9 @@
 		% Some (e.g. C#) also allow switches on strings.
 		% Most target languages only allow matching on values;
 		% only some (e.g. GNU C) allow matching on ranges.
+		% The MLDS code generator should only generate switches
+		% that the target will support.
+		%
 		% Note that unlike C, MLDS cases do NOT fall through; if you
 		% want to achieve that effect, you need to use an explicit goto.
 	;	switch(
@@ -833,7 +836,12 @@
 	;	match_range(mlds__rval, mlds__rval).  % match_range(Min, Max)
 						% matches if the switch value
 						% is between Min and Max,
-						% inclusive
+						% inclusive.
+						% Note that this should only be
+						% used if the target supports
+						% it; currently the C back-end
+						% supports this only if you're
+						% using the GNU C compiler.
 
 	% The switch_default specifies what to do if none of the switch
 	% conditions match.
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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