diff: change pass ordering

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Mar 30 22:20:35 AEST 1998


Estimated hours taken: 0.25

compiler/mercury_compile.m:
	Change the order of the passes to match that specified in
	notes/compiler_design.html: invoke check_typeclass.m
	(which checks the correctness of instance declarations)
	immediately after unique mode checking, before simplify.m
	and stratify.m.

	Note that for the purposes of mode inference, it would be
	nice to run a pass similar to the current check_typeclass
	pass *before* mode inference; this pass would would insert modes
	for all predicates declared as being instance methods, so that 
	we can do mode inference for such procedures even if the only
	call is via instance methods.

Index: mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.79
diff -u -u -r1.79 mercury_compile.m
--- mercury_compile.m	1998/03/20 02:58:08	1.79
+++ mercury_compile.m	1998/03/30 12:08:17
@@ -674,20 +674,21 @@
 		mercury_compile__maybe_dump_hlds(HLDS9, "09", "unique_modes"),
 		!,
 		
-		mercury_compile__check_stratification(HLDS9, Verbose, Stats, 
-			HLDS10, FoundStratError), !,
-		mercury_compile__maybe_dump_hlds(HLDS10, "10",
-			"stratification"), !,
-
-		globals__io_lookup_bool_option(warn_simple_code, Warn),
-		mercury_compile__simplify(HLDS10, Warn, no,
-			Verbose, Stats, HLDS11), !,
-		mercury_compile__maybe_dump_hlds(HLDS11, "11", "simplify"), !,
-
 		maybe_write_string(Verbose, 
 			"% Mode and type checking typeclass instances...\n"),
-		check_typeclass__check_instance_decls(HLDS11, HLDS12,
+		check_typeclass__check_instance_decls(HLDS9, HLDS10,
 			FoundTypeclassError),
+		mercury_compile__maybe_dump_hlds(HLDS10, "10", "typeclass"), !,
+
+		mercury_compile__check_stratification(HLDS10, Verbose, Stats, 
+			HLDS11, FoundStratError), !,
+		mercury_compile__maybe_dump_hlds(HLDS11, "11",
+			"stratification"), !,
+
+		globals__io_lookup_bool_option(warn_simple_code, Warn),
+		mercury_compile__simplify(HLDS11, Warn, no,
+			Verbose, Stats, HLDS12), !,
+		mercury_compile__maybe_dump_hlds(HLDS11, "12", "simplify"), !,
 
 		%
 		% work out whether we encountered any errors

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list