diff: Bug fix in frameopt/labelopt

Andrew Bromage bromage at cs.mu.oz.au
Wed Jul 16 16:15:55 AEST 1997


G'day all.

Zoltan, could you please review this one?  Thnaks.

Cheers,
Andrew Bromage



Estimated hours taken: 0.2

This fixes (or, more correctly, hides) a limitation of frameopt.m where
it does not always work when labelopt is turned off.  The problem is
now documented in frameopt.m.

compiler/handle_options.m:
	Fix detailed above.

compiler/frameopt.m:
	Limitation documented.


Index: frameopt.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/frameopt.m,v
retrieving revision 1.57
diff -u -r1.57 frameopt.m
--- frameopt.m	1997/05/21 02:13:25	1.57
+++ frameopt.m	1997/07/16 05:55:34
@@ -67,6 +67,16 @@
 %
 % Since the second transformation is a bigger win, we prefer to use it
 % whenever both transformations are possible.
+%
+% NOTE: This module requires label optimisation to be turned on because
+% it cannot handle code sequences of the form
+%
+%	label1:
+%	label2:
+%
+% The "null block" between the labels makes this choke.  This should
+% be handled by handle_options, but if you see an error of the form
+% "label in substitute_labels_instr", this is a possible cause.
 
 %-----------------------------------------------------------------------------%
 
Index: handle_options.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/handle_options.m,v
retrieving revision 1.23
diff -u -r1.23 handle_options.m
--- handle_options.m	1997/05/20 01:51:48	1.23
+++ handle_options.m	1997/07/16 05:51:19
@@ -291,6 +291,14 @@
 			accumulating(IntermodDirs))
 	;
 		[]
+	),
+	
+	% --optimize-frames implies --optimize-labels
+	globals__io_lookup_bool_option(optimize_frames, OptFrames),
+	( { OptFrames = yes } ->
+		globals__io_set_option(optimize_labels, bool(yes))
+	;
+		[]
 	).
 
 :- pred convert_grade_option(string::in, option_table::in, option_table::out)




More information about the developers mailing list