[m-rev.] for review: minor cleanup to mlds_to_ilasm.m

Fergus Henderson fjh at cs.mu.OZ.AU
Thu May 3 05:38:20 AEST 2001


On 03-May-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> compiler/mlds_to_ilasm.m:
> 	Clean up and generalize the code for handling foreign code:
> 	- Handle the case where a module contains code in more than one
> 	  foreign language, e.g. both C# and Managed C++.
> 	  (the rest of the compiler doesn't handles that case yet, though).
> 	- Make it easier to add new foreign languages.
> 	- Report an error if there is any foreign language that we don't
> 	  know about (e.g. C).

Also:

	- Remove some unnecessary imports.

--- mlds_to_ilasm.m	Thu May  3 05:35:57 2001
+++ mlds_to_ilasm.m.new	Thu May  3 05:34:33 2001
@@ -19,6 +19,8 @@
 :- import_module io.
 
 	% Convert the MLDS to IL and write it to a file.
+	% Also write any foreign language code in the MLDS
+	% to appropriate files.
 
 :- pred mlds_to_ilasm__output_mlds(mlds, io__state, io__state).
 :- mode mlds_to_ilasm__output_mlds(in, di, uo) is det.
@@ -28,25 +30,16 @@
 
 :- implementation.
 
-:- import_module globals, options, passes_aux.
-:- import_module builtin_ops, c_util, modules, tree.
-:- import_module hlds_pred. % for `pred_proc_id'.
-:- import_module prog_data, prog_out, llds_out.
-:- import_module rtti, type_util, error_util.
-
-:- import_module ilds, ilasm, il_peephole.
-:- import_module ml_util, ml_code_util.
-:- import_module mlds_to_csharp. /* to output C sharp code */
-:- import_module mlds_to_mcpp. /* to output MC++ code */
-:- use_module llds. /* for user_c_code */
-
-:- import_module bool, int, map, string, set, list, assoc_list, term, std_util.
-:- import_module library, require, counter.
+:- import_module prog_data.		/* for the `foreign_language' type */
+:- import_module modules, error_util.
 
-:- import_module mlds_to_il.
+:- import_module mlds_to_il, il_peephole, ilasm. /* to output IL code */
+:- import_module mlds_to_csharp.	/* to output C sharp code */
+:- import_module mlds_to_mcpp.		/* to output MC++ code */
 
-%-----------------------------------------------------------------------------%
+:- import_module globals, options, passes_aux.
 
+:- import_module bool, set, list, std_util.
 
 %-----------------------------------------------------------------------------%
 
@@ -84,9 +77,11 @@
 handle_foreign_lang(c, _, _) :-
 	sorry(this_file, "language C foreign code not supported").
 
+%-----------------------------------------------------------------------------%
+
 	%
 	% Generate the `.il' file.
-	% Returns the set of foreign language
+	% Also returns the set of foreign language that are used by this MLDS.
 	%
 :- pred output_assembler(mlds, set(foreign_language), io__state, io__state).
 :- mode output_assembler(in, out, di, uo) is det.
@@ -110,7 +105,11 @@
 
 	output_src_end(ModuleName).
 
+%-----------------------------------------------------------------------------%
+
 :- func this_file = string.
 this_file = "mlds_to_ilasm.m".
 
 :- end_module mlds_to_ilasm.
+
+%-----------------------------------------------------------------------------%
-- 
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-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list