[m-dev.] diff: always generate a `.rlo' file if `--aditi-only' is set

Simon TAYLOR stayl at cs.mu.OZ.AU
Wed May 24 16:26:01 AEST 2000



Estimated hours taken: 0.25

compiler/mercury_compile.m:
	Always generate a `.rlo' file when `--aditi-only' is set,
	even if the module does not contain any RL procedures.


Index: mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.164
diff -u -u -r1.164 mercury_compile.m
--- mercury_compile.m	2000/05/22 17:59:45	1.164
+++ mercury_compile.m	2000/05/24 06:15:40
@@ -442,13 +442,8 @@
 		% magic sets can report errors.
 		{ module_info_num_errors(HLDS50, NumErrors) },
 		( { NumErrors = 0 } ->
-		    { module_info_get_do_aditi_compilation(HLDS50, Aditi) },
-		    ( { Aditi = do_aditi_compilation } ->
-			mercury_compile__generate_rl_bytecode(HLDS50,
-				Verbose, MaybeRLFile)
-		    ;
-			{ MaybeRLFile = no }
-		    ),
+		    mercury_compile__maybe_generate_rl_bytecode(HLDS50,
+				Verbose, MaybeRLFile),
 		    ( { AditiOnly = yes } ->
 		    	[]
 		    ; { HighLevelCode = yes } ->
@@ -1067,18 +1062,63 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred mercury_compile__generate_rl_bytecode(module_info, bool,
+:- pred mercury_compile__maybe_generate_rl_bytecode(module_info, bool,
 		maybe(rl_file), io__state, io__state).
-:- mode mercury_compile__generate_rl_bytecode(in, in, out, di, uo) is det.
+:- mode mercury_compile__maybe_generate_rl_bytecode(in, in,
+		out, di, uo) is det.
 
-mercury_compile__generate_rl_bytecode(ModuleInfo, Verbose, MaybeRLFile) -->
-	maybe_write_string(Verbose, "% Generating RL...\n"),
-	maybe_flush_output(Verbose),
-	rl_gen__module(ModuleInfo, RLProcs0),
-	mercury_compile__maybe_dump_rl(RLProcs0, ModuleInfo, "", ""),
-	rl_opt__procs(ModuleInfo, RLProcs0, RLProcs),
-	mercury_compile__maybe_dump_rl(RLProcs, ModuleInfo, "", ".opt"),
-	rl_out__generate_rl_bytecode(ModuleInfo, RLProcs, MaybeRLFile).
+mercury_compile__maybe_generate_rl_bytecode(ModuleInfo,
+		Verbose, MaybeRLFile) -->
+	globals__io_lookup_bool_option(aditi, Aditi),
+	(
+		{ Aditi = yes },
+		{ module_info_get_do_aditi_compilation(ModuleInfo,
+			AditiCompile) },
+		(
+			{ AditiCompile = do_aditi_compilation },
+
+			%
+			% Generate the RL procedures.
+			%
+			maybe_write_string(Verbose, "% Generating RL...\n"),
+			maybe_flush_output(Verbose),
+			rl_gen__module(ModuleInfo, RLProcs0),
+			mercury_compile__maybe_dump_rl(RLProcs0,
+				ModuleInfo, "", ""),
+
+			%
+			% Optimize the RL procedures.
+			%
+			rl_opt__procs(ModuleInfo, RLProcs0, RLProcs),
+			mercury_compile__maybe_dump_rl(RLProcs,
+				ModuleInfo, "", ".opt"),
+
+			%
+			% Convert the RL procedures to bytecode.
+			%
+			rl_out__generate_rl_bytecode(ModuleInfo,
+				RLProcs, MaybeRLFile)
+		;
+			{ AditiCompile = no_aditi_compilation },
+			{ MaybeRLFile = no },
+
+			globals__io_lookup_bool_option(aditi_only, AditiOnly),
+			(
+				{ AditiOnly = yes },
+
+				% Always generate a `.rlo' file if compiling
+				% with `--aditi-only'.
+				{ RLProcs = [] },
+				rl_out__generate_rl_bytecode(ModuleInfo,
+					RLProcs, _)
+			;
+				{ AditiOnly = no }
+			)
+		)
+	;
+		{ Aditi = no },
+		{ MaybeRLFile = no }
+	).
 
 %-----------------------------------------------------------------------------%
 
--------------------------------------------------------------------------
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